diff --git a/arcgis.go b/arcgis.go index 8a5b0da8..2c17be59 100644 --- a/arcgis.go +++ b/arcgis.go @@ -1077,7 +1077,7 @@ func updateSummaryTables(ctx context.Context, org *models.Organization) { 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, db.PGInstance.BobDB) + point_locations, err := org.Pointlocations().All(ctx, db.PGInstance.BobDB) if err != nil { log.Error().Err(err).Msg("Failed to get organization") return @@ -1088,7 +1088,12 @@ func updateSummaryTables(ctx context.Context, org *models.Organization) { 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) + p, err := getPoint(p.Geometry) + if err != nil { + log.Error().Err(err).Msg("Failed to get geometry point") + continue + } + cell, err := h3.LatLngToCell(p, i) if err != nil { log.Error().Err(err).Msg("Failed to get cell") continue @@ -1615,3 +1620,5 @@ func exportFieldseekerLayer(ctx context.Context, org *models.Organization, fssyn log.Info().Uint("inserts", stats.Inserts).Uint("updates", stats.Updates).Uint("no change", stats.Unchanged).Str("layer", layer.Name).Msg("Finished layer") return stats, nil } + + diff --git a/db/bobgen.yaml b/db/bobgen.yaml index 04edc43a..41eacc7e 100644 --- a/db/bobgen.yaml +++ b/db/bobgen.yaml @@ -10,4 +10,5 @@ psql: - "fieldseeker" queries: - ./sql + uuid_pkg: google plugins_preset: "all" diff --git a/db/dberrors/bob_errors.bob.go b/db/dberrors/bob_errors.bob.go index 588cc968..94fa2a0d 100644 --- a/db/dberrors/bob_errors.bob.go +++ b/db/dberrors/bob_errors.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/bob_main.bob_test.go b/db/dberrors/bob_main.bob_test.go index fc2ceba9..b199ee12 100644 --- a/db/dberrors/bob_main.bob_test.go +++ b/db/dberrors/bob_main.bob_test.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.containerrelate.bob.go b/db/dberrors/fieldseeker.containerrelate.bob.go index f1648dcd..ea06eaf7 100644 --- a/db/dberrors/fieldseeker.containerrelate.bob.go +++ b/db/dberrors/fieldseeker.containerrelate.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.fieldscoutinglog.bob.go b/db/dberrors/fieldseeker.fieldscoutinglog.bob.go index b3f155fc..40578e86 100644 --- a/db/dberrors/fieldseeker.fieldscoutinglog.bob.go +++ b/db/dberrors/fieldseeker.fieldscoutinglog.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.habitatrelate.bob.go b/db/dberrors/fieldseeker.habitatrelate.bob.go index 50b934c9..6c0d41ee 100644 --- a/db/dberrors/fieldseeker.habitatrelate.bob.go +++ b/db/dberrors/fieldseeker.habitatrelate.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.inspectionsample.bob.go b/db/dberrors/fieldseeker.inspectionsample.bob.go index 25cf1ed5..bce23b32 100644 --- a/db/dberrors/fieldseeker.inspectionsample.bob.go +++ b/db/dberrors/fieldseeker.inspectionsample.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.inspectionsampledetail.bob.go b/db/dberrors/fieldseeker.inspectionsampledetail.bob.go index ca3cbc6b..011ca3c6 100644 --- a/db/dberrors/fieldseeker.inspectionsampledetail.bob.go +++ b/db/dberrors/fieldseeker.inspectionsampledetail.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.linelocation.bob.go b/db/dberrors/fieldseeker.linelocation.bob.go index a56317e0..6587a55e 100644 --- a/db/dberrors/fieldseeker.linelocation.bob.go +++ b/db/dberrors/fieldseeker.linelocation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.locationtracking.bob.go b/db/dberrors/fieldseeker.locationtracking.bob.go index 5d78b877..7d2b822b 100644 --- a/db/dberrors/fieldseeker.locationtracking.bob.go +++ b/db/dberrors/fieldseeker.locationtracking.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.mosquitoinspection.bob.go b/db/dberrors/fieldseeker.mosquitoinspection.bob.go index cbed889f..a275973d 100644 --- a/db/dberrors/fieldseeker.mosquitoinspection.bob.go +++ b/db/dberrors/fieldseeker.mosquitoinspection.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.pointlocation.bob.go b/db/dberrors/fieldseeker.pointlocation.bob.go index d0538eb7..31f8bc5e 100644 --- a/db/dberrors/fieldseeker.pointlocation.bob.go +++ b/db/dberrors/fieldseeker.pointlocation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.polygonlocation.bob.go b/db/dberrors/fieldseeker.polygonlocation.bob.go index 42e57b61..7bcf13a3 100644 --- a/db/dberrors/fieldseeker.polygonlocation.bob.go +++ b/db/dberrors/fieldseeker.polygonlocation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.pool.bob.go b/db/dberrors/fieldseeker.pool.bob.go index b318a796..1ed6f276 100644 --- a/db/dberrors/fieldseeker.pool.bob.go +++ b/db/dberrors/fieldseeker.pool.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.pooldetail.bob.go b/db/dberrors/fieldseeker.pooldetail.bob.go index 2861b4c4..0989a670 100644 --- a/db/dberrors/fieldseeker.pooldetail.bob.go +++ b/db/dberrors/fieldseeker.pooldetail.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.proposedtreatmentarea.bob.go b/db/dberrors/fieldseeker.proposedtreatmentarea.bob.go index 4120f147..4dae7501 100644 --- a/db/dberrors/fieldseeker.proposedtreatmentarea.bob.go +++ b/db/dberrors/fieldseeker.proposedtreatmentarea.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.qamosquitoinspection.bob.go b/db/dberrors/fieldseeker.qamosquitoinspection.bob.go index c0c62fbe..64daad9d 100644 --- a/db/dberrors/fieldseeker.qamosquitoinspection.bob.go +++ b/db/dberrors/fieldseeker.qamosquitoinspection.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.rodentlocation.bob.go b/db/dberrors/fieldseeker.rodentlocation.bob.go index e48264a1..72da4597 100644 --- a/db/dberrors/fieldseeker.rodentlocation.bob.go +++ b/db/dberrors/fieldseeker.rodentlocation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.samplecollection.bob.go b/db/dberrors/fieldseeker.samplecollection.bob.go index f6ec4c2f..325e1890 100644 --- a/db/dberrors/fieldseeker.samplecollection.bob.go +++ b/db/dberrors/fieldseeker.samplecollection.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.samplelocation.bob.go b/db/dberrors/fieldseeker.samplelocation.bob.go index 3d4c5cd0..d51094c3 100644 --- a/db/dberrors/fieldseeker.samplelocation.bob.go +++ b/db/dberrors/fieldseeker.samplelocation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.servicerequest.bob.go b/db/dberrors/fieldseeker.servicerequest.bob.go index 4c3627ee..2dc5a17e 100644 --- a/db/dberrors/fieldseeker.servicerequest.bob.go +++ b/db/dberrors/fieldseeker.servicerequest.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.speciesabundance.bob.go b/db/dberrors/fieldseeker.speciesabundance.bob.go index 105fce55..deb68f8e 100644 --- a/db/dberrors/fieldseeker.speciesabundance.bob.go +++ b/db/dberrors/fieldseeker.speciesabundance.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.stormdrain.bob.go b/db/dberrors/fieldseeker.stormdrain.bob.go index 3da060d0..5d35b7b0 100644 --- a/db/dberrors/fieldseeker.stormdrain.bob.go +++ b/db/dberrors/fieldseeker.stormdrain.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.timecard.bob.go b/db/dberrors/fieldseeker.timecard.bob.go index 1fa8bfe6..9a4be96a 100644 --- a/db/dberrors/fieldseeker.timecard.bob.go +++ b/db/dberrors/fieldseeker.timecard.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.trapdata.bob.go b/db/dberrors/fieldseeker.trapdata.bob.go index 223885b0..f7710ecc 100644 --- a/db/dberrors/fieldseeker.trapdata.bob.go +++ b/db/dberrors/fieldseeker.trapdata.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.traplocation.bob.go b/db/dberrors/fieldseeker.traplocation.bob.go index bfa3de7c..ea5e3251 100644 --- a/db/dberrors/fieldseeker.traplocation.bob.go +++ b/db/dberrors/fieldseeker.traplocation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.treatment.bob.go b/db/dberrors/fieldseeker.treatment.bob.go index 7a7604fa..76c50031 100644 --- a/db/dberrors/fieldseeker.treatment.bob.go +++ b/db/dberrors/fieldseeker.treatment.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.treatmentarea.bob.go b/db/dberrors/fieldseeker.treatmentarea.bob.go index 4cf22e26..28bb270a 100644 --- a/db/dberrors/fieldseeker.treatmentarea.bob.go +++ b/db/dberrors/fieldseeker.treatmentarea.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.zones.bob.go b/db/dberrors/fieldseeker.zones.bob.go index 6172abc2..44d6fe11 100644 --- a/db/dberrors/fieldseeker.zones.bob.go +++ b/db/dberrors/fieldseeker.zones.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker.zones2.bob.go b/db/dberrors/fieldseeker.zones2.bob.go index 763d302b..af73f8d9 100644 --- a/db/dberrors/fieldseeker.zones2.bob.go +++ b/db/dberrors/fieldseeker.zones2.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fieldseeker_sync.bob.go b/db/dberrors/fieldseeker_sync.bob.go index a05c8131..4e322c18 100644 --- a/db/dberrors/fieldseeker_sync.bob.go +++ b/db/dberrors/fieldseeker_sync.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/fs_containerrelate.bob.go b/db/dberrors/fs_containerrelate.bob.go deleted file mode 100644 index 02df3d36..00000000 --- a/db/dberrors/fs_containerrelate.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSContainerrelateErrors = &fsContainerrelateErrors{ - ErrUniqueFsContainerrelatePkey: &UniqueConstraintError{ - schema: "", - table: "fs_containerrelate", - columns: []string{"objectid"}, - s: "fs_containerrelate_pkey", - }, -} - -type fsContainerrelateErrors struct { - ErrUniqueFsContainerrelatePkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_fieldscoutinglog.bob.go b/db/dberrors/fs_fieldscoutinglog.bob.go deleted file mode 100644 index d49e4ce3..00000000 --- a/db/dberrors/fs_fieldscoutinglog.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSFieldscoutinglogErrors = &fsFieldscoutinglogErrors{ - ErrUniqueFsFieldscoutinglogPkey: &UniqueConstraintError{ - schema: "", - table: "fs_fieldscoutinglog", - columns: []string{"objectid"}, - s: "fs_fieldscoutinglog_pkey", - }, -} - -type fsFieldscoutinglogErrors struct { - ErrUniqueFsFieldscoutinglogPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_habitatrelate.bob.go b/db/dberrors/fs_habitatrelate.bob.go deleted file mode 100644 index 6ed93b93..00000000 --- a/db/dberrors/fs_habitatrelate.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSHabitatrelateErrors = &fsHabitatrelateErrors{ - ErrUniqueFsHabitatrelatePkey: &UniqueConstraintError{ - schema: "", - table: "fs_habitatrelate", - columns: []string{"objectid"}, - s: "fs_habitatrelate_pkey", - }, -} - -type fsHabitatrelateErrors struct { - ErrUniqueFsHabitatrelatePkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_inspectionsample.bob.go b/db/dberrors/fs_inspectionsample.bob.go deleted file mode 100644 index fb79b576..00000000 --- a/db/dberrors/fs_inspectionsample.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSInspectionsampleErrors = &fsInspectionsampleErrors{ - ErrUniqueFsInspectionsamplePkey: &UniqueConstraintError{ - schema: "", - table: "fs_inspectionsample", - columns: []string{"objectid"}, - s: "fs_inspectionsample_pkey", - }, -} - -type fsInspectionsampleErrors struct { - ErrUniqueFsInspectionsamplePkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_inspectionsampledetail.bob.go b/db/dberrors/fs_inspectionsampledetail.bob.go deleted file mode 100644 index e06faf5a..00000000 --- a/db/dberrors/fs_inspectionsampledetail.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSInspectionsampledetailErrors = &fsInspectionsampledetailErrors{ - ErrUniqueFsInspectionsampledetailPkey: &UniqueConstraintError{ - schema: "", - table: "fs_inspectionsampledetail", - columns: []string{"objectid"}, - s: "fs_inspectionsampledetail_pkey", - }, -} - -type fsInspectionsampledetailErrors struct { - ErrUniqueFsInspectionsampledetailPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_linelocation.bob.go b/db/dberrors/fs_linelocation.bob.go deleted file mode 100644 index 437425e7..00000000 --- a/db/dberrors/fs_linelocation.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSLinelocationErrors = &fsLinelocationErrors{ - ErrUniqueFsLinelocationPkey: &UniqueConstraintError{ - schema: "", - table: "fs_linelocation", - columns: []string{"objectid"}, - s: "fs_linelocation_pkey", - }, -} - -type fsLinelocationErrors struct { - ErrUniqueFsLinelocationPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_locationtracking.bob.go b/db/dberrors/fs_locationtracking.bob.go deleted file mode 100644 index dda54281..00000000 --- a/db/dberrors/fs_locationtracking.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSLocationtrackingErrors = &fsLocationtrackingErrors{ - ErrUniqueFsLocationtrackingPkey: &UniqueConstraintError{ - schema: "", - table: "fs_locationtracking", - columns: []string{"objectid"}, - s: "fs_locationtracking_pkey", - }, -} - -type fsLocationtrackingErrors struct { - ErrUniqueFsLocationtrackingPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_mosquitoinspection.bob.go b/db/dberrors/fs_mosquitoinspection.bob.go deleted file mode 100644 index d8c4e4c5..00000000 --- a/db/dberrors/fs_mosquitoinspection.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSMosquitoinspectionErrors = &fsMosquitoinspectionErrors{ - ErrUniqueFsMosquitoinspectionPkey: &UniqueConstraintError{ - schema: "", - table: "fs_mosquitoinspection", - columns: []string{"objectid"}, - s: "fs_mosquitoinspection_pkey", - }, -} - -type fsMosquitoinspectionErrors struct { - ErrUniqueFsMosquitoinspectionPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_pointlocation.bob.go b/db/dberrors/fs_pointlocation.bob.go deleted file mode 100644 index 6164a0ba..00000000 --- a/db/dberrors/fs_pointlocation.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSPointlocationErrors = &fsPointlocationErrors{ - ErrUniqueFsPointlocationPkey: &UniqueConstraintError{ - schema: "", - table: "fs_pointlocation", - columns: []string{"objectid"}, - s: "fs_pointlocation_pkey", - }, -} - -type fsPointlocationErrors struct { - ErrUniqueFsPointlocationPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_polygonlocation.bob.go b/db/dberrors/fs_polygonlocation.bob.go deleted file mode 100644 index e7ed3c1b..00000000 --- a/db/dberrors/fs_polygonlocation.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSPolygonlocationErrors = &fsPolygonlocationErrors{ - ErrUniqueFsPolygonlocationPkey: &UniqueConstraintError{ - schema: "", - table: "fs_polygonlocation", - columns: []string{"objectid"}, - s: "fs_polygonlocation_pkey", - }, -} - -type fsPolygonlocationErrors struct { - ErrUniqueFsPolygonlocationPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_pool.bob.go b/db/dberrors/fs_pool.bob.go deleted file mode 100644 index 5cdc196e..00000000 --- a/db/dberrors/fs_pool.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSPoolErrors = &fsPoolErrors{ - ErrUniqueFsPoolPkey: &UniqueConstraintError{ - schema: "", - table: "fs_pool", - columns: []string{"objectid"}, - s: "fs_pool_pkey", - }, -} - -type fsPoolErrors struct { - ErrUniqueFsPoolPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_pooldetail.bob.go b/db/dberrors/fs_pooldetail.bob.go deleted file mode 100644 index b0f20fda..00000000 --- a/db/dberrors/fs_pooldetail.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSPooldetailErrors = &fsPooldetailErrors{ - ErrUniqueFsPooldetailPkey: &UniqueConstraintError{ - schema: "", - table: "fs_pooldetail", - columns: []string{"objectid"}, - s: "fs_pooldetail_pkey", - }, -} - -type fsPooldetailErrors struct { - ErrUniqueFsPooldetailPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_proposedtreatmentarea.bob.go b/db/dberrors/fs_proposedtreatmentarea.bob.go deleted file mode 100644 index ff5c9f7e..00000000 --- a/db/dberrors/fs_proposedtreatmentarea.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSProposedtreatmentareaErrors = &fsProposedtreatmentareaErrors{ - ErrUniqueFsProposedtreatmentareaPkey: &UniqueConstraintError{ - schema: "", - table: "fs_proposedtreatmentarea", - columns: []string{"objectid"}, - s: "fs_proposedtreatmentarea_pkey", - }, -} - -type fsProposedtreatmentareaErrors struct { - ErrUniqueFsProposedtreatmentareaPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_qamosquitoinspection.bob.go b/db/dberrors/fs_qamosquitoinspection.bob.go deleted file mode 100644 index e682d923..00000000 --- a/db/dberrors/fs_qamosquitoinspection.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSQamosquitoinspectionErrors = &fsQamosquitoinspectionErrors{ - ErrUniqueFsQamosquitoinspectionPkey: &UniqueConstraintError{ - schema: "", - table: "fs_qamosquitoinspection", - columns: []string{"objectid"}, - s: "fs_qamosquitoinspection_pkey", - }, -} - -type fsQamosquitoinspectionErrors struct { - ErrUniqueFsQamosquitoinspectionPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_rodentlocation.bob.go b/db/dberrors/fs_rodentlocation.bob.go deleted file mode 100644 index 4fd0c7d9..00000000 --- a/db/dberrors/fs_rodentlocation.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSRodentlocationErrors = &fsRodentlocationErrors{ - ErrUniqueFsRodentlocationPkey: &UniqueConstraintError{ - schema: "", - table: "fs_rodentlocation", - columns: []string{"objectid"}, - s: "fs_rodentlocation_pkey", - }, -} - -type fsRodentlocationErrors struct { - ErrUniqueFsRodentlocationPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_samplecollection.bob.go b/db/dberrors/fs_samplecollection.bob.go deleted file mode 100644 index a2e4585d..00000000 --- a/db/dberrors/fs_samplecollection.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSSamplecollectionErrors = &fsSamplecollectionErrors{ - ErrUniqueFsSamplecollectionPkey: &UniqueConstraintError{ - schema: "", - table: "fs_samplecollection", - columns: []string{"objectid"}, - s: "fs_samplecollection_pkey", - }, -} - -type fsSamplecollectionErrors struct { - ErrUniqueFsSamplecollectionPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_samplelocation.bob.go b/db/dberrors/fs_samplelocation.bob.go deleted file mode 100644 index ccd58bfe..00000000 --- a/db/dberrors/fs_samplelocation.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSSamplelocationErrors = &fsSamplelocationErrors{ - ErrUniqueFsSamplelocationPkey: &UniqueConstraintError{ - schema: "", - table: "fs_samplelocation", - columns: []string{"objectid"}, - s: "fs_samplelocation_pkey", - }, -} - -type fsSamplelocationErrors struct { - ErrUniqueFsSamplelocationPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_servicerequest.bob.go b/db/dberrors/fs_servicerequest.bob.go deleted file mode 100644 index 29fb740a..00000000 --- a/db/dberrors/fs_servicerequest.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSServicerequestErrors = &fsServicerequestErrors{ - ErrUniqueFsServicerequestPkey: &UniqueConstraintError{ - schema: "", - table: "fs_servicerequest", - columns: []string{"objectid"}, - s: "fs_servicerequest_pkey", - }, -} - -type fsServicerequestErrors struct { - ErrUniqueFsServicerequestPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_speciesabundance.bob.go b/db/dberrors/fs_speciesabundance.bob.go deleted file mode 100644 index 6417abfc..00000000 --- a/db/dberrors/fs_speciesabundance.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSSpeciesabundanceErrors = &fsSpeciesabundanceErrors{ - ErrUniqueFsSpeciesabundancePkey: &UniqueConstraintError{ - schema: "", - table: "fs_speciesabundance", - columns: []string{"objectid"}, - s: "fs_speciesabundance_pkey", - }, -} - -type fsSpeciesabundanceErrors struct { - ErrUniqueFsSpeciesabundancePkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_stormdrain.bob.go b/db/dberrors/fs_stormdrain.bob.go deleted file mode 100644 index 7de48ce6..00000000 --- a/db/dberrors/fs_stormdrain.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSStormdrainErrors = &fsStormdrainErrors{ - ErrUniqueFsStormdrainPkey: &UniqueConstraintError{ - schema: "", - table: "fs_stormdrain", - columns: []string{"objectid"}, - s: "fs_stormdrain_pkey", - }, -} - -type fsStormdrainErrors struct { - ErrUniqueFsStormdrainPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_timecard.bob.go b/db/dberrors/fs_timecard.bob.go deleted file mode 100644 index a9100887..00000000 --- a/db/dberrors/fs_timecard.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSTimecardErrors = &fsTimecardErrors{ - ErrUniqueFsTimecardPkey: &UniqueConstraintError{ - schema: "", - table: "fs_timecard", - columns: []string{"objectid"}, - s: "fs_timecard_pkey", - }, -} - -type fsTimecardErrors struct { - ErrUniqueFsTimecardPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_trapdata.bob.go b/db/dberrors/fs_trapdata.bob.go deleted file mode 100644 index 964d3ac1..00000000 --- a/db/dberrors/fs_trapdata.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSTrapdatumErrors = &fsTrapdatumErrors{ - ErrUniqueFsTrapdataPkey: &UniqueConstraintError{ - schema: "", - table: "fs_trapdata", - columns: []string{"objectid"}, - s: "fs_trapdata_pkey", - }, -} - -type fsTrapdatumErrors struct { - ErrUniqueFsTrapdataPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_traplocation.bob.go b/db/dberrors/fs_traplocation.bob.go deleted file mode 100644 index 85551047..00000000 --- a/db/dberrors/fs_traplocation.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSTraplocationErrors = &fsTraplocationErrors{ - ErrUniqueFsTraplocationPkey: &UniqueConstraintError{ - schema: "", - table: "fs_traplocation", - columns: []string{"objectid"}, - s: "fs_traplocation_pkey", - }, -} - -type fsTraplocationErrors struct { - ErrUniqueFsTraplocationPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_treatment.bob.go b/db/dberrors/fs_treatment.bob.go deleted file mode 100644 index 1683ef2f..00000000 --- a/db/dberrors/fs_treatment.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSTreatmentErrors = &fsTreatmentErrors{ - ErrUniqueFsTreatmentPkey: &UniqueConstraintError{ - schema: "", - table: "fs_treatment", - columns: []string{"objectid"}, - s: "fs_treatment_pkey", - }, -} - -type fsTreatmentErrors struct { - ErrUniqueFsTreatmentPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_treatmentarea.bob.go b/db/dberrors/fs_treatmentarea.bob.go deleted file mode 100644 index c435bfa1..00000000 --- a/db/dberrors/fs_treatmentarea.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSTreatmentareaErrors = &fsTreatmentareaErrors{ - ErrUniqueFsTreatmentareaPkey: &UniqueConstraintError{ - schema: "", - table: "fs_treatmentarea", - columns: []string{"objectid"}, - s: "fs_treatmentarea_pkey", - }, -} - -type fsTreatmentareaErrors struct { - ErrUniqueFsTreatmentareaPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_zones.bob.go b/db/dberrors/fs_zones.bob.go deleted file mode 100644 index 57ec5028..00000000 --- a/db/dberrors/fs_zones.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSZoneErrors = &fsZoneErrors{ - ErrUniqueFsZonesPkey: &UniqueConstraintError{ - schema: "", - table: "fs_zones", - columns: []string{"objectid"}, - s: "fs_zones_pkey", - }, -} - -type fsZoneErrors struct { - ErrUniqueFsZonesPkey *UniqueConstraintError -} diff --git a/db/dberrors/fs_zones2.bob.go b/db/dberrors/fs_zones2.bob.go deleted file mode 100644 index 64e9eb33..00000000 --- a/db/dberrors/fs_zones2.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var FSZones2Errors = &fsZones2Errors{ - ErrUniqueFsZones2Pkey: &UniqueConstraintError{ - schema: "", - table: "fs_zones2", - columns: []string{"objectid"}, - s: "fs_zones2_pkey", - }, -} - -type fsZones2Errors struct { - ErrUniqueFsZones2Pkey *UniqueConstraintError -} diff --git a/db/dberrors/goose_db_version.bob.go b/db/dberrors/goose_db_version.bob.go index 0fdbe32c..491c13b9 100644 --- a/db/dberrors/goose_db_version.bob.go +++ b/db/dberrors/goose_db_version.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/h3_aggregation.bob.go b/db/dberrors/h3_aggregation.bob.go index 2b930123..ec315783 100644 --- a/db/dberrors/h3_aggregation.bob.go +++ b/db/dberrors/h3_aggregation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/h3_aggregation.bob_test.go b/db/dberrors/h3_aggregation.bob_test.go index 9aba7b1f..840b2c02 100644 --- a/db/dberrors/h3_aggregation.bob_test.go +++ b/db/dberrors/h3_aggregation.bob_test.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/history_containerrelate.bob.go b/db/dberrors/history_containerrelate.bob.go deleted file mode 100644 index 5c848208..00000000 --- a/db/dberrors/history_containerrelate.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryContainerrelateErrors = &historyContainerrelateErrors{ - ErrUniqueHistoryContainerrelatePkey: &UniqueConstraintError{ - schema: "", - table: "history_containerrelate", - columns: []string{"objectid", "version"}, - s: "history_containerrelate_pkey", - }, -} - -type historyContainerrelateErrors struct { - ErrUniqueHistoryContainerrelatePkey *UniqueConstraintError -} diff --git a/db/dberrors/history_fieldscoutinglog.bob.go b/db/dberrors/history_fieldscoutinglog.bob.go deleted file mode 100644 index d25326a6..00000000 --- a/db/dberrors/history_fieldscoutinglog.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryFieldscoutinglogErrors = &historyFieldscoutinglogErrors{ - ErrUniqueHistoryFieldscoutinglogPkey: &UniqueConstraintError{ - schema: "", - table: "history_fieldscoutinglog", - columns: []string{"objectid", "version"}, - s: "history_fieldscoutinglog_pkey", - }, -} - -type historyFieldscoutinglogErrors struct { - ErrUniqueHistoryFieldscoutinglogPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_habitatrelate.bob.go b/db/dberrors/history_habitatrelate.bob.go deleted file mode 100644 index 6e0ecfa0..00000000 --- a/db/dberrors/history_habitatrelate.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryHabitatrelateErrors = &historyHabitatrelateErrors{ - ErrUniqueHistoryHabitatrelatePkey: &UniqueConstraintError{ - schema: "", - table: "history_habitatrelate", - columns: []string{"objectid", "version"}, - s: "history_habitatrelate_pkey", - }, -} - -type historyHabitatrelateErrors struct { - ErrUniqueHistoryHabitatrelatePkey *UniqueConstraintError -} diff --git a/db/dberrors/history_inspectionsample.bob.go b/db/dberrors/history_inspectionsample.bob.go deleted file mode 100644 index 8f5c5c20..00000000 --- a/db/dberrors/history_inspectionsample.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryInspectionsampleErrors = &historyInspectionsampleErrors{ - ErrUniqueHistoryInspectionsamplePkey: &UniqueConstraintError{ - schema: "", - table: "history_inspectionsample", - columns: []string{"objectid", "version"}, - s: "history_inspectionsample_pkey", - }, -} - -type historyInspectionsampleErrors struct { - ErrUniqueHistoryInspectionsamplePkey *UniqueConstraintError -} diff --git a/db/dberrors/history_inspectionsampledetail.bob.go b/db/dberrors/history_inspectionsampledetail.bob.go deleted file mode 100644 index 70fe6a7d..00000000 --- a/db/dberrors/history_inspectionsampledetail.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryInspectionsampledetailErrors = &historyInspectionsampledetailErrors{ - ErrUniqueHistoryInspectionsampledetailPkey: &UniqueConstraintError{ - schema: "", - table: "history_inspectionsampledetail", - columns: []string{"objectid", "version"}, - s: "history_inspectionsampledetail_pkey", - }, -} - -type historyInspectionsampledetailErrors struct { - ErrUniqueHistoryInspectionsampledetailPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_linelocation.bob.go b/db/dberrors/history_linelocation.bob.go deleted file mode 100644 index b236f231..00000000 --- a/db/dberrors/history_linelocation.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryLinelocationErrors = &historyLinelocationErrors{ - ErrUniqueHistoryLinelocationPkey: &UniqueConstraintError{ - schema: "", - table: "history_linelocation", - columns: []string{"objectid", "version"}, - s: "history_linelocation_pkey", - }, -} - -type historyLinelocationErrors struct { - ErrUniqueHistoryLinelocationPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_locationtracking.bob.go b/db/dberrors/history_locationtracking.bob.go deleted file mode 100644 index f5c9b242..00000000 --- a/db/dberrors/history_locationtracking.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryLocationtrackingErrors = &historyLocationtrackingErrors{ - ErrUniqueHistoryLocationtrackingPkey: &UniqueConstraintError{ - schema: "", - table: "history_locationtracking", - columns: []string{"objectid", "version"}, - s: "history_locationtracking_pkey", - }, -} - -type historyLocationtrackingErrors struct { - ErrUniqueHistoryLocationtrackingPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_mosquitoinspection.bob.go b/db/dberrors/history_mosquitoinspection.bob.go deleted file mode 100644 index dd4d8ec2..00000000 --- a/db/dberrors/history_mosquitoinspection.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryMosquitoinspectionErrors = &historyMosquitoinspectionErrors{ - ErrUniqueHistoryMosquitoinspectionPkey: &UniqueConstraintError{ - schema: "", - table: "history_mosquitoinspection", - columns: []string{"objectid", "version"}, - s: "history_mosquitoinspection_pkey", - }, -} - -type historyMosquitoinspectionErrors struct { - ErrUniqueHistoryMosquitoinspectionPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_pointlocation.bob.go b/db/dberrors/history_pointlocation.bob.go deleted file mode 100644 index e71bef1d..00000000 --- a/db/dberrors/history_pointlocation.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryPointlocationErrors = &historyPointlocationErrors{ - ErrUniqueHistoryPointlocationPkey: &UniqueConstraintError{ - schema: "", - table: "history_pointlocation", - columns: []string{"objectid", "version"}, - s: "history_pointlocation_pkey", - }, -} - -type historyPointlocationErrors struct { - ErrUniqueHistoryPointlocationPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_polygonlocation.bob.go b/db/dberrors/history_polygonlocation.bob.go deleted file mode 100644 index 0e552eec..00000000 --- a/db/dberrors/history_polygonlocation.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryPolygonlocationErrors = &historyPolygonlocationErrors{ - ErrUniqueHistoryPolygonlocationPkey: &UniqueConstraintError{ - schema: "", - table: "history_polygonlocation", - columns: []string{"objectid", "version"}, - s: "history_polygonlocation_pkey", - }, -} - -type historyPolygonlocationErrors struct { - ErrUniqueHistoryPolygonlocationPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_pool.bob.go b/db/dberrors/history_pool.bob.go deleted file mode 100644 index 7e0c7b0b..00000000 --- a/db/dberrors/history_pool.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryPoolErrors = &historyPoolErrors{ - ErrUniqueHistoryPoolPkey: &UniqueConstraintError{ - schema: "", - table: "history_pool", - columns: []string{"objectid", "version"}, - s: "history_pool_pkey", - }, -} - -type historyPoolErrors struct { - ErrUniqueHistoryPoolPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_pooldetail.bob.go b/db/dberrors/history_pooldetail.bob.go deleted file mode 100644 index be5a8cad..00000000 --- a/db/dberrors/history_pooldetail.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryPooldetailErrors = &historyPooldetailErrors{ - ErrUniqueHistoryPooldetailPkey: &UniqueConstraintError{ - schema: "", - table: "history_pooldetail", - columns: []string{"objectid", "version"}, - s: "history_pooldetail_pkey", - }, -} - -type historyPooldetailErrors struct { - ErrUniqueHistoryPooldetailPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_proposedtreatmentarea.bob.go b/db/dberrors/history_proposedtreatmentarea.bob.go deleted file mode 100644 index c3602129..00000000 --- a/db/dberrors/history_proposedtreatmentarea.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryProposedtreatmentareaErrors = &historyProposedtreatmentareaErrors{ - ErrUniqueHistoryProposedtreatmentareaPkey: &UniqueConstraintError{ - schema: "", - table: "history_proposedtreatmentarea", - columns: []string{"objectid", "version"}, - s: "history_proposedtreatmentarea_pkey", - }, -} - -type historyProposedtreatmentareaErrors struct { - ErrUniqueHistoryProposedtreatmentareaPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_qamosquitoinspection.bob.go b/db/dberrors/history_qamosquitoinspection.bob.go deleted file mode 100644 index 3b9ee2c3..00000000 --- a/db/dberrors/history_qamosquitoinspection.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryQamosquitoinspectionErrors = &historyQamosquitoinspectionErrors{ - ErrUniqueHistoryQamosquitoinspectionPkey: &UniqueConstraintError{ - schema: "", - table: "history_qamosquitoinspection", - columns: []string{"objectid", "version"}, - s: "history_qamosquitoinspection_pkey", - }, -} - -type historyQamosquitoinspectionErrors struct { - ErrUniqueHistoryQamosquitoinspectionPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_rodentlocation.bob.go b/db/dberrors/history_rodentlocation.bob.go deleted file mode 100644 index 89e97c54..00000000 --- a/db/dberrors/history_rodentlocation.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryRodentlocationErrors = &historyRodentlocationErrors{ - ErrUniqueHistoryRodentlocationPkey: &UniqueConstraintError{ - schema: "", - table: "history_rodentlocation", - columns: []string{"objectid", "version"}, - s: "history_rodentlocation_pkey", - }, -} - -type historyRodentlocationErrors struct { - ErrUniqueHistoryRodentlocationPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_samplecollection.bob.go b/db/dberrors/history_samplecollection.bob.go deleted file mode 100644 index 23cc5309..00000000 --- a/db/dberrors/history_samplecollection.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistorySamplecollectionErrors = &historySamplecollectionErrors{ - ErrUniqueHistorySamplecollectionPkey: &UniqueConstraintError{ - schema: "", - table: "history_samplecollection", - columns: []string{"objectid", "version"}, - s: "history_samplecollection_pkey", - }, -} - -type historySamplecollectionErrors struct { - ErrUniqueHistorySamplecollectionPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_samplelocation.bob.go b/db/dberrors/history_samplelocation.bob.go deleted file mode 100644 index 67ce597e..00000000 --- a/db/dberrors/history_samplelocation.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistorySamplelocationErrors = &historySamplelocationErrors{ - ErrUniqueHistorySamplelocationPkey: &UniqueConstraintError{ - schema: "", - table: "history_samplelocation", - columns: []string{"objectid", "version"}, - s: "history_samplelocation_pkey", - }, -} - -type historySamplelocationErrors struct { - ErrUniqueHistorySamplelocationPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_servicerequest.bob.go b/db/dberrors/history_servicerequest.bob.go deleted file mode 100644 index 6cf9a49a..00000000 --- a/db/dberrors/history_servicerequest.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryServicerequestErrors = &historyServicerequestErrors{ - ErrUniqueHistoryServicerequestPkey: &UniqueConstraintError{ - schema: "", - table: "history_servicerequest", - columns: []string{"objectid", "version"}, - s: "history_servicerequest_pkey", - }, -} - -type historyServicerequestErrors struct { - ErrUniqueHistoryServicerequestPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_speciesabundance.bob.go b/db/dberrors/history_speciesabundance.bob.go deleted file mode 100644 index 96387e55..00000000 --- a/db/dberrors/history_speciesabundance.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistorySpeciesabundanceErrors = &historySpeciesabundanceErrors{ - ErrUniqueHistorySpeciesabundancePkey: &UniqueConstraintError{ - schema: "", - table: "history_speciesabundance", - columns: []string{"objectid", "version"}, - s: "history_speciesabundance_pkey", - }, -} - -type historySpeciesabundanceErrors struct { - ErrUniqueHistorySpeciesabundancePkey *UniqueConstraintError -} diff --git a/db/dberrors/history_stormdrain.bob.go b/db/dberrors/history_stormdrain.bob.go deleted file mode 100644 index 9af00a32..00000000 --- a/db/dberrors/history_stormdrain.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryStormdrainErrors = &historyStormdrainErrors{ - ErrUniqueHistoryStormdrainPkey: &UniqueConstraintError{ - schema: "", - table: "history_stormdrain", - columns: []string{"objectid", "version"}, - s: "history_stormdrain_pkey", - }, -} - -type historyStormdrainErrors struct { - ErrUniqueHistoryStormdrainPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_timecard.bob.go b/db/dberrors/history_timecard.bob.go deleted file mode 100644 index fe4adc89..00000000 --- a/db/dberrors/history_timecard.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryTimecardErrors = &historyTimecardErrors{ - ErrUniqueHistoryTimecardPkey: &UniqueConstraintError{ - schema: "", - table: "history_timecard", - columns: []string{"objectid", "version"}, - s: "history_timecard_pkey", - }, -} - -type historyTimecardErrors struct { - ErrUniqueHistoryTimecardPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_trapdata.bob.go b/db/dberrors/history_trapdata.bob.go deleted file mode 100644 index 2ce0ef5b..00000000 --- a/db/dberrors/history_trapdata.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryTrapdatumErrors = &historyTrapdatumErrors{ - ErrUniqueHistoryTrapdataPkey: &UniqueConstraintError{ - schema: "", - table: "history_trapdata", - columns: []string{"objectid", "version"}, - s: "history_trapdata_pkey", - }, -} - -type historyTrapdatumErrors struct { - ErrUniqueHistoryTrapdataPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_traplocation.bob.go b/db/dberrors/history_traplocation.bob.go deleted file mode 100644 index db0c8c81..00000000 --- a/db/dberrors/history_traplocation.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryTraplocationErrors = &historyTraplocationErrors{ - ErrUniqueHistoryTraplocationPkey: &UniqueConstraintError{ - schema: "", - table: "history_traplocation", - columns: []string{"objectid", "version"}, - s: "history_traplocation_pkey", - }, -} - -type historyTraplocationErrors struct { - ErrUniqueHistoryTraplocationPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_treatment.bob.go b/db/dberrors/history_treatment.bob.go deleted file mode 100644 index b6c764c6..00000000 --- a/db/dberrors/history_treatment.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryTreatmentErrors = &historyTreatmentErrors{ - ErrUniqueHistoryTreatmentPkey: &UniqueConstraintError{ - schema: "", - table: "history_treatment", - columns: []string{"objectid", "version"}, - s: "history_treatment_pkey", - }, -} - -type historyTreatmentErrors struct { - ErrUniqueHistoryTreatmentPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_treatmentarea.bob.go b/db/dberrors/history_treatmentarea.bob.go deleted file mode 100644 index 227e50ab..00000000 --- a/db/dberrors/history_treatmentarea.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryTreatmentareaErrors = &historyTreatmentareaErrors{ - ErrUniqueHistoryTreatmentareaPkey: &UniqueConstraintError{ - schema: "", - table: "history_treatmentarea", - columns: []string{"objectid", "version"}, - s: "history_treatmentarea_pkey", - }, -} - -type historyTreatmentareaErrors struct { - ErrUniqueHistoryTreatmentareaPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_zones.bob.go b/db/dberrors/history_zones.bob.go deleted file mode 100644 index 318137fd..00000000 --- a/db/dberrors/history_zones.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryZoneErrors = &historyZoneErrors{ - ErrUniqueHistoryZonesPkey: &UniqueConstraintError{ - schema: "", - table: "history_zones", - columns: []string{"objectid", "version"}, - s: "history_zones_pkey", - }, -} - -type historyZoneErrors struct { - ErrUniqueHistoryZonesPkey *UniqueConstraintError -} diff --git a/db/dberrors/history_zones2.bob.go b/db/dberrors/history_zones2.bob.go deleted file mode 100644 index 6fddfe71..00000000 --- a/db/dberrors/history_zones2.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var HistoryZones2Errors = &historyZones2Errors{ - ErrUniqueHistoryZones2Pkey: &UniqueConstraintError{ - schema: "", - table: "history_zones2", - columns: []string{"objectid", "version"}, - s: "history_zones2_pkey", - }, -} - -type historyZones2Errors struct { - ErrUniqueHistoryZones2Pkey *UniqueConstraintError -} diff --git a/db/dberrors/note_audio.bob.go b/db/dberrors/note_audio.bob.go new file mode 100644 index 00000000..2e171711 --- /dev/null +++ b/db/dberrors/note_audio.bob.go @@ -0,0 +1,17 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dberrors + +var NoteAudioErrors = ¬eAudioErrors{ + ErrUniqueNoteAudioPkey: &UniqueConstraintError{ + schema: "", + table: "note_audio", + columns: []string{"version", "uuid"}, + s: "note_audio_pkey", + }, +} + +type noteAudioErrors struct { + ErrUniqueNoteAudioPkey *UniqueConstraintError +} diff --git a/db/dberrors/note_audio_breadcrumb.bob.go b/db/dberrors/note_audio_breadcrumb.bob.go new file mode 100644 index 00000000..9c702f14 --- /dev/null +++ b/db/dberrors/note_audio_breadcrumb.bob.go @@ -0,0 +1,17 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dberrors + +var NoteAudioBreadcrumbErrors = ¬eAudioBreadcrumbErrors{ + ErrUniqueNoteAudioBreadcrumbPkey: &UniqueConstraintError{ + schema: "", + table: "note_audio_breadcrumb", + columns: []string{"note_audio_version", "note_audio_uuid", "position"}, + s: "note_audio_breadcrumb_pkey", + }, +} + +type noteAudioBreadcrumbErrors struct { + ErrUniqueNoteAudioBreadcrumbPkey *UniqueConstraintError +} diff --git a/db/dberrors/note_audio_data.bob.go b/db/dberrors/note_audio_data.bob.go new file mode 100644 index 00000000..91094b86 --- /dev/null +++ b/db/dberrors/note_audio_data.bob.go @@ -0,0 +1,17 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dberrors + +var NoteAudioDatumErrors = ¬eAudioDatumErrors{ + ErrUniqueNoteAudioDataPkey: &UniqueConstraintError{ + schema: "", + table: "note_audio_data", + columns: []string{"note_audio_version", "note_audio_uuid", "type_"}, + s: "note_audio_data_pkey", + }, +} + +type noteAudioDatumErrors struct { + ErrUniqueNoteAudioDataPkey *UniqueConstraintError +} diff --git a/db/dberrors/note_image.bob.go b/db/dberrors/note_image.bob.go new file mode 100644 index 00000000..892745cc --- /dev/null +++ b/db/dberrors/note_image.bob.go @@ -0,0 +1,17 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dberrors + +var NoteImageErrors = ¬eImageErrors{ + ErrUniqueNoteImagePkey: &UniqueConstraintError{ + schema: "", + table: "note_image", + columns: []string{"version", "uuid"}, + s: "note_image_pkey", + }, +} + +type noteImageErrors struct { + ErrUniqueNoteImagePkey *UniqueConstraintError +} diff --git a/db/dberrors/note_image_breadcrumb.bob.go b/db/dberrors/note_image_breadcrumb.bob.go new file mode 100644 index 00000000..6e52cecd --- /dev/null +++ b/db/dberrors/note_image_breadcrumb.bob.go @@ -0,0 +1,17 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dberrors + +var NoteImageBreadcrumbErrors = ¬eImageBreadcrumbErrors{ + ErrUniqueNoteImageBreadcrumbPkey: &UniqueConstraintError{ + schema: "", + table: "note_image_breadcrumb", + columns: []string{"note_image_version", "note_image_uuid", "position"}, + s: "note_image_breadcrumb_pkey", + }, +} + +type noteImageBreadcrumbErrors struct { + ErrUniqueNoteImageBreadcrumbPkey *UniqueConstraintError +} diff --git a/db/dberrors/note_image_data.bob.go b/db/dberrors/note_image_data.bob.go new file mode 100644 index 00000000..fc9b307a --- /dev/null +++ b/db/dberrors/note_image_data.bob.go @@ -0,0 +1,17 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dberrors + +var NoteImageDatumErrors = ¬eImageDatumErrors{ + ErrUniqueNoteImageDataPkey: &UniqueConstraintError{ + schema: "", + table: "note_image_data", + columns: []string{"note_image_version", "note_image_uuid", "type_"}, + s: "note_image_data_pkey", + }, +} + +type noteImageDatumErrors struct { + ErrUniqueNoteImageDataPkey *UniqueConstraintError +} diff --git a/db/dberrors/notification.bob.go b/db/dberrors/notification.bob.go index c6271307..07196de6 100644 --- a/db/dberrors/notification.bob.go +++ b/db/dberrors/notification.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/oauth_token.bob.go b/db/dberrors/oauth_token.bob.go index 62b458e4..c474b6f9 100644 --- a/db/dberrors/oauth_token.bob.go +++ b/db/dberrors/oauth_token.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/organization.bob.go b/db/dberrors/organization.bob.go index 2f7bc6b9..19d5213d 100644 --- a/db/dberrors/organization.bob.go +++ b/db/dberrors/organization.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/sessions.bob.go b/db/dberrors/sessions.bob.go index e7150f3a..8e3460f6 100644 --- a/db/dberrors/sessions.bob.go +++ b/db/dberrors/sessions.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/spatial_ref_sys.bob.go b/db/dberrors/spatial_ref_sys.bob.go index 81a1157b..99af4f55 100644 --- a/db/dberrors/spatial_ref_sys.bob.go +++ b/db/dberrors/spatial_ref_sys.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dberrors/user_.bob.go b/db/dberrors/user_.bob.go index 70522a60..1a7c9554 100644 --- a/db/dberrors/user_.bob.go +++ b/db/dberrors/user_.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dberrors diff --git a/db/dbinfo/bob_types.bob.go b/db/dbinfo/bob_types.bob.go index f1fec63d..51fad5b1 100644 --- a/db/dbinfo/bob_types.bob.go +++ b/db/dbinfo/bob_types.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo diff --git a/db/dbinfo/fieldseeker.containerrelate.bob.go b/db/dbinfo/fieldseeker.containerrelate.bob.go index 1a92b00e..ab7f390b 100644 --- a/db/dbinfo/fieldseeker.containerrelate.bob.go +++ b/db/dbinfo/fieldseeker.containerrelate.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerContainerrelates = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -37,7 +37,7 @@ var FieldseekerContainerrelates = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -46,7 +46,7 @@ var FieldseekerContainerrelates = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerContainerrelates = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerContainerrelates = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerContainerrelates = Table[ Name: "inspsampleid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is INSPSAMPLEID", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerContainerrelates = Table[ Name: "mosquitoinspid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is MOSQUITOINSPID", Nullable: true, Generated: false, AutoIncr: false, @@ -91,16 +91,16 @@ var FieldseekerContainerrelates = Table[ Name: "treatmentid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is TREATMENTID", Nullable: true, Generated: false, AutoIncr: false, }, Containertype: column{ Name: "containertype", - DBType: "fieldseeker.containerrelate_mosquitocontainertype_enum", + DBType: "character varying", Default: "NULL", - Comment: "Container Type", + Comment: "Original attribute from ArcGIS API is CONTAINERTYPE", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerContainerrelates = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerContainerrelates = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerContainerrelates = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -136,6 +136,24 @@ var FieldseekerContainerrelates = Table[ Name: "editor", DBType: "character varying", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Editor", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -145,7 +163,16 @@ var FieldseekerContainerrelates = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -180,6 +207,17 @@ var FieldseekerContainerrelates = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerContainerrelateForeignKeys{ + FieldseekerContainerrelateContainerrelateOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.containerrelate.containerrelate_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -199,12 +237,15 @@ type fieldseekerContainerrelateColumns struct { Creator column Editdate column Editor column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerContainerrelateColumns) AsSlice() []column { return []column{ - c.Objectid, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Inspsampleid, c.Mosquitoinspid, c.Treatmentid, c.Containertype, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Version, + c.Objectid, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Inspsampleid, c.Mosquitoinspid, c.Treatmentid, c.Containertype, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -218,10 +259,14 @@ func (i fieldseekerContainerrelateIndexes) AsSlice() []index { } } -type fieldseekerContainerrelateForeignKeys struct{} +type fieldseekerContainerrelateForeignKeys struct { + FieldseekerContainerrelateContainerrelateOrganizationIDFkey foreignKey +} func (f fieldseekerContainerrelateForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerContainerrelateContainerrelateOrganizationIDFkey, + } } type fieldseekerContainerrelateUniques struct{} diff --git a/db/dbinfo/fieldseeker.fieldscoutinglog.bob.go b/db/dbinfo/fieldseeker.fieldscoutinglog.bob.go index de12e074..41ff4b20 100644 --- a/db/dbinfo/fieldseeker.fieldscoutinglog.bob.go +++ b/db/dbinfo/fieldseeker.fieldscoutinglog.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -26,9 +26,9 @@ var FieldseekerFieldscoutinglogs = Table[ }, Status: column{ Name: "status", - DBType: "fieldseeker.fieldscoutinglog_fieldscoutingsymbology_enum", + DBType: "smallint", Default: "NULL", - Comment: "Status", + Comment: "Original attribute from ArcGIS API is STATUS", Nullable: true, Generated: false, AutoIncr: false, @@ -37,7 +37,7 @@ var FieldseekerFieldscoutinglogs = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -46,7 +46,7 @@ var FieldseekerFieldscoutinglogs = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerFieldscoutinglogs = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerFieldscoutinglogs = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerFieldscoutinglogs = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerFieldscoutinglogs = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerFieldscoutinglogs = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerFieldscoutinglogs = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -109,6 +109,24 @@ var FieldseekerFieldscoutinglogs = Table[ Name: "editor", DBType: "character varying", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Editor", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -118,7 +136,16 @@ var FieldseekerFieldscoutinglogs = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -153,6 +180,17 @@ var FieldseekerFieldscoutinglogs = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerFieldscoutinglogForeignKeys{ + FieldseekerFieldscoutinglogFieldscoutinglogOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.fieldscoutinglog.fieldscoutinglog_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -169,12 +207,15 @@ type fieldseekerFieldscoutinglogColumns struct { Creator column Editdate column Editor column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerFieldscoutinglogColumns) AsSlice() []column { return []column{ - c.Objectid, c.Status, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Version, + c.Objectid, c.Status, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -188,10 +229,14 @@ func (i fieldseekerFieldscoutinglogIndexes) AsSlice() []index { } } -type fieldseekerFieldscoutinglogForeignKeys struct{} +type fieldseekerFieldscoutinglogForeignKeys struct { + FieldseekerFieldscoutinglogFieldscoutinglogOrganizationIDFkey foreignKey +} func (f fieldseekerFieldscoutinglogForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerFieldscoutinglogFieldscoutinglogOrganizationIDFkey, + } } type fieldseekerFieldscoutinglogUniques struct{} diff --git a/db/dbinfo/fieldseeker.habitatrelate.bob.go b/db/dbinfo/fieldseeker.habitatrelate.bob.go index da5fff58..75d75900 100644 --- a/db/dbinfo/fieldseeker.habitatrelate.bob.go +++ b/db/dbinfo/fieldseeker.habitatrelate.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerHabitatrelates = Table[ Name: "foreign_id", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is FOREIGN_ID", Nullable: true, Generated: false, AutoIncr: false, @@ -37,7 +37,7 @@ var FieldseekerHabitatrelates = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -46,7 +46,7 @@ var FieldseekerHabitatrelates = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerHabitatrelates = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerHabitatrelates = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -73,16 +73,16 @@ var FieldseekerHabitatrelates = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, }, Habitattype: column{ Name: "habitattype", - DBType: "fieldseeker.habitatrelate_habitatrelate_habitattype_2e81cf2f550e400783cf284", + DBType: "character varying", Default: "NULL", - Comment: "Habitat Type", + Comment: "Original attribute from ArcGIS API is HABITATTYPE", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerHabitatrelates = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerHabitatrelates = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerHabitatrelates = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -118,6 +118,24 @@ var FieldseekerHabitatrelates = Table[ Name: "editor", DBType: "character varying", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Editor", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -127,7 +145,16 @@ var FieldseekerHabitatrelates = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -162,6 +189,17 @@ var FieldseekerHabitatrelates = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerHabitatrelateForeignKeys{ + FieldseekerHabitatrelateHabitatrelateOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.habitatrelate.habitatrelate_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -179,12 +217,15 @@ type fieldseekerHabitatrelateColumns struct { Creator column Editdate column Editor column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerHabitatrelateColumns) AsSlice() []column { return []column{ - c.Objectid, c.ForeignID, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Habitattype, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Version, + c.Objectid, c.ForeignID, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Habitattype, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -198,10 +239,14 @@ func (i fieldseekerHabitatrelateIndexes) AsSlice() []index { } } -type fieldseekerHabitatrelateForeignKeys struct{} +type fieldseekerHabitatrelateForeignKeys struct { + FieldseekerHabitatrelateHabitatrelateOrganizationIDFkey foreignKey +} func (f fieldseekerHabitatrelateForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerHabitatrelateHabitatrelateOrganizationIDFkey, + } } type fieldseekerHabitatrelateUniques struct{} diff --git a/db/dbinfo/fieldseeker.inspectionsample.bob.go b/db/dbinfo/fieldseeker.inspectionsample.bob.go index 3d3f98fd..5c6914b4 100644 --- a/db/dbinfo/fieldseeker.inspectionsample.bob.go +++ b/db/dbinfo/fieldseeker.inspectionsample.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerInspectionsamples = Table[ Name: "insp_id", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is INSP_ID", Nullable: true, Generated: false, AutoIncr: false, @@ -37,16 +37,16 @@ var FieldseekerInspectionsamples = Table[ Name: "sampleid", DBType: "character varying", Default: "NULL", - Comment: "Sample ID", + Comment: "Original attribute from ArcGIS API is SAMPLEID", Nullable: true, Generated: false, AutoIncr: false, }, Processed: column{ Name: "processed", - DBType: "fieldseeker.inspectionsample_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Processed", + Comment: "Original attribute from ArcGIS API is PROCESSED", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerInspectionsamples = Table[ Name: "idbytech", DBType: "character varying", Default: "NULL", - Comment: "Tech Identifying Species in Lab", + Comment: "Original attribute from ArcGIS API is IDBYTECH", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerInspectionsamples = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerInspectionsamples = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerInspectionsamples = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerInspectionsamples = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerInspectionsamples = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerInspectionsamples = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerInspectionsamples = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerInspectionsamples = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -136,6 +136,24 @@ var FieldseekerInspectionsamples = Table[ Name: "editor", DBType: "character varying", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Editor", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -145,7 +163,16 @@ var FieldseekerInspectionsamples = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -180,6 +207,17 @@ var FieldseekerInspectionsamples = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerInspectionsampleForeignKeys{ + FieldseekerInspectionsampleInspectionsampleOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.inspectionsample.inspectionsample_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -199,12 +237,15 @@ type fieldseekerInspectionsampleColumns struct { Creator column Editdate column Editor column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerInspectionsampleColumns) AsSlice() []column { return []column{ - c.Objectid, c.InspID, c.Sampleid, c.Processed, c.Idbytech, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Version, + c.Objectid, c.InspID, c.Sampleid, c.Processed, c.Idbytech, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -218,10 +259,14 @@ func (i fieldseekerInspectionsampleIndexes) AsSlice() []index { } } -type fieldseekerInspectionsampleForeignKeys struct{} +type fieldseekerInspectionsampleForeignKeys struct { + FieldseekerInspectionsampleInspectionsampleOrganizationIDFkey foreignKey +} func (f fieldseekerInspectionsampleForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerInspectionsampleInspectionsampleOrganizationIDFkey, + } } type fieldseekerInspectionsampleUniques struct{} diff --git a/db/dbinfo/fieldseeker.inspectionsampledetail.bob.go b/db/dbinfo/fieldseeker.inspectionsampledetail.bob.go index 1cdef1a9..35ae4af1 100644 --- a/db/dbinfo/fieldseeker.inspectionsampledetail.bob.go +++ b/db/dbinfo/fieldseeker.inspectionsampledetail.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,16 +28,16 @@ var FieldseekerInspectionsampledetails = Table[ Name: "inspsample_id", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is INSPSAMPLE_ID", Nullable: true, Generated: false, AutoIncr: false, }, Fieldspecies: column{ Name: "fieldspecies", - DBType: "fieldseeker.inspectionsampledetail_mosquitofieldspecies_enum", + DBType: "character varying", Default: "NULL", - Comment: "Field Species", + Comment: "Original attribute from ArcGIS API is FIELDSPECIES", Nullable: true, Generated: false, AutoIncr: false, @@ -46,7 +46,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "flarvcount", DBType: "smallint", Default: "NULL", - Comment: "Field Larva Count", + Comment: "Original attribute from ArcGIS API is FLARVCOUNT", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "fpupcount", DBType: "smallint", Default: "NULL", - Comment: "Field Pupa Count", + Comment: "Original attribute from ArcGIS API is FPUPCOUNT", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "feggcount", DBType: "smallint", Default: "NULL", - Comment: "Field Egg Count", + Comment: "Original attribute from ArcGIS API is FEGGCOUNT", Nullable: true, Generated: false, AutoIncr: false, @@ -73,25 +73,25 @@ var FieldseekerInspectionsampledetails = Table[ Name: "flstages", DBType: "character varying", Default: "NULL", - Comment: "Field Larval Stages", + Comment: "Original attribute from ArcGIS API is FLSTAGES", Nullable: true, Generated: false, AutoIncr: false, }, Fdomstage: column{ Name: "fdomstage", - DBType: "fieldseeker.inspectionsampledetail_mosquitodominantstage_enum", + DBType: "character varying", Default: "NULL", - Comment: "Field Dominant Stage", + Comment: "Original attribute from ArcGIS API is FDOMSTAGE", Nullable: true, Generated: false, AutoIncr: false, }, Fadultact: column{ Name: "fadultact", - DBType: "fieldseeker.inspectionsampledetail_mosquitoadultactivity_enum", + DBType: "character varying", Default: "NULL", - Comment: "Field Adult Activity", + Comment: "Original attribute from ArcGIS API is FADULTACT", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "labspecies", DBType: "character varying", Default: "NULL", - Comment: "Lab Species", + Comment: "Original attribute from ArcGIS API is LABSPECIES", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "llarvcount", DBType: "smallint", Default: "NULL", - Comment: "Lab Larva Count", + Comment: "Original attribute from ArcGIS API is LLARVCOUNT", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "lpupcount", DBType: "smallint", Default: "NULL", - Comment: "Lab Pupa Count", + Comment: "Original attribute from ArcGIS API is LPUPCOUNT", Nullable: true, Generated: false, AutoIncr: false, @@ -127,16 +127,16 @@ var FieldseekerInspectionsampledetails = Table[ Name: "leggcount", DBType: "smallint", Default: "NULL", - Comment: "Lab Egg Count", + Comment: "Original attribute from ArcGIS API is LEGGCOUNT", Nullable: true, Generated: false, AutoIncr: false, }, Ldomstage: column{ Name: "ldomstage", - DBType: "fieldseeker.inspectionsampledetail_mosquitodominantstage_enum", + DBType: "character varying", Default: "NULL", - Comment: "Lab Dominant Stage", + Comment: "Original attribute from ArcGIS API is LDOMSTAGE", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "Comments", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -172,7 +172,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -181,7 +181,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +190,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -199,7 +199,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "processed", DBType: "smallint", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is PROCESSED", Nullable: true, Generated: false, AutoIncr: false, @@ -208,7 +208,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -217,7 +217,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -226,7 +226,7 @@ var FieldseekerInspectionsampledetails = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -235,6 +235,24 @@ var FieldseekerInspectionsampledetails = Table[ Name: "editor", DBType: "character varying", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Editor", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -244,7 +262,16 @@ var FieldseekerInspectionsampledetails = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -279,6 +306,17 @@ var FieldseekerInspectionsampledetails = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerInspectionsampledetailForeignKeys{ + FieldseekerInspectionsampledetailInspectionsampledetailOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.inspectionsampledetail.inspectionsampledetail_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -309,12 +347,15 @@ type fieldseekerInspectionsampledetailColumns struct { Creator column Editdate column Editor column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerInspectionsampledetailColumns) AsSlice() []column { return []column{ - c.Objectid, c.InspsampleID, c.Fieldspecies, c.Flarvcount, c.Fpupcount, c.Feggcount, c.Flstages, c.Fdomstage, c.Fadultact, c.Labspecies, c.Llarvcount, c.Lpupcount, c.Leggcount, c.Ldomstage, c.Comments, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Processed, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Version, + c.Objectid, c.InspsampleID, c.Fieldspecies, c.Flarvcount, c.Fpupcount, c.Feggcount, c.Flstages, c.Fdomstage, c.Fadultact, c.Labspecies, c.Llarvcount, c.Lpupcount, c.Leggcount, c.Ldomstage, c.Comments, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Processed, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -328,10 +369,14 @@ func (i fieldseekerInspectionsampledetailIndexes) AsSlice() []index { } } -type fieldseekerInspectionsampledetailForeignKeys struct{} +type fieldseekerInspectionsampledetailForeignKeys struct { + FieldseekerInspectionsampledetailInspectionsampledetailOrganizationIDFkey foreignKey +} func (f fieldseekerInspectionsampledetailForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerInspectionsampledetailInspectionsampledetailOrganizationIDFkey, + } } type fieldseekerInspectionsampledetailUniques struct{} diff --git a/db/dbinfo/fieldseeker.linelocation.bob.go b/db/dbinfo/fieldseeker.linelocation.bob.go index 5e830622..6d830898 100644 --- a/db/dbinfo/fieldseeker.linelocation.bob.go +++ b/db/dbinfo/fieldseeker.linelocation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerLinelocations = Table[ Name: "name", DBType: "character varying", Default: "NULL", - Comment: "Name", + Comment: "Original attribute from ArcGIS API is NAME", Nullable: true, Generated: false, AutoIncr: false, @@ -37,43 +37,43 @@ var FieldseekerLinelocations = Table[ Name: "zone", DBType: "character varying", Default: "NULL", - Comment: "Zone", + Comment: "Original attribute from ArcGIS API is ZONE", Nullable: true, Generated: false, AutoIncr: false, }, Habitat: column{ Name: "habitat", - DBType: "fieldseeker.linelocation_linelocation_habitat_fc51bdc4f1954df58206d69ce1418", + DBType: "character varying", Default: "NULL", - Comment: "Habitat", + Comment: "Original attribute from ArcGIS API is HABITAT", Nullable: true, Generated: false, AutoIncr: false, }, Priority: column{ Name: "priority", - DBType: "fieldseeker.linelocation_locationpriority_enum", + DBType: "character varying", Default: "NULL", - Comment: "Priority", + Comment: "Original attribute from ArcGIS API is PRIORITY", Nullable: true, Generated: false, AutoIncr: false, }, Usetype: column{ Name: "usetype", - DBType: "fieldseeker.linelocation_linelocation_usetype_2aeca2e60d2f455c86fc34895dc80", + DBType: "character varying", Default: "NULL", - Comment: "Use Type", + Comment: "Original attribute from ArcGIS API is USETYPE", Nullable: true, Generated: false, AutoIncr: false, }, Active: column{ Name: "active", - DBType: "fieldseeker.linelocation_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Active", + Comment: "Original attribute from ArcGIS API is ACTIVE", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerLinelocations = Table[ Name: "description", DBType: "character varying", Default: "NULL", - Comment: "Description", + Comment: "Original attribute from ArcGIS API is DESCRIPTION", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerLinelocations = Table[ Name: "accessdesc", DBType: "character varying", Default: "NULL", - Comment: "Access Description", + Comment: "Original attribute from ArcGIS API is ACCESSDESC", Nullable: true, Generated: false, AutoIncr: false, @@ -100,16 +100,16 @@ var FieldseekerLinelocations = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "Comments", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, }, Symbology: column{ Name: "symbology", - DBType: "fieldseeker.linelocation_locationsymbology_enum", + DBType: "character varying", Default: "NULL", - Comment: "Symbology", + Comment: "Original attribute from ArcGIS API is SYMBOLOGY", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerLinelocations = Table[ Name: "externalid", DBType: "character varying", Default: "NULL", - Comment: "External ID", + Comment: "Original attribute from ArcGIS API is EXTERNALID", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerLinelocations = Table[ Name: "acres", DBType: "double precision", Default: "NULL", - Comment: "Acres", + Comment: "Original attribute from ArcGIS API is ACRES", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerLinelocations = Table[ Name: "nextactiondatescheduled", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Next Scheduled Action", + Comment: "Original attribute from ArcGIS API is NEXTACTIONDATESCHEDULED", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerLinelocations = Table[ Name: "larvinspectinterval", DBType: "smallint", Default: "NULL", - Comment: "Larval Inspection Interval", + Comment: "Original attribute from ArcGIS API is LARVINSPECTINTERVAL", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerLinelocations = Table[ Name: "length_ft", DBType: "double precision", Default: "NULL", - Comment: "Length", + Comment: "Original attribute from ArcGIS API is LENGTH_FT", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerLinelocations = Table[ Name: "width_ft", DBType: "double precision", Default: "NULL", - Comment: "Width", + Comment: "Original attribute from ArcGIS API is WIDTH_FT", Nullable: true, Generated: false, AutoIncr: false, @@ -172,7 +172,7 @@ var FieldseekerLinelocations = Table[ Name: "zone2", DBType: "character varying", Default: "NULL", - Comment: "Zone2", + Comment: "Original attribute from ArcGIS API is ZONE2", Nullable: true, Generated: false, AutoIncr: false, @@ -181,7 +181,7 @@ var FieldseekerLinelocations = Table[ Name: "locationnumber", DBType: "integer", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LOCATIONNUMBER", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +190,7 @@ var FieldseekerLinelocations = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -199,7 +199,7 @@ var FieldseekerLinelocations = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -208,7 +208,7 @@ var FieldseekerLinelocations = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -217,7 +217,7 @@ var FieldseekerLinelocations = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -226,7 +226,7 @@ var FieldseekerLinelocations = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -235,7 +235,7 @@ var FieldseekerLinelocations = Table[ Name: "lastinspectdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Last Inspection Date", + Comment: "Original attribute from ArcGIS API is LASTINSPECTDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -244,7 +244,7 @@ var FieldseekerLinelocations = Table[ Name: "lastinspectbreeding", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Breeding", + Comment: "Original attribute from ArcGIS API is LASTINSPECTBREEDING", Nullable: true, Generated: false, AutoIncr: false, @@ -253,7 +253,7 @@ var FieldseekerLinelocations = Table[ Name: "lastinspectavglarvae", DBType: "double precision", Default: "NULL", - Comment: "Last Inspection Average Larvae", + Comment: "Original attribute from ArcGIS API is LASTINSPECTAVGLARVAE", Nullable: true, Generated: false, AutoIncr: false, @@ -262,7 +262,7 @@ var FieldseekerLinelocations = Table[ Name: "lastinspectavgpupae", DBType: "double precision", Default: "NULL", - Comment: "Last Inspection Average Pupae", + Comment: "Original attribute from ArcGIS API is LASTINSPECTAVGPUPAE", Nullable: true, Generated: false, AutoIncr: false, @@ -271,7 +271,7 @@ var FieldseekerLinelocations = Table[ Name: "lastinspectlstages", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Larval Stages", + Comment: "Original attribute from ArcGIS API is LASTINSPECTLSTAGES", Nullable: true, Generated: false, AutoIncr: false, @@ -280,7 +280,7 @@ var FieldseekerLinelocations = Table[ Name: "lastinspectactiontaken", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Action", + Comment: "Original attribute from ArcGIS API is LASTINSPECTACTIONTAKEN", Nullable: true, Generated: false, AutoIncr: false, @@ -289,7 +289,7 @@ var FieldseekerLinelocations = Table[ Name: "lastinspectfieldspecies", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Field Species", + Comment: "Original attribute from ArcGIS API is LASTINSPECTFIELDSPECIES", Nullable: true, Generated: false, AutoIncr: false, @@ -298,7 +298,7 @@ var FieldseekerLinelocations = Table[ Name: "lasttreatdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Last Treatment Date", + Comment: "Original attribute from ArcGIS API is LASTTREATDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -307,7 +307,7 @@ var FieldseekerLinelocations = Table[ Name: "lasttreatproduct", DBType: "character varying", Default: "NULL", - Comment: "Last Treatment Product", + Comment: "Original attribute from ArcGIS API is LASTTREATPRODUCT", Nullable: true, Generated: false, AutoIncr: false, @@ -316,7 +316,7 @@ var FieldseekerLinelocations = Table[ Name: "lasttreatqty", DBType: "double precision", Default: "NULL", - Comment: "Last Treatment Quantity", + Comment: "Original attribute from ArcGIS API is LASTTREATQTY", Nullable: true, Generated: false, AutoIncr: false, @@ -325,7 +325,7 @@ var FieldseekerLinelocations = Table[ Name: "lasttreatqtyunit", DBType: "character varying", Default: "NULL", - Comment: "Last Treatment Quantity Unit", + Comment: "Original attribute from ArcGIS API is LASTTREATQTYUNIT", Nullable: true, Generated: false, AutoIncr: false, @@ -334,7 +334,7 @@ var FieldseekerLinelocations = Table[ Name: "hectares", DBType: "double precision", Default: "NULL", - Comment: "Hectares", + Comment: "Original attribute from ArcGIS API is HECTARES", Nullable: true, Generated: false, AutoIncr: false, @@ -343,7 +343,7 @@ var FieldseekerLinelocations = Table[ Name: "lastinspectactivity", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Activity", + Comment: "Original attribute from ArcGIS API is LASTINSPECTACTIVITY", Nullable: true, Generated: false, AutoIncr: false, @@ -352,7 +352,7 @@ var FieldseekerLinelocations = Table[ Name: "lasttreatactivity", DBType: "character varying", Default: "NULL", - Comment: "Last Treatment Activity", + Comment: "Original attribute from ArcGIS API is LASTTREATACTIVITY", Nullable: true, Generated: false, AutoIncr: false, @@ -361,7 +361,7 @@ var FieldseekerLinelocations = Table[ Name: "length_meters", DBType: "double precision", Default: "NULL", - Comment: "Length Meters", + Comment: "Original attribute from ArcGIS API is LENGTH_METERS", Nullable: true, Generated: false, AutoIncr: false, @@ -370,7 +370,7 @@ var FieldseekerLinelocations = Table[ Name: "width_meters", DBType: "double precision", Default: "NULL", - Comment: "Width Meters", + Comment: "Original attribute from ArcGIS API is WIDTH_METERS", Nullable: true, Generated: false, AutoIncr: false, @@ -379,16 +379,16 @@ var FieldseekerLinelocations = Table[ Name: "lastinspectconditions", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Conditions", + Comment: "Original attribute from ArcGIS API is LASTINSPECTCONDITIONS", Nullable: true, Generated: false, AutoIncr: false, }, Waterorigin: column{ Name: "waterorigin", - DBType: "fieldseeker.linelocation_linelocation_waterorigin_84723d92_306a_46f4_8ef1_6", + DBType: "character varying", Default: "NULL", - Comment: "Water Origin", + Comment: "Original attribute from ArcGIS API is WATERORIGIN", Nullable: true, Generated: false, AutoIncr: false, @@ -397,7 +397,7 @@ var FieldseekerLinelocations = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -406,7 +406,7 @@ var FieldseekerLinelocations = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -415,7 +415,7 @@ var FieldseekerLinelocations = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -424,7 +424,7 @@ var FieldseekerLinelocations = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, @@ -433,7 +433,7 @@ var FieldseekerLinelocations = Table[ Name: "jurisdiction", DBType: "character varying", Default: "NULL", - Comment: "Jurisdiction", + Comment: "Original attribute from ArcGIS API is JURISDICTION", Nullable: true, Generated: false, AutoIncr: false, @@ -442,6 +442,24 @@ var FieldseekerLinelocations = Table[ Name: "shape__length", DBType: "double precision", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Shape__Length", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -451,7 +469,16 @@ var FieldseekerLinelocations = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -486,6 +513,17 @@ var FieldseekerLinelocations = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerLinelocationForeignKeys{ + FieldseekerLinelocationLinelocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.linelocation.linelocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -539,12 +577,15 @@ type fieldseekerLinelocationColumns struct { Editor column Jurisdiction column ShapeLength column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerLinelocationColumns) AsSlice() []column { return []column{ - c.Objectid, c.Name, c.Zone, c.Habitat, c.Priority, c.Usetype, c.Active, c.Description, c.Accessdesc, c.Comments, c.Symbology, c.Externalid, c.Acres, c.Nextactiondatescheduled, c.Larvinspectinterval, c.LengthFT, c.WidthFT, c.Zone2, c.Locationnumber, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Lastinspectdate, c.Lastinspectbreeding, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectlstages, c.Lastinspectactiontaken, c.Lastinspectfieldspecies, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Hectares, c.Lastinspectactivity, c.Lasttreatactivity, c.LengthMeters, c.WidthMeters, c.Lastinspectconditions, c.Waterorigin, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Jurisdiction, c.ShapeLength, c.Version, + c.Objectid, c.Name, c.Zone, c.Habitat, c.Priority, c.Usetype, c.Active, c.Description, c.Accessdesc, c.Comments, c.Symbology, c.Externalid, c.Acres, c.Nextactiondatescheduled, c.Larvinspectinterval, c.LengthFT, c.WidthFT, c.Zone2, c.Locationnumber, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Lastinspectdate, c.Lastinspectbreeding, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectlstages, c.Lastinspectactiontaken, c.Lastinspectfieldspecies, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Hectares, c.Lastinspectactivity, c.Lasttreatactivity, c.LengthMeters, c.WidthMeters, c.Lastinspectconditions, c.Waterorigin, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Jurisdiction, c.ShapeLength, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -558,10 +599,14 @@ func (i fieldseekerLinelocationIndexes) AsSlice() []index { } } -type fieldseekerLinelocationForeignKeys struct{} +type fieldseekerLinelocationForeignKeys struct { + FieldseekerLinelocationLinelocationOrganizationIDFkey foreignKey +} func (f fieldseekerLinelocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerLinelocationLinelocationOrganizationIDFkey, + } } type fieldseekerLinelocationUniques struct{} diff --git a/db/dbinfo/fieldseeker.locationtracking.bob.go b/db/dbinfo/fieldseeker.locationtracking.bob.go index fbb1aea0..6cd5337e 100644 --- a/db/dbinfo/fieldseeker.locationtracking.bob.go +++ b/db/dbinfo/fieldseeker.locationtracking.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerLocationtrackings = Table[ Name: "accuracy", DBType: "double precision", Default: "NULL", - Comment: "Accuracy(m)", + Comment: "Original attribute from ArcGIS API is Accuracy", Nullable: true, Generated: false, AutoIncr: false, @@ -37,7 +37,7 @@ var FieldseekerLocationtrackings = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -46,7 +46,7 @@ var FieldseekerLocationtrackings = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerLocationtrackings = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerLocationtrackings = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerLocationtrackings = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerLocationtrackings = Table[ Name: "fieldtech", DBType: "character varying", Default: "NULL", - Comment: "Field Tech", + Comment: "Original attribute from ArcGIS API is FIELDTECH", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerLocationtrackings = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerLocationtrackings = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerLocationtrackings = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -118,6 +118,24 @@ var FieldseekerLocationtrackings = Table[ Name: "editor", DBType: "character varying", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Editor", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -127,7 +145,16 @@ var FieldseekerLocationtrackings = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -162,6 +189,17 @@ var FieldseekerLocationtrackings = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerLocationtrackingForeignKeys{ + FieldseekerLocationtrackingLocationtrackingOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.locationtracking.locationtracking_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -179,12 +217,15 @@ type fieldseekerLocationtrackingColumns struct { Creator column Editdate column Editor column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerLocationtrackingColumns) AsSlice() []column { return []column{ - c.Objectid, c.Accuracy, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Globalid, c.Fieldtech, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Version, + c.Objectid, c.Accuracy, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Globalid, c.Fieldtech, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -198,10 +239,14 @@ func (i fieldseekerLocationtrackingIndexes) AsSlice() []index { } } -type fieldseekerLocationtrackingForeignKeys struct{} +type fieldseekerLocationtrackingForeignKeys struct { + FieldseekerLocationtrackingLocationtrackingOrganizationIDFkey foreignKey +} func (f fieldseekerLocationtrackingForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerLocationtrackingLocationtrackingOrganizationIDFkey, + } } type fieldseekerLocationtrackingUniques struct{} diff --git a/db/dbinfo/fieldseeker.mosquitoinspection.bob.go b/db/dbinfo/fieldseeker.mosquitoinspection.bob.go index 13bb1456..0003c5f4 100644 --- a/db/dbinfo/fieldseeker.mosquitoinspection.bob.go +++ b/db/dbinfo/fieldseeker.mosquitoinspection.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,25 +28,25 @@ var FieldseekerMosquitoinspections = Table[ Name: "numdips", DBType: "smallint", Default: "NULL", - Comment: "# Dips", + Comment: "Original attribute from ArcGIS API is NUMDIPS", Nullable: true, Generated: false, AutoIncr: false, }, Activity: column{ Name: "activity", - DBType: "fieldseeker.mosquitoinspection_mosquitoactivity_enum", + DBType: "character varying", Default: "NULL", - Comment: "Activity", + Comment: "Original attribute from ArcGIS API is ACTIVITY", Nullable: true, Generated: false, AutoIncr: false, }, Breeding: column{ Name: "breeding", - DBType: "fieldseeker.mosquitoinspection_mosquitobreeding_enum", + DBType: "character varying", Default: "NULL", - Comment: "Breeding", + Comment: "Original attribute from ArcGIS API is BREEDING", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "totlarvae", DBType: "smallint", Default: "NULL", - Comment: "Total Larvae", + Comment: "Original attribute from ArcGIS API is TOTLARVAE", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "totpupae", DBType: "smallint", Default: "NULL", - Comment: "Total Pupae", + Comment: "Original attribute from ArcGIS API is TOTPUPAE", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "eggs", DBType: "smallint", Default: "NULL", - Comment: "Eggs", + Comment: "Original attribute from ArcGIS API is EGGS", Nullable: true, Generated: false, AutoIncr: false, @@ -82,16 +82,16 @@ var FieldseekerMosquitoinspections = Table[ Name: "posdips", DBType: "smallint", Default: "NULL", - Comment: "Positive Dips", + Comment: "Original attribute from ArcGIS API is POSDIPS", Nullable: true, Generated: false, AutoIncr: false, }, Adultact: column{ Name: "adultact", - DBType: "fieldseeker.mosquitoinspection_mosquitoadultactivity_enum", + DBType: "character varying", Default: "NULL", - Comment: "Adult Activity", + Comment: "Original attribute from ArcGIS API is ADULTACT", Nullable: true, Generated: false, AutoIncr: false, @@ -100,25 +100,25 @@ var FieldseekerMosquitoinspections = Table[ Name: "lstages", DBType: "character varying", Default: "NULL", - Comment: "Larval Stages", + Comment: "Original attribute from ArcGIS API is LSTAGES", Nullable: true, Generated: false, AutoIncr: false, }, Domstage: column{ Name: "domstage", - DBType: "fieldseeker.mosquitoinspection_mosquitoinspection_domstage_b7a6c36bccde49a2", + DBType: "character varying", Default: "NULL", - Comment: "Dominant Stage", + Comment: "Original attribute from ArcGIS API is DOMSTAGE", Nullable: true, Generated: false, AutoIncr: false, }, Actiontaken: column{ Name: "actiontaken", - DBType: "fieldseeker.mosquitoinspection_mosquitoinspection_actiontaken_252243d69b0b4", + DBType: "character varying", Default: "NULL", - Comment: "Action", + Comment: "Original attribute from ArcGIS API is ACTIONTAKEN", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "Comments", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "avetemp", DBType: "double precision", Default: "NULL", - Comment: "Average Temperature", + Comment: "Original attribute from ArcGIS API is AVETEMP", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "windspeed", DBType: "double precision", Default: "NULL", - Comment: "Wind Speed", + Comment: "Original attribute from ArcGIS API is WINDSPEED", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "raingauge", DBType: "double precision", Default: "NULL", - Comment: "Rain Gauge", + Comment: "Original attribute from ArcGIS API is RAINGAUGE", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "startdatetime", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Start", + Comment: "Original attribute from ArcGIS API is STARTDATETIME", Nullable: true, Generated: false, AutoIncr: false, @@ -172,16 +172,16 @@ var FieldseekerMosquitoinspections = Table[ Name: "enddatetime", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Finish", + Comment: "Original attribute from ArcGIS API is ENDDATETIME", Nullable: true, Generated: false, AutoIncr: false, }, Winddir: column{ Name: "winddir", - DBType: "fieldseeker.mosquitoinspection_notinuiwinddirection_enum", + DBType: "character varying", Default: "NULL", - Comment: "Wind Direction", + Comment: "Original attribute from ArcGIS API is WINDDIR", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +190,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "avglarvae", DBType: "double precision", Default: "NULL", - Comment: "Average Larvae", + Comment: "Original attribute from ArcGIS API is AVGLARVAE", Nullable: true, Generated: false, AutoIncr: false, @@ -199,16 +199,16 @@ var FieldseekerMosquitoinspections = Table[ Name: "avgpupae", DBType: "double precision", Default: "NULL", - Comment: "Average Pupae", + Comment: "Original attribute from ArcGIS API is AVGPUPAE", Nullable: true, Generated: false, AutoIncr: false, }, Reviewed: column{ Name: "reviewed", - DBType: "fieldseeker.mosquitoinspection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Reviewed", + Comment: "Original attribute from ArcGIS API is REVIEWED", Nullable: true, Generated: false, AutoIncr: false, @@ -217,7 +217,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "reviewedby", DBType: "character varying", Default: "NULL", - Comment: "Reviewed By", + Comment: "Original attribute from ArcGIS API is REVIEWEDBY", Nullable: true, Generated: false, AutoIncr: false, @@ -226,7 +226,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "revieweddate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Reviewed Date", + Comment: "Original attribute from ArcGIS API is REVIEWEDDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -235,7 +235,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "locationname", DBType: "character varying", Default: "NULL", - Comment: "Location Name", + Comment: "Original attribute from ArcGIS API is LOCATIONNAME", Nullable: true, Generated: false, AutoIncr: false, @@ -244,7 +244,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "zone", DBType: "character varying", Default: "NULL", - Comment: "Zone", + Comment: "Original attribute from ArcGIS API is ZONE", Nullable: true, Generated: false, AutoIncr: false, @@ -253,7 +253,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "recordstatus", DBType: "smallint", Default: "NULL", - Comment: "RecordStatus", + Comment: "Original attribute from ArcGIS API is RECORDSTATUS", Nullable: true, Generated: false, AutoIncr: false, @@ -262,16 +262,16 @@ var FieldseekerMosquitoinspections = Table[ Name: "zone2", DBType: "character varying", Default: "NULL", - Comment: "Zone2", + Comment: "Original attribute from ArcGIS API is ZONE2", Nullable: true, Generated: false, AutoIncr: false, }, Personalcontact: column{ Name: "personalcontact", - DBType: "fieldseeker.mosquitoinspection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Personal Contact", + Comment: "Original attribute from ArcGIS API is PERSONALCONTACT", Nullable: true, Generated: false, AutoIncr: false, @@ -280,7 +280,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "tirecount", DBType: "smallint", Default: "NULL", - Comment: "Tire Count", + Comment: "Original attribute from ArcGIS API is TIRECOUNT", Nullable: true, Generated: false, AutoIncr: false, @@ -289,7 +289,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "cbcount", DBType: "smallint", Default: "NULL", - Comment: "Catch Basin Count", + Comment: "Original attribute from ArcGIS API is CBCOUNT", Nullable: true, Generated: false, AutoIncr: false, @@ -298,16 +298,16 @@ var FieldseekerMosquitoinspections = Table[ Name: "containercount", DBType: "smallint", Default: "NULL", - Comment: "Container Count", + Comment: "Original attribute from ArcGIS API is CONTAINERCOUNT", Nullable: true, Generated: false, AutoIncr: false, }, Fieldspecies: column{ Name: "fieldspecies", - DBType: "fieldseeker.mosquitoinspection_mosquitofieldspecies_enum", + DBType: "character varying", Default: "NULL", - Comment: "Field Species", + Comment: "Original attribute from ArcGIS API is FIELDSPECIES", Nullable: true, Generated: false, AutoIncr: false, @@ -316,7 +316,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -325,7 +325,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -334,7 +334,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -343,7 +343,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -352,7 +352,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -361,7 +361,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "linelocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LINELOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -370,7 +370,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "pointlocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is POINTLOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -379,7 +379,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "polygonlocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is POLYGONLOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -388,7 +388,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "srid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is SRID", Nullable: true, Generated: false, AutoIncr: false, @@ -397,25 +397,25 @@ var FieldseekerMosquitoinspections = Table[ Name: "fieldtech", DBType: "character varying", Default: "NULL", - Comment: "Field Tech", + Comment: "Original attribute from ArcGIS API is FIELDTECH", Nullable: true, Generated: false, AutoIncr: false, }, Larvaepresent: column{ Name: "larvaepresent", - DBType: "fieldseeker.mosquitoinspection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Larvae Present", + Comment: "Original attribute from ArcGIS API is LARVAEPRESENT", Nullable: true, Generated: false, AutoIncr: false, }, Pupaepresent: column{ Name: "pupaepresent", - DBType: "fieldseeker.mosquitoinspection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Pupae Present", + Comment: "Original attribute from ArcGIS API is PUPAEPRESENT", Nullable: true, Generated: false, AutoIncr: false, @@ -424,16 +424,16 @@ var FieldseekerMosquitoinspections = Table[ Name: "sdid", DBType: "uuid", Default: "NULL", - Comment: "Storm Drain ID", + Comment: "Original attribute from ArcGIS API is SDID", Nullable: true, Generated: false, AutoIncr: false, }, Sitecond: column{ Name: "sitecond", - DBType: "fieldseeker.mosquitoinspection_mosquitoinspection_sitecond_db7350bc_81e5_40", + DBType: "character varying", Default: "NULL", - Comment: "Conditions", + Comment: "Original attribute from ArcGIS API is SITECOND", Nullable: true, Generated: false, AutoIncr: false, @@ -442,7 +442,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "positivecontainercount", DBType: "smallint", Default: "NULL", - Comment: "Positive Container Count", + Comment: "Original attribute from ArcGIS API is POSITIVECONTAINERCOUNT", Nullable: true, Generated: false, AutoIncr: false, @@ -451,7 +451,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -460,7 +460,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -469,7 +469,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -478,7 +478,7 @@ var FieldseekerMosquitoinspections = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, @@ -487,16 +487,16 @@ var FieldseekerMosquitoinspections = Table[ Name: "jurisdiction", DBType: "character varying", Default: "NULL", - Comment: "Jurisdiction", + Comment: "Original attribute from ArcGIS API is JURISDICTION", Nullable: true, Generated: false, AutoIncr: false, }, Visualmonitoring: column{ Name: "visualmonitoring", - DBType: "fieldseeker.mosquitoinspection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Visual Monitoring", + Comment: "Original attribute from ArcGIS API is VISUALMONITORING", Nullable: true, Generated: false, AutoIncr: false, @@ -505,16 +505,16 @@ var FieldseekerMosquitoinspections = Table[ Name: "vmcomments", DBType: "character varying", Default: "NULL", - Comment: "VM Comments", + Comment: "Original attribute from ArcGIS API is VMCOMMENTS", Nullable: true, Generated: false, AutoIncr: false, }, Adminaction: column{ Name: "adminaction", - DBType: "fieldseeker.mosquitoinspection_mosquitoinspection_adminaction_b74ae1bb_c98b", + DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is adminAction", Nullable: true, Generated: false, AutoIncr: false, @@ -523,6 +523,24 @@ var FieldseekerMosquitoinspections = Table[ Name: "ptaid", DBType: "uuid", Default: "NULL", + Comment: "Original attribute from ArcGIS API is PTAID", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -532,7 +550,16 @@ var FieldseekerMosquitoinspections = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -567,6 +594,17 @@ var FieldseekerMosquitoinspections = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerMosquitoinspectionForeignKeys{ + FieldseekerMosquitoinspectionMosquitoinspectionOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.mosquitoinspection.mosquitoinspection_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -629,12 +667,15 @@ type fieldseekerMosquitoinspectionColumns struct { Vmcomments column Adminaction column Ptaid column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerMosquitoinspectionColumns) AsSlice() []column { return []column{ - c.Objectid, c.Numdips, c.Activity, c.Breeding, c.Totlarvae, c.Totpupae, c.Eggs, c.Posdips, c.Adultact, c.Lstages, c.Domstage, c.Actiontaken, c.Comments, c.Avetemp, c.Windspeed, c.Raingauge, c.Startdatetime, c.Enddatetime, c.Winddir, c.Avglarvae, c.Avgpupae, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Locationname, c.Zone, c.Recordstatus, c.Zone2, c.Personalcontact, c.Tirecount, c.Cbcount, c.Containercount, c.Fieldspecies, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Linelocid, c.Pointlocid, c.Polygonlocid, c.Srid, c.Fieldtech, c.Larvaepresent, c.Pupaepresent, c.Sdid, c.Sitecond, c.Positivecontainercount, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Jurisdiction, c.Visualmonitoring, c.Vmcomments, c.Adminaction, c.Ptaid, c.Version, + c.Objectid, c.Numdips, c.Activity, c.Breeding, c.Totlarvae, c.Totpupae, c.Eggs, c.Posdips, c.Adultact, c.Lstages, c.Domstage, c.Actiontaken, c.Comments, c.Avetemp, c.Windspeed, c.Raingauge, c.Startdatetime, c.Enddatetime, c.Winddir, c.Avglarvae, c.Avgpupae, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Locationname, c.Zone, c.Recordstatus, c.Zone2, c.Personalcontact, c.Tirecount, c.Cbcount, c.Containercount, c.Fieldspecies, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Linelocid, c.Pointlocid, c.Polygonlocid, c.Srid, c.Fieldtech, c.Larvaepresent, c.Pupaepresent, c.Sdid, c.Sitecond, c.Positivecontainercount, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Jurisdiction, c.Visualmonitoring, c.Vmcomments, c.Adminaction, c.Ptaid, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -648,10 +689,14 @@ func (i fieldseekerMosquitoinspectionIndexes) AsSlice() []index { } } -type fieldseekerMosquitoinspectionForeignKeys struct{} +type fieldseekerMosquitoinspectionForeignKeys struct { + FieldseekerMosquitoinspectionMosquitoinspectionOrganizationIDFkey foreignKey +} func (f fieldseekerMosquitoinspectionForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerMosquitoinspectionMosquitoinspectionOrganizationIDFkey, + } } type fieldseekerMosquitoinspectionUniques struct{} diff --git a/db/dbinfo/fieldseeker.pointlocation.bob.go b/db/dbinfo/fieldseeker.pointlocation.bob.go index 793707d2..76624ff8 100644 --- a/db/dbinfo/fieldseeker.pointlocation.bob.go +++ b/db/dbinfo/fieldseeker.pointlocation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerPointlocations = Table[ Name: "name", DBType: "character varying", Default: "NULL", - Comment: "Name", + Comment: "Original attribute from ArcGIS API is NAME", Nullable: true, Generated: false, AutoIncr: false, @@ -37,43 +37,43 @@ var FieldseekerPointlocations = Table[ Name: "zone", DBType: "character varying", Default: "NULL", - Comment: "Zone", + Comment: "Original attribute from ArcGIS API is ZONE", Nullable: true, Generated: false, AutoIncr: false, }, Habitat: column{ Name: "habitat", - DBType: "fieldseeker.pointlocation_pointlocation_habitat_b4d8135a_4979_49c8_8bb3_67e", + DBType: "character varying", Default: "NULL", - Comment: "Habitat", + Comment: "Original attribute from ArcGIS API is HABITAT", Nullable: true, Generated: false, AutoIncr: false, }, Priority: column{ Name: "priority", - DBType: "fieldseeker.pointlocation_locationpriority_enum", + DBType: "character varying", Default: "NULL", - Comment: "Priority", + Comment: "Original attribute from ArcGIS API is PRIORITY", Nullable: true, Generated: false, AutoIncr: false, }, Usetype: column{ Name: "usetype", - DBType: "fieldseeker.pointlocation_pointlocation_usetype_58d62d18ef4f47fc8cb9874df86", + DBType: "character varying", Default: "NULL", - Comment: "Use Type", + Comment: "Original attribute from ArcGIS API is USETYPE", Nullable: true, Generated: false, AutoIncr: false, }, Active: column{ Name: "active", - DBType: "fieldseeker.pointlocation_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Active", + Comment: "Original attribute from ArcGIS API is ACTIVE", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerPointlocations = Table[ Name: "description", DBType: "character varying", Default: "NULL", - Comment: "Description", + Comment: "Original attribute from ArcGIS API is DESCRIPTION", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerPointlocations = Table[ Name: "accessdesc", DBType: "character varying", Default: "NULL", - Comment: "Access Description", + Comment: "Original attribute from ArcGIS API is ACCESSDESC", Nullable: true, Generated: false, AutoIncr: false, @@ -100,16 +100,16 @@ var FieldseekerPointlocations = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "Comments", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, }, Symbology: column{ Name: "symbology", - DBType: "fieldseeker.pointlocation_locationsymbology_enum", + DBType: "character varying", Default: "NULL", - Comment: "Symbology", + Comment: "Original attribute from ArcGIS API is SYMBOLOGY", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerPointlocations = Table[ Name: "externalid", DBType: "character varying", Default: "NULL", - Comment: "External ID", + Comment: "Original attribute from ArcGIS API is EXTERNALID", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerPointlocations = Table[ Name: "nextactiondatescheduled", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Next Scheduled Action", + Comment: "Original attribute from ArcGIS API is NEXTACTIONDATESCHEDULED", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerPointlocations = Table[ Name: "larvinspectinterval", DBType: "smallint", Default: "NULL", - Comment: "Larval Inspection Interval", + Comment: "Original attribute from ArcGIS API is LARVINSPECTINTERVAL", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerPointlocations = Table[ Name: "zone2", DBType: "character varying", Default: "NULL", - Comment: "Zone2", + Comment: "Original attribute from ArcGIS API is ZONE2", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerPointlocations = Table[ Name: "locationnumber", DBType: "integer", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LOCATIONNUMBER", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerPointlocations = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -172,7 +172,7 @@ var FieldseekerPointlocations = Table[ Name: "stype", DBType: "character varying", Default: "NULL", - Comment: "SourceType", + Comment: "Original attribute from ArcGIS API is STYPE", Nullable: true, Generated: false, AutoIncr: false, @@ -181,7 +181,7 @@ var FieldseekerPointlocations = Table[ Name: "lastinspectdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Last Inspection Date", + Comment: "Original attribute from ArcGIS API is LASTINSPECTDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +190,7 @@ var FieldseekerPointlocations = Table[ Name: "lastinspectbreeding", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Breeding", + Comment: "Original attribute from ArcGIS API is LASTINSPECTBREEDING", Nullable: true, Generated: false, AutoIncr: false, @@ -199,7 +199,7 @@ var FieldseekerPointlocations = Table[ Name: "lastinspectavglarvae", DBType: "double precision", Default: "NULL", - Comment: "Last Inspection Average Larvae", + Comment: "Original attribute from ArcGIS API is LASTINSPECTAVGLARVAE", Nullable: true, Generated: false, AutoIncr: false, @@ -208,7 +208,7 @@ var FieldseekerPointlocations = Table[ Name: "lastinspectavgpupae", DBType: "double precision", Default: "NULL", - Comment: "Last Inspection Average Pupae", + Comment: "Original attribute from ArcGIS API is LASTINSPECTAVGPUPAE", Nullable: true, Generated: false, AutoIncr: false, @@ -217,7 +217,7 @@ var FieldseekerPointlocations = Table[ Name: "lastinspectlstages", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Larval Stages", + Comment: "Original attribute from ArcGIS API is LASTINSPECTLSTAGES", Nullable: true, Generated: false, AutoIncr: false, @@ -226,7 +226,7 @@ var FieldseekerPointlocations = Table[ Name: "lastinspectactiontaken", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Action", + Comment: "Original attribute from ArcGIS API is LASTINSPECTACTIONTAKEN", Nullable: true, Generated: false, AutoIncr: false, @@ -235,7 +235,7 @@ var FieldseekerPointlocations = Table[ Name: "lastinspectfieldspecies", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Field Species", + Comment: "Original attribute from ArcGIS API is LASTINSPECTFIELDSPECIES", Nullable: true, Generated: false, AutoIncr: false, @@ -244,7 +244,7 @@ var FieldseekerPointlocations = Table[ Name: "lasttreatdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Last Treatment Date", + Comment: "Original attribute from ArcGIS API is LASTTREATDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -253,7 +253,7 @@ var FieldseekerPointlocations = Table[ Name: "lasttreatproduct", DBType: "character varying", Default: "NULL", - Comment: "Last Treatment Product", + Comment: "Original attribute from ArcGIS API is LASTTREATPRODUCT", Nullable: true, Generated: false, AutoIncr: false, @@ -262,7 +262,7 @@ var FieldseekerPointlocations = Table[ Name: "lasttreatqty", DBType: "double precision", Default: "NULL", - Comment: "Last Treatment Quantity", + Comment: "Original attribute from ArcGIS API is LASTTREATQTY", Nullable: true, Generated: false, AutoIncr: false, @@ -271,7 +271,7 @@ var FieldseekerPointlocations = Table[ Name: "lasttreatqtyunit", DBType: "character varying", Default: "NULL", - Comment: "Last Treatment Quantity Unit", + Comment: "Original attribute from ArcGIS API is LASTTREATQTYUNIT", Nullable: true, Generated: false, AutoIncr: false, @@ -280,7 +280,7 @@ var FieldseekerPointlocations = Table[ Name: "lastinspectactivity", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Activity", + Comment: "Original attribute from ArcGIS API is LASTINSPECTACTIVITY", Nullable: true, Generated: false, AutoIncr: false, @@ -289,7 +289,7 @@ var FieldseekerPointlocations = Table[ Name: "lasttreatactivity", DBType: "character varying", Default: "NULL", - Comment: "Last Treatment Activity", + Comment: "Original attribute from ArcGIS API is LASTTREATACTIVITY", Nullable: true, Generated: false, AutoIncr: false, @@ -298,16 +298,16 @@ var FieldseekerPointlocations = Table[ Name: "lastinspectconditions", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Conditions", + Comment: "Original attribute from ArcGIS API is LASTINSPECTCONDITIONS", Nullable: true, Generated: false, AutoIncr: false, }, Waterorigin: column{ Name: "waterorigin", - DBType: "fieldseeker.pointlocation_pointlocation_waterorigin_197b22bf_f3eb_4dad_8899", + DBType: "character varying", Default: "NULL", - Comment: "Water Origin", + Comment: "Original attribute from ArcGIS API is WATERORIGIN", Nullable: true, Generated: false, AutoIncr: false, @@ -316,7 +316,7 @@ var FieldseekerPointlocations = Table[ Name: "x", DBType: "double precision", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is X", Nullable: true, Generated: false, AutoIncr: false, @@ -325,16 +325,16 @@ var FieldseekerPointlocations = Table[ Name: "y", DBType: "double precision", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Y", Nullable: true, Generated: false, AutoIncr: false, }, Assignedtech: column{ Name: "assignedtech", - DBType: "fieldseeker.pointlocation_pointlocation_assignedtech_9393a162_2474_429d_85b", + DBType: "character varying", Default: "NULL", - Comment: "Assigned Tech", + Comment: "Original attribute from ArcGIS API is ASSIGNEDTECH", Nullable: true, Generated: false, AutoIncr: false, @@ -343,7 +343,7 @@ var FieldseekerPointlocations = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -352,7 +352,7 @@ var FieldseekerPointlocations = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -361,7 +361,7 @@ var FieldseekerPointlocations = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -370,7 +370,7 @@ var FieldseekerPointlocations = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, @@ -379,16 +379,16 @@ var FieldseekerPointlocations = Table[ Name: "jurisdiction", DBType: "character varying", Default: "NULL", - Comment: "Jurisdiction", + Comment: "Original attribute from ArcGIS API is JURISDICTION", Nullable: true, Generated: false, AutoIncr: false, }, DeactivateReason: column{ Name: "deactivate_reason", - DBType: "fieldseeker.pointlocation_pointlocation_deactivate_reason_dd303085_b33c_489", + DBType: "character varying", Default: "NULL", - Comment: "Reason for Deactivation", + Comment: "Original attribute from ArcGIS API is deactivate_reason", Nullable: true, Generated: false, AutoIncr: false, @@ -397,7 +397,7 @@ var FieldseekerPointlocations = Table[ Name: "scalarpriority", DBType: "integer", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is scalarPriority", Nullable: true, Generated: false, AutoIncr: false, @@ -406,6 +406,24 @@ var FieldseekerPointlocations = Table[ Name: "sourcestatus", DBType: "character varying", Default: "NULL", + Comment: "Original attribute from ArcGIS API is sourceStatus", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -415,7 +433,16 @@ var FieldseekerPointlocations = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -450,6 +477,17 @@ var FieldseekerPointlocations = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerPointlocationForeignKeys{ + FieldseekerPointlocationPointlocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.pointlocation.pointlocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -499,12 +537,15 @@ type fieldseekerPointlocationColumns struct { DeactivateReason column Scalarpriority column Sourcestatus column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerPointlocationColumns) AsSlice() []column { return []column{ - c.Objectid, c.Name, c.Zone, c.Habitat, c.Priority, c.Usetype, c.Active, c.Description, c.Accessdesc, c.Comments, c.Symbology, c.Externalid, c.Nextactiondatescheduled, c.Larvinspectinterval, c.Zone2, c.Locationnumber, c.Globalid, c.Stype, c.Lastinspectdate, c.Lastinspectbreeding, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectlstages, c.Lastinspectactiontaken, c.Lastinspectfieldspecies, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Lastinspectactivity, c.Lasttreatactivity, c.Lastinspectconditions, c.Waterorigin, c.X, c.Y, c.Assignedtech, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Jurisdiction, c.DeactivateReason, c.Scalarpriority, c.Sourcestatus, c.Version, + c.Objectid, c.Name, c.Zone, c.Habitat, c.Priority, c.Usetype, c.Active, c.Description, c.Accessdesc, c.Comments, c.Symbology, c.Externalid, c.Nextactiondatescheduled, c.Larvinspectinterval, c.Zone2, c.Locationnumber, c.Globalid, c.Stype, c.Lastinspectdate, c.Lastinspectbreeding, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectlstages, c.Lastinspectactiontaken, c.Lastinspectfieldspecies, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Lastinspectactivity, c.Lasttreatactivity, c.Lastinspectconditions, c.Waterorigin, c.X, c.Y, c.Assignedtech, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Jurisdiction, c.DeactivateReason, c.Scalarpriority, c.Sourcestatus, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -518,10 +559,14 @@ func (i fieldseekerPointlocationIndexes) AsSlice() []index { } } -type fieldseekerPointlocationForeignKeys struct{} +type fieldseekerPointlocationForeignKeys struct { + FieldseekerPointlocationPointlocationOrganizationIDFkey foreignKey +} func (f fieldseekerPointlocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerPointlocationPointlocationOrganizationIDFkey, + } } type fieldseekerPointlocationUniques struct{} diff --git a/db/dbinfo/fieldseeker.polygonlocation.bob.go b/db/dbinfo/fieldseeker.polygonlocation.bob.go index fb5ce2f7..acf1da69 100644 --- a/db/dbinfo/fieldseeker.polygonlocation.bob.go +++ b/db/dbinfo/fieldseeker.polygonlocation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerPolygonlocations = Table[ Name: "name", DBType: "character varying", Default: "NULL", - Comment: "Name", + Comment: "Original attribute from ArcGIS API is NAME", Nullable: true, Generated: false, AutoIncr: false, @@ -37,43 +37,43 @@ var FieldseekerPolygonlocations = Table[ Name: "zone", DBType: "character varying", Default: "NULL", - Comment: "Zone", + Comment: "Original attribute from ArcGIS API is ZONE", Nullable: true, Generated: false, AutoIncr: false, }, Habitat: column{ Name: "habitat", - DBType: "fieldseeker.polygonlocation_polygonlocation_habitat_45e9dde79ac84d959df8b65", + DBType: "character varying", Default: "NULL", - Comment: "Habitat", + Comment: "Original attribute from ArcGIS API is HABITAT", Nullable: true, Generated: false, AutoIncr: false, }, Priority: column{ Name: "priority", - DBType: "fieldseeker.polygonlocation_locationpriority_enum", + DBType: "character varying", Default: "NULL", - Comment: "Priority", + Comment: "Original attribute from ArcGIS API is PRIORITY", Nullable: true, Generated: false, AutoIncr: false, }, Usetype: column{ Name: "usetype", - DBType: "fieldseeker.polygonlocation_polygonlocation_usetype_e546154cb9544b9aa8e7b13", + DBType: "character varying", Default: "NULL", - Comment: "Use Type", + Comment: "Original attribute from ArcGIS API is USETYPE", Nullable: true, Generated: false, AutoIncr: false, }, Active: column{ Name: "active", - DBType: "fieldseeker.polygonlocation_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Active", + Comment: "Original attribute from ArcGIS API is ACTIVE", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerPolygonlocations = Table[ Name: "description", DBType: "character varying", Default: "NULL", - Comment: "Description", + Comment: "Original attribute from ArcGIS API is DESCRIPTION", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerPolygonlocations = Table[ Name: "accessdesc", DBType: "character varying", Default: "NULL", - Comment: "Access Description", + Comment: "Original attribute from ArcGIS API is ACCESSDESC", Nullable: true, Generated: false, AutoIncr: false, @@ -100,16 +100,16 @@ var FieldseekerPolygonlocations = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "Comments", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, }, Symbology: column{ Name: "symbology", - DBType: "fieldseeker.polygonlocation_locationsymbology_enum", + DBType: "character varying", Default: "NULL", - Comment: "Symbology", + Comment: "Original attribute from ArcGIS API is SYMBOLOGY", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerPolygonlocations = Table[ Name: "externalid", DBType: "character varying", Default: "NULL", - Comment: "External ID", + Comment: "Original attribute from ArcGIS API is EXTERNALID", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerPolygonlocations = Table[ Name: "acres", DBType: "double precision", Default: "NULL", - Comment: "Acres", + Comment: "Original attribute from ArcGIS API is ACRES", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerPolygonlocations = Table[ Name: "nextactiondatescheduled", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Next Scheduled Action", + Comment: "Original attribute from ArcGIS API is NEXTACTIONDATESCHEDULED", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerPolygonlocations = Table[ Name: "larvinspectinterval", DBType: "smallint", Default: "NULL", - Comment: "Larval Inspection Interval", + Comment: "Original attribute from ArcGIS API is LARVINSPECTINTERVAL", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerPolygonlocations = Table[ Name: "zone2", DBType: "character varying", Default: "NULL", - Comment: "Zone2", + Comment: "Original attribute from ArcGIS API is ZONE2", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerPolygonlocations = Table[ Name: "locationnumber", DBType: "integer", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LOCATIONNUMBER", Nullable: true, Generated: false, AutoIncr: false, @@ -172,7 +172,7 @@ var FieldseekerPolygonlocations = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -181,7 +181,7 @@ var FieldseekerPolygonlocations = Table[ Name: "lastinspectdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Last Inspection Date", + Comment: "Original attribute from ArcGIS API is LASTINSPECTDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +190,7 @@ var FieldseekerPolygonlocations = Table[ Name: "lastinspectbreeding", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Breeding", + Comment: "Original attribute from ArcGIS API is LASTINSPECTBREEDING", Nullable: true, Generated: false, AutoIncr: false, @@ -199,7 +199,7 @@ var FieldseekerPolygonlocations = Table[ Name: "lastinspectavglarvae", DBType: "double precision", Default: "NULL", - Comment: "Last Inspection Average Larvae", + Comment: "Original attribute from ArcGIS API is LASTINSPECTAVGLARVAE", Nullable: true, Generated: false, AutoIncr: false, @@ -208,7 +208,7 @@ var FieldseekerPolygonlocations = Table[ Name: "lastinspectavgpupae", DBType: "double precision", Default: "NULL", - Comment: "Last Inspection Average Pupae", + Comment: "Original attribute from ArcGIS API is LASTINSPECTAVGPUPAE", Nullable: true, Generated: false, AutoIncr: false, @@ -217,7 +217,7 @@ var FieldseekerPolygonlocations = Table[ Name: "lastinspectlstages", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Larval Stages", + Comment: "Original attribute from ArcGIS API is LASTINSPECTLSTAGES", Nullable: true, Generated: false, AutoIncr: false, @@ -226,7 +226,7 @@ var FieldseekerPolygonlocations = Table[ Name: "lastinspectactiontaken", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Action", + Comment: "Original attribute from ArcGIS API is LASTINSPECTACTIONTAKEN", Nullable: true, Generated: false, AutoIncr: false, @@ -235,7 +235,7 @@ var FieldseekerPolygonlocations = Table[ Name: "lastinspectfieldspecies", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Field Species", + Comment: "Original attribute from ArcGIS API is LASTINSPECTFIELDSPECIES", Nullable: true, Generated: false, AutoIncr: false, @@ -244,7 +244,7 @@ var FieldseekerPolygonlocations = Table[ Name: "lasttreatdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Last Treatment Date", + Comment: "Original attribute from ArcGIS API is LASTTREATDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -253,7 +253,7 @@ var FieldseekerPolygonlocations = Table[ Name: "lasttreatproduct", DBType: "character varying", Default: "NULL", - Comment: "Last Treatment Product", + Comment: "Original attribute from ArcGIS API is LASTTREATPRODUCT", Nullable: true, Generated: false, AutoIncr: false, @@ -262,7 +262,7 @@ var FieldseekerPolygonlocations = Table[ Name: "lasttreatqty", DBType: "double precision", Default: "NULL", - Comment: "Last Treatment Quantity", + Comment: "Original attribute from ArcGIS API is LASTTREATQTY", Nullable: true, Generated: false, AutoIncr: false, @@ -271,7 +271,7 @@ var FieldseekerPolygonlocations = Table[ Name: "lasttreatqtyunit", DBType: "character varying", Default: "NULL", - Comment: "Last Treatment Quantity Unit", + Comment: "Original attribute from ArcGIS API is LASTTREATQTYUNIT", Nullable: true, Generated: false, AutoIncr: false, @@ -280,7 +280,7 @@ var FieldseekerPolygonlocations = Table[ Name: "hectares", DBType: "double precision", Default: "NULL", - Comment: "Hectares", + Comment: "Original attribute from ArcGIS API is HECTARES", Nullable: true, Generated: false, AutoIncr: false, @@ -289,7 +289,7 @@ var FieldseekerPolygonlocations = Table[ Name: "lastinspectactivity", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Activity", + Comment: "Original attribute from ArcGIS API is LASTINSPECTACTIVITY", Nullable: true, Generated: false, AutoIncr: false, @@ -298,7 +298,7 @@ var FieldseekerPolygonlocations = Table[ Name: "lasttreatactivity", DBType: "character varying", Default: "NULL", - Comment: "Last Treatment Activity", + Comment: "Original attribute from ArcGIS API is LASTTREATACTIVITY", Nullable: true, Generated: false, AutoIncr: false, @@ -307,16 +307,16 @@ var FieldseekerPolygonlocations = Table[ Name: "lastinspectconditions", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Conditions", + Comment: "Original attribute from ArcGIS API is LASTINSPECTCONDITIONS", Nullable: true, Generated: false, AutoIncr: false, }, Waterorigin: column{ Name: "waterorigin", - DBType: "fieldseeker.polygonlocation_polygonlocation_waterorigin_e9018e92_5f47_4ff9_", + DBType: "character varying", Default: "NULL", - Comment: "Water Origin", + Comment: "Original attribute from ArcGIS API is WATERORIGIN", Nullable: true, Generated: false, AutoIncr: false, @@ -325,7 +325,7 @@ var FieldseekerPolygonlocations = Table[ Name: "filter", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Filter", Nullable: true, Generated: false, AutoIncr: false, @@ -334,7 +334,7 @@ var FieldseekerPolygonlocations = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -343,7 +343,7 @@ var FieldseekerPolygonlocations = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -352,7 +352,7 @@ var FieldseekerPolygonlocations = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -361,7 +361,7 @@ var FieldseekerPolygonlocations = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, @@ -370,7 +370,7 @@ var FieldseekerPolygonlocations = Table[ Name: "jurisdiction", DBType: "character varying", Default: "NULL", - Comment: "Jurisdiction", + Comment: "Original attribute from ArcGIS API is JURISDICTION", Nullable: true, Generated: false, AutoIncr: false, @@ -379,7 +379,7 @@ var FieldseekerPolygonlocations = Table[ Name: "shape__area", DBType: "double precision", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Shape__Area", Nullable: true, Generated: false, AutoIncr: false, @@ -388,6 +388,24 @@ var FieldseekerPolygonlocations = Table[ Name: "shape__length", DBType: "double precision", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Shape__Length", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -397,7 +415,16 @@ var FieldseekerPolygonlocations = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -432,6 +459,17 @@ var FieldseekerPolygonlocations = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerPolygonlocationForeignKeys{ + FieldseekerPolygonlocationPolygonlocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.polygonlocation.polygonlocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -479,12 +517,15 @@ type fieldseekerPolygonlocationColumns struct { Jurisdiction column ShapeArea column ShapeLength column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerPolygonlocationColumns) AsSlice() []column { return []column{ - c.Objectid, c.Name, c.Zone, c.Habitat, c.Priority, c.Usetype, c.Active, c.Description, c.Accessdesc, c.Comments, c.Symbology, c.Externalid, c.Acres, c.Nextactiondatescheduled, c.Larvinspectinterval, c.Zone2, c.Locationnumber, c.Globalid, c.Lastinspectdate, c.Lastinspectbreeding, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectlstages, c.Lastinspectactiontaken, c.Lastinspectfieldspecies, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Hectares, c.Lastinspectactivity, c.Lasttreatactivity, c.Lastinspectconditions, c.Waterorigin, c.Filter, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Jurisdiction, c.ShapeArea, c.ShapeLength, c.Version, + c.Objectid, c.Name, c.Zone, c.Habitat, c.Priority, c.Usetype, c.Active, c.Description, c.Accessdesc, c.Comments, c.Symbology, c.Externalid, c.Acres, c.Nextactiondatescheduled, c.Larvinspectinterval, c.Zone2, c.Locationnumber, c.Globalid, c.Lastinspectdate, c.Lastinspectbreeding, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectlstages, c.Lastinspectactiontaken, c.Lastinspectfieldspecies, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Hectares, c.Lastinspectactivity, c.Lasttreatactivity, c.Lastinspectconditions, c.Waterorigin, c.Filter, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Jurisdiction, c.ShapeArea, c.ShapeLength, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -498,10 +539,14 @@ func (i fieldseekerPolygonlocationIndexes) AsSlice() []index { } } -type fieldseekerPolygonlocationForeignKeys struct{} +type fieldseekerPolygonlocationForeignKeys struct { + FieldseekerPolygonlocationPolygonlocationOrganizationIDFkey foreignKey +} func (f fieldseekerPolygonlocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerPolygonlocationPolygonlocationOrganizationIDFkey, + } } type fieldseekerPolygonlocationUniques struct{} diff --git a/db/dbinfo/fieldseeker.pool.bob.go b/db/dbinfo/fieldseeker.pool.bob.go index 151d487e..394739e6 100644 --- a/db/dbinfo/fieldseeker.pool.bob.go +++ b/db/dbinfo/fieldseeker.pool.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerPools = Table[ Name: "trapdata_id", DBType: "uuid", Default: "NULL", - Comment: "Trap Data ID", + Comment: "Original attribute from ArcGIS API is TRAPDATA_ID", Nullable: true, Generated: false, AutoIncr: false, @@ -37,7 +37,7 @@ var FieldseekerPools = Table[ Name: "datesent", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Date Sent", + Comment: "Original attribute from ArcGIS API is DATESENT", Nullable: true, Generated: false, AutoIncr: false, @@ -46,7 +46,7 @@ var FieldseekerPools = Table[ Name: "survtech", DBType: "character varying", Default: "NULL", - Comment: "Survey Tech", + Comment: "Original attribute from ArcGIS API is SURVTECH", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerPools = Table[ Name: "datetested", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Date Tested", + Comment: "Original attribute from ArcGIS API is DATETESTED", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerPools = Table[ Name: "testtech", DBType: "character varying", Default: "NULL", - Comment: "Test Tech", + Comment: "Original attribute from ArcGIS API is TESTTECH", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerPools = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "Comments", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, @@ -82,16 +82,16 @@ var FieldseekerPools = Table[ Name: "sampleid", DBType: "character varying", Default: "NULL", - Comment: "Sample ID", + Comment: "Original attribute from ArcGIS API is SAMPLEID", Nullable: true, Generated: false, AutoIncr: false, }, Processed: column{ Name: "processed", - DBType: "fieldseeker.pool_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Processed", + Comment: "Original attribute from ArcGIS API is PROCESSED", Nullable: true, Generated: false, AutoIncr: false, @@ -100,34 +100,34 @@ var FieldseekerPools = Table[ Name: "lab_id", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LAB_ID", Nullable: true, Generated: false, AutoIncr: false, }, Testmethod: column{ Name: "testmethod", - DBType: "fieldseeker.pool_pool_testmethod_670efbfba86d41ba8e2d3cab5d749e7f_enum", + DBType: "character varying", Default: "NULL", - Comment: "Test Methods", + Comment: "Original attribute from ArcGIS API is TESTMETHOD", Nullable: true, Generated: false, AutoIncr: false, }, Diseasetested: column{ Name: "diseasetested", - DBType: "fieldseeker.pool_pool_diseasetested_0f02232949c04c7e8de820b9b515ed97_enum", + DBType: "character varying", Default: "NULL", - Comment: "Diseases Tested", + Comment: "Original attribute from ArcGIS API is DISEASETESTED", Nullable: true, Generated: false, AutoIncr: false, }, Diseasepos: column{ Name: "diseasepos", - DBType: "fieldseeker.pool_pool_diseasepos_6889f8dd00074874aa726907e78497fa_enum", + DBType: "character varying", Default: "NULL", - Comment: "Diseases Positive", + Comment: "Original attribute from ArcGIS API is DISEASEPOS", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerPools = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerPools = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerPools = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerPools = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -172,16 +172,16 @@ var FieldseekerPools = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, }, Lab: column{ Name: "lab", - DBType: "fieldseeker.pool_mosquitolabname_enum", + DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LAB", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +190,7 @@ var FieldseekerPools = Table[ Name: "poolyear", DBType: "smallint", Default: "NULL", - Comment: "Pool Year", + Comment: "Original attribute from ArcGIS API is POOLYEAR", Nullable: true, Generated: false, AutoIncr: false, @@ -199,7 +199,7 @@ var FieldseekerPools = Table[ Name: "gatewaysync", DBType: "smallint", Default: "NULL", - Comment: "Gateway Sync", + Comment: "Original attribute from ArcGIS API is GATEWAYSYNC", Nullable: true, Generated: false, AutoIncr: false, @@ -208,7 +208,7 @@ var FieldseekerPools = Table[ Name: "vectorsurvcollectionid", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is VECTORSURVCOLLECTIONID", Nullable: true, Generated: false, AutoIncr: false, @@ -217,7 +217,7 @@ var FieldseekerPools = Table[ Name: "vectorsurvpoolid", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is VECTORSURVPOOLID", Nullable: true, Generated: false, AutoIncr: false, @@ -226,7 +226,7 @@ var FieldseekerPools = Table[ Name: "vectorsurvtrapdataid", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is VECTORSURVTRAPDATAID", Nullable: true, Generated: false, AutoIncr: false, @@ -235,7 +235,7 @@ var FieldseekerPools = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -244,7 +244,7 @@ var FieldseekerPools = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -253,7 +253,7 @@ var FieldseekerPools = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -262,6 +262,24 @@ var FieldseekerPools = Table[ Name: "editor", DBType: "character varying", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Editor", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -271,7 +289,16 @@ var FieldseekerPools = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -306,6 +333,17 @@ var FieldseekerPools = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerPoolForeignKeys{ + FieldseekerPoolPoolOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.pool.pool_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -339,12 +377,15 @@ type fieldseekerPoolColumns struct { Creator column Editdate column Editor column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerPoolColumns) AsSlice() []column { return []column{ - c.Objectid, c.TrapdataID, c.Datesent, c.Survtech, c.Datetested, c.Testtech, c.Comments, c.Sampleid, c.Processed, c.LabID, c.Testmethod, c.Diseasetested, c.Diseasepos, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Lab, c.Poolyear, c.Gatewaysync, c.Vectorsurvcollectionid, c.Vectorsurvpoolid, c.Vectorsurvtrapdataid, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Version, + c.Objectid, c.TrapdataID, c.Datesent, c.Survtech, c.Datetested, c.Testtech, c.Comments, c.Sampleid, c.Processed, c.LabID, c.Testmethod, c.Diseasetested, c.Diseasepos, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Lab, c.Poolyear, c.Gatewaysync, c.Vectorsurvcollectionid, c.Vectorsurvpoolid, c.Vectorsurvtrapdataid, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -358,10 +399,14 @@ func (i fieldseekerPoolIndexes) AsSlice() []index { } } -type fieldseekerPoolForeignKeys struct{} +type fieldseekerPoolForeignKeys struct { + FieldseekerPoolPoolOrganizationIDFkey foreignKey +} func (f fieldseekerPoolForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerPoolPoolOrganizationIDFkey, + } } type fieldseekerPoolUniques struct{} diff --git a/db/dbinfo/fieldseeker.pooldetail.bob.go b/db/dbinfo/fieldseeker.pooldetail.bob.go index 5438c502..73c7b66a 100644 --- a/db/dbinfo/fieldseeker.pooldetail.bob.go +++ b/db/dbinfo/fieldseeker.pooldetail.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerPooldetails = Table[ Name: "trapdata_id", DBType: "uuid", Default: "NULL", - Comment: "Trap Data ID", + Comment: "Original attribute from ArcGIS API is TRAPDATA_ID", Nullable: true, Generated: false, AutoIncr: false, @@ -37,7 +37,7 @@ var FieldseekerPooldetails = Table[ Name: "pool_id", DBType: "uuid", Default: "NULL", - Comment: "Pool ID", + Comment: "Original attribute from ArcGIS API is POOL_ID", Nullable: true, Generated: false, AutoIncr: false, @@ -46,7 +46,7 @@ var FieldseekerPooldetails = Table[ Name: "species", DBType: "character varying", Default: "NULL", - Comment: "Species", + Comment: "Original attribute from ArcGIS API is SPECIES", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerPooldetails = Table[ Name: "females", DBType: "smallint", Default: "NULL", - Comment: "Females", + Comment: "Original attribute from ArcGIS API is FEMALES", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerPooldetails = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerPooldetails = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerPooldetails = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerPooldetails = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerPooldetails = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerPooldetails = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerPooldetails = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerPooldetails = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -136,6 +136,24 @@ var FieldseekerPooldetails = Table[ Name: "editor", DBType: "character varying", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Editor", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -145,7 +163,16 @@ var FieldseekerPooldetails = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -180,6 +207,17 @@ var FieldseekerPooldetails = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerPooldetailForeignKeys{ + FieldseekerPooldetailPooldetailOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.pooldetail.pooldetail_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -199,12 +237,15 @@ type fieldseekerPooldetailColumns struct { Creator column Editdate column Editor column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerPooldetailColumns) AsSlice() []column { return []column{ - c.Objectid, c.TrapdataID, c.PoolID, c.Species, c.Females, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Version, + c.Objectid, c.TrapdataID, c.PoolID, c.Species, c.Females, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -218,10 +259,14 @@ func (i fieldseekerPooldetailIndexes) AsSlice() []index { } } -type fieldseekerPooldetailForeignKeys struct{} +type fieldseekerPooldetailForeignKeys struct { + FieldseekerPooldetailPooldetailOrganizationIDFkey foreignKey +} func (f fieldseekerPooldetailForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerPooldetailPooldetailOrganizationIDFkey, + } } type fieldseekerPooldetailUniques struct{} diff --git a/db/dbinfo/fieldseeker.proposedtreatmentarea.bob.go b/db/dbinfo/fieldseeker.proposedtreatmentarea.bob.go index 02669c9f..93691667 100644 --- a/db/dbinfo/fieldseeker.proposedtreatmentarea.bob.go +++ b/db/dbinfo/fieldseeker.proposedtreatmentarea.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -26,9 +26,9 @@ var FieldseekerProposedtreatmentareas = Table[ }, Method: column{ Name: "method", - DBType: "fieldseeker.proposedtreatmentarea_mosquitotreatmentmethod_enum", + DBType: "character varying", Default: "NULL", - Comment: "Method", + Comment: "Original attribute from ArcGIS API is METHOD", Nullable: true, Generated: false, AutoIncr: false, @@ -37,7 +37,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "Comments", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, @@ -46,16 +46,16 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "zone", DBType: "character varying", Default: "NULL", - Comment: "Zone", + Comment: "Original attribute from ArcGIS API is ZONE", Nullable: true, Generated: false, AutoIncr: false, }, Reviewed: column{ Name: "reviewed", - DBType: "fieldseeker.proposedtreatmentarea_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Reviewed", + Comment: "Original attribute from ArcGIS API is REVIEWED", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "reviewedby", DBType: "character varying", Default: "NULL", - Comment: "Reviewed By", + Comment: "Original attribute from ArcGIS API is REVIEWEDBY", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "revieweddate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Reviewed Date", + Comment: "Original attribute from ArcGIS API is REVIEWEDDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "zone2", DBType: "character varying", Default: "NULL", - Comment: "Zone2", + Comment: "Original attribute from ArcGIS API is ZONE2", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "completeddate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Completed Date", + Comment: "Original attribute from ArcGIS API is COMPLETEDDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -100,25 +100,25 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "completedby", DBType: "character varying", Default: "NULL", - Comment: "Completed By", + Comment: "Original attribute from ArcGIS API is COMPLETEDBY", Nullable: true, Generated: false, AutoIncr: false, }, Completed: column{ Name: "completed", - DBType: "fieldseeker.proposedtreatmentarea_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Completed", + Comment: "Original attribute from ArcGIS API is COMPLETED", Nullable: true, Generated: false, AutoIncr: false, }, Issprayroute: column{ Name: "issprayroute", - DBType: "fieldseeker.proposedtreatmentarea_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Is Spray Route", + Comment: "Original attribute from ArcGIS API is ISSPRAYROUTE", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "name", DBType: "character varying", Default: "NULL", - Comment: "Name", + Comment: "Original attribute from ArcGIS API is NAME", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "acres", DBType: "double precision", Default: "NULL", - Comment: "Acres", + Comment: "Original attribute from ArcGIS API is ACRES", Nullable: true, Generated: false, AutoIncr: false, @@ -145,16 +145,16 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, }, Exported: column{ Name: "exported", - DBType: "fieldseeker.proposedtreatmentarea_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EXPORTED", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "targetproduct", DBType: "character varying", Default: "NULL", - Comment: "Target Product", + Comment: "Original attribute from ArcGIS API is TARGETPRODUCT", Nullable: true, Generated: false, AutoIncr: false, @@ -172,7 +172,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "targetapprate", DBType: "double precision", Default: "NULL", - Comment: "Target App Rate", + Comment: "Original attribute from ArcGIS API is TARGETAPPRATE", Nullable: true, Generated: false, AutoIncr: false, @@ -181,7 +181,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "hectares", DBType: "double precision", Default: "NULL", - Comment: "Hectares", + Comment: "Original attribute from ArcGIS API is HECTARES", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +190,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "lasttreatactivity", DBType: "character varying", Default: "NULL", - Comment: "Last Treatment Activity", + Comment: "Original attribute from ArcGIS API is LASTTREATACTIVITY", Nullable: true, Generated: false, AutoIncr: false, @@ -199,7 +199,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "lasttreatdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Last Treatment Date", + Comment: "Original attribute from ArcGIS API is LASTTREATDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -208,7 +208,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "lasttreatproduct", DBType: "character varying", Default: "NULL", - Comment: "Last Treatment Product", + Comment: "Original attribute from ArcGIS API is LASTTREATPRODUCT", Nullable: true, Generated: false, AutoIncr: false, @@ -217,7 +217,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "lasttreatqty", DBType: "double precision", Default: "NULL", - Comment: "Last Treatment Quantity", + Comment: "Original attribute from ArcGIS API is LASTTREATQTY", Nullable: true, Generated: false, AutoIncr: false, @@ -226,16 +226,16 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "lasttreatqtyunit", DBType: "character varying", Default: "NULL", - Comment: "Last Treatment Quantity Unit", + Comment: "Original attribute from ArcGIS API is LASTTREATQTYUNIT", Nullable: true, Generated: false, AutoIncr: false, }, Priority: column{ Name: "priority", - DBType: "fieldseeker.proposedtreatmentarea_locationpriority_enum", + DBType: "character varying", Default: "NULL", - Comment: "Priority", + Comment: "Original attribute from ArcGIS API is PRIORITY", Nullable: true, Generated: false, AutoIncr: false, @@ -244,7 +244,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "duedate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Due Date", + Comment: "Original attribute from ArcGIS API is DUEDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -253,7 +253,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -262,7 +262,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -271,7 +271,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -280,7 +280,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, @@ -289,7 +289,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "targetspecies", DBType: "character varying", Default: "NULL", - Comment: "Target Species", + Comment: "Original attribute from ArcGIS API is TARGETSPECIES", Nullable: true, Generated: false, AutoIncr: false, @@ -298,7 +298,7 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "shape__area", DBType: "double precision", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Shape__Area", Nullable: true, Generated: false, AutoIncr: false, @@ -307,6 +307,24 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "shape__length", DBType: "double precision", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Shape__Length", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -316,7 +334,16 @@ var FieldseekerProposedtreatmentareas = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -351,6 +378,17 @@ var FieldseekerProposedtreatmentareas = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerProposedtreatmentareaForeignKeys{ + FieldseekerProposedtreatmentareaProposedtreatmentareaOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.proposedtreatmentarea.proposedtreatmentarea_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -389,12 +427,15 @@ type fieldseekerProposedtreatmentareaColumns struct { Targetspecies column ShapeArea column ShapeLength column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerProposedtreatmentareaColumns) AsSlice() []column { return []column{ - c.Objectid, c.Method, c.Comments, c.Zone, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Zone2, c.Completeddate, c.Completedby, c.Completed, c.Issprayroute, c.Name, c.Acres, c.Globalid, c.Exported, c.Targetproduct, c.Targetapprate, c.Hectares, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Priority, c.Duedate, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Targetspecies, c.ShapeArea, c.ShapeLength, c.Version, + c.Objectid, c.Method, c.Comments, c.Zone, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Zone2, c.Completeddate, c.Completedby, c.Completed, c.Issprayroute, c.Name, c.Acres, c.Globalid, c.Exported, c.Targetproduct, c.Targetapprate, c.Hectares, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Priority, c.Duedate, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Targetspecies, c.ShapeArea, c.ShapeLength, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -408,10 +449,14 @@ func (i fieldseekerProposedtreatmentareaIndexes) AsSlice() []index { } } -type fieldseekerProposedtreatmentareaForeignKeys struct{} +type fieldseekerProposedtreatmentareaForeignKeys struct { + FieldseekerProposedtreatmentareaProposedtreatmentareaOrganizationIDFkey foreignKey +} func (f fieldseekerProposedtreatmentareaForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerProposedtreatmentareaProposedtreatmentareaOrganizationIDFkey, + } } type fieldseekerProposedtreatmentareaUniques struct{} diff --git a/db/dbinfo/fieldseeker.qamosquitoinspection.bob.go b/db/dbinfo/fieldseeker.qamosquitoinspection.bob.go index 310a1e52..b8440900 100644 --- a/db/dbinfo/fieldseeker.qamosquitoinspection.bob.go +++ b/db/dbinfo/fieldseeker.qamosquitoinspection.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,16 +28,16 @@ var FieldseekerQamosquitoinspections = Table[ Name: "posdips", DBType: "smallint", Default: "NULL", - Comment: "Positive Dips", + Comment: "Original attribute from ArcGIS API is POSDIPS", Nullable: true, Generated: false, AutoIncr: false, }, Actiontaken: column{ Name: "actiontaken", - DBType: "fieldseeker.qamosquitoinspection_mosquitoaction_enum", + DBType: "character varying", Default: "NULL", - Comment: "Action", + Comment: "Original attribute from ArcGIS API is ACTIONTAKEN", Nullable: true, Generated: false, AutoIncr: false, @@ -46,7 +46,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "Comments", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "avetemp", DBType: "double precision", Default: "NULL", - Comment: "Average Temperature", + Comment: "Original attribute from ArcGIS API is AVETEMP", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "windspeed", DBType: "double precision", Default: "NULL", - Comment: "Wind Speed", + Comment: "Original attribute from ArcGIS API is WINDSPEED", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "raingauge", DBType: "double precision", Default: "NULL", - Comment: "Rain Gauge", + Comment: "Original attribute from ArcGIS API is RAINGAUGE", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "startdatetime", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Start", + Comment: "Original attribute from ArcGIS API is STARTDATETIME", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "enddatetime", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Finish", + Comment: "Original attribute from ArcGIS API is ENDDATETIME", Nullable: true, Generated: false, AutoIncr: false, @@ -109,16 +109,16 @@ var FieldseekerQamosquitoinspections = Table[ Name: "winddir", DBType: "character varying", Default: "NULL", - Comment: "Wind Direction", + Comment: "Original attribute from ArcGIS API is WINDDIR", Nullable: true, Generated: false, AutoIncr: false, }, Reviewed: column{ Name: "reviewed", - DBType: "fieldseeker.qamosquitoinspection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is REVIEWED", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "reviewedby", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is REVIEWEDBY", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "revieweddate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is REVIEWEDDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "locationname", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LOCATIONNAME", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "zone", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is ZONE", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "recordstatus", DBType: "smallint", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is RECORDSTATUS", Nullable: true, Generated: false, AutoIncr: false, @@ -172,7 +172,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "zone2", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is ZONE2", Nullable: true, Generated: false, AutoIncr: false, @@ -181,7 +181,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "lr", DBType: "smallint", Default: "NULL", - Comment: "Landing Rate", + Comment: "Original attribute from ArcGIS API is LR", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +190,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "negdips", DBType: "smallint", Default: "NULL", - Comment: "Negative Dips", + Comment: "Original attribute from ArcGIS API is NEGDIPS", Nullable: true, Generated: false, AutoIncr: false, @@ -199,7 +199,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "totalacres", DBType: "double precision", Default: "NULL", - Comment: "Total Acres", + Comment: "Original attribute from ArcGIS API is TOTALACRES", Nullable: true, Generated: false, AutoIncr: false, @@ -208,61 +208,61 @@ var FieldseekerQamosquitoinspections = Table[ Name: "acresbreeding", DBType: "double precision", Default: "NULL", - Comment: "Acres Breeding", + Comment: "Original attribute from ArcGIS API is ACRESBREEDING", Nullable: true, Generated: false, AutoIncr: false, }, Fish: column{ Name: "fish", - DBType: "fieldseeker.qamosquitoinspection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Fish Present?", + Comment: "Original attribute from ArcGIS API is FISH", Nullable: true, Generated: false, AutoIncr: false, }, Sitetype: column{ Name: "sitetype", - DBType: "fieldseeker.qamosquitoinspection_qasitetype_enum", + DBType: "character varying", Default: "NULL", - Comment: "Site Type", + Comment: "Original attribute from ArcGIS API is SITETYPE", Nullable: true, Generated: false, AutoIncr: false, }, Breedingpotential: column{ Name: "breedingpotential", - DBType: "fieldseeker.qamosquitoinspection_qabreedingpotential_enum", + DBType: "character varying", Default: "NULL", - Comment: "Breeding Potential", + Comment: "Original attribute from ArcGIS API is BREEDINGPOTENTIAL", Nullable: true, Generated: false, AutoIncr: false, }, Movingwater: column{ Name: "movingwater", - DBType: "fieldseeker.qamosquitoinspection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Moving Water", + Comment: "Original attribute from ArcGIS API is MOVINGWATER", Nullable: true, Generated: false, AutoIncr: false, }, Nowaterever: column{ Name: "nowaterever", - DBType: "fieldseeker.qamosquitoinspection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "No Evidence of Water Ever", + Comment: "Original attribute from ArcGIS API is NOWATEREVER", Nullable: true, Generated: false, AutoIncr: false, }, Mosquitohabitat: column{ Name: "mosquitohabitat", - DBType: "fieldseeker.qamosquitoinspection_qamosquitohabitat_enum", + DBType: "character varying", Default: "NULL", - Comment: "Mosquito Habitat Indicators", + Comment: "Original attribute from ArcGIS API is MOSQUITOHABITAT", Nullable: true, Generated: false, AutoIncr: false, @@ -271,7 +271,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "habvalue1", DBType: "smallint", Default: "NULL", - Comment: "Habitat Value", + Comment: "Original attribute from ArcGIS API is HABVALUE1", Nullable: true, Generated: false, AutoIncr: false, @@ -280,7 +280,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "habvalue1percent", DBType: "smallint", Default: "NULL", - Comment: "%", + Comment: "Original attribute from ArcGIS API is HABVALUE1PERCENT", Nullable: true, Generated: false, AutoIncr: false, @@ -289,7 +289,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "habvalue2", DBType: "smallint", Default: "NULL", - Comment: "Habitat Value", + Comment: "Original attribute from ArcGIS API is HABVALUE2", Nullable: true, Generated: false, AutoIncr: false, @@ -298,7 +298,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "habvalue2percent", DBType: "smallint", Default: "NULL", - Comment: "%", + Comment: "Original attribute from ArcGIS API is HABVALUE2PERCENT", Nullable: true, Generated: false, AutoIncr: false, @@ -307,88 +307,88 @@ var FieldseekerQamosquitoinspections = Table[ Name: "potential", DBType: "smallint", Default: "NULL", - Comment: "Potential", + Comment: "Original attribute from ArcGIS API is POTENTIAL", Nullable: true, Generated: false, AutoIncr: false, }, Larvaepresent: column{ Name: "larvaepresent", - DBType: "fieldseeker.qamosquitoinspection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Larvae Present", + Comment: "Original attribute from ArcGIS API is LARVAEPRESENT", Nullable: true, Generated: false, AutoIncr: false, }, Larvaeinsidetreatedarea: column{ Name: "larvaeinsidetreatedarea", - DBType: "fieldseeker.qamosquitoinspection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Larvae Inside Treated Area?", + Comment: "Original attribute from ArcGIS API is LARVAEINSIDETREATEDAREA", Nullable: true, Generated: false, AutoIncr: false, }, Larvaeoutsidetreatedarea: column{ Name: "larvaeoutsidetreatedarea", - DBType: "fieldseeker.qamosquitoinspection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Larvae Outside Treated Area?", + Comment: "Original attribute from ArcGIS API is LARVAEOUTSIDETREATEDAREA", Nullable: true, Generated: false, AutoIncr: false, }, Larvaereason: column{ Name: "larvaereason", - DBType: "fieldseeker.qamosquitoinspection_qalarvaereason_enum", + DBType: "character varying", Default: "NULL", - Comment: "Reason Larvae Present", + Comment: "Original attribute from ArcGIS API is LARVAEREASON", Nullable: true, Generated: false, AutoIncr: false, }, Aquaticorganisms: column{ Name: "aquaticorganisms", - DBType: "fieldseeker.qamosquitoinspection_qaaquaticorganisms_enum", + DBType: "character varying", Default: "NULL", - Comment: "Aquatic Organisms", + Comment: "Original attribute from ArcGIS API is AQUATICORGANISMS", Nullable: true, Generated: false, AutoIncr: false, }, Vegetation: column{ Name: "vegetation", - DBType: "fieldseeker.qamosquitoinspection_qavegetation_enum", + DBType: "character varying", Default: "NULL", - Comment: "Vegetation", + Comment: "Original attribute from ArcGIS API is VEGETATION", Nullable: true, Generated: false, AutoIncr: false, }, Sourcereduction: column{ Name: "sourcereduction", - DBType: "fieldseeker.qamosquitoinspection_qasourcereduction_enum", + DBType: "character varying", Default: "NULL", - Comment: "Source Reduction", + Comment: "Original attribute from ArcGIS API is SOURCEREDUCTION", Nullable: true, Generated: false, AutoIncr: false, }, Waterpresent: column{ Name: "waterpresent", - DBType: "fieldseeker.qamosquitoinspection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Water Present?", + Comment: "Original attribute from ArcGIS API is WATERPRESENT", Nullable: true, Generated: false, AutoIncr: false, }, Watermovement1: column{ Name: "watermovement1", - DBType: "fieldseeker.qamosquitoinspection_qawatermovement_enum", + DBType: "character varying", Default: "NULL", - Comment: "Water Movement", + Comment: "Original attribute from ArcGIS API is WATERMOVEMENT1", Nullable: true, Generated: false, AutoIncr: false, @@ -397,16 +397,16 @@ var FieldseekerQamosquitoinspections = Table[ Name: "watermovement1percent", DBType: "smallint", Default: "NULL", - Comment: "%", + Comment: "Original attribute from ArcGIS API is WATERMOVEMENT1PERCENT", Nullable: true, Generated: false, AutoIncr: false, }, Watermovement2: column{ Name: "watermovement2", - DBType: "fieldseeker.qamosquitoinspection_qawatermovement_enum", + DBType: "character varying", Default: "NULL", - Comment: "Water Movement", + Comment: "Original attribute from ArcGIS API is WATERMOVEMENT2", Nullable: true, Generated: false, AutoIncr: false, @@ -415,52 +415,52 @@ var FieldseekerQamosquitoinspections = Table[ Name: "watermovement2percent", DBType: "smallint", Default: "NULL", - Comment: "%", + Comment: "Original attribute from ArcGIS API is WATERMOVEMENT2PERCENT", Nullable: true, Generated: false, AutoIncr: false, }, Soilconditions: column{ Name: "soilconditions", - DBType: "fieldseeker.qamosquitoinspection_qasoilcondition_enum", + DBType: "character varying", Default: "NULL", - Comment: "Soil Conditions", + Comment: "Original attribute from ArcGIS API is SOILCONDITIONS", Nullable: true, Generated: false, AutoIncr: false, }, Waterduration: column{ Name: "waterduration", - DBType: "fieldseeker.qamosquitoinspection_qawaterduration_enum", + DBType: "character varying", Default: "NULL", - Comment: "How Long Water Present?", + Comment: "Original attribute from ArcGIS API is WATERDURATION", Nullable: true, Generated: false, AutoIncr: false, }, Watersource: column{ Name: "watersource", - DBType: "fieldseeker.qamosquitoinspection_qawatersource_enum", + DBType: "character varying", Default: "NULL", - Comment: "Water Source", + Comment: "Original attribute from ArcGIS API is WATERSOURCE", Nullable: true, Generated: false, AutoIncr: false, }, Waterconditions: column{ Name: "waterconditions", - DBType: "fieldseeker.qamosquitoinspection_qawaterconditions_enum", + DBType: "character varying", Default: "NULL", - Comment: "Water Conditions", + Comment: "Original attribute from ArcGIS API is WATERCONDITIONS", Nullable: true, Generated: false, AutoIncr: false, }, Adultactivity: column{ Name: "adultactivity", - DBType: "fieldseeker.qamosquitoinspection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Adult Activity", + Comment: "Original attribute from ArcGIS API is ADULTACTIVITY", Nullable: true, Generated: false, AutoIncr: false, @@ -469,7 +469,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "linelocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LINELOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -478,7 +478,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "pointlocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is POINTLOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -487,7 +487,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "polygonlocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is POLYGONLOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -496,7 +496,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -505,7 +505,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -514,7 +514,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -523,7 +523,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -532,7 +532,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "fieldtech", DBType: "character varying", Default: "NULL", - Comment: "Field Tech", + Comment: "Original attribute from ArcGIS API is FIELDTECH", Nullable: true, Generated: false, AutoIncr: false, @@ -541,7 +541,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -550,7 +550,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -559,7 +559,7 @@ var FieldseekerQamosquitoinspections = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -568,6 +568,24 @@ var FieldseekerQamosquitoinspections = Table[ Name: "editor", DBType: "character varying", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Editor", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -577,7 +595,16 @@ var FieldseekerQamosquitoinspections = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -612,6 +639,17 @@ var FieldseekerQamosquitoinspections = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerQamosquitoinspectionForeignKeys{ + FieldseekerQamosquitoinspectionQamosquitoinspectionOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.qamosquitoinspection.qamosquitoinspection_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -679,12 +717,15 @@ type fieldseekerQamosquitoinspectionColumns struct { Creator column Editdate column Editor column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerQamosquitoinspectionColumns) AsSlice() []column { return []column{ - c.Objectid, c.Posdips, c.Actiontaken, c.Comments, c.Avetemp, c.Windspeed, c.Raingauge, c.Globalid, c.Startdatetime, c.Enddatetime, c.Winddir, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Locationname, c.Zone, c.Recordstatus, c.Zone2, c.LR, c.Negdips, c.Totalacres, c.Acresbreeding, c.Fish, c.Sitetype, c.Breedingpotential, c.Movingwater, c.Nowaterever, c.Mosquitohabitat, c.Habvalue1, c.Habvalue1percent, c.Habvalue2, c.Habvalue2percent, c.Potential, c.Larvaepresent, c.Larvaeinsidetreatedarea, c.Larvaeoutsidetreatedarea, c.Larvaereason, c.Aquaticorganisms, c.Vegetation, c.Sourcereduction, c.Waterpresent, c.Watermovement1, c.Watermovement1percent, c.Watermovement2, c.Watermovement2percent, c.Soilconditions, c.Waterduration, c.Watersource, c.Waterconditions, c.Adultactivity, c.Linelocid, c.Pointlocid, c.Polygonlocid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Fieldtech, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Version, + c.Objectid, c.Posdips, c.Actiontaken, c.Comments, c.Avetemp, c.Windspeed, c.Raingauge, c.Globalid, c.Startdatetime, c.Enddatetime, c.Winddir, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Locationname, c.Zone, c.Recordstatus, c.Zone2, c.LR, c.Negdips, c.Totalacres, c.Acresbreeding, c.Fish, c.Sitetype, c.Breedingpotential, c.Movingwater, c.Nowaterever, c.Mosquitohabitat, c.Habvalue1, c.Habvalue1percent, c.Habvalue2, c.Habvalue2percent, c.Potential, c.Larvaepresent, c.Larvaeinsidetreatedarea, c.Larvaeoutsidetreatedarea, c.Larvaereason, c.Aquaticorganisms, c.Vegetation, c.Sourcereduction, c.Waterpresent, c.Watermovement1, c.Watermovement1percent, c.Watermovement2, c.Watermovement2percent, c.Soilconditions, c.Waterduration, c.Watersource, c.Waterconditions, c.Adultactivity, c.Linelocid, c.Pointlocid, c.Polygonlocid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Fieldtech, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -698,10 +739,14 @@ func (i fieldseekerQamosquitoinspectionIndexes) AsSlice() []index { } } -type fieldseekerQamosquitoinspectionForeignKeys struct{} +type fieldseekerQamosquitoinspectionForeignKeys struct { + FieldseekerQamosquitoinspectionQamosquitoinspectionOrganizationIDFkey foreignKey +} func (f fieldseekerQamosquitoinspectionForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerQamosquitoinspectionQamosquitoinspectionOrganizationIDFkey, + } } type fieldseekerQamosquitoinspectionUniques struct{} diff --git a/db/dbinfo/fieldseeker.rodentlocation.bob.go b/db/dbinfo/fieldseeker.rodentlocation.bob.go index 196997c1..932afed3 100644 --- a/db/dbinfo/fieldseeker.rodentlocation.bob.go +++ b/db/dbinfo/fieldseeker.rodentlocation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerRodentlocations = Table[ Name: "locationname", DBType: "character varying", Default: "NULL", - Comment: "Location Name", + Comment: "Original attribute from ArcGIS API is LOCATIONNAME", Nullable: true, Generated: false, AutoIncr: false, @@ -37,7 +37,7 @@ var FieldseekerRodentlocations = Table[ Name: "zone", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is ZONE", Nullable: true, Generated: false, AutoIncr: false, @@ -46,43 +46,43 @@ var FieldseekerRodentlocations = Table[ Name: "zone2", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is ZONE2", Nullable: true, Generated: false, AutoIncr: false, }, Habitat: column{ Name: "habitat", - DBType: "fieldseeker.rodentlocation_rodentlocationhabitat_enum", + DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is HABITAT", Nullable: true, Generated: false, AutoIncr: false, }, Priority: column{ Name: "priority", - DBType: "fieldseeker.rodentlocation_locationpriority_1_enum", + DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is PRIORITY", Nullable: true, Generated: false, AutoIncr: false, }, Usetype: column{ Name: "usetype", - DBType: "fieldseeker.rodentlocation_locationusetype_1_enum", + DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is USETYPE", Nullable: true, Generated: false, AutoIncr: false, }, Active: column{ Name: "active", - DBType: "fieldseeker.rodentlocation_notinuit_f_1_enum", + DBType: "smallint", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is ACTIVE", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerRodentlocations = Table[ Name: "description", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is DESCRIPTION", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerRodentlocations = Table[ Name: "accessdesc", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is ACCESSDESC", Nullable: true, Generated: false, AutoIncr: false, @@ -109,16 +109,16 @@ var FieldseekerRodentlocations = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, }, Symbology: column{ Name: "symbology", - DBType: "fieldseeker.rodentlocation_rodentlocation_symbology_enum", + DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is SYMBOLOGY", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerRodentlocations = Table[ Name: "externalid", DBType: "character varying", Default: "NULL", - Comment: "External ID", + Comment: "Original attribute from ArcGIS API is EXTERNALID", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerRodentlocations = Table[ Name: "nextactiondatescheduled", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is NEXTACTIONDATESCHEDULED", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerRodentlocations = Table[ Name: "locationnumber", DBType: "integer", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LOCATIONNUMBER", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerRodentlocations = Table[ Name: "lastinspectdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Last Inspection Date", + Comment: "Original attribute from ArcGIS API is LASTINSPECTDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerRodentlocations = Table[ Name: "lastinspectspecies", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Species", + Comment: "Original attribute from ArcGIS API is LASTINSPECTSPECIES", Nullable: true, Generated: false, AutoIncr: false, @@ -172,7 +172,7 @@ var FieldseekerRodentlocations = Table[ Name: "lastinspectaction", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Action", + Comment: "Original attribute from ArcGIS API is LASTINSPECTACTION", Nullable: true, Generated: false, AutoIncr: false, @@ -181,7 +181,7 @@ var FieldseekerRodentlocations = Table[ Name: "lastinspectconditions", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Conditions", + Comment: "Original attribute from ArcGIS API is LASTINSPECTCONDITIONS", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +190,7 @@ var FieldseekerRodentlocations = Table[ Name: "lastinspectrodentevidence", DBType: "character varying", Default: "NULL", - Comment: "Last Inspection Rodent Evidence", + Comment: "Original attribute from ArcGIS API is LASTINSPECTRODENTEVIDENCE", Nullable: true, Generated: false, AutoIncr: false, @@ -199,7 +199,7 @@ var FieldseekerRodentlocations = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -208,7 +208,7 @@ var FieldseekerRodentlocations = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -217,7 +217,7 @@ var FieldseekerRodentlocations = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -226,7 +226,7 @@ var FieldseekerRodentlocations = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -235,7 +235,7 @@ var FieldseekerRodentlocations = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -244,7 +244,7 @@ var FieldseekerRodentlocations = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -253,7 +253,7 @@ var FieldseekerRodentlocations = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -262,7 +262,7 @@ var FieldseekerRodentlocations = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -271,7 +271,7 @@ var FieldseekerRodentlocations = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, @@ -280,7 +280,25 @@ var FieldseekerRodentlocations = Table[ Name: "jurisdiction", DBType: "character varying", Default: "NULL", - Comment: "Jurisdiction", + Comment: "Original attribute from ArcGIS API is JURISDICTION", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", + Comment: "", Nullable: true, Generated: false, AutoIncr: false, @@ -289,7 +307,16 @@ var FieldseekerRodentlocations = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -324,6 +351,17 @@ var FieldseekerRodentlocations = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerRodentlocationForeignKeys{ + FieldseekerRodentlocationRodentlocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.rodentlocation.rodentlocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -359,12 +397,15 @@ type fieldseekerRodentlocationColumns struct { Editdate column Editor column Jurisdiction column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerRodentlocationColumns) AsSlice() []column { return []column{ - c.Objectid, c.Locationname, c.Zone, c.Zone2, c.Habitat, c.Priority, c.Usetype, c.Active, c.Description, c.Accessdesc, c.Comments, c.Symbology, c.Externalid, c.Nextactiondatescheduled, c.Locationnumber, c.Lastinspectdate, c.Lastinspectspecies, c.Lastinspectaction, c.Lastinspectconditions, c.Lastinspectrodentevidence, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Jurisdiction, c.Version, + c.Objectid, c.Locationname, c.Zone, c.Zone2, c.Habitat, c.Priority, c.Usetype, c.Active, c.Description, c.Accessdesc, c.Comments, c.Symbology, c.Externalid, c.Nextactiondatescheduled, c.Locationnumber, c.Lastinspectdate, c.Lastinspectspecies, c.Lastinspectaction, c.Lastinspectconditions, c.Lastinspectrodentevidence, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Jurisdiction, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -378,10 +419,14 @@ func (i fieldseekerRodentlocationIndexes) AsSlice() []index { } } -type fieldseekerRodentlocationForeignKeys struct{} +type fieldseekerRodentlocationForeignKeys struct { + FieldseekerRodentlocationRodentlocationOrganizationIDFkey foreignKey +} func (f fieldseekerRodentlocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerRodentlocationRodentlocationOrganizationIDFkey, + } } type fieldseekerRodentlocationUniques struct{} diff --git a/db/dbinfo/fieldseeker.samplecollection.bob.go b/db/dbinfo/fieldseeker.samplecollection.bob.go index 89955c26..d42e328f 100644 --- a/db/dbinfo/fieldseeker.samplecollection.bob.go +++ b/db/dbinfo/fieldseeker.samplecollection.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerSamplecollections = Table[ Name: "loc_id", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LOC_ID", Nullable: true, Generated: false, AutoIncr: false, @@ -37,7 +37,7 @@ var FieldseekerSamplecollections = Table[ Name: "startdatetime", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Start", + Comment: "Original attribute from ArcGIS API is STARTDATETIME", Nullable: true, Generated: false, AutoIncr: false, @@ -46,16 +46,16 @@ var FieldseekerSamplecollections = Table[ Name: "enddatetime", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Finish", + Comment: "Original attribute from ArcGIS API is ENDDATETIME", Nullable: true, Generated: false, AutoIncr: false, }, Sitecond: column{ Name: "sitecond", - DBType: "fieldseeker.samplecollection_mosquitositecondition_enum", + DBType: "character varying", Default: "NULL", - Comment: "Conditions", + Comment: "Original attribute from ArcGIS API is SITECOND", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerSamplecollections = Table[ Name: "sampleid", DBType: "character varying", Default: "NULL", - Comment: "Sample ID", + Comment: "Original attribute from ArcGIS API is SAMPLEID", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerSamplecollections = Table[ Name: "survtech", DBType: "character varying", Default: "NULL", - Comment: "Surveillance Technician", + Comment: "Original attribute from ArcGIS API is SURVTECH", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerSamplecollections = Table[ Name: "datesent", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Sent", + Comment: "Original attribute from ArcGIS API is DATESENT", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerSamplecollections = Table[ Name: "datetested", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Tested", + Comment: "Original attribute from ArcGIS API is DATETESTED", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerSamplecollections = Table[ Name: "testtech", DBType: "character varying", Default: "NULL", - Comment: "Test Technician", + Comment: "Original attribute from ArcGIS API is TESTTECH", Nullable: true, Generated: false, AutoIncr: false, @@ -109,52 +109,52 @@ var FieldseekerSamplecollections = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "Comments", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, }, Processed: column{ Name: "processed", - DBType: "fieldseeker.samplecollection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Processed", + Comment: "Original attribute from ArcGIS API is PROCESSED", Nullable: true, Generated: false, AutoIncr: false, }, Sampletype: column{ Name: "sampletype", - DBType: "fieldseeker.samplecollection_mosquitosampletype_enum", + DBType: "character varying", Default: "NULL", - Comment: "Sample Type", + Comment: "Original attribute from ArcGIS API is SAMPLETYPE", Nullable: true, Generated: false, AutoIncr: false, }, Samplecond: column{ Name: "samplecond", - DBType: "fieldseeker.samplecollection_mosquitosamplecondition_enum", + DBType: "character varying", Default: "NULL", - Comment: "Sample Condition", + Comment: "Original attribute from ArcGIS API is SAMPLECOND", Nullable: true, Generated: false, AutoIncr: false, }, Species: column{ Name: "species", - DBType: "fieldseeker.samplecollection_mosquitosamplespecies_enum", + DBType: "character varying", Default: "NULL", - Comment: "Species", + Comment: "Original attribute from ArcGIS API is SPECIES", Nullable: true, Generated: false, AutoIncr: false, }, Sex: column{ Name: "sex", - DBType: "fieldseeker.samplecollection_notinuisex_enum", + DBType: "character varying", Default: "NULL", - Comment: "Sex", + Comment: "Original attribute from ArcGIS API is SEX", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerSamplecollections = Table[ Name: "avetemp", DBType: "double precision", Default: "NULL", - Comment: "Average Temperature", + Comment: "Original attribute from ArcGIS API is AVETEMP", Nullable: true, Generated: false, AutoIncr: false, @@ -172,16 +172,16 @@ var FieldseekerSamplecollections = Table[ Name: "windspeed", DBType: "double precision", Default: "NULL", - Comment: "Wind Speed", + Comment: "Original attribute from ArcGIS API is WINDSPEED", Nullable: true, Generated: false, AutoIncr: false, }, Winddir: column{ Name: "winddir", - DBType: "fieldseeker.samplecollection_notinuiwinddirection_enum", + DBType: "character varying", Default: "NULL", - Comment: "Wind Direction", + Comment: "Original attribute from ArcGIS API is WINDDIR", Nullable: true, Generated: false, AutoIncr: false, @@ -190,52 +190,52 @@ var FieldseekerSamplecollections = Table[ Name: "raingauge", DBType: "double precision", Default: "NULL", - Comment: "Rain Gauge", + Comment: "Original attribute from ArcGIS API is RAINGAUGE", Nullable: true, Generated: false, AutoIncr: false, }, Activity: column{ Name: "activity", - DBType: "fieldseeker.samplecollection_mosquitoactivity_enum", + DBType: "character varying", Default: "NULL", - Comment: "Activity", + Comment: "Original attribute from ArcGIS API is ACTIVITY", Nullable: true, Generated: false, AutoIncr: false, }, Testmethod: column{ Name: "testmethod", - DBType: "fieldseeker.samplecollection_mosquitotestmethod_enum", + DBType: "character varying", Default: "NULL", - Comment: "Test Method", + Comment: "Original attribute from ArcGIS API is TESTMETHOD", Nullable: true, Generated: false, AutoIncr: false, }, Diseasetested: column{ Name: "diseasetested", - DBType: "fieldseeker.samplecollection_mosquitodisease_enum", + DBType: "character varying", Default: "NULL", - Comment: "Disease Tested", + Comment: "Original attribute from ArcGIS API is DISEASETESTED", Nullable: true, Generated: false, AutoIncr: false, }, Diseasepos: column{ Name: "diseasepos", - DBType: "fieldseeker.samplecollection_mosquitodisease_enum", + DBType: "character varying", Default: "NULL", - Comment: "Disease Positive", + Comment: "Original attribute from ArcGIS API is DISEASEPOS", Nullable: true, Generated: false, AutoIncr: false, }, Reviewed: column{ Name: "reviewed", - DBType: "fieldseeker.samplecollection_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Reviewed", + Comment: "Original attribute from ArcGIS API is REVIEWED", Nullable: true, Generated: false, AutoIncr: false, @@ -244,7 +244,7 @@ var FieldseekerSamplecollections = Table[ Name: "reviewedby", DBType: "character varying", Default: "NULL", - Comment: "Reviewed By", + Comment: "Original attribute from ArcGIS API is REVIEWEDBY", Nullable: true, Generated: false, AutoIncr: false, @@ -253,7 +253,7 @@ var FieldseekerSamplecollections = Table[ Name: "revieweddate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Reviewed Date", + Comment: "Original attribute from ArcGIS API is REVIEWEDDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -262,7 +262,7 @@ var FieldseekerSamplecollections = Table[ Name: "locationname", DBType: "character varying", Default: "NULL", - Comment: "Location Name", + Comment: "Original attribute from ArcGIS API is LOCATIONNAME", Nullable: true, Generated: false, AutoIncr: false, @@ -271,7 +271,7 @@ var FieldseekerSamplecollections = Table[ Name: "zone", DBType: "character varying", Default: "NULL", - Comment: "Zone", + Comment: "Original attribute from ArcGIS API is ZONE", Nullable: true, Generated: false, AutoIncr: false, @@ -280,7 +280,7 @@ var FieldseekerSamplecollections = Table[ Name: "recordstatus", DBType: "smallint", Default: "NULL", - Comment: "RecordStatus", + Comment: "Original attribute from ArcGIS API is RECORDSTATUS", Nullable: true, Generated: false, AutoIncr: false, @@ -289,7 +289,7 @@ var FieldseekerSamplecollections = Table[ Name: "zone2", DBType: "character varying", Default: "NULL", - Comment: "Zone2", + Comment: "Original attribute from ArcGIS API is ZONE2", Nullable: true, Generated: false, AutoIncr: false, @@ -298,7 +298,7 @@ var FieldseekerSamplecollections = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -307,7 +307,7 @@ var FieldseekerSamplecollections = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -316,7 +316,7 @@ var FieldseekerSamplecollections = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -325,7 +325,7 @@ var FieldseekerSamplecollections = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -334,16 +334,16 @@ var FieldseekerSamplecollections = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, }, Lab: column{ Name: "lab", - DBType: "fieldseeker.samplecollection_mosquitolabname_enum", + DBType: "character varying", Default: "NULL", - Comment: "Lab", + Comment: "Original attribute from ArcGIS API is LAB", Nullable: true, Generated: false, AutoIncr: false, @@ -352,7 +352,7 @@ var FieldseekerSamplecollections = Table[ Name: "fieldtech", DBType: "character varying", Default: "NULL", - Comment: "Field Tech", + Comment: "Original attribute from ArcGIS API is FIELDTECH", Nullable: true, Generated: false, AutoIncr: false, @@ -361,7 +361,7 @@ var FieldseekerSamplecollections = Table[ Name: "flockid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is FLOCKID", Nullable: true, Generated: false, AutoIncr: false, @@ -370,7 +370,7 @@ var FieldseekerSamplecollections = Table[ Name: "samplecount", DBType: "smallint", Default: "NULL", - Comment: "Sample Count", + Comment: "Original attribute from ArcGIS API is SAMPLECOUNT", Nullable: true, Generated: false, AutoIncr: false, @@ -379,7 +379,7 @@ var FieldseekerSamplecollections = Table[ Name: "chickenid", DBType: "uuid", Default: "NULL", - Comment: "ChickenID", + Comment: "Original attribute from ArcGIS API is CHICKENID", Nullable: true, Generated: false, AutoIncr: false, @@ -388,7 +388,7 @@ var FieldseekerSamplecollections = Table[ Name: "gatewaysync", DBType: "smallint", Default: "NULL", - Comment: "Gateway Sync", + Comment: "Original attribute from ArcGIS API is GATEWAYSYNC", Nullable: true, Generated: false, AutoIncr: false, @@ -397,7 +397,7 @@ var FieldseekerSamplecollections = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -406,7 +406,7 @@ var FieldseekerSamplecollections = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -415,7 +415,7 @@ var FieldseekerSamplecollections = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -424,6 +424,24 @@ var FieldseekerSamplecollections = Table[ Name: "editor", DBType: "character varying", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Editor", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -433,7 +451,16 @@ var FieldseekerSamplecollections = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -468,6 +495,17 @@ var FieldseekerSamplecollections = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerSamplecollectionForeignKeys{ + FieldseekerSamplecollectionSamplecollectionOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.samplecollection.samplecollection_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -519,12 +557,15 @@ type fieldseekerSamplecollectionColumns struct { Creator column Editdate column Editor column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerSamplecollectionColumns) AsSlice() []column { return []column{ - c.Objectid, c.LocID, c.Startdatetime, c.Enddatetime, c.Sitecond, c.Sampleid, c.Survtech, c.Datesent, c.Datetested, c.Testtech, c.Comments, c.Processed, c.Sampletype, c.Samplecond, c.Species, c.Sex, c.Avetemp, c.Windspeed, c.Winddir, c.Raingauge, c.Activity, c.Testmethod, c.Diseasetested, c.Diseasepos, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Locationname, c.Zone, c.Recordstatus, c.Zone2, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Lab, c.Fieldtech, c.Flockid, c.Samplecount, c.Chickenid, c.Gatewaysync, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Version, + c.Objectid, c.LocID, c.Startdatetime, c.Enddatetime, c.Sitecond, c.Sampleid, c.Survtech, c.Datesent, c.Datetested, c.Testtech, c.Comments, c.Processed, c.Sampletype, c.Samplecond, c.Species, c.Sex, c.Avetemp, c.Windspeed, c.Winddir, c.Raingauge, c.Activity, c.Testmethod, c.Diseasetested, c.Diseasepos, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Locationname, c.Zone, c.Recordstatus, c.Zone2, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Lab, c.Fieldtech, c.Flockid, c.Samplecount, c.Chickenid, c.Gatewaysync, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -538,10 +579,14 @@ func (i fieldseekerSamplecollectionIndexes) AsSlice() []index { } } -type fieldseekerSamplecollectionForeignKeys struct{} +type fieldseekerSamplecollectionForeignKeys struct { + FieldseekerSamplecollectionSamplecollectionOrganizationIDFkey foreignKey +} func (f fieldseekerSamplecollectionForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerSamplecollectionSamplecollectionOrganizationIDFkey, + } } type fieldseekerSamplecollectionUniques struct{} diff --git a/db/dbinfo/fieldseeker.samplelocation.bob.go b/db/dbinfo/fieldseeker.samplelocation.bob.go index c1a66e37..2c909d45 100644 --- a/db/dbinfo/fieldseeker.samplelocation.bob.go +++ b/db/dbinfo/fieldseeker.samplelocation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerSamplelocations = Table[ Name: "name", DBType: "character varying", Default: "NULL", - Comment: "Name", + Comment: "Original attribute from ArcGIS API is NAME", Nullable: true, Generated: false, AutoIncr: false, @@ -37,43 +37,43 @@ var FieldseekerSamplelocations = Table[ Name: "zone", DBType: "character varying", Default: "NULL", - Comment: "Zone", + Comment: "Original attribute from ArcGIS API is ZONE", Nullable: true, Generated: false, AutoIncr: false, }, Habitat: column{ Name: "habitat", - DBType: "fieldseeker.samplelocation_locationhabitattype_enum", + DBType: "character varying", Default: "NULL", - Comment: "Habitat", + Comment: "Original attribute from ArcGIS API is HABITAT", Nullable: true, Generated: false, AutoIncr: false, }, Priority: column{ Name: "priority", - DBType: "fieldseeker.samplelocation_locationpriority_enum", + DBType: "character varying", Default: "NULL", - Comment: "Priority", + Comment: "Original attribute from ArcGIS API is PRIORITY", Nullable: true, Generated: false, AutoIncr: false, }, Usetype: column{ Name: "usetype", - DBType: "fieldseeker.samplelocation_samplelocationusetype_enum", + DBType: "character varying", Default: "NULL", - Comment: "Use Type", + Comment: "Original attribute from ArcGIS API is USETYPE", Nullable: true, Generated: false, AutoIncr: false, }, Active: column{ Name: "active", - DBType: "fieldseeker.samplelocation_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Active", + Comment: "Original attribute from ArcGIS API is ACTIVE", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerSamplelocations = Table[ Name: "description", DBType: "character varying", Default: "NULL", - Comment: "Description", + Comment: "Original attribute from ArcGIS API is DESCRIPTION", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerSamplelocations = Table[ Name: "accessdesc", DBType: "character varying", Default: "NULL", - Comment: "Access Description", + Comment: "Original attribute from ArcGIS API is ACCESSDESC", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerSamplelocations = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "Comments", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerSamplelocations = Table[ Name: "externalid", DBType: "character varying", Default: "NULL", - Comment: "External ID", + Comment: "Original attribute from ArcGIS API is EXTERNALID", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerSamplelocations = Table[ Name: "nextactiondatescheduled", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Next Scheduled Action", + Comment: "Original attribute from ArcGIS API is NEXTACTIONDATESCHEDULED", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerSamplelocations = Table[ Name: "zone2", DBType: "character varying", Default: "NULL", - Comment: "Zone2", + Comment: "Original attribute from ArcGIS API is ZONE2", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerSamplelocations = Table[ Name: "locationnumber", DBType: "integer", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LOCATIONNUMBER", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerSamplelocations = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerSamplelocations = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerSamplelocations = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -172,7 +172,7 @@ var FieldseekerSamplelocations = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -181,7 +181,7 @@ var FieldseekerSamplelocations = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +190,7 @@ var FieldseekerSamplelocations = Table[ Name: "gatewaysync", DBType: "smallint", Default: "NULL", - Comment: "Gateway Sync", + Comment: "Original attribute from ArcGIS API is GATEWAYSYNC", Nullable: true, Generated: false, AutoIncr: false, @@ -199,7 +199,7 @@ var FieldseekerSamplelocations = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -208,7 +208,7 @@ var FieldseekerSamplelocations = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -217,7 +217,7 @@ var FieldseekerSamplelocations = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -226,6 +226,24 @@ var FieldseekerSamplelocations = Table[ Name: "editor", DBType: "character varying", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Editor", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -235,7 +253,16 @@ var FieldseekerSamplelocations = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -270,6 +297,17 @@ var FieldseekerSamplelocations = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerSamplelocationForeignKeys{ + FieldseekerSamplelocationSamplelocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.samplelocation.samplelocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -299,12 +337,15 @@ type fieldseekerSamplelocationColumns struct { Creator column Editdate column Editor column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerSamplelocationColumns) AsSlice() []column { return []column{ - c.Objectid, c.Name, c.Zone, c.Habitat, c.Priority, c.Usetype, c.Active, c.Description, c.Accessdesc, c.Comments, c.Externalid, c.Nextactiondatescheduled, c.Zone2, c.Locationnumber, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Gatewaysync, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Version, + c.Objectid, c.Name, c.Zone, c.Habitat, c.Priority, c.Usetype, c.Active, c.Description, c.Accessdesc, c.Comments, c.Externalid, c.Nextactiondatescheduled, c.Zone2, c.Locationnumber, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Gatewaysync, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -318,10 +359,14 @@ func (i fieldseekerSamplelocationIndexes) AsSlice() []index { } } -type fieldseekerSamplelocationForeignKeys struct{} +type fieldseekerSamplelocationForeignKeys struct { + FieldseekerSamplelocationSamplelocationOrganizationIDFkey foreignKey +} func (f fieldseekerSamplelocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerSamplelocationSamplelocationOrganizationIDFkey, + } } type fieldseekerSamplelocationUniques struct{} diff --git a/db/dbinfo/fieldseeker.servicerequest.bob.go b/db/dbinfo/fieldseeker.servicerequest.bob.go index c9d3db31..8d305150 100644 --- a/db/dbinfo/fieldseeker.servicerequest.bob.go +++ b/db/dbinfo/fieldseeker.servicerequest.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,16 +28,16 @@ var FieldseekerServicerequests = Table[ Name: "recdatetime", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Received", + Comment: "Original attribute from ArcGIS API is RECDATETIME", Nullable: true, Generated: false, AutoIncr: false, }, Source: column{ Name: "source", - DBType: "fieldseeker.servicerequest_servicerequestsource_enum", + DBType: "character varying", Default: "NULL", - Comment: "Source", + Comment: "Original attribute from ArcGIS API is SOURCE", Nullable: true, Generated: false, AutoIncr: false, @@ -46,52 +46,52 @@ var FieldseekerServicerequests = Table[ Name: "entrytech", DBType: "character varying", Default: "NULL", - Comment: "Entered By", + Comment: "Original attribute from ArcGIS API is ENTRYTECH", Nullable: true, Generated: false, AutoIncr: false, }, Priority: column{ Name: "priority", - DBType: "fieldseeker.servicerequest_servicerequestpriority_enum", + DBType: "character varying", Default: "NULL", - Comment: "Priority", + Comment: "Original attribute from ArcGIS API is PRIORITY", Nullable: true, Generated: false, AutoIncr: false, }, Supervisor: column{ Name: "supervisor", - DBType: "fieldseeker.servicerequest_servicerequest_supervisor_eba07b90_c885_4fe6_808", + DBType: "character varying", Default: "NULL", - Comment: "Supervisor", + Comment: "Original attribute from ArcGIS API is SUPERVISOR", Nullable: true, Generated: false, AutoIncr: false, }, Assignedtech: column{ Name: "assignedtech", - DBType: "fieldseeker.servicerequest_servicerequest_assignedtech_71d0d685_868f_4b7a_8", + DBType: "character varying", Default: "NULL", - Comment: "Assigned To", + Comment: "Original attribute from ArcGIS API is ASSIGNEDTECH", Nullable: true, Generated: false, AutoIncr: false, }, Status: column{ Name: "status", - DBType: "fieldseeker.servicerequest_servicerequeststatus_enum", + DBType: "character varying", Default: "NULL", - Comment: "Status", + Comment: "Original attribute from ArcGIS API is STATUS", Nullable: true, Generated: false, AutoIncr: false, }, Clranon: column{ Name: "clranon", - DBType: "fieldseeker.servicerequest_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Anonymous Caller", + Comment: "Original attribute from ArcGIS API is CLRANON", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerServicerequests = Table[ Name: "clrfname", DBType: "character varying", Default: "NULL", - Comment: "Caller Name", + Comment: "Original attribute from ArcGIS API is CLRFNAME", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerServicerequests = Table[ Name: "clrphone1", DBType: "character varying", Default: "NULL", - Comment: "Caller Phone", + Comment: "Original attribute from ArcGIS API is CLRPHONE1", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerServicerequests = Table[ Name: "clrphone2", DBType: "character varying", Default: "NULL", - Comment: "Caller Alternate Phone", + Comment: "Original attribute from ArcGIS API is CLRPHONE2", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerServicerequests = Table[ Name: "clremail", DBType: "character varying", Default: "NULL", - Comment: "Caller Email", + Comment: "Original attribute from ArcGIS API is CLREMAIL", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerServicerequests = Table[ Name: "clrcompany", DBType: "character varying", Default: "NULL", - Comment: "Caller Company", + Comment: "Original attribute from ArcGIS API is CLRCOMPANY", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerServicerequests = Table[ Name: "clraddr1", DBType: "character varying", Default: "NULL", - Comment: "Caller Address", + Comment: "Original attribute from ArcGIS API is CLRADDR1", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerServicerequests = Table[ Name: "clraddr2", DBType: "character varying", Default: "NULL", - Comment: "Caller Address 2", + Comment: "Original attribute from ArcGIS API is CLRADDR2", Nullable: true, Generated: false, AutoIncr: false, @@ -163,16 +163,16 @@ var FieldseekerServicerequests = Table[ Name: "clrcity", DBType: "character varying", Default: "NULL", - Comment: "Caller City", + Comment: "Original attribute from ArcGIS API is CLRCITY", Nullable: true, Generated: false, AutoIncr: false, }, Clrstate: column{ Name: "clrstate", - DBType: "fieldseeker.servicerequest_servicerequestregion_enum", + DBType: "character varying", Default: "NULL", - Comment: "Caller State", + Comment: "Original attribute from ArcGIS API is CLRSTATE", Nullable: true, Generated: false, AutoIncr: false, @@ -181,7 +181,7 @@ var FieldseekerServicerequests = Table[ Name: "clrzip", DBType: "character varying", Default: "NULL", - Comment: "Caller ZIP", + Comment: "Original attribute from ArcGIS API is CLRZIP", Nullable: true, Generated: false, AutoIncr: false, @@ -190,16 +190,16 @@ var FieldseekerServicerequests = Table[ Name: "clrother", DBType: "character varying", Default: "NULL", - Comment: "Caller Other", + Comment: "Original attribute from ArcGIS API is CLROTHER", Nullable: true, Generated: false, AutoIncr: false, }, Clrcontpref: column{ Name: "clrcontpref", - DBType: "fieldseeker.servicerequest_servicerequestcontactpreferences_enum", + DBType: "character varying", Default: "NULL", - Comment: "Caller Contact Preference", + Comment: "Original attribute from ArcGIS API is CLRCONTPREF", Nullable: true, Generated: false, AutoIncr: false, @@ -208,7 +208,7 @@ var FieldseekerServicerequests = Table[ Name: "reqcompany", DBType: "character varying", Default: "NULL", - Comment: "Request Company", + Comment: "Original attribute from ArcGIS API is REQCOMPANY", Nullable: true, Generated: false, AutoIncr: false, @@ -217,7 +217,7 @@ var FieldseekerServicerequests = Table[ Name: "reqaddr1", DBType: "character varying", Default: "NULL", - Comment: "Request Address", + Comment: "Original attribute from ArcGIS API is REQADDR1", Nullable: true, Generated: false, AutoIncr: false, @@ -226,7 +226,7 @@ var FieldseekerServicerequests = Table[ Name: "reqaddr2", DBType: "character varying", Default: "NULL", - Comment: "Request Address 2", + Comment: "Original attribute from ArcGIS API is REQADDR2", Nullable: true, Generated: false, AutoIncr: false, @@ -235,16 +235,16 @@ var FieldseekerServicerequests = Table[ Name: "reqcity", DBType: "character varying", Default: "NULL", - Comment: "Request City", + Comment: "Original attribute from ArcGIS API is REQCITY", Nullable: true, Generated: false, AutoIncr: false, }, Reqstate: column{ Name: "reqstate", - DBType: "fieldseeker.servicerequest_servicerequestregion_enum", + DBType: "character varying", Default: "NULL", - Comment: "Request State", + Comment: "Original attribute from ArcGIS API is REQSTATE", Nullable: true, Generated: false, AutoIncr: false, @@ -253,7 +253,7 @@ var FieldseekerServicerequests = Table[ Name: "reqzip", DBType: "character varying", Default: "NULL", - Comment: "Request ZIP", + Comment: "Original attribute from ArcGIS API is REQZIP", Nullable: true, Generated: false, AutoIncr: false, @@ -262,7 +262,7 @@ var FieldseekerServicerequests = Table[ Name: "reqcrossst", DBType: "character varying", Default: "NULL", - Comment: "Request Cross Street", + Comment: "Original attribute from ArcGIS API is REQCROSSST", Nullable: true, Generated: false, AutoIncr: false, @@ -271,7 +271,7 @@ var FieldseekerServicerequests = Table[ Name: "reqsubdiv", DBType: "character varying", Default: "NULL", - Comment: "Request Subdivision", + Comment: "Original attribute from ArcGIS API is REQSUBDIV", Nullable: true, Generated: false, AutoIncr: false, @@ -280,25 +280,25 @@ var FieldseekerServicerequests = Table[ Name: "reqmapgrid", DBType: "character varying", Default: "NULL", - Comment: "Request Map Grid", + Comment: "Original attribute from ArcGIS API is REQMAPGRID", Nullable: true, Generated: false, AutoIncr: false, }, Reqpermission: column{ Name: "reqpermission", - DBType: "fieldseeker.servicerequest_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Permission to Enter", + Comment: "Original attribute from ArcGIS API is REQPERMISSION", Nullable: true, Generated: false, AutoIncr: false, }, Reqtarget: column{ Name: "reqtarget", - DBType: "fieldseeker.servicerequest_servicerequesttarget_enum", + DBType: "character varying", Default: "NULL", - Comment: "Request Target", + Comment: "Original attribute from ArcGIS API is REQTARGET", Nullable: true, Generated: false, AutoIncr: false, @@ -307,7 +307,7 @@ var FieldseekerServicerequests = Table[ Name: "reqdescr", DBType: "character varying", Default: "NULL", - Comment: "Request Description", + Comment: "Original attribute from ArcGIS API is REQDESCR", Nullable: true, Generated: false, AutoIncr: false, @@ -316,7 +316,7 @@ var FieldseekerServicerequests = Table[ Name: "reqnotesfortech", DBType: "character varying", Default: "NULL", - Comment: "Notes for Field Technician", + Comment: "Original attribute from ArcGIS API is REQNOTESFORTECH", Nullable: true, Generated: false, AutoIncr: false, @@ -325,7 +325,7 @@ var FieldseekerServicerequests = Table[ Name: "reqnotesforcust", DBType: "character varying", Default: "NULL", - Comment: "Notes for Customer", + Comment: "Original attribute from ArcGIS API is REQNOTESFORCUST", Nullable: true, Generated: false, AutoIncr: false, @@ -334,7 +334,7 @@ var FieldseekerServicerequests = Table[ Name: "reqfldnotes", DBType: "character varying", Default: "NULL", - Comment: "Request Field Notes", + Comment: "Original attribute from ArcGIS API is REQFLDNOTES", Nullable: true, Generated: false, AutoIncr: false, @@ -343,7 +343,7 @@ var FieldseekerServicerequests = Table[ Name: "reqprogramactions", DBType: "character varying", Default: "NULL", - Comment: "Request Program Actions", + Comment: "Original attribute from ArcGIS API is REQPROGRAMACTIONS", Nullable: true, Generated: false, AutoIncr: false, @@ -352,7 +352,7 @@ var FieldseekerServicerequests = Table[ Name: "datetimeclosed", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Closed", + Comment: "Original attribute from ArcGIS API is DATETIMECLOSED", Nullable: true, Generated: false, AutoIncr: false, @@ -361,7 +361,7 @@ var FieldseekerServicerequests = Table[ Name: "techclosed", DBType: "character varying", Default: "NULL", - Comment: "Closed By", + Comment: "Original attribute from ArcGIS API is TECHCLOSED", Nullable: true, Generated: false, AutoIncr: false, @@ -370,16 +370,16 @@ var FieldseekerServicerequests = Table[ Name: "sr_number", DBType: "integer", Default: "NULL", - Comment: "SR#", + Comment: "Original attribute from ArcGIS API is SR_NUMBER", Nullable: true, Generated: false, AutoIncr: false, }, Reviewed: column{ Name: "reviewed", - DBType: "fieldseeker.servicerequest_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Reviewed", + Comment: "Original attribute from ArcGIS API is REVIEWED", Nullable: true, Generated: false, AutoIncr: false, @@ -388,7 +388,7 @@ var FieldseekerServicerequests = Table[ Name: "reviewedby", DBType: "character varying", Default: "NULL", - Comment: "Reviewed By", + Comment: "Original attribute from ArcGIS API is REVIEWEDBY", Nullable: true, Generated: false, AutoIncr: false, @@ -397,16 +397,16 @@ var FieldseekerServicerequests = Table[ Name: "revieweddate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Reviewed Date", + Comment: "Original attribute from ArcGIS API is REVIEWEDDATE", Nullable: true, Generated: false, AutoIncr: false, }, Accepted: column{ Name: "accepted", - DBType: "fieldseeker.servicerequest_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Accepted", + Comment: "Original attribute from ArcGIS API is ACCEPTED", Nullable: true, Generated: false, AutoIncr: false, @@ -415,7 +415,7 @@ var FieldseekerServicerequests = Table[ Name: "accepteddate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Accepted Date", + Comment: "Original attribute from ArcGIS API is ACCEPTEDDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -424,7 +424,7 @@ var FieldseekerServicerequests = Table[ Name: "rejectedby", DBType: "character varying", Default: "NULL", - Comment: "Rejected By", + Comment: "Original attribute from ArcGIS API is REJECTEDBY", Nullable: true, Generated: false, AutoIncr: false, @@ -433,16 +433,16 @@ var FieldseekerServicerequests = Table[ Name: "rejecteddate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Rejected Date", + Comment: "Original attribute from ArcGIS API is REJECTEDDATE", Nullable: true, Generated: false, AutoIncr: false, }, Rejectedreason: column{ Name: "rejectedreason", - DBType: "fieldseeker.servicerequest_servicerequestrejectedreason_enum", + DBType: "character varying", Default: "NULL", - Comment: "Rejected Reason", + Comment: "Original attribute from ArcGIS API is REJECTEDREASON", Nullable: true, Generated: false, AutoIncr: false, @@ -451,7 +451,7 @@ var FieldseekerServicerequests = Table[ Name: "duedate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Due Date", + Comment: "Original attribute from ArcGIS API is DUEDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -460,7 +460,7 @@ var FieldseekerServicerequests = Table[ Name: "acceptedby", DBType: "character varying", Default: "NULL", - Comment: "Accepted By", + Comment: "Original attribute from ArcGIS API is ACCEPTEDBY", Nullable: true, Generated: false, AutoIncr: false, @@ -469,7 +469,7 @@ var FieldseekerServicerequests = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "Comments", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, @@ -478,16 +478,16 @@ var FieldseekerServicerequests = Table[ Name: "estcompletedate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Estimated Completion Date", + Comment: "Original attribute from ArcGIS API is ESTCOMPLETEDATE", Nullable: true, Generated: false, AutoIncr: false, }, Nextaction: column{ Name: "nextaction", - DBType: "fieldseeker.servicerequest_servicerequestnextaction_enum", + DBType: "character varying", Default: "NULL", - Comment: "Next Action", + Comment: "Original attribute from ArcGIS API is NEXTACTION", Nullable: true, Generated: false, AutoIncr: false, @@ -496,7 +496,7 @@ var FieldseekerServicerequests = Table[ Name: "recordstatus", DBType: "smallint", Default: "NULL", - Comment: "Record Status", + Comment: "Original attribute from ArcGIS API is RECORDSTATUS", Nullable: true, Generated: false, AutoIncr: false, @@ -505,7 +505,7 @@ var FieldseekerServicerequests = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -514,7 +514,7 @@ var FieldseekerServicerequests = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -523,7 +523,7 @@ var FieldseekerServicerequests = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -532,7 +532,7 @@ var FieldseekerServicerequests = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -541,7 +541,7 @@ var FieldseekerServicerequests = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -550,7 +550,7 @@ var FieldseekerServicerequests = Table[ Name: "firstresponsedate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "First Response Date", + Comment: "Original attribute from ArcGIS API is FIRSTRESPONSEDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -559,7 +559,7 @@ var FieldseekerServicerequests = Table[ Name: "responsedaycount", DBType: "smallint", Default: "NULL", - Comment: "Response Day Count", + Comment: "Original attribute from ArcGIS API is RESPONSEDAYCOUNT", Nullable: true, Generated: false, AutoIncr: false, @@ -568,7 +568,7 @@ var FieldseekerServicerequests = Table[ Name: "allowed", DBType: "character varying", Default: "NULL", - Comment: "Verify Correct Location", + Comment: "Original attribute from ArcGIS API is ALLOWED", Nullable: true, Generated: false, AutoIncr: false, @@ -577,7 +577,7 @@ var FieldseekerServicerequests = Table[ Name: "xvalue", DBType: "character varying", Default: "NULL", - Comment: "Xvalue", + Comment: "Original attribute from ArcGIS API is XVALUE", Nullable: true, Generated: false, AutoIncr: false, @@ -586,7 +586,7 @@ var FieldseekerServicerequests = Table[ Name: "yvalue", DBType: "character varying", Default: "NULL", - Comment: "Yvalue", + Comment: "Original attribute from ArcGIS API is YVALUE", Nullable: true, Generated: false, AutoIncr: false, @@ -595,7 +595,7 @@ var FieldseekerServicerequests = Table[ Name: "validx", DBType: "character varying", Default: "NULL", - Comment: "ValidX", + Comment: "Original attribute from ArcGIS API is VALIDX", Nullable: true, Generated: false, AutoIncr: false, @@ -604,7 +604,7 @@ var FieldseekerServicerequests = Table[ Name: "validy", DBType: "character varying", Default: "NULL", - Comment: "ValidY", + Comment: "Original attribute from ArcGIS API is VALIDY", Nullable: true, Generated: false, AutoIncr: false, @@ -613,7 +613,7 @@ var FieldseekerServicerequests = Table[ Name: "externalid", DBType: "character varying", Default: "NULL", - Comment: "External ID", + Comment: "Original attribute from ArcGIS API is EXTERNALID", Nullable: true, Generated: false, AutoIncr: false, @@ -622,7 +622,7 @@ var FieldseekerServicerequests = Table[ Name: "externalerror", DBType: "character varying", Default: "NULL", - Comment: "External Error", + Comment: "Original attribute from ArcGIS API is EXTERNALERROR", Nullable: true, Generated: false, AutoIncr: false, @@ -631,7 +631,7 @@ var FieldseekerServicerequests = Table[ Name: "pointlocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is POINTLOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -640,7 +640,7 @@ var FieldseekerServicerequests = Table[ Name: "notified", DBType: "smallint", Default: "NULL", - Comment: "Notified", + Comment: "Original attribute from ArcGIS API is NOTIFIED", Nullable: true, Generated: false, AutoIncr: false, @@ -649,7 +649,7 @@ var FieldseekerServicerequests = Table[ Name: "notifieddate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Notified Date", + Comment: "Original attribute from ArcGIS API is NOTIFIEDDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -658,7 +658,7 @@ var FieldseekerServicerequests = Table[ Name: "scheduled", DBType: "smallint", Default: "NULL", - Comment: "Scheduled", + Comment: "Original attribute from ArcGIS API is SCHEDULED", Nullable: true, Generated: false, AutoIncr: false, @@ -667,25 +667,25 @@ var FieldseekerServicerequests = Table[ Name: "scheduleddate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Scheduled Date", + Comment: "Original attribute from ArcGIS API is SCHEDULEDDATE", Nullable: true, Generated: false, AutoIncr: false, }, Dog: column{ Name: "dog", - DBType: "fieldseeker.servicerequest_servicerequest_dog_2b95ec97_1286_4fcd_88f4_f0e31", + DBType: "integer", Default: "NULL", - Comment: "Dog", + Comment: "Original attribute from ArcGIS API is DOG", Nullable: true, Generated: false, AutoIncr: false, }, SchedulePeriod: column{ Name: "schedule_period", - DBType: "fieldseeker.servicerequest_servicerequest_schedule_period_3f40c046_afd1_4ab", + DBType: "character varying", Default: "NULL", - Comment: "Schedule Period", + Comment: "Original attribute from ArcGIS API is schedule_period", Nullable: true, Generated: false, AutoIncr: false, @@ -694,16 +694,16 @@ var FieldseekerServicerequests = Table[ Name: "schedule_notes", DBType: "character varying", Default: "NULL", - Comment: "Schedule Notes", + Comment: "Original attribute from ArcGIS API is schedule_notes", Nullable: true, Generated: false, AutoIncr: false, }, Spanish: column{ Name: "spanish", - DBType: "fieldseeker.servicerequest_servicerequest_spanish_aaa3dc66_9f9a_4527_8ecd_c", + DBType: "integer", Default: "NULL", - Comment: "Prefer speaking Spanish", + Comment: "Original attribute from ArcGIS API is Spanish", Nullable: true, Generated: false, AutoIncr: false, @@ -712,7 +712,7 @@ var FieldseekerServicerequests = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -721,7 +721,7 @@ var FieldseekerServicerequests = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -730,7 +730,7 @@ var FieldseekerServicerequests = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -739,16 +739,16 @@ var FieldseekerServicerequests = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, }, Issuesreported: column{ Name: "issuesreported", - DBType: "fieldseeker.servicerequest_servicerequestissues_enum", + DBType: "character varying", Default: "NULL", - Comment: "Issues Reported", + Comment: "Original attribute from ArcGIS API is ISSUESREPORTED", Nullable: true, Generated: false, AutoIncr: false, @@ -757,7 +757,7 @@ var FieldseekerServicerequests = Table[ Name: "jurisdiction", DBType: "character varying", Default: "NULL", - Comment: "Jurisdiction", + Comment: "Original attribute from ArcGIS API is JURISDICTION", Nullable: true, Generated: false, AutoIncr: false, @@ -766,7 +766,7 @@ var FieldseekerServicerequests = Table[ Name: "notificationtimestamp", DBType: "character varying", Default: "NULL", - Comment: "Notification Timestamp", + Comment: "Original attribute from ArcGIS API is NOTIFICATIONTIMESTAMP", Nullable: true, Generated: false, AutoIncr: false, @@ -775,7 +775,7 @@ var FieldseekerServicerequests = Table[ Name: "zone", DBType: "character varying", Default: "NULL", - Comment: "Zone", + Comment: "Original attribute from ArcGIS API is ZONE", Nullable: true, Generated: false, AutoIncr: false, @@ -784,7 +784,25 @@ var FieldseekerServicerequests = Table[ Name: "zone2", DBType: "character varying", Default: "NULL", - Comment: "Zone2", + Comment: "Original attribute from ArcGIS API is ZONE2", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", + Comment: "", Nullable: true, Generated: false, AutoIncr: false, @@ -793,7 +811,16 @@ var FieldseekerServicerequests = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -828,6 +855,17 @@ var FieldseekerServicerequests = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerServicerequestForeignKeys{ + FieldseekerServicerequestServicerequestOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.servicerequest.servicerequest_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -919,12 +957,15 @@ type fieldseekerServicerequestColumns struct { Notificationtimestamp column Zone column Zone2 column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerServicerequestColumns) AsSlice() []column { return []column{ - c.Objectid, c.Recdatetime, c.Source, c.Entrytech, c.Priority, c.Supervisor, c.Assignedtech, c.Status, c.Clranon, c.Clrfname, c.Clrphone1, c.Clrphone2, c.Clremail, c.Clrcompany, c.Clraddr1, c.Clraddr2, c.Clrcity, c.Clrstate, c.Clrzip, c.Clrother, c.Clrcontpref, c.Reqcompany, c.Reqaddr1, c.Reqaddr2, c.Reqcity, c.Reqstate, c.Reqzip, c.Reqcrossst, c.Reqsubdiv, c.Reqmapgrid, c.Reqpermission, c.Reqtarget, c.Reqdescr, c.Reqnotesfortech, c.Reqnotesforcust, c.Reqfldnotes, c.Reqprogramactions, c.Datetimeclosed, c.Techclosed, c.SRNumber, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Accepted, c.Accepteddate, c.Rejectedby, c.Rejecteddate, c.Rejectedreason, c.Duedate, c.Acceptedby, c.Comments, c.Estcompletedate, c.Nextaction, c.Recordstatus, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Firstresponsedate, c.Responsedaycount, c.Allowed, c.Xvalue, c.Yvalue, c.Validx, c.Validy, c.Externalid, c.Externalerror, c.Pointlocid, c.Notified, c.Notifieddate, c.Scheduled, c.Scheduleddate, c.Dog, c.SchedulePeriod, c.ScheduleNotes, c.Spanish, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Issuesreported, c.Jurisdiction, c.Notificationtimestamp, c.Zone, c.Zone2, c.Version, + c.Objectid, c.Recdatetime, c.Source, c.Entrytech, c.Priority, c.Supervisor, c.Assignedtech, c.Status, c.Clranon, c.Clrfname, c.Clrphone1, c.Clrphone2, c.Clremail, c.Clrcompany, c.Clraddr1, c.Clraddr2, c.Clrcity, c.Clrstate, c.Clrzip, c.Clrother, c.Clrcontpref, c.Reqcompany, c.Reqaddr1, c.Reqaddr2, c.Reqcity, c.Reqstate, c.Reqzip, c.Reqcrossst, c.Reqsubdiv, c.Reqmapgrid, c.Reqpermission, c.Reqtarget, c.Reqdescr, c.Reqnotesfortech, c.Reqnotesforcust, c.Reqfldnotes, c.Reqprogramactions, c.Datetimeclosed, c.Techclosed, c.SRNumber, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Accepted, c.Accepteddate, c.Rejectedby, c.Rejecteddate, c.Rejectedreason, c.Duedate, c.Acceptedby, c.Comments, c.Estcompletedate, c.Nextaction, c.Recordstatus, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Firstresponsedate, c.Responsedaycount, c.Allowed, c.Xvalue, c.Yvalue, c.Validx, c.Validy, c.Externalid, c.Externalerror, c.Pointlocid, c.Notified, c.Notifieddate, c.Scheduled, c.Scheduleddate, c.Dog, c.SchedulePeriod, c.ScheduleNotes, c.Spanish, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Issuesreported, c.Jurisdiction, c.Notificationtimestamp, c.Zone, c.Zone2, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -938,10 +979,14 @@ func (i fieldseekerServicerequestIndexes) AsSlice() []index { } } -type fieldseekerServicerequestForeignKeys struct{} +type fieldseekerServicerequestForeignKeys struct { + FieldseekerServicerequestServicerequestOrganizationIDFkey foreignKey +} func (f fieldseekerServicerequestForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerServicerequestServicerequestOrganizationIDFkey, + } } type fieldseekerServicerequestUniques struct{} diff --git a/db/dbinfo/fieldseeker.speciesabundance.bob.go b/db/dbinfo/fieldseeker.speciesabundance.bob.go index 5eeda013..920b99ae 100644 --- a/db/dbinfo/fieldseeker.speciesabundance.bob.go +++ b/db/dbinfo/fieldseeker.speciesabundance.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "trapdata_id", DBType: "uuid", Default: "NULL", - Comment: "Trap Data ID", + Comment: "Original attribute from ArcGIS API is TRAPDATA_ID", Nullable: true, Generated: false, AutoIncr: false, @@ -37,7 +37,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "species", DBType: "character varying", Default: "NULL", - Comment: "Species", + Comment: "Original attribute from ArcGIS API is SPECIES", Nullable: true, Generated: false, AutoIncr: false, @@ -46,7 +46,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "males", DBType: "smallint", Default: "NULL", - Comment: "Males", + Comment: "Original attribute from ArcGIS API is MALES", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "unknown", DBType: "smallint", Default: "NULL", - Comment: "Unknown", + Comment: "Original attribute from ArcGIS API is UNKNOWN", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "bloodedfem", DBType: "smallint", Default: "NULL", - Comment: "Blooded Females", + Comment: "Original attribute from ArcGIS API is BLOODEDFEM", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "gravidfem", DBType: "smallint", Default: "NULL", - Comment: "Gravid Females", + Comment: "Original attribute from ArcGIS API is GRAVIDFEM", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "larvae", DBType: "smallint", Default: "NULL", - Comment: "Larvae", + Comment: "Original attribute from ArcGIS API is LARVAE", Nullable: true, Generated: false, AutoIncr: false, @@ -91,16 +91,16 @@ var FieldseekerSpeciesabundances = Table[ Name: "poolstogen", DBType: "smallint", Default: "NULL", - Comment: "Pools to Generate", + Comment: "Original attribute from ArcGIS API is POOLSTOGEN", Nullable: true, Generated: false, AutoIncr: false, }, Processed: column{ Name: "processed", - DBType: "fieldseeker.speciesabundance_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Processed", + Comment: "Original attribute from ArcGIS API is PROCESSED", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "pupae", DBType: "smallint", Default: "NULL", - Comment: "Pupae", + Comment: "Original attribute from ArcGIS API is PUPAE", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "eggs", DBType: "smallint", Default: "NULL", - Comment: "Eggs", + Comment: "Original attribute from ArcGIS API is EGGS", Nullable: true, Generated: false, AutoIncr: false, @@ -172,7 +172,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "females", DBType: "integer", Default: "NULL", - Comment: "Females", + Comment: "Original attribute from ArcGIS API is FEMALES", Nullable: true, Generated: false, AutoIncr: false, @@ -181,7 +181,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "total", DBType: "integer", Default: "NULL", - Comment: "Total Adults", + Comment: "Original attribute from ArcGIS API is TOTAL", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +190,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -199,7 +199,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -208,7 +208,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -217,7 +217,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, @@ -226,7 +226,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "yearweek", DBType: "integer", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is yearWeek", Nullable: true, Generated: false, AutoIncr: false, @@ -235,7 +235,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "globalzscore", DBType: "double precision", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is globalZScore", Nullable: true, Generated: false, AutoIncr: false, @@ -244,7 +244,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "r7score", DBType: "double precision", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is r7Score", Nullable: true, Generated: false, AutoIncr: false, @@ -253,7 +253,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "r8score", DBType: "double precision", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is r8Score", Nullable: true, Generated: false, AutoIncr: false, @@ -262,7 +262,7 @@ var FieldseekerSpeciesabundances = Table[ Name: "h3r7", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is h3r7", Nullable: true, Generated: false, AutoIncr: false, @@ -271,6 +271,24 @@ var FieldseekerSpeciesabundances = Table[ Name: "h3r8", DBType: "character varying", Default: "NULL", + Comment: "Original attribute from ArcGIS API is h3r8", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -280,7 +298,16 @@ var FieldseekerSpeciesabundances = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -315,6 +342,17 @@ var FieldseekerSpeciesabundances = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerSpeciesabundanceForeignKeys{ + FieldseekerSpeciesabundanceSpeciesabundanceOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.speciesabundance.speciesabundance_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -349,12 +387,15 @@ type fieldseekerSpeciesabundanceColumns struct { R8score column H3R7 column H3R8 column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerSpeciesabundanceColumns) AsSlice() []column { return []column{ - c.Objectid, c.TrapdataID, c.Species, c.Males, c.Unknown, c.Bloodedfem, c.Gravidfem, c.Larvae, c.Poolstogen, c.Processed, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Pupae, c.Eggs, c.Females, c.Total, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Yearweek, c.Globalzscore, c.R7score, c.R8score, c.H3R7, c.H3R8, c.Version, + c.Objectid, c.TrapdataID, c.Species, c.Males, c.Unknown, c.Bloodedfem, c.Gravidfem, c.Larvae, c.Poolstogen, c.Processed, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Pupae, c.Eggs, c.Females, c.Total, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Yearweek, c.Globalzscore, c.R7score, c.R8score, c.H3R7, c.H3R8, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -368,10 +409,14 @@ func (i fieldseekerSpeciesabundanceIndexes) AsSlice() []index { } } -type fieldseekerSpeciesabundanceForeignKeys struct{} +type fieldseekerSpeciesabundanceForeignKeys struct { + FieldseekerSpeciesabundanceSpeciesabundanceOrganizationIDFkey foreignKey +} func (f fieldseekerSpeciesabundanceForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerSpeciesabundanceSpeciesabundanceOrganizationIDFkey, + } } type fieldseekerSpeciesabundanceUniques struct{} diff --git a/db/dbinfo/fieldseeker.stormdrain.bob.go b/db/dbinfo/fieldseeker.stormdrain.bob.go index ba71f49c..c843983b 100644 --- a/db/dbinfo/fieldseeker.stormdrain.bob.go +++ b/db/dbinfo/fieldseeker.stormdrain.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerStormdrains = Table[ Name: "nexttreatmentdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is NextTreatmentDate", Nullable: true, Generated: false, AutoIncr: false, @@ -37,7 +37,7 @@ var FieldseekerStormdrains = Table[ Name: "lasttreatdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LastTreatDate", Nullable: true, Generated: false, AutoIncr: false, @@ -46,16 +46,16 @@ var FieldseekerStormdrains = Table[ Name: "lastaction", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LastAction", Nullable: true, Generated: false, AutoIncr: false, }, Symbology: column{ Name: "symbology", - DBType: "fieldseeker.stormdrain_stormdrainsymbology_enum", + DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Symbology", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerStormdrains = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerStormdrains = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerStormdrains = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerStormdrains = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerStormdrains = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerStormdrains = Table[ Name: "laststatus", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LastStatus", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerStormdrains = Table[ Name: "zone", DBType: "character varying", Default: "NULL", - Comment: "Zone", + Comment: "Original attribute from ArcGIS API is ZONE", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerStormdrains = Table[ Name: "zone2", DBType: "character varying", Default: "NULL", - Comment: "Zone2", + Comment: "Original attribute from ArcGIS API is ZONE2", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerStormdrains = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerStormdrains = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerStormdrains = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerStormdrains = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, @@ -172,7 +172,7 @@ var FieldseekerStormdrains = Table[ Name: "type", DBType: "character varying", Default: "NULL", - Comment: "Type", + Comment: "Original attribute from ArcGIS API is TYPE", Nullable: true, Generated: false, AutoIncr: false, @@ -181,7 +181,25 @@ var FieldseekerStormdrains = Table[ Name: "jurisdiction", DBType: "character varying", Default: "NULL", - Comment: "Jurisdiction", + Comment: "Original attribute from ArcGIS API is JURISDICTION", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", + Comment: "", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +208,16 @@ var FieldseekerStormdrains = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -225,6 +252,17 @@ var FieldseekerStormdrains = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerStormdrainForeignKeys{ + FieldseekerStormdrainStormdrainOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.stormdrain.stormdrain_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -249,12 +287,15 @@ type fieldseekerStormdrainColumns struct { Editor column Type column Jurisdiction column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerStormdrainColumns) AsSlice() []column { return []column{ - c.Objectid, c.Nexttreatmentdate, c.Lasttreatdate, c.Lastaction, c.Symbology, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Laststatus, c.Zone, c.Zone2, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Type, c.Jurisdiction, c.Version, + c.Objectid, c.Nexttreatmentdate, c.Lasttreatdate, c.Lastaction, c.Symbology, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Laststatus, c.Zone, c.Zone2, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Type, c.Jurisdiction, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -268,10 +309,14 @@ func (i fieldseekerStormdrainIndexes) AsSlice() []index { } } -type fieldseekerStormdrainForeignKeys struct{} +type fieldseekerStormdrainForeignKeys struct { + FieldseekerStormdrainStormdrainOrganizationIDFkey foreignKey +} func (f fieldseekerStormdrainForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerStormdrainStormdrainOrganizationIDFkey, + } } type fieldseekerStormdrainUniques struct{} diff --git a/db/dbinfo/fieldseeker.timecard.bob.go b/db/dbinfo/fieldseeker.timecard.bob.go index bc461b84..1592b2a6 100644 --- a/db/dbinfo/fieldseeker.timecard.bob.go +++ b/db/dbinfo/fieldseeker.timecard.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -26,9 +26,9 @@ var FieldseekerTimecards = Table[ }, Activity: column{ Name: "activity", - DBType: "fieldseeker.timecard_timecard_activity_451e67260c084304a35457170dc13366_enu", + DBType: "character varying", Default: "NULL", - Comment: "Activity", + Comment: "Original attribute from ArcGIS API is ACTIVITY", Nullable: true, Generated: false, AutoIncr: false, @@ -37,7 +37,7 @@ var FieldseekerTimecards = Table[ Name: "startdatetime", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Start", + Comment: "Original attribute from ArcGIS API is STARTDATETIME", Nullable: true, Generated: false, AutoIncr: false, @@ -46,7 +46,7 @@ var FieldseekerTimecards = Table[ Name: "enddatetime", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Finish", + Comment: "Original attribute from ArcGIS API is ENDDATETIME", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerTimecards = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "Comments", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, @@ -64,16 +64,16 @@ var FieldseekerTimecards = Table[ Name: "externalid", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EXTERNALID", Nullable: true, Generated: false, AutoIncr: false, }, Equiptype: column{ Name: "equiptype", - DBType: "fieldseeker.timecard_timecardequipmenttype_enum", + DBType: "character varying", Default: "NULL", - Comment: "Equipment Type", + Comment: "Original attribute from ArcGIS API is EQUIPTYPE", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerTimecards = Table[ Name: "locationname", DBType: "character varying", Default: "NULL", - Comment: "Location Name", + Comment: "Original attribute from ArcGIS API is LOCATIONNAME", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerTimecards = Table[ Name: "zone", DBType: "character varying", Default: "NULL", - Comment: "Zone", + Comment: "Original attribute from ArcGIS API is ZONE", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerTimecards = Table[ Name: "zone2", DBType: "character varying", Default: "NULL", - Comment: "Zone2", + Comment: "Original attribute from ArcGIS API is ZONE2", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerTimecards = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerTimecards = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerTimecards = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerTimecards = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerTimecards = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerTimecards = Table[ Name: "linelocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LINELOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerTimecards = Table[ Name: "pointlocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is POINTLOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -172,7 +172,7 @@ var FieldseekerTimecards = Table[ Name: "polygonlocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is POLYGONLOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -181,7 +181,7 @@ var FieldseekerTimecards = Table[ Name: "lclocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LCLOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +190,7 @@ var FieldseekerTimecards = Table[ Name: "samplelocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is SAMPLELOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -199,7 +199,7 @@ var FieldseekerTimecards = Table[ Name: "srid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is SRID", Nullable: true, Generated: false, AutoIncr: false, @@ -208,7 +208,7 @@ var FieldseekerTimecards = Table[ Name: "traplocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is TRAPLOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -217,7 +217,7 @@ var FieldseekerTimecards = Table[ Name: "fieldtech", DBType: "character varying", Default: "NULL", - Comment: "Field Tech", + Comment: "Original attribute from ArcGIS API is FIELDTECH", Nullable: true, Generated: false, AutoIncr: false, @@ -226,7 +226,7 @@ var FieldseekerTimecards = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -235,7 +235,7 @@ var FieldseekerTimecards = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -244,7 +244,7 @@ var FieldseekerTimecards = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -253,7 +253,7 @@ var FieldseekerTimecards = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, @@ -262,6 +262,24 @@ var FieldseekerTimecards = Table[ Name: "rodentlocid", DBType: "uuid", Default: "NULL", + Comment: "Original attribute from ArcGIS API is RODENTLOCID", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -271,7 +289,16 @@ var FieldseekerTimecards = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -306,6 +333,17 @@ var FieldseekerTimecards = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerTimecardForeignKeys{ + FieldseekerTimecardTimecardOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.timecard.timecard_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -339,12 +377,15 @@ type fieldseekerTimecardColumns struct { Editdate column Editor column Rodentlocid column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerTimecardColumns) AsSlice() []column { return []column{ - c.Objectid, c.Activity, c.Startdatetime, c.Enddatetime, c.Comments, c.Externalid, c.Equiptype, c.Locationname, c.Zone, c.Zone2, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Linelocid, c.Pointlocid, c.Polygonlocid, c.Lclocid, c.Samplelocid, c.Srid, c.Traplocid, c.Fieldtech, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Rodentlocid, c.Version, + c.Objectid, c.Activity, c.Startdatetime, c.Enddatetime, c.Comments, c.Externalid, c.Equiptype, c.Locationname, c.Zone, c.Zone2, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Linelocid, c.Pointlocid, c.Polygonlocid, c.Lclocid, c.Samplelocid, c.Srid, c.Traplocid, c.Fieldtech, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Rodentlocid, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -358,10 +399,14 @@ func (i fieldseekerTimecardIndexes) AsSlice() []index { } } -type fieldseekerTimecardForeignKeys struct{} +type fieldseekerTimecardForeignKeys struct { + FieldseekerTimecardTimecardOrganizationIDFkey foreignKey +} func (f fieldseekerTimecardForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerTimecardTimecardOrganizationIDFkey, + } } type fieldseekerTimecardUniques struct{} diff --git a/db/dbinfo/fieldseeker.trapdata.bob.go b/db/dbinfo/fieldseeker.trapdata.bob.go index 56bfac88..9364415b 100644 --- a/db/dbinfo/fieldseeker.trapdata.bob.go +++ b/db/dbinfo/fieldseeker.trapdata.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -26,18 +26,18 @@ var FieldseekerTrapdata = Table[ }, Traptype: column{ Name: "traptype", - DBType: "fieldseeker.trapdata_mosquitotraptype_enum", + DBType: "character varying", Default: "NULL", - Comment: "Trap Type", + Comment: "Original attribute from ArcGIS API is TRAPTYPE", Nullable: true, Generated: false, AutoIncr: false, }, Trapactivitytype: column{ Name: "trapactivitytype", - DBType: "fieldseeker.trapdata_notinuitrapactivitytype_enum", + DBType: "character varying", Default: "NULL", - Comment: "Trap Activity Type", + Comment: "Original attribute from ArcGIS API is TRAPACTIVITYTYPE", Nullable: true, Generated: false, AutoIncr: false, @@ -46,7 +46,7 @@ var FieldseekerTrapdata = Table[ Name: "startdatetime", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Start", + Comment: "Original attribute from ArcGIS API is STARTDATETIME", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerTrapdata = Table[ Name: "enddatetime", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Finish", + Comment: "Original attribute from ArcGIS API is ENDDATETIME", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerTrapdata = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "Comments", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerTrapdata = Table[ Name: "idbytech", DBType: "character varying", Default: "NULL", - Comment: "Tech Identifying Species in Lab", + Comment: "Original attribute from ArcGIS API is IDBYTECH", Nullable: true, Generated: false, AutoIncr: false, @@ -82,25 +82,25 @@ var FieldseekerTrapdata = Table[ Name: "sortbytech", DBType: "character varying", Default: "NULL", - Comment: "Tech Sorting Trap Results in Lab", + Comment: "Original attribute from ArcGIS API is SORTBYTECH", Nullable: true, Generated: false, AutoIncr: false, }, Processed: column{ Name: "processed", - DBType: "fieldseeker.trapdata_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Processed", + Comment: "Original attribute from ArcGIS API is PROCESSED", Nullable: true, Generated: false, AutoIncr: false, }, Sitecond: column{ Name: "sitecond", - DBType: "fieldseeker.trapdata_mosquitositecondition_enum", + DBType: "character varying", Default: "NULL", - Comment: "Site Conditions", + Comment: "Original attribute from ArcGIS API is SITECOND", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerTrapdata = Table[ Name: "locationname", DBType: "character varying", Default: "NULL", - Comment: "Location Name", + Comment: "Original attribute from ArcGIS API is LOCATIONNAME", Nullable: true, Generated: false, AutoIncr: false, @@ -118,16 +118,16 @@ var FieldseekerTrapdata = Table[ Name: "recordstatus", DBType: "smallint", Default: "NULL", - Comment: "RecordStatus", + Comment: "Original attribute from ArcGIS API is RECORDSTATUS", Nullable: true, Generated: false, AutoIncr: false, }, Reviewed: column{ Name: "reviewed", - DBType: "fieldseeker.trapdata_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Reviewed", + Comment: "Original attribute from ArcGIS API is REVIEWED", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerTrapdata = Table[ Name: "reviewedby", DBType: "character varying", Default: "NULL", - Comment: "Reviewed By", + Comment: "Original attribute from ArcGIS API is REVIEWEDBY", Nullable: true, Generated: false, AutoIncr: false, @@ -145,16 +145,16 @@ var FieldseekerTrapdata = Table[ Name: "revieweddate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Reviewed Date", + Comment: "Original attribute from ArcGIS API is REVIEWEDDATE", Nullable: true, Generated: false, AutoIncr: false, }, Trapcondition: column{ Name: "trapcondition", - DBType: "fieldseeker.trapdata_mosquitotrapcondition_enum", + DBType: "character varying", Default: "NULL", - Comment: "Trap Condition", + Comment: "Original attribute from ArcGIS API is TRAPCONDITION", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerTrapdata = Table[ Name: "trapnights", DBType: "smallint", Default: "NULL", - Comment: "Trap Nights", + Comment: "Original attribute from ArcGIS API is TRAPNIGHTS", Nullable: true, Generated: false, AutoIncr: false, @@ -172,7 +172,7 @@ var FieldseekerTrapdata = Table[ Name: "zone", DBType: "character varying", Default: "NULL", - Comment: "Zone", + Comment: "Original attribute from ArcGIS API is ZONE", Nullable: true, Generated: false, AutoIncr: false, @@ -181,7 +181,7 @@ var FieldseekerTrapdata = Table[ Name: "zone2", DBType: "character varying", Default: "NULL", - Comment: "Zone2", + Comment: "Original attribute from ArcGIS API is ZONE2", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +190,7 @@ var FieldseekerTrapdata = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -199,7 +199,7 @@ var FieldseekerTrapdata = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -208,7 +208,7 @@ var FieldseekerTrapdata = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -217,7 +217,7 @@ var FieldseekerTrapdata = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -226,7 +226,7 @@ var FieldseekerTrapdata = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -235,7 +235,7 @@ var FieldseekerTrapdata = Table[ Name: "srid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is SRID", Nullable: true, Generated: false, AutoIncr: false, @@ -244,7 +244,7 @@ var FieldseekerTrapdata = Table[ Name: "fieldtech", DBType: "character varying", Default: "NULL", - Comment: "Field Tech", + Comment: "Original attribute from ArcGIS API is FIELDTECH", Nullable: true, Generated: false, AutoIncr: false, @@ -253,7 +253,7 @@ var FieldseekerTrapdata = Table[ Name: "gatewaysync", DBType: "smallint", Default: "NULL", - Comment: "Gateway Sync", + Comment: "Original attribute from ArcGIS API is GATEWAYSYNC", Nullable: true, Generated: false, AutoIncr: false, @@ -262,7 +262,7 @@ var FieldseekerTrapdata = Table[ Name: "loc_id", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LOC_ID", Nullable: true, Generated: false, AutoIncr: false, @@ -271,16 +271,16 @@ var FieldseekerTrapdata = Table[ Name: "voltage", DBType: "double precision", Default: "NULL", - Comment: "Voltage", + Comment: "Original attribute from ArcGIS API is VOLTAGE", Nullable: true, Generated: false, AutoIncr: false, }, Winddir: column{ Name: "winddir", - DBType: "fieldseeker.trapdata_trapdata_winddir_c1a31e05_d0b9_4b22_8800_be127bb3f166_", + DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is WINDDIR", Nullable: true, Generated: false, AutoIncr: false, @@ -289,7 +289,7 @@ var FieldseekerTrapdata = Table[ Name: "windspeed", DBType: "double precision", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is WINDSPEED", Nullable: true, Generated: false, AutoIncr: false, @@ -298,7 +298,7 @@ var FieldseekerTrapdata = Table[ Name: "avetemp", DBType: "double precision", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is AVETEMP", Nullable: true, Generated: false, AutoIncr: false, @@ -307,7 +307,7 @@ var FieldseekerTrapdata = Table[ Name: "raingauge", DBType: "double precision", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is RAINGAUGE", Nullable: true, Generated: false, AutoIncr: false, @@ -316,7 +316,7 @@ var FieldseekerTrapdata = Table[ Name: "lr", DBType: "smallint", Default: "NULL", - Comment: "Landing Rate", + Comment: "Original attribute from ArcGIS API is LR", Nullable: true, Generated: false, AutoIncr: false, @@ -325,7 +325,7 @@ var FieldseekerTrapdata = Table[ Name: "field", DBType: "integer", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Field", Nullable: true, Generated: false, AutoIncr: false, @@ -334,7 +334,7 @@ var FieldseekerTrapdata = Table[ Name: "vectorsurvtrapdataid", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is VECTORSURVTRAPDATAID", Nullable: true, Generated: false, AutoIncr: false, @@ -343,7 +343,7 @@ var FieldseekerTrapdata = Table[ Name: "vectorsurvtraplocationid", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is VECTORSURVTRAPLOCATIONID", Nullable: true, Generated: false, AutoIncr: false, @@ -352,7 +352,7 @@ var FieldseekerTrapdata = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -361,7 +361,7 @@ var FieldseekerTrapdata = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -370,7 +370,7 @@ var FieldseekerTrapdata = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -379,14 +379,32 @@ var FieldseekerTrapdata = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, }, Lure: column{ Name: "lure", - DBType: "fieldseeker.trapdata_trapdata_lure_25fe542f_077f_4254_8681_76e8f436354b_enu", + DBType: "character varying", + Default: "NULL", + Comment: "Original attribute from ArcGIS API is Lure", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", Default: "NULL", Comment: "", Nullable: true, @@ -397,7 +415,16 @@ var FieldseekerTrapdata = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -432,6 +459,17 @@ var FieldseekerTrapdata = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerTrapdatumForeignKeys{ + FieldseekerTrapdataTrapdataOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.trapdata.trapdata_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -479,12 +517,15 @@ type fieldseekerTrapdatumColumns struct { Editdate column Editor column Lure column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerTrapdatumColumns) AsSlice() []column { return []column{ - c.Objectid, c.Traptype, c.Trapactivitytype, c.Startdatetime, c.Enddatetime, c.Comments, c.Idbytech, c.Sortbytech, c.Processed, c.Sitecond, c.Locationname, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Trapcondition, c.Trapnights, c.Zone, c.Zone2, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Srid, c.Fieldtech, c.Gatewaysync, c.LocID, c.Voltage, c.Winddir, c.Windspeed, c.Avetemp, c.Raingauge, c.LR, c.Field, c.Vectorsurvtrapdataid, c.Vectorsurvtraplocationid, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Lure, c.Version, + c.Objectid, c.Traptype, c.Trapactivitytype, c.Startdatetime, c.Enddatetime, c.Comments, c.Idbytech, c.Sortbytech, c.Processed, c.Sitecond, c.Locationname, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Trapcondition, c.Trapnights, c.Zone, c.Zone2, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Srid, c.Fieldtech, c.Gatewaysync, c.LocID, c.Voltage, c.Winddir, c.Windspeed, c.Avetemp, c.Raingauge, c.LR, c.Field, c.Vectorsurvtrapdataid, c.Vectorsurvtraplocationid, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Lure, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -498,10 +539,14 @@ func (i fieldseekerTrapdatumIndexes) AsSlice() []index { } } -type fieldseekerTrapdatumForeignKeys struct{} +type fieldseekerTrapdatumForeignKeys struct { + FieldseekerTrapdataTrapdataOrganizationIDFkey foreignKey +} func (f fieldseekerTrapdatumForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerTrapdataTrapdataOrganizationIDFkey, + } } type fieldseekerTrapdatumUniques struct{} diff --git a/db/dbinfo/fieldseeker.traplocation.bob.go b/db/dbinfo/fieldseeker.traplocation.bob.go index 7729e2be..4875f955 100644 --- a/db/dbinfo/fieldseeker.traplocation.bob.go +++ b/db/dbinfo/fieldseeker.traplocation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerTraplocations = Table[ Name: "name", DBType: "character varying", Default: "NULL", - Comment: "Name", + Comment: "Original attribute from ArcGIS API is NAME", Nullable: true, Generated: false, AutoIncr: false, @@ -37,43 +37,43 @@ var FieldseekerTraplocations = Table[ Name: "zone", DBType: "character varying", Default: "NULL", - Comment: "Zone", + Comment: "Original attribute from ArcGIS API is ZONE", Nullable: true, Generated: false, AutoIncr: false, }, Habitat: column{ Name: "habitat", - DBType: "fieldseeker.traplocation_traplocation_habitat_5c349680f5ff40b1aeca88c17993e", + DBType: "character varying", Default: "NULL", - Comment: "Habitat", + Comment: "Original attribute from ArcGIS API is HABITAT", Nullable: true, Generated: false, AutoIncr: false, }, Priority: column{ Name: "priority", - DBType: "fieldseeker.traplocation_traplocation_priority_680fb011063b41d59f39271c959b", + DBType: "character varying", Default: "NULL", - Comment: "Priority", + Comment: "Original attribute from ArcGIS API is PRIORITY", Nullable: true, Generated: false, AutoIncr: false, }, Usetype: column{ Name: "usetype", - DBType: "fieldseeker.traplocation_traplocation_usetype_5e0eff9231fb404c98cc53c1d49a2", + DBType: "character varying", Default: "NULL", - Comment: "Use Type", + Comment: "Original attribute from ArcGIS API is USETYPE", Nullable: true, Generated: false, AutoIncr: false, }, Active: column{ Name: "active", - DBType: "fieldseeker.traplocation_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Active", + Comment: "Original attribute from ArcGIS API is ACTIVE", Nullable: true, Generated: false, AutoIncr: false, @@ -82,16 +82,16 @@ var FieldseekerTraplocations = Table[ Name: "description", DBType: "character varying", Default: "NULL", - Comment: "Description", + Comment: "Original attribute from ArcGIS API is DESCRIPTION", Nullable: true, Generated: false, AutoIncr: false, }, Accessdesc: column{ Name: "accessdesc", - DBType: "fieldseeker.traplocation_traplocation_accessdesc_154cbd10_4524_4e3a_8ca0_f0", + DBType: "character varying", Default: "NULL", - Comment: "Access Description", + Comment: "Original attribute from ArcGIS API is ACCESSDESC", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerTraplocations = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "Comments", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerTraplocations = Table[ Name: "externalid", DBType: "character varying", Default: "NULL", - Comment: "External ID", + Comment: "Original attribute from ArcGIS API is EXTERNALID", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerTraplocations = Table[ Name: "nextactiondatescheduled", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Next Scheduled Action", + Comment: "Original attribute from ArcGIS API is NEXTACTIONDATESCHEDULED", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerTraplocations = Table[ Name: "zone2", DBType: "character varying", Default: "NULL", - Comment: "Zone2", + Comment: "Original attribute from ArcGIS API is ZONE2", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerTraplocations = Table[ Name: "locationnumber", DBType: "integer", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LOCATIONNUMBER", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerTraplocations = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerTraplocations = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerTraplocations = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -172,7 +172,7 @@ var FieldseekerTraplocations = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -181,7 +181,7 @@ var FieldseekerTraplocations = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +190,7 @@ var FieldseekerTraplocations = Table[ Name: "gatewaysync", DBType: "smallint", Default: "NULL", - Comment: "Gateway Sync", + Comment: "Original attribute from ArcGIS API is GATEWAYSYNC", Nullable: true, Generated: false, AutoIncr: false, @@ -199,7 +199,7 @@ var FieldseekerTraplocations = Table[ Name: "route", DBType: "integer", Default: "NULL", - Comment: "Route", + Comment: "Original attribute from ArcGIS API is route", Nullable: true, Generated: false, AutoIncr: false, @@ -208,7 +208,7 @@ var FieldseekerTraplocations = Table[ Name: "set_dow", DBType: "integer", Default: "NULL", - Comment: "Set Day of Week", + Comment: "Original attribute from ArcGIS API is set_dow", Nullable: true, Generated: false, AutoIncr: false, @@ -217,7 +217,7 @@ var FieldseekerTraplocations = Table[ Name: "route_order", DBType: "integer", Default: "NULL", - Comment: "Route order", + Comment: "Original attribute from ArcGIS API is route_order", Nullable: true, Generated: false, AutoIncr: false, @@ -226,7 +226,7 @@ var FieldseekerTraplocations = Table[ Name: "vectorsurvsiteid", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is VECTORSURVSITEID", Nullable: true, Generated: false, AutoIncr: false, @@ -235,7 +235,7 @@ var FieldseekerTraplocations = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -244,7 +244,7 @@ var FieldseekerTraplocations = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -253,7 +253,7 @@ var FieldseekerTraplocations = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -262,7 +262,7 @@ var FieldseekerTraplocations = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, @@ -271,7 +271,7 @@ var FieldseekerTraplocations = Table[ Name: "h3r7", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is h3r7", Nullable: true, Generated: false, AutoIncr: false, @@ -280,6 +280,24 @@ var FieldseekerTraplocations = Table[ Name: "h3r8", DBType: "character varying", Default: "NULL", + Comment: "Original attribute from ArcGIS API is h3r8", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -289,7 +307,16 @@ var FieldseekerTraplocations = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -324,6 +351,17 @@ var FieldseekerTraplocations = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerTraplocationForeignKeys{ + FieldseekerTraplocationTraplocationOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.traplocation.traplocation_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -359,12 +397,15 @@ type fieldseekerTraplocationColumns struct { Editor column H3R7 column H3R8 column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerTraplocationColumns) AsSlice() []column { return []column{ - c.Objectid, c.Name, c.Zone, c.Habitat, c.Priority, c.Usetype, c.Active, c.Description, c.Accessdesc, c.Comments, c.Externalid, c.Nextactiondatescheduled, c.Zone2, c.Locationnumber, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Gatewaysync, c.Route, c.SetDow, c.RouteOrder, c.Vectorsurvsiteid, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.H3R7, c.H3R8, c.Version, + c.Objectid, c.Name, c.Zone, c.Habitat, c.Priority, c.Usetype, c.Active, c.Description, c.Accessdesc, c.Comments, c.Externalid, c.Nextactiondatescheduled, c.Zone2, c.Locationnumber, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Gatewaysync, c.Route, c.SetDow, c.RouteOrder, c.Vectorsurvsiteid, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.H3R7, c.H3R8, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -378,10 +419,14 @@ func (i fieldseekerTraplocationIndexes) AsSlice() []index { } } -type fieldseekerTraplocationForeignKeys struct{} +type fieldseekerTraplocationForeignKeys struct { + FieldseekerTraplocationTraplocationOrganizationIDFkey foreignKey +} func (f fieldseekerTraplocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerTraplocationTraplocationOrganizationIDFkey, + } } type fieldseekerTraplocationUniques struct{} diff --git a/db/dbinfo/fieldseeker.treatment.bob.go b/db/dbinfo/fieldseeker.treatment.bob.go index edec06c9..e2eb8687 100644 --- a/db/dbinfo/fieldseeker.treatment.bob.go +++ b/db/dbinfo/fieldseeker.treatment.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -26,9 +26,9 @@ var FieldseekerTreatments = Table[ }, Activity: column{ Name: "activity", - DBType: "fieldseeker.treatment_mosquitoactivity_enum", + DBType: "character varying", Default: "NULL", - Comment: "Activity", + Comment: "Original attribute from ArcGIS API is ACTIVITY", Nullable: true, Generated: false, AutoIncr: false, @@ -37,16 +37,16 @@ var FieldseekerTreatments = Table[ Name: "treatarea", DBType: "double precision", Default: "NULL", - Comment: "Area Treated", + Comment: "Original attribute from ArcGIS API is TREATAREA", Nullable: true, Generated: false, AutoIncr: false, }, Areaunit: column{ Name: "areaunit", - DBType: "fieldseeker.treatment_mosquitoproductareaunit_enum", + DBType: "character varying", Default: "NULL", - Comment: "Area Unit", + Comment: "Original attribute from ArcGIS API is AREAUNIT", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerTreatments = Table[ Name: "product", DBType: "character varying", Default: "NULL", - Comment: "Product", + Comment: "Original attribute from ArcGIS API is PRODUCT", Nullable: true, Generated: false, AutoIncr: false, @@ -64,34 +64,34 @@ var FieldseekerTreatments = Table[ Name: "qty", DBType: "double precision", Default: "NULL", - Comment: "Quantity", + Comment: "Original attribute from ArcGIS API is QTY", Nullable: true, Generated: false, AutoIncr: false, }, Qtyunit: column{ Name: "qtyunit", - DBType: "fieldseeker.treatment_mosquitoproductmeasureunit_enum", + DBType: "character varying", Default: "NULL", - Comment: "Quantity Unit", + Comment: "Original attribute from ArcGIS API is QTYUNIT", Nullable: true, Generated: false, AutoIncr: false, }, Method: column{ Name: "method", - DBType: "fieldseeker.treatment_treatment_method_d558ca3ccf43440c8160758253967621_enu", + DBType: "character varying", Default: "NULL", - Comment: "Method", + Comment: "Original attribute from ArcGIS API is METHOD", Nullable: true, Generated: false, AutoIncr: false, }, Equiptype: column{ Name: "equiptype", - DBType: "fieldseeker.treatment_treatment_equiptype_45694d79_ff21_42cc_be4f_a0d1def4f", + DBType: "character varying", Default: "NULL", - Comment: "Equipment Type", + Comment: "Original attribute from ArcGIS API is EQUIPTYPE", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerTreatments = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "Comments", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerTreatments = Table[ Name: "avetemp", DBType: "double precision", Default: "NULL", - Comment: "Average Temperature", + Comment: "Original attribute from ArcGIS API is AVETEMP", Nullable: true, Generated: false, AutoIncr: false, @@ -118,16 +118,16 @@ var FieldseekerTreatments = Table[ Name: "windspeed", DBType: "double precision", Default: "NULL", - Comment: "Wind Speed", + Comment: "Original attribute from ArcGIS API is WINDSPEED", Nullable: true, Generated: false, AutoIncr: false, }, Winddir: column{ Name: "winddir", - DBType: "fieldseeker.treatment_notinuiwinddirection_enum", + DBType: "character varying", Default: "NULL", - Comment: "Wind Direction", + Comment: "Original attribute from ArcGIS API is WINDDIR", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerTreatments = Table[ Name: "raingauge", DBType: "double precision", Default: "NULL", - Comment: "Rain Gauge", + Comment: "Original attribute from ArcGIS API is RAINGAUGE", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerTreatments = Table[ Name: "startdatetime", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Start", + Comment: "Original attribute from ArcGIS API is STARTDATETIME", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerTreatments = Table[ Name: "enddatetime", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Finish", + Comment: "Original attribute from ArcGIS API is ENDDATETIME", Nullable: true, Generated: false, AutoIncr: false, @@ -163,16 +163,16 @@ var FieldseekerTreatments = Table[ Name: "insp_id", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is INSP_ID", Nullable: true, Generated: false, AutoIncr: false, }, Reviewed: column{ Name: "reviewed", - DBType: "fieldseeker.treatment_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Reviewed", + Comment: "Original attribute from ArcGIS API is REVIEWED", Nullable: true, Generated: false, AutoIncr: false, @@ -181,7 +181,7 @@ var FieldseekerTreatments = Table[ Name: "reviewedby", DBType: "character varying", Default: "NULL", - Comment: "Reviewed By", + Comment: "Original attribute from ArcGIS API is REVIEWEDBY", Nullable: true, Generated: false, AutoIncr: false, @@ -190,7 +190,7 @@ var FieldseekerTreatments = Table[ Name: "revieweddate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Reviewed Date", + Comment: "Original attribute from ArcGIS API is REVIEWEDDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -199,7 +199,7 @@ var FieldseekerTreatments = Table[ Name: "locationname", DBType: "character varying", Default: "NULL", - Comment: "Location Name", + Comment: "Original attribute from ArcGIS API is LOCATIONNAME", Nullable: true, Generated: false, AutoIncr: false, @@ -208,16 +208,16 @@ var FieldseekerTreatments = Table[ Name: "zone", DBType: "character varying", Default: "NULL", - Comment: "Zone", + Comment: "Original attribute from ArcGIS API is ZONE", Nullable: true, Generated: false, AutoIncr: false, }, Warningoverride: column{ Name: "warningoverride", - DBType: "fieldseeker.treatment_notinuit_f_enum", + DBType: "smallint", Default: "NULL", - Comment: "Warning Override", + Comment: "Original attribute from ArcGIS API is WARNINGOVERRIDE", Nullable: true, Generated: false, AutoIncr: false, @@ -226,7 +226,7 @@ var FieldseekerTreatments = Table[ Name: "recordstatus", DBType: "smallint", Default: "NULL", - Comment: "RecordStatus", + Comment: "Original attribute from ArcGIS API is RECORDSTATUS", Nullable: true, Generated: false, AutoIncr: false, @@ -235,7 +235,7 @@ var FieldseekerTreatments = Table[ Name: "zone2", DBType: "character varying", Default: "NULL", - Comment: "Zone2", + Comment: "Original attribute from ArcGIS API is ZONE2", Nullable: true, Generated: false, AutoIncr: false, @@ -244,7 +244,7 @@ var FieldseekerTreatments = Table[ Name: "treatacres", DBType: "double precision", Default: "NULL", - Comment: "Treated Acres", + Comment: "Original attribute from ArcGIS API is TREATACRES", Nullable: true, Generated: false, AutoIncr: false, @@ -253,7 +253,7 @@ var FieldseekerTreatments = Table[ Name: "tirecount", DBType: "smallint", Default: "NULL", - Comment: "Tire Count", + Comment: "Original attribute from ArcGIS API is TIRECOUNT", Nullable: true, Generated: false, AutoIncr: false, @@ -262,7 +262,7 @@ var FieldseekerTreatments = Table[ Name: "cbcount", DBType: "smallint", Default: "NULL", - Comment: "Catch Basin Count", + Comment: "Original attribute from ArcGIS API is CBCOUNT", Nullable: true, Generated: false, AutoIncr: false, @@ -271,7 +271,7 @@ var FieldseekerTreatments = Table[ Name: "containercount", DBType: "smallint", Default: "NULL", - Comment: "Container Count", + Comment: "Original attribute from ArcGIS API is CONTAINERCOUNT", Nullable: true, Generated: false, AutoIncr: false, @@ -280,7 +280,7 @@ var FieldseekerTreatments = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -289,7 +289,7 @@ var FieldseekerTreatments = Table[ Name: "treatmentlength", DBType: "double precision", Default: "NULL", - Comment: "Treatment Length", + Comment: "Original attribute from ArcGIS API is TREATMENTLENGTH", Nullable: true, Generated: false, AutoIncr: false, @@ -298,7 +298,7 @@ var FieldseekerTreatments = Table[ Name: "treatmenthours", DBType: "double precision", Default: "NULL", - Comment: "Treatment Hours", + Comment: "Original attribute from ArcGIS API is TREATMENTHOURS", Nullable: true, Generated: false, AutoIncr: false, @@ -307,7 +307,7 @@ var FieldseekerTreatments = Table[ Name: "treatmentlengthunits", DBType: "character varying", Default: "NULL", - Comment: "Treatment Length Units", + Comment: "Original attribute from ArcGIS API is TREATMENTLENGTHUNITS", Nullable: true, Generated: false, AutoIncr: false, @@ -316,7 +316,7 @@ var FieldseekerTreatments = Table[ Name: "linelocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is LINELOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -325,7 +325,7 @@ var FieldseekerTreatments = Table[ Name: "pointlocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is POINTLOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -334,7 +334,7 @@ var FieldseekerTreatments = Table[ Name: "polygonlocid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is POLYGONLOCID", Nullable: true, Generated: false, AutoIncr: false, @@ -343,7 +343,7 @@ var FieldseekerTreatments = Table[ Name: "srid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is SRID", Nullable: true, Generated: false, AutoIncr: false, @@ -352,7 +352,7 @@ var FieldseekerTreatments = Table[ Name: "sdid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is SDID", Nullable: true, Generated: false, AutoIncr: false, @@ -361,7 +361,7 @@ var FieldseekerTreatments = Table[ Name: "barrierrouteid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is BARRIERROUTEID", Nullable: true, Generated: false, AutoIncr: false, @@ -370,7 +370,7 @@ var FieldseekerTreatments = Table[ Name: "ulvrouteid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is ULVROUTEID", Nullable: true, Generated: false, AutoIncr: false, @@ -379,7 +379,7 @@ var FieldseekerTreatments = Table[ Name: "fieldtech", DBType: "character varying", Default: "NULL", - Comment: "Field Tech", + Comment: "Original attribute from ArcGIS API is FIELDTECH", Nullable: true, Generated: false, AutoIncr: false, @@ -388,7 +388,7 @@ var FieldseekerTreatments = Table[ Name: "ptaid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is PTAID", Nullable: true, Generated: false, AutoIncr: false, @@ -397,16 +397,16 @@ var FieldseekerTreatments = Table[ Name: "flowrate", DBType: "double precision", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is FLOWRATE", Nullable: true, Generated: false, AutoIncr: false, }, Habitat: column{ Name: "habitat", - DBType: "fieldseeker.treatment_treatment_habitat_0afee7eb_f9ea_4707_8483_cccfe60f0d1", + DBType: "character varying", Default: "NULL", - Comment: "Habitat", + Comment: "Original attribute from ArcGIS API is HABITAT", Nullable: true, Generated: false, AutoIncr: false, @@ -415,7 +415,7 @@ var FieldseekerTreatments = Table[ Name: "treathectares", DBType: "double precision", Default: "NULL", - Comment: "Treat Hectares", + Comment: "Original attribute from ArcGIS API is TREATHECTARES", Nullable: true, Generated: false, AutoIncr: false, @@ -424,25 +424,25 @@ var FieldseekerTreatments = Table[ Name: "invloc", DBType: "character varying", Default: "NULL", - Comment: "Inventory Location", + Comment: "Original attribute from ArcGIS API is INVLOC", Nullable: true, Generated: false, AutoIncr: false, }, TempSitecond: column{ Name: "temp_sitecond", - DBType: "fieldseeker.treatment_treatment_sitecond_f812e1f64dcb4dc9a75da9d00abe6169_e", + DBType: "character varying", Default: "NULL", - Comment: "temp_Conditions", + Comment: "Original attribute from ArcGIS API is temp_SITECOND", Nullable: true, Generated: false, AutoIncr: false, }, Sitecond: column{ Name: "sitecond", - DBType: "fieldseeker.treatment_treatment_sitecond_5a15bf36fa124280b961f31cd1a9b571_e", + DBType: "character varying", Default: "NULL", - Comment: "Conditions", + Comment: "Original attribute from ArcGIS API is SITECOND", Nullable: true, Generated: false, AutoIncr: false, @@ -451,7 +451,7 @@ var FieldseekerTreatments = Table[ Name: "totalcostprodcut", DBType: "double precision", Default: "NULL", - Comment: "TotalCostProduct", + Comment: "Original attribute from ArcGIS API is TotalCostProdcut", Nullable: true, Generated: false, AutoIncr: false, @@ -460,7 +460,7 @@ var FieldseekerTreatments = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -469,7 +469,7 @@ var FieldseekerTreatments = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -478,7 +478,7 @@ var FieldseekerTreatments = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -487,7 +487,7 @@ var FieldseekerTreatments = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, @@ -496,7 +496,25 @@ var FieldseekerTreatments = Table[ Name: "targetspecies", DBType: "character varying", Default: "NULL", - Comment: "Target Species", + Comment: "Original attribute from ArcGIS API is TARGETSPECIES", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", + Comment: "", Nullable: true, Generated: false, AutoIncr: false, @@ -505,7 +523,16 @@ var FieldseekerTreatments = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -540,6 +567,17 @@ var FieldseekerTreatments = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerTreatmentForeignKeys{ + FieldseekerTreatmentTreatmentOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.treatment.treatment_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -599,12 +637,15 @@ type fieldseekerTreatmentColumns struct { Editdate column Editor column Targetspecies column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerTreatmentColumns) AsSlice() []column { return []column{ - c.Objectid, c.Activity, c.Treatarea, c.Areaunit, c.Product, c.Qty, c.Qtyunit, c.Method, c.Equiptype, c.Comments, c.Avetemp, c.Windspeed, c.Winddir, c.Raingauge, c.Startdatetime, c.Enddatetime, c.InspID, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Locationname, c.Zone, c.Warningoverride, c.Recordstatus, c.Zone2, c.Treatacres, c.Tirecount, c.Cbcount, c.Containercount, c.Globalid, c.Treatmentlength, c.Treatmenthours, c.Treatmentlengthunits, c.Linelocid, c.Pointlocid, c.Polygonlocid, c.Srid, c.Sdid, c.Barrierrouteid, c.Ulvrouteid, c.Fieldtech, c.Ptaid, c.Flowrate, c.Habitat, c.Treathectares, c.Invloc, c.TempSitecond, c.Sitecond, c.Totalcostprodcut, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Targetspecies, c.Version, + c.Objectid, c.Activity, c.Treatarea, c.Areaunit, c.Product, c.Qty, c.Qtyunit, c.Method, c.Equiptype, c.Comments, c.Avetemp, c.Windspeed, c.Winddir, c.Raingauge, c.Startdatetime, c.Enddatetime, c.InspID, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Locationname, c.Zone, c.Warningoverride, c.Recordstatus, c.Zone2, c.Treatacres, c.Tirecount, c.Cbcount, c.Containercount, c.Globalid, c.Treatmentlength, c.Treatmenthours, c.Treatmentlengthunits, c.Linelocid, c.Pointlocid, c.Polygonlocid, c.Srid, c.Sdid, c.Barrierrouteid, c.Ulvrouteid, c.Fieldtech, c.Ptaid, c.Flowrate, c.Habitat, c.Treathectares, c.Invloc, c.TempSitecond, c.Sitecond, c.Totalcostprodcut, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Targetspecies, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -618,10 +659,14 @@ func (i fieldseekerTreatmentIndexes) AsSlice() []index { } } -type fieldseekerTreatmentForeignKeys struct{} +type fieldseekerTreatmentForeignKeys struct { + FieldseekerTreatmentTreatmentOrganizationIDFkey foreignKey +} func (f fieldseekerTreatmentForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerTreatmentTreatmentOrganizationIDFkey, + } } type fieldseekerTreatmentUniques struct{} diff --git a/db/dbinfo/fieldseeker.treatmentarea.bob.go b/db/dbinfo/fieldseeker.treatmentarea.bob.go index 2a254faf..c44f18f6 100644 --- a/db/dbinfo/fieldseeker.treatmentarea.bob.go +++ b/db/dbinfo/fieldseeker.treatmentarea.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerTreatmentareas = Table[ Name: "treat_id", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is TREAT_ID", Nullable: true, Generated: false, AutoIncr: false, @@ -37,7 +37,7 @@ var FieldseekerTreatmentareas = Table[ Name: "session_id", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is SESSION_ID", Nullable: true, Generated: false, AutoIncr: false, @@ -46,7 +46,7 @@ var FieldseekerTreatmentareas = Table[ Name: "treatdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "Treatment Date", + Comment: "Original attribute from ArcGIS API is TREATDATE", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerTreatmentareas = Table[ Name: "comments", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is COMMENTS", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerTreatmentareas = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerTreatmentareas = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerTreatmentareas = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerTreatmentareas = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerTreatmentareas = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerTreatmentareas = Table[ Name: "notified", DBType: "smallint", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Notified", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerTreatmentareas = Table[ Name: "type", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Type", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerTreatmentareas = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -136,7 +136,7 @@ var FieldseekerTreatmentareas = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -145,7 +145,7 @@ var FieldseekerTreatmentareas = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -154,7 +154,7 @@ var FieldseekerTreatmentareas = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, @@ -163,7 +163,7 @@ var FieldseekerTreatmentareas = Table[ Name: "shape__area", DBType: "double precision", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Shape__Area", Nullable: true, Generated: false, AutoIncr: false, @@ -172,6 +172,24 @@ var FieldseekerTreatmentareas = Table[ Name: "shape__length", DBType: "double precision", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Shape__Length", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -181,7 +199,16 @@ var FieldseekerTreatmentareas = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -216,6 +243,17 @@ var FieldseekerTreatmentareas = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerTreatmentareaForeignKeys{ + FieldseekerTreatmentareaTreatmentareaOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.treatmentarea.treatmentarea_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -239,12 +277,15 @@ type fieldseekerTreatmentareaColumns struct { Editor column ShapeArea column ShapeLength column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerTreatmentareaColumns) AsSlice() []column { return []column{ - c.Objectid, c.TreatID, c.SessionID, c.Treatdate, c.Comments, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Notified, c.Type, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.ShapeArea, c.ShapeLength, c.Version, + c.Objectid, c.TreatID, c.SessionID, c.Treatdate, c.Comments, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Notified, c.Type, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.ShapeArea, c.ShapeLength, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -258,10 +299,14 @@ func (i fieldseekerTreatmentareaIndexes) AsSlice() []index { } } -type fieldseekerTreatmentareaForeignKeys struct{} +type fieldseekerTreatmentareaForeignKeys struct { + FieldseekerTreatmentareaTreatmentareaOrganizationIDFkey foreignKey +} func (f fieldseekerTreatmentareaForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerTreatmentareaTreatmentareaOrganizationIDFkey, + } } type fieldseekerTreatmentareaUniques struct{} diff --git a/db/dbinfo/fieldseeker.zones.bob.go b/db/dbinfo/fieldseeker.zones.bob.go index e3770abb..04e94a1d 100644 --- a/db/dbinfo/fieldseeker.zones.bob.go +++ b/db/dbinfo/fieldseeker.zones.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerZones = Table[ Name: "name", DBType: "character varying", Default: "NULL", - Comment: "Name", + Comment: "Original attribute from ArcGIS API is NAME", Nullable: true, Generated: false, AutoIncr: false, @@ -37,7 +37,7 @@ var FieldseekerZones = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -46,7 +46,7 @@ var FieldseekerZones = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerZones = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerZones = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerZones = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerZones = Table[ Name: "active", DBType: "integer", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is ACTIVE", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerZones = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerZones = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerZones = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerZones = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, @@ -127,7 +127,7 @@ var FieldseekerZones = Table[ Name: "shape__area", DBType: "double precision", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Shape__Area", Nullable: true, Generated: false, AutoIncr: false, @@ -136,6 +136,24 @@ var FieldseekerZones = Table[ Name: "shape__length", DBType: "double precision", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Shape__Length", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -145,7 +163,16 @@ var FieldseekerZones = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -180,6 +207,17 @@ var FieldseekerZones = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerZoneForeignKeys{ + FieldseekerZonesZonesOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.zones.zones_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -199,12 +237,15 @@ type fieldseekerZoneColumns struct { Editor column ShapeArea column ShapeLength column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerZoneColumns) AsSlice() []column { return []column{ - c.Objectid, c.Name, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Active, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.ShapeArea, c.ShapeLength, c.Version, + c.Objectid, c.Name, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Active, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.ShapeArea, c.ShapeLength, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -218,10 +259,14 @@ func (i fieldseekerZoneIndexes) AsSlice() []index { } } -type fieldseekerZoneForeignKeys struct{} +type fieldseekerZoneForeignKeys struct { + FieldseekerZonesZonesOrganizationIDFkey foreignKey +} func (f fieldseekerZoneForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerZonesZonesOrganizationIDFkey, + } } type fieldseekerZoneUniques struct{} diff --git a/db/dbinfo/fieldseeker.zones2.bob.go b/db/dbinfo/fieldseeker.zones2.bob.go index c0ba77dd..987d7370 100644 --- a/db/dbinfo/fieldseeker.zones2.bob.go +++ b/db/dbinfo/fieldseeker.zones2.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo @@ -28,7 +28,7 @@ var FieldseekerZones2s = Table[ Name: "name", DBType: "character varying", Default: "NULL", - Comment: "Name", + Comment: "Original attribute from ArcGIS API is NAME", Nullable: true, Generated: false, AutoIncr: false, @@ -37,7 +37,7 @@ var FieldseekerZones2s = Table[ Name: "globalid", DBType: "uuid", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is GlobalID", Nullable: true, Generated: false, AutoIncr: false, @@ -46,7 +46,7 @@ var FieldseekerZones2s = Table[ Name: "created_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_user", Nullable: true, Generated: false, AutoIncr: false, @@ -55,7 +55,7 @@ var FieldseekerZones2s = Table[ Name: "created_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is created_date", Nullable: true, Generated: false, AutoIncr: false, @@ -64,7 +64,7 @@ var FieldseekerZones2s = Table[ Name: "last_edited_user", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_user", Nullable: true, Generated: false, AutoIncr: false, @@ -73,7 +73,7 @@ var FieldseekerZones2s = Table[ Name: "last_edited_date", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is last_edited_date", Nullable: true, Generated: false, AutoIncr: false, @@ -82,7 +82,7 @@ var FieldseekerZones2s = Table[ Name: "creationdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is CreationDate", Nullable: true, Generated: false, AutoIncr: false, @@ -91,7 +91,7 @@ var FieldseekerZones2s = Table[ Name: "creator", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Creator", Nullable: true, Generated: false, AutoIncr: false, @@ -100,7 +100,7 @@ var FieldseekerZones2s = Table[ Name: "editdate", DBType: "timestamp without time zone", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is EditDate", Nullable: true, Generated: false, AutoIncr: false, @@ -109,7 +109,7 @@ var FieldseekerZones2s = Table[ Name: "editor", DBType: "character varying", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Editor", Nullable: true, Generated: false, AutoIncr: false, @@ -118,7 +118,7 @@ var FieldseekerZones2s = Table[ Name: "shape__area", DBType: "double precision", Default: "NULL", - Comment: "", + Comment: "Original attribute from ArcGIS API is Shape__Area", Nullable: true, Generated: false, AutoIncr: false, @@ -127,6 +127,24 @@ var FieldseekerZones2s = Table[ Name: "shape__length", DBType: "double precision", Default: "NULL", + Comment: "Original attribute from ArcGIS API is Shape__Length", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "jsonb", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Geospatial: column{ + Name: "geospatial", + DBType: "geometry", + Default: "NULL", Comment: "", Nullable: true, Generated: false, @@ -136,7 +154,16 @@ var FieldseekerZones2s = Table[ Name: "version", DBType: "integer", Default: "1", - Comment: "Tracks version changes to the row. Increases when data is modified.", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", Nullable: false, Generated: false, AutoIncr: false, @@ -171,6 +198,17 @@ var FieldseekerZones2s = Table[ Columns: []string{"objectid", "version"}, Comment: "", }, + ForeignKeys: fieldseekerZones2ForeignKeys{ + FieldseekerZones2Zones2OrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "fieldseeker.zones2.zones2_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, Comment: "", } @@ -189,12 +227,15 @@ type fieldseekerZones2Columns struct { Editor column ShapeArea column ShapeLength column + Geometry column + Geospatial column Version column + OrganizationID column } func (c fieldseekerZones2Columns) AsSlice() []column { return []column{ - c.Objectid, c.Name, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.ShapeArea, c.ShapeLength, c.Version, + c.Objectid, c.Name, c.Globalid, c.CreatedUser, c.CreatedDate, c.LastEditedUser, c.LastEditedDate, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.ShapeArea, c.ShapeLength, c.Geometry, c.Geospatial, c.Version, c.OrganizationID, } } @@ -208,10 +249,14 @@ func (i fieldseekerZones2Indexes) AsSlice() []index { } } -type fieldseekerZones2ForeignKeys struct{} +type fieldseekerZones2ForeignKeys struct { + FieldseekerZones2Zones2OrganizationIDFkey foreignKey +} func (f fieldseekerZones2ForeignKeys) AsSlice() []foreignKey { - return []foreignKey{} + return []foreignKey{ + f.FieldseekerZones2Zones2OrganizationIDFkey, + } } type fieldseekerZones2Uniques struct{} diff --git a/db/dbinfo/fieldseeker_sync.bob.go b/db/dbinfo/fieldseeker_sync.bob.go index f3b1b8f5..cd4359fb 100644 --- a/db/dbinfo/fieldseeker_sync.bob.go +++ b/db/dbinfo/fieldseeker_sync.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo diff --git a/db/dbinfo/fs_containerrelate.bob.go b/db/dbinfo/fs_containerrelate.bob.go deleted file mode 100644 index be6b1380..00000000 --- a/db/dbinfo/fs_containerrelate.bob.go +++ /dev/null @@ -1,277 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSContainerrelates = Table[ - fsContainerrelateColumns, - fsContainerrelateIndexes, - fsContainerrelateForeignKeys, - fsContainerrelateUniques, - fsContainerrelateChecks, -]{ - Schema: "", - Name: "fs_containerrelate", - Columns: fsContainerrelateColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Containertype: column{ - Name: "containertype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Inspsampleid: column{ - Name: "inspsampleid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Mosquitoinspid: column{ - Name: "mosquitoinspid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Treatmentid: column{ - Name: "treatmentid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsContainerrelateIndexes{ - FSContainerrelatePkey: index{ - Type: "btree", - Name: "fs_containerrelate_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_containerrelate_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsContainerrelateForeignKeys{ - FSContainerrelateFSContainerrelateOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_containerrelate.fs_containerrelate_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsContainerrelateColumns struct { - OrganizationID column - Containertype column - Creationdate column - Creator column - Editdate column - Editor column - Globalid column - Inspsampleid column - Mosquitoinspid column - Objectid column - Treatmentid column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Updated column -} - -func (c fsContainerrelateColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Containertype, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Inspsampleid, c.Mosquitoinspid, c.Objectid, c.Treatmentid, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Updated, - } -} - -type fsContainerrelateIndexes struct { - FSContainerrelatePkey index -} - -func (i fsContainerrelateIndexes) AsSlice() []index { - return []index{ - i.FSContainerrelatePkey, - } -} - -type fsContainerrelateForeignKeys struct { - FSContainerrelateFSContainerrelateOrganizationIDFkey foreignKey -} - -func (f fsContainerrelateForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSContainerrelateFSContainerrelateOrganizationIDFkey, - } -} - -type fsContainerrelateUniques struct{} - -func (u fsContainerrelateUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsContainerrelateChecks struct{} - -func (c fsContainerrelateChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_fieldscoutinglog.bob.go b/db/dbinfo/fs_fieldscoutinglog.bob.go deleted file mode 100644 index 4ded1baf..00000000 --- a/db/dbinfo/fs_fieldscoutinglog.bob.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSFieldscoutinglogs = Table[ - fsFieldscoutinglogColumns, - fsFieldscoutinglogIndexes, - fsFieldscoutinglogForeignKeys, - fsFieldscoutinglogUniques, - fsFieldscoutinglogChecks, -]{ - Schema: "", - Name: "fs_fieldscoutinglog", - Columns: fsFieldscoutinglogColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Status: column{ - Name: "status", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsFieldscoutinglogIndexes{ - FSFieldscoutinglogPkey: index{ - Type: "btree", - Name: "fs_fieldscoutinglog_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_fieldscoutinglog_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsFieldscoutinglogForeignKeys{ - FSFieldscoutinglogFSFieldscoutinglogOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_fieldscoutinglog.fs_fieldscoutinglog_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsFieldscoutinglogColumns struct { - OrganizationID column - Creationdate column - Creator column - Editdate column - Editor column - Globalid column - Objectid column - Status column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Updated column -} - -func (c fsFieldscoutinglogColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Objectid, c.Status, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Updated, - } -} - -type fsFieldscoutinglogIndexes struct { - FSFieldscoutinglogPkey index -} - -func (i fsFieldscoutinglogIndexes) AsSlice() []index { - return []index{ - i.FSFieldscoutinglogPkey, - } -} - -type fsFieldscoutinglogForeignKeys struct { - FSFieldscoutinglogFSFieldscoutinglogOrganizationIDFkey foreignKey -} - -func (f fsFieldscoutinglogForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSFieldscoutinglogFSFieldscoutinglogOrganizationIDFkey, - } -} - -type fsFieldscoutinglogUniques struct{} - -func (u fsFieldscoutinglogUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsFieldscoutinglogChecks struct{} - -func (c fsFieldscoutinglogChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_habitatrelate.bob.go b/db/dbinfo/fs_habitatrelate.bob.go deleted file mode 100644 index b7bdc903..00000000 --- a/db/dbinfo/fs_habitatrelate.bob.go +++ /dev/null @@ -1,257 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSHabitatrelates = Table[ - fsHabitatrelateColumns, - fsHabitatrelateIndexes, - fsHabitatrelateForeignKeys, - fsHabitatrelateUniques, - fsHabitatrelateChecks, -]{ - Schema: "", - Name: "fs_habitatrelate", - Columns: fsHabitatrelateColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ForeignID: column{ - Name: "foreign_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Habitattype: column{ - Name: "habitattype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsHabitatrelateIndexes{ - FSHabitatrelatePkey: index{ - Type: "btree", - Name: "fs_habitatrelate_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_habitatrelate_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsHabitatrelateForeignKeys{ - FSHabitatrelateFSHabitatrelateOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_habitatrelate.fs_habitatrelate_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsHabitatrelateColumns struct { - OrganizationID column - Creationdate column - Creator column - Editdate column - Editor column - ForeignID column - Globalid column - Habitattype column - Objectid column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Updated column -} - -func (c fsHabitatrelateColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.ForeignID, c.Globalid, c.Habitattype, c.Objectid, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Updated, - } -} - -type fsHabitatrelateIndexes struct { - FSHabitatrelatePkey index -} - -func (i fsHabitatrelateIndexes) AsSlice() []index { - return []index{ - i.FSHabitatrelatePkey, - } -} - -type fsHabitatrelateForeignKeys struct { - FSHabitatrelateFSHabitatrelateOrganizationIDFkey foreignKey -} - -func (f fsHabitatrelateForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSHabitatrelateFSHabitatrelateOrganizationIDFkey, - } -} - -type fsHabitatrelateUniques struct{} - -func (u fsHabitatrelateUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsHabitatrelateChecks struct{} - -func (c fsHabitatrelateChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_inspectionsample.bob.go b/db/dbinfo/fs_inspectionsample.bob.go deleted file mode 100644 index 0e503d3f..00000000 --- a/db/dbinfo/fs_inspectionsample.bob.go +++ /dev/null @@ -1,277 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSInspectionsamples = Table[ - fsInspectionsampleColumns, - fsInspectionsampleIndexes, - fsInspectionsampleForeignKeys, - fsInspectionsampleUniques, - fsInspectionsampleChecks, -]{ - Schema: "", - Name: "fs_inspectionsample", - Columns: fsInspectionsampleColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Idbytech: column{ - Name: "idbytech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - InspID: column{ - Name: "insp_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Processed: column{ - Name: "processed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sampleid: column{ - Name: "sampleid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsInspectionsampleIndexes{ - FSInspectionsamplePkey: index{ - Type: "btree", - Name: "fs_inspectionsample_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_inspectionsample_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsInspectionsampleForeignKeys{ - FSInspectionsampleFSInspectionsampleOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_inspectionsample.fs_inspectionsample_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsInspectionsampleColumns struct { - OrganizationID column - Creationdate column - Creator column - Editdate column - Editor column - Globalid column - Idbytech column - InspID column - Objectid column - Processed column - Sampleid column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Updated column -} - -func (c fsInspectionsampleColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Idbytech, c.InspID, c.Objectid, c.Processed, c.Sampleid, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Updated, - } -} - -type fsInspectionsampleIndexes struct { - FSInspectionsamplePkey index -} - -func (i fsInspectionsampleIndexes) AsSlice() []index { - return []index{ - i.FSInspectionsamplePkey, - } -} - -type fsInspectionsampleForeignKeys struct { - FSInspectionsampleFSInspectionsampleOrganizationIDFkey foreignKey -} - -func (f fsInspectionsampleForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSInspectionsampleFSInspectionsampleOrganizationIDFkey, - } -} - -type fsInspectionsampleUniques struct{} - -func (u fsInspectionsampleUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsInspectionsampleChecks struct{} - -func (c fsInspectionsampleChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_inspectionsampledetail.bob.go b/db/dbinfo/fs_inspectionsampledetail.bob.go deleted file mode 100644 index 5a903c84..00000000 --- a/db/dbinfo/fs_inspectionsampledetail.bob.go +++ /dev/null @@ -1,387 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSInspectionsampledetails = Table[ - fsInspectionsampledetailColumns, - fsInspectionsampledetailIndexes, - fsInspectionsampledetailForeignKeys, - fsInspectionsampledetailUniques, - fsInspectionsampledetailChecks, -]{ - Schema: "", - Name: "fs_inspectionsampledetail", - Columns: fsInspectionsampledetailColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fadultact: column{ - Name: "fadultact", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fdomstage: column{ - Name: "fdomstage", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Feggcount: column{ - Name: "feggcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldspecies: column{ - Name: "fieldspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Flarvcount: column{ - Name: "flarvcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Flstages: column{ - Name: "flstages", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fpupcount: column{ - Name: "fpupcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - InspsampleID: column{ - Name: "inspsample_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Labspecies: column{ - Name: "labspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Ldomstage: column{ - Name: "ldomstage", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Leggcount: column{ - Name: "leggcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Llarvcount: column{ - Name: "llarvcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lpupcount: column{ - Name: "lpupcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Processed: column{ - Name: "processed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsInspectionsampledetailIndexes{ - FSInspectionsampledetailPkey: index{ - Type: "btree", - Name: "fs_inspectionsampledetail_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_inspectionsampledetail_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsInspectionsampledetailForeignKeys{ - FSInspectionsampledetailFSInspectionsampledetailOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_inspectionsampledetail.fs_inspectionsampledetail_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsInspectionsampledetailColumns struct { - OrganizationID column - Comments column - Creationdate column - Creator column - Editdate column - Editor column - Fadultact column - Fdomstage column - Feggcount column - Fieldspecies column - Flarvcount column - Flstages column - Fpupcount column - Globalid column - InspsampleID column - Labspecies column - Ldomstage column - Leggcount column - Llarvcount column - Lpupcount column - Objectid column - Processed column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Updated column -} - -func (c fsInspectionsampledetailColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Fadultact, c.Fdomstage, c.Feggcount, c.Fieldspecies, c.Flarvcount, c.Flstages, c.Fpupcount, c.Globalid, c.InspsampleID, c.Labspecies, c.Ldomstage, c.Leggcount, c.Llarvcount, c.Lpupcount, c.Objectid, c.Processed, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Updated, - } -} - -type fsInspectionsampledetailIndexes struct { - FSInspectionsampledetailPkey index -} - -func (i fsInspectionsampledetailIndexes) AsSlice() []index { - return []index{ - i.FSInspectionsampledetailPkey, - } -} - -type fsInspectionsampledetailForeignKeys struct { - FSInspectionsampledetailFSInspectionsampledetailOrganizationIDFkey foreignKey -} - -func (f fsInspectionsampledetailForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSInspectionsampledetailFSInspectionsampledetailOrganizationIDFkey, - } -} - -type fsInspectionsampledetailUniques struct{} - -func (u fsInspectionsampledetailUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsInspectionsampledetailChecks struct{} - -func (c fsInspectionsampledetailChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_linelocation.bob.go b/db/dbinfo/fs_linelocation.bob.go deleted file mode 100644 index 96abf326..00000000 --- a/db/dbinfo/fs_linelocation.bob.go +++ /dev/null @@ -1,617 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSLinelocations = Table[ - fsLinelocationColumns, - fsLinelocationIndexes, - fsLinelocationForeignKeys, - fsLinelocationUniques, - fsLinelocationChecks, -]{ - Schema: "", - Name: "fs_linelocation", - Columns: fsLinelocationColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accessdesc: column{ - Name: "accessdesc", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Acres: column{ - Name: "acres", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Active: column{ - Name: "active", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Description: column{ - Name: "description", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Habitat: column{ - Name: "habitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Hectares: column{ - Name: "hectares", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Jurisdiction: column{ - Name: "jurisdiction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvinspectinterval: column{ - Name: "larvinspectinterval", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectactiontaken: column{ - Name: "lastinspectactiontaken", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectactivity: column{ - Name: "lastinspectactivity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectavglarvae: column{ - Name: "lastinspectavglarvae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectavgpupae: column{ - Name: "lastinspectavgpupae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectbreeding: column{ - Name: "lastinspectbreeding", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectconditions: column{ - Name: "lastinspectconditions", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectdate: column{ - Name: "lastinspectdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectfieldspecies: column{ - Name: "lastinspectfieldspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectlstages: column{ - Name: "lastinspectlstages", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatactivity: column{ - Name: "lasttreatactivity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatdate: column{ - Name: "lasttreatdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatproduct: column{ - Name: "lasttreatproduct", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqty: column{ - Name: "lasttreatqty", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqtyunit: column{ - Name: "lasttreatqtyunit", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LengthFT: column{ - Name: "length_ft", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LengthMeters: column{ - Name: "length_meters", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationnumber: column{ - Name: "locationnumber", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nextactiondatescheduled: column{ - Name: "nextactiondatescheduled", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Symbology: column{ - Name: "symbology", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeLength: column{ - Name: "shape__length", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Usetype: column{ - Name: "usetype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Waterorigin: column{ - Name: "waterorigin", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - WidthFT: column{ - Name: "width_ft", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - WidthMeters: column{ - Name: "width_meters", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsLinelocationIndexes{ - FSLinelocationPkey: index{ - Type: "btree", - Name: "fs_linelocation_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_linelocation_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsLinelocationForeignKeys{ - FSLinelocationFSLinelocationOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_linelocation.fs_linelocation_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsLinelocationColumns struct { - OrganizationID column - Accessdesc column - Acres column - Active column - Comments column - Creationdate column - Creator column - Description column - Externalid column - Editdate column - Editor column - Globalid column - Habitat column - Hectares column - Jurisdiction column - Larvinspectinterval column - Lastinspectactiontaken column - Lastinspectactivity column - Lastinspectavglarvae column - Lastinspectavgpupae column - Lastinspectbreeding column - Lastinspectconditions column - Lastinspectdate column - Lastinspectfieldspecies column - Lastinspectlstages column - Lasttreatactivity column - Lasttreatdate column - Lasttreatproduct column - Lasttreatqty column - Lasttreatqtyunit column - LengthFT column - LengthMeters column - Locationnumber column - Name column - Nextactiondatescheduled column - Objectid column - Priority column - Symbology column - ShapeLength column - Usetype column - Waterorigin column - WidthFT column - WidthMeters column - Zone column - Zone2 column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Updated column -} - -func (c fsLinelocationColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accessdesc, c.Acres, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Globalid, c.Habitat, c.Hectares, c.Jurisdiction, c.Larvinspectinterval, c.Lastinspectactiontaken, c.Lastinspectactivity, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectbreeding, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectfieldspecies, c.Lastinspectlstages, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.LengthFT, c.LengthMeters, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.ShapeLength, c.Usetype, c.Waterorigin, c.WidthFT, c.WidthMeters, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Updated, - } -} - -type fsLinelocationIndexes struct { - FSLinelocationPkey index -} - -func (i fsLinelocationIndexes) AsSlice() []index { - return []index{ - i.FSLinelocationPkey, - } -} - -type fsLinelocationForeignKeys struct { - FSLinelocationFSLinelocationOrganizationIDFkey foreignKey -} - -func (f fsLinelocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSLinelocationFSLinelocationOrganizationIDFkey, - } -} - -type fsLinelocationUniques struct{} - -func (u fsLinelocationUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsLinelocationChecks struct{} - -func (c fsLinelocationChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_locationtracking.bob.go b/db/dbinfo/fs_locationtracking.bob.go deleted file mode 100644 index 4a28fd12..00000000 --- a/db/dbinfo/fs_locationtracking.bob.go +++ /dev/null @@ -1,257 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSLocationtrackings = Table[ - fsLocationtrackingColumns, - fsLocationtrackingIndexes, - fsLocationtrackingForeignKeys, - fsLocationtrackingUniques, - fsLocationtrackingChecks, -]{ - Schema: "", - Name: "fs_locationtracking", - Columns: fsLocationtrackingColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accuracy: column{ - Name: "accuracy", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldtech: column{ - Name: "fieldtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsLocationtrackingIndexes{ - FSLocationtrackingPkey: index{ - Type: "btree", - Name: "fs_locationtracking_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_locationtracking_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsLocationtrackingForeignKeys{ - FSLocationtrackingFSLocationtrackingOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_locationtracking.fs_locationtracking_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsLocationtrackingColumns struct { - OrganizationID column - Accuracy column - Creationdate column - Creator column - Editdate column - Editor column - Fieldtech column - Globalid column - Objectid column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Updated column -} - -func (c fsLocationtrackingColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accuracy, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Fieldtech, c.Globalid, c.Objectid, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Updated, - } -} - -type fsLocationtrackingIndexes struct { - FSLocationtrackingPkey index -} - -func (i fsLocationtrackingIndexes) AsSlice() []index { - return []index{ - i.FSLocationtrackingPkey, - } -} - -type fsLocationtrackingForeignKeys struct { - FSLocationtrackingFSLocationtrackingOrganizationIDFkey foreignKey -} - -func (f fsLocationtrackingForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSLocationtrackingFSLocationtrackingOrganizationIDFkey, - } -} - -type fsLocationtrackingUniques struct{} - -func (u fsLocationtrackingUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsLocationtrackingChecks struct{} - -func (c fsLocationtrackingChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_mosquitoinspection.bob.go b/db/dbinfo/fs_mosquitoinspection.bob.go deleted file mode 100644 index 2fab369e..00000000 --- a/db/dbinfo/fs_mosquitoinspection.bob.go +++ /dev/null @@ -1,735 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSMosquitoinspections = Table[ - fsMosquitoinspectionColumns, - fsMosquitoinspectionIndexes, - fsMosquitoinspectionForeignKeys, - fsMosquitoinspectionUniques, - fsMosquitoinspectionChecks, -]{ - Schema: "", - Name: "fs_mosquitoinspection", - Columns: fsMosquitoinspectionColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Actiontaken: column{ - Name: "actiontaken", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Activity: column{ - Name: "activity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Adultact: column{ - Name: "adultact", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Avetemp: column{ - Name: "avetemp", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Avglarvae: column{ - Name: "avglarvae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Avgpupae: column{ - Name: "avgpupae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Breeding: column{ - Name: "breeding", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Cbcount: column{ - Name: "cbcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Containercount: column{ - Name: "containercount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Domstage: column{ - Name: "domstage", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Eggs: column{ - Name: "eggs", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Enddatetime: column{ - Name: "enddatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldspecies: column{ - Name: "fieldspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldtech: column{ - Name: "fieldtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Jurisdiction: column{ - Name: "jurisdiction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvaepresent: column{ - Name: "larvaepresent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Linelocid: column{ - Name: "linelocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationname: column{ - Name: "locationname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lstages: column{ - Name: "lstages", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Numdips: column{ - Name: "numdips", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Personalcontact: column{ - Name: "personalcontact", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Pointlocid: column{ - Name: "pointlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Polygonlocid: column{ - Name: "polygonlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Posdips: column{ - Name: "posdips", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Positivecontainercount: column{ - Name: "positivecontainercount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Pupaepresent: column{ - Name: "pupaepresent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Raingauge: column{ - Name: "raingauge", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Recordstatus: column{ - Name: "recordstatus", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewed: column{ - Name: "reviewed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewedby: column{ - Name: "reviewedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Revieweddate: column{ - Name: "revieweddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sdid: column{ - Name: "sdid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sitecond: column{ - Name: "sitecond", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Srid: column{ - Name: "srid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Startdatetime: column{ - Name: "startdatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Tirecount: column{ - Name: "tirecount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Totlarvae: column{ - Name: "totlarvae", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Totpupae: column{ - Name: "totpupae", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Visualmonitoring: column{ - Name: "visualmonitoring", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vmcomments: column{ - Name: "vmcomments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Winddir: column{ - Name: "winddir", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Windspeed: column{ - Name: "windspeed", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Adminaction: column{ - Name: "adminaction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Ptaid: column{ - Name: "ptaid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Geom: column{ - Name: "geom", - DBType: "geometry", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsMosquitoinspectionIndexes{ - FSMosquitoinspectionPkey: index{ - Type: "btree", - Name: "fs_mosquitoinspection_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - IdxFSMosquitoinspectionGeom: index{ - Type: "gist", - Name: "idx_fs_mosquitoinspection_geom", - Columns: []indexColumn{ - { - Name: "geom", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: false, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_mosquitoinspection_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsMosquitoinspectionForeignKeys{ - FSMosquitoinspectionFSMosquitoinspectionOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_mosquitoinspection.fs_mosquitoinspection_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsMosquitoinspectionColumns struct { - OrganizationID column - Actiontaken column - Activity column - Adultact column - Avetemp column - Avglarvae column - Avgpupae column - Breeding column - Cbcount column - Comments column - Containercount column - Creationdate column - Creator column - Domstage column - Eggs column - Enddatetime column - Editdate column - Editor column - Fieldspecies column - Fieldtech column - Globalid column - Jurisdiction column - Larvaepresent column - Linelocid column - Locationname column - Lstages column - Numdips column - Objectid column - Personalcontact column - Pointlocid column - Polygonlocid column - Posdips column - Positivecontainercount column - Pupaepresent column - Raingauge column - Recordstatus column - Reviewed column - Reviewedby column - Revieweddate column - Sdid column - Sitecond column - Srid column - Startdatetime column - Tirecount column - Totlarvae column - Totpupae column - Visualmonitoring column - Vmcomments column - Winddir column - Windspeed column - Zone column - Zone2 column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Adminaction column - Ptaid column - Updated column - Geom column -} - -func (c fsMosquitoinspectionColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Actiontaken, c.Activity, c.Adultact, c.Avetemp, c.Avglarvae, c.Avgpupae, c.Breeding, c.Cbcount, c.Comments, c.Containercount, c.Creationdate, c.Creator, c.Domstage, c.Eggs, c.Enddatetime, c.Editdate, c.Editor, c.Fieldspecies, c.Fieldtech, c.Globalid, c.Jurisdiction, c.Larvaepresent, c.Linelocid, c.Locationname, c.Lstages, c.Numdips, c.Objectid, c.Personalcontact, c.Pointlocid, c.Polygonlocid, c.Posdips, c.Positivecontainercount, c.Pupaepresent, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sdid, c.Sitecond, c.Srid, c.Startdatetime, c.Tirecount, c.Totlarvae, c.Totpupae, c.Visualmonitoring, c.Vmcomments, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Adminaction, c.Ptaid, c.Updated, c.Geom, - } -} - -type fsMosquitoinspectionIndexes struct { - FSMosquitoinspectionPkey index - IdxFSMosquitoinspectionGeom index -} - -func (i fsMosquitoinspectionIndexes) AsSlice() []index { - return []index{ - i.FSMosquitoinspectionPkey, i.IdxFSMosquitoinspectionGeom, - } -} - -type fsMosquitoinspectionForeignKeys struct { - FSMosquitoinspectionFSMosquitoinspectionOrganizationIDFkey foreignKey -} - -func (f fsMosquitoinspectionForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSMosquitoinspectionFSMosquitoinspectionOrganizationIDFkey, - } -} - -type fsMosquitoinspectionUniques struct{} - -func (u fsMosquitoinspectionUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsMosquitoinspectionChecks struct{} - -func (c fsMosquitoinspectionChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_pointlocation.bob.go b/db/dbinfo/fs_pointlocation.bob.go deleted file mode 100644 index 09532922..00000000 --- a/db/dbinfo/fs_pointlocation.bob.go +++ /dev/null @@ -1,605 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSPointlocations = Table[ - fsPointlocationColumns, - fsPointlocationIndexes, - fsPointlocationForeignKeys, - fsPointlocationUniques, - fsPointlocationChecks, -]{ - Schema: "", - Name: "fs_pointlocation", - Columns: fsPointlocationColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accessdesc: column{ - Name: "accessdesc", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Active: column{ - Name: "active", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Description: column{ - Name: "description", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Habitat: column{ - Name: "habitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Jurisdiction: column{ - Name: "jurisdiction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvinspectinterval: column{ - Name: "larvinspectinterval", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectactiontaken: column{ - Name: "lastinspectactiontaken", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectactivity: column{ - Name: "lastinspectactivity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectavglarvae: column{ - Name: "lastinspectavglarvae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectavgpupae: column{ - Name: "lastinspectavgpupae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectbreeding: column{ - Name: "lastinspectbreeding", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectconditions: column{ - Name: "lastinspectconditions", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectdate: column{ - Name: "lastinspectdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectfieldspecies: column{ - Name: "lastinspectfieldspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectlstages: column{ - Name: "lastinspectlstages", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatactivity: column{ - Name: "lasttreatactivity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatdate: column{ - Name: "lasttreatdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatproduct: column{ - Name: "lasttreatproduct", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqty: column{ - Name: "lasttreatqty", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqtyunit: column{ - Name: "lasttreatqtyunit", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationnumber: column{ - Name: "locationnumber", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nextactiondatescheduled: column{ - Name: "nextactiondatescheduled", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Stype: column{ - Name: "stype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Symbology: column{ - Name: "symbology", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Usetype: column{ - Name: "usetype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Waterorigin: column{ - Name: "waterorigin", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - X: column{ - Name: "x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Y: column{ - Name: "y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Assignedtech: column{ - Name: "assignedtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - DeactivateReason: column{ - Name: "deactivate_reason", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Scalarpriority: column{ - Name: "scalarpriority", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sourcestatus: column{ - Name: "sourcestatus", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Geom: column{ - Name: "geom", - DBType: "geometry", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsPointlocationIndexes{ - FSPointlocationPkey: index{ - Type: "btree", - Name: "fs_pointlocation_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - IdxFSPointlocationGeom: index{ - Type: "gist", - Name: "idx_fs_pointlocation_geom", - Columns: []indexColumn{ - { - Name: "geom", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: false, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_pointlocation_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsPointlocationForeignKeys{ - FSPointlocationFSPointlocationOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_pointlocation.fs_pointlocation_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsPointlocationColumns struct { - OrganizationID column - Accessdesc column - Active column - Comments column - Creationdate column - Creator column - Description column - Externalid column - Editdate column - Editor column - Globalid column - Habitat column - Jurisdiction column - Larvinspectinterval column - Lastinspectactiontaken column - Lastinspectactivity column - Lastinspectavglarvae column - Lastinspectavgpupae column - Lastinspectbreeding column - Lastinspectconditions column - Lastinspectdate column - Lastinspectfieldspecies column - Lastinspectlstages column - Lasttreatactivity column - Lasttreatdate column - Lasttreatproduct column - Lasttreatqty column - Lasttreatqtyunit column - Locationnumber column - Name column - Nextactiondatescheduled column - Objectid column - Priority column - Stype column - Symbology column - Usetype column - Waterorigin column - X column - Y column - Zone column - Zone2 column - GeometryX column - GeometryY column - Assignedtech column - DeactivateReason column - Scalarpriority column - Sourcestatus column - Updated column - Geom column -} - -func (c fsPointlocationColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Globalid, c.Habitat, c.Jurisdiction, c.Larvinspectinterval, c.Lastinspectactiontaken, c.Lastinspectactivity, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectbreeding, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectfieldspecies, c.Lastinspectlstages, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Stype, c.Symbology, c.Usetype, c.Waterorigin, c.X, c.Y, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.Assignedtech, c.DeactivateReason, c.Scalarpriority, c.Sourcestatus, c.Updated, c.Geom, - } -} - -type fsPointlocationIndexes struct { - FSPointlocationPkey index - IdxFSPointlocationGeom index -} - -func (i fsPointlocationIndexes) AsSlice() []index { - return []index{ - i.FSPointlocationPkey, i.IdxFSPointlocationGeom, - } -} - -type fsPointlocationForeignKeys struct { - FSPointlocationFSPointlocationOrganizationIDFkey foreignKey -} - -func (f fsPointlocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSPointlocationFSPointlocationOrganizationIDFkey, - } -} - -type fsPointlocationUniques struct{} - -func (u fsPointlocationUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsPointlocationChecks struct{} - -func (c fsPointlocationChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_polygonlocation.bob.go b/db/dbinfo/fs_polygonlocation.bob.go deleted file mode 100644 index 0d0549ab..00000000 --- a/db/dbinfo/fs_polygonlocation.bob.go +++ /dev/null @@ -1,557 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSPolygonlocations = Table[ - fsPolygonlocationColumns, - fsPolygonlocationIndexes, - fsPolygonlocationForeignKeys, - fsPolygonlocationUniques, - fsPolygonlocationChecks, -]{ - Schema: "", - Name: "fs_polygonlocation", - Columns: fsPolygonlocationColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accessdesc: column{ - Name: "accessdesc", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Acres: column{ - Name: "acres", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Active: column{ - Name: "active", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Description: column{ - Name: "description", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Filter: column{ - Name: "filter", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Habitat: column{ - Name: "habitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Hectares: column{ - Name: "hectares", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Jurisdiction: column{ - Name: "jurisdiction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvinspectinterval: column{ - Name: "larvinspectinterval", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectactiontaken: column{ - Name: "lastinspectactiontaken", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectactivity: column{ - Name: "lastinspectactivity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectavglarvae: column{ - Name: "lastinspectavglarvae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectavgpupae: column{ - Name: "lastinspectavgpupae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectbreeding: column{ - Name: "lastinspectbreeding", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectconditions: column{ - Name: "lastinspectconditions", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectdate: column{ - Name: "lastinspectdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectfieldspecies: column{ - Name: "lastinspectfieldspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectlstages: column{ - Name: "lastinspectlstages", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatactivity: column{ - Name: "lasttreatactivity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatdate: column{ - Name: "lasttreatdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatproduct: column{ - Name: "lasttreatproduct", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqty: column{ - Name: "lasttreatqty", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqtyunit: column{ - Name: "lasttreatqtyunit", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationnumber: column{ - Name: "locationnumber", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nextactiondatescheduled: column{ - Name: "nextactiondatescheduled", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Symbology: column{ - Name: "symbology", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeArea: column{ - Name: "shape__area", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeLength: column{ - Name: "shape__length", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Usetype: column{ - Name: "usetype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Waterorigin: column{ - Name: "waterorigin", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsPolygonlocationIndexes{ - FSPolygonlocationPkey: index{ - Type: "btree", - Name: "fs_polygonlocation_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_polygonlocation_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsPolygonlocationForeignKeys{ - FSPolygonlocationFSPolygonlocationOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_polygonlocation.fs_polygonlocation_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsPolygonlocationColumns struct { - OrganizationID column - Accessdesc column - Acres column - Active column - Comments column - Creationdate column - Creator column - Description column - Externalid column - Editdate column - Editor column - Filter column - Globalid column - Habitat column - Hectares column - Jurisdiction column - Larvinspectinterval column - Lastinspectactiontaken column - Lastinspectactivity column - Lastinspectavglarvae column - Lastinspectavgpupae column - Lastinspectbreeding column - Lastinspectconditions column - Lastinspectdate column - Lastinspectfieldspecies column - Lastinspectlstages column - Lasttreatactivity column - Lasttreatdate column - Lasttreatproduct column - Lasttreatqty column - Lasttreatqtyunit column - Locationnumber column - Name column - Nextactiondatescheduled column - Objectid column - Priority column - Symbology column - ShapeArea column - ShapeLength column - Usetype column - Waterorigin column - Zone column - Zone2 column - GeometryX column - GeometryY column - Updated column -} - -func (c fsPolygonlocationColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accessdesc, c.Acres, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Filter, c.Globalid, c.Habitat, c.Hectares, c.Jurisdiction, c.Larvinspectinterval, c.Lastinspectactiontaken, c.Lastinspectactivity, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectbreeding, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectfieldspecies, c.Lastinspectlstages, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.ShapeArea, c.ShapeLength, c.Usetype, c.Waterorigin, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.Updated, - } -} - -type fsPolygonlocationIndexes struct { - FSPolygonlocationPkey index -} - -func (i fsPolygonlocationIndexes) AsSlice() []index { - return []index{ - i.FSPolygonlocationPkey, - } -} - -type fsPolygonlocationForeignKeys struct { - FSPolygonlocationFSPolygonlocationOrganizationIDFkey foreignKey -} - -func (f fsPolygonlocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSPolygonlocationFSPolygonlocationOrganizationIDFkey, - } -} - -type fsPolygonlocationUniques struct{} - -func (u fsPolygonlocationUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsPolygonlocationChecks struct{} - -func (c fsPolygonlocationChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_pool.bob.go b/db/dbinfo/fs_pool.bob.go deleted file mode 100644 index 2c490020..00000000 --- a/db/dbinfo/fs_pool.bob.go +++ /dev/null @@ -1,417 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSPools = Table[ - fsPoolColumns, - fsPoolIndexes, - fsPoolForeignKeys, - fsPoolUniques, - fsPoolChecks, -]{ - Schema: "", - Name: "fs_pool", - Columns: fsPoolColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Datesent: column{ - Name: "datesent", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Datetested: column{ - Name: "datetested", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Diseasepos: column{ - Name: "diseasepos", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Diseasetested: column{ - Name: "diseasetested", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Gatewaysync: column{ - Name: "gatewaysync", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Lab: column{ - Name: "lab", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LabID: column{ - Name: "lab_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Poolyear: column{ - Name: "poolyear", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Processed: column{ - Name: "processed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sampleid: column{ - Name: "sampleid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Survtech: column{ - Name: "survtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Testmethod: column{ - Name: "testmethod", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Testtech: column{ - Name: "testtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - TrapdataID: column{ - Name: "trapdata_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vectorsurvcollectionid: column{ - Name: "vectorsurvcollectionid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vectorsurvpoolid: column{ - Name: "vectorsurvpoolid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vectorsurvtrapdataid: column{ - Name: "vectorsurvtrapdataid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsPoolIndexes{ - FSPoolPkey: index{ - Type: "btree", - Name: "fs_pool_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_pool_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsPoolForeignKeys{ - FSPoolFSPoolOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_pool.fs_pool_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsPoolColumns struct { - OrganizationID column - Comments column - Creationdate column - Creator column - Datesent column - Datetested column - Diseasepos column - Diseasetested column - Editdate column - Editor column - Gatewaysync column - Globalid column - Lab column - LabID column - Objectid column - Poolyear column - Processed column - Sampleid column - Survtech column - Testmethod column - Testtech column - TrapdataID column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Vectorsurvcollectionid column - Vectorsurvpoolid column - Vectorsurvtrapdataid column - Updated column -} - -func (c fsPoolColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Datesent, c.Datetested, c.Diseasepos, c.Diseasetested, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Lab, c.LabID, c.Objectid, c.Poolyear, c.Processed, c.Sampleid, c.Survtech, c.Testmethod, c.Testtech, c.TrapdataID, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Vectorsurvcollectionid, c.Vectorsurvpoolid, c.Vectorsurvtrapdataid, c.Updated, - } -} - -type fsPoolIndexes struct { - FSPoolPkey index -} - -func (i fsPoolIndexes) AsSlice() []index { - return []index{ - i.FSPoolPkey, - } -} - -type fsPoolForeignKeys struct { - FSPoolFSPoolOrganizationIDFkey foreignKey -} - -func (f fsPoolForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSPoolFSPoolOrganizationIDFkey, - } -} - -type fsPoolUniques struct{} - -func (u fsPoolUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsPoolChecks struct{} - -func (c fsPoolChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_pooldetail.bob.go b/db/dbinfo/fs_pooldetail.bob.go deleted file mode 100644 index 7ae502cf..00000000 --- a/db/dbinfo/fs_pooldetail.bob.go +++ /dev/null @@ -1,277 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSPooldetails = Table[ - fsPooldetailColumns, - fsPooldetailIndexes, - fsPooldetailForeignKeys, - fsPooldetailUniques, - fsPooldetailChecks, -]{ - Schema: "", - Name: "fs_pooldetail", - Columns: fsPooldetailColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Females: column{ - Name: "females", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - PoolID: column{ - Name: "pool_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Species: column{ - Name: "species", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - TrapdataID: column{ - Name: "trapdata_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsPooldetailIndexes{ - FSPooldetailPkey: index{ - Type: "btree", - Name: "fs_pooldetail_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_pooldetail_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsPooldetailForeignKeys{ - FSPooldetailFSPooldetailOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_pooldetail.fs_pooldetail_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsPooldetailColumns struct { - OrganizationID column - Creationdate column - Creator column - Editdate column - Editor column - Females column - Globalid column - Objectid column - PoolID column - Species column - TrapdataID column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Updated column -} - -func (c fsPooldetailColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Females, c.Globalid, c.Objectid, c.PoolID, c.Species, c.TrapdataID, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Updated, - } -} - -type fsPooldetailIndexes struct { - FSPooldetailPkey index -} - -func (i fsPooldetailIndexes) AsSlice() []index { - return []index{ - i.FSPooldetailPkey, - } -} - -type fsPooldetailForeignKeys struct { - FSPooldetailFSPooldetailOrganizationIDFkey foreignKey -} - -func (f fsPooldetailForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSPooldetailFSPooldetailOrganizationIDFkey, - } -} - -type fsPooldetailUniques struct{} - -func (u fsPooldetailUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsPooldetailChecks struct{} - -func (c fsPooldetailChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_proposedtreatmentarea.bob.go b/db/dbinfo/fs_proposedtreatmentarea.bob.go deleted file mode 100644 index c68ac2d1..00000000 --- a/db/dbinfo/fs_proposedtreatmentarea.bob.go +++ /dev/null @@ -1,467 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSProposedtreatmentareas = Table[ - fsProposedtreatmentareaColumns, - fsProposedtreatmentareaIndexes, - fsProposedtreatmentareaForeignKeys, - fsProposedtreatmentareaUniques, - fsProposedtreatmentareaChecks, -]{ - Schema: "", - Name: "fs_proposedtreatmentarea", - Columns: fsProposedtreatmentareaColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Acres: column{ - Name: "acres", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Completed: column{ - Name: "completed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Completedby: column{ - Name: "completedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Completeddate: column{ - Name: "completeddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Duedate: column{ - Name: "duedate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Exported: column{ - Name: "exported", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Hectares: column{ - Name: "hectares", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Issprayroute: column{ - Name: "issprayroute", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatactivity: column{ - Name: "lasttreatactivity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatdate: column{ - Name: "lasttreatdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatproduct: column{ - Name: "lasttreatproduct", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqty: column{ - Name: "lasttreatqty", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqtyunit: column{ - Name: "lasttreatqtyunit", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Method: column{ - Name: "method", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewed: column{ - Name: "reviewed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewedby: column{ - Name: "reviewedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Revieweddate: column{ - Name: "revieweddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeArea: column{ - Name: "shape__area", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeLength: column{ - Name: "shape__length", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Targetapprate: column{ - Name: "targetapprate", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Targetproduct: column{ - Name: "targetproduct", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Targetspecies: column{ - Name: "targetspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsProposedtreatmentareaIndexes{ - FSProposedtreatmentareaPkey: index{ - Type: "btree", - Name: "fs_proposedtreatmentarea_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_proposedtreatmentarea_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsProposedtreatmentareaForeignKeys{ - FSProposedtreatmentareaFSProposedtreatmentareaOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_proposedtreatmentarea.fs_proposedtreatmentarea_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsProposedtreatmentareaColumns struct { - OrganizationID column - Acres column - Comments column - Completed column - Completedby column - Completeddate column - Creationdate column - Creator column - Duedate column - Exported column - Editdate column - Editor column - Globalid column - Hectares column - Issprayroute column - Lasttreatactivity column - Lasttreatdate column - Lasttreatproduct column - Lasttreatqty column - Lasttreatqtyunit column - Method column - Name column - Objectid column - Priority column - Reviewed column - Reviewedby column - Revieweddate column - ShapeArea column - ShapeLength column - Targetapprate column - Targetproduct column - Targetspecies column - Zone column - Zone2 column - GeometryX column - GeometryY column - Updated column -} - -func (c fsProposedtreatmentareaColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Acres, c.Comments, c.Completed, c.Completedby, c.Completeddate, c.Creationdate, c.Creator, c.Duedate, c.Exported, c.Editdate, c.Editor, c.Globalid, c.Hectares, c.Issprayroute, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Method, c.Name, c.Objectid, c.Priority, c.Reviewed, c.Reviewedby, c.Revieweddate, c.ShapeArea, c.ShapeLength, c.Targetapprate, c.Targetproduct, c.Targetspecies, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.Updated, - } -} - -type fsProposedtreatmentareaIndexes struct { - FSProposedtreatmentareaPkey index -} - -func (i fsProposedtreatmentareaIndexes) AsSlice() []index { - return []index{ - i.FSProposedtreatmentareaPkey, - } -} - -type fsProposedtreatmentareaForeignKeys struct { - FSProposedtreatmentareaFSProposedtreatmentareaOrganizationIDFkey foreignKey -} - -func (f fsProposedtreatmentareaForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSProposedtreatmentareaFSProposedtreatmentareaOrganizationIDFkey, - } -} - -type fsProposedtreatmentareaUniques struct{} - -func (u fsProposedtreatmentareaUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsProposedtreatmentareaChecks struct{} - -func (c fsProposedtreatmentareaChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_qamosquitoinspection.bob.go b/db/dbinfo/fs_qamosquitoinspection.bob.go deleted file mode 100644 index 9a6f43e5..00000000 --- a/db/dbinfo/fs_qamosquitoinspection.bob.go +++ /dev/null @@ -1,757 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSQamosquitoinspections = Table[ - fsQamosquitoinspectionColumns, - fsQamosquitoinspectionIndexes, - fsQamosquitoinspectionForeignKeys, - fsQamosquitoinspectionUniques, - fsQamosquitoinspectionChecks, -]{ - Schema: "", - Name: "fs_qamosquitoinspection", - Columns: fsQamosquitoinspectionColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Acresbreeding: column{ - Name: "acresbreeding", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Actiontaken: column{ - Name: "actiontaken", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Adultactivity: column{ - Name: "adultactivity", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Aquaticorganisms: column{ - Name: "aquaticorganisms", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Avetemp: column{ - Name: "avetemp", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Breedingpotential: column{ - Name: "breedingpotential", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Enddatetime: column{ - Name: "enddatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldtech: column{ - Name: "fieldtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fish: column{ - Name: "fish", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Habvalue1: column{ - Name: "habvalue1", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Habvalue1percent: column{ - Name: "habvalue1percent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Habvalue2: column{ - Name: "habvalue2", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Habvalue2percent: column{ - Name: "habvalue2percent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvaeinsidetreatedarea: column{ - Name: "larvaeinsidetreatedarea", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvaeoutsidetreatedarea: column{ - Name: "larvaeoutsidetreatedarea", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvaepresent: column{ - Name: "larvaepresent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvaereason: column{ - Name: "larvaereason", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Linelocid: column{ - Name: "linelocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationname: column{ - Name: "locationname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LR: column{ - Name: "lr", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Mosquitohabitat: column{ - Name: "mosquitohabitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Movingwater: column{ - Name: "movingwater", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Negdips: column{ - Name: "negdips", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nowaterever: column{ - Name: "nowaterever", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Pointlocid: column{ - Name: "pointlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Polygonlocid: column{ - Name: "polygonlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Posdips: column{ - Name: "posdips", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Potential: column{ - Name: "potential", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Raingauge: column{ - Name: "raingauge", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Recordstatus: column{ - Name: "recordstatus", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewed: column{ - Name: "reviewed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewedby: column{ - Name: "reviewedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Revieweddate: column{ - Name: "revieweddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sitetype: column{ - Name: "sitetype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Soilconditions: column{ - Name: "soilconditions", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sourcereduction: column{ - Name: "sourcereduction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Startdatetime: column{ - Name: "startdatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Totalacres: column{ - Name: "totalacres", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vegetation: column{ - Name: "vegetation", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Waterconditions: column{ - Name: "waterconditions", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Waterduration: column{ - Name: "waterduration", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Watermovement1: column{ - Name: "watermovement1", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Watermovement1percent: column{ - Name: "watermovement1percent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Watermovement2: column{ - Name: "watermovement2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Watermovement2percent: column{ - Name: "watermovement2percent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Waterpresent: column{ - Name: "waterpresent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Watersource: column{ - Name: "watersource", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Winddir: column{ - Name: "winddir", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Windspeed: column{ - Name: "windspeed", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsQamosquitoinspectionIndexes{ - FSQamosquitoinspectionPkey: index{ - Type: "btree", - Name: "fs_qamosquitoinspection_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_qamosquitoinspection_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsQamosquitoinspectionForeignKeys{ - FSQamosquitoinspectionFSQamosquitoinspectionOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_qamosquitoinspection.fs_qamosquitoinspection_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsQamosquitoinspectionColumns struct { - OrganizationID column - Acresbreeding column - Actiontaken column - Adultactivity column - Aquaticorganisms column - Avetemp column - Breedingpotential column - Comments column - Creationdate column - Creator column - Enddatetime column - Editdate column - Editor column - Fieldtech column - Fish column - Globalid column - Habvalue1 column - Habvalue1percent column - Habvalue2 column - Habvalue2percent column - Larvaeinsidetreatedarea column - Larvaeoutsidetreatedarea column - Larvaepresent column - Larvaereason column - Linelocid column - Locationname column - LR column - Mosquitohabitat column - Movingwater column - Negdips column - Nowaterever column - Objectid column - Pointlocid column - Polygonlocid column - Posdips column - Potential column - Raingauge column - Recordstatus column - Reviewed column - Reviewedby column - Revieweddate column - Sitetype column - Soilconditions column - Sourcereduction column - Startdatetime column - Totalacres column - Vegetation column - Waterconditions column - Waterduration column - Watermovement1 column - Watermovement1percent column - Watermovement2 column - Watermovement2percent column - Waterpresent column - Watersource column - Winddir column - Windspeed column - Zone column - Zone2 column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Updated column -} - -func (c fsQamosquitoinspectionColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Acresbreeding, c.Actiontaken, c.Adultactivity, c.Aquaticorganisms, c.Avetemp, c.Breedingpotential, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Fish, c.Globalid, c.Habvalue1, c.Habvalue1percent, c.Habvalue2, c.Habvalue2percent, c.Larvaeinsidetreatedarea, c.Larvaeoutsidetreatedarea, c.Larvaepresent, c.Larvaereason, c.Linelocid, c.Locationname, c.LR, c.Mosquitohabitat, c.Movingwater, c.Negdips, c.Nowaterever, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Posdips, c.Potential, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sitetype, c.Soilconditions, c.Sourcereduction, c.Startdatetime, c.Totalacres, c.Vegetation, c.Waterconditions, c.Waterduration, c.Watermovement1, c.Watermovement1percent, c.Watermovement2, c.Watermovement2percent, c.Waterpresent, c.Watersource, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Updated, - } -} - -type fsQamosquitoinspectionIndexes struct { - FSQamosquitoinspectionPkey index -} - -func (i fsQamosquitoinspectionIndexes) AsSlice() []index { - return []index{ - i.FSQamosquitoinspectionPkey, - } -} - -type fsQamosquitoinspectionForeignKeys struct { - FSQamosquitoinspectionFSQamosquitoinspectionOrganizationIDFkey foreignKey -} - -func (f fsQamosquitoinspectionForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSQamosquitoinspectionFSQamosquitoinspectionOrganizationIDFkey, - } -} - -type fsQamosquitoinspectionUniques struct{} - -func (u fsQamosquitoinspectionUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsQamosquitoinspectionChecks struct{} - -func (c fsQamosquitoinspectionChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_rodentlocation.bob.go b/db/dbinfo/fs_rodentlocation.bob.go deleted file mode 100644 index df01594e..00000000 --- a/db/dbinfo/fs_rodentlocation.bob.go +++ /dev/null @@ -1,437 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSRodentlocations = Table[ - fsRodentlocationColumns, - fsRodentlocationIndexes, - fsRodentlocationForeignKeys, - fsRodentlocationUniques, - fsRodentlocationChecks, -]{ - Schema: "", - Name: "fs_rodentlocation", - Columns: fsRodentlocationColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accessdesc: column{ - Name: "accessdesc", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Active: column{ - Name: "active", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Description: column{ - Name: "description", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Habitat: column{ - Name: "habitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectaction: column{ - Name: "lastinspectaction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectconditions: column{ - Name: "lastinspectconditions", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectdate: column{ - Name: "lastinspectdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectrodentevidence: column{ - Name: "lastinspectrodentevidence", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectspecies: column{ - Name: "lastinspectspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationname: column{ - Name: "locationname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationnumber: column{ - Name: "locationnumber", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nextactiondatescheduled: column{ - Name: "nextactiondatescheduled", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Symbology: column{ - Name: "symbology", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Usetype: column{ - Name: "usetype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Jurisdiction: column{ - Name: "jurisdiction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsRodentlocationIndexes{ - FSRodentlocationPkey: index{ - Type: "btree", - Name: "fs_rodentlocation_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_rodentlocation_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsRodentlocationForeignKeys{ - FSRodentlocationFSRodentlocationOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_rodentlocation.fs_rodentlocation_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsRodentlocationColumns struct { - OrganizationID column - Accessdesc column - Active column - Comments column - Creationdate column - Creator column - Description column - Externalid column - Editdate column - Editor column - Globalid column - Habitat column - Lastinspectaction column - Lastinspectconditions column - Lastinspectdate column - Lastinspectrodentevidence column - Lastinspectspecies column - Locationname column - Locationnumber column - Nextactiondatescheduled column - Objectid column - Priority column - Symbology column - Usetype column - Zone column - Zone2 column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Jurisdiction column - Updated column -} - -func (c fsRodentlocationColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Globalid, c.Habitat, c.Lastinspectaction, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectrodentevidence, c.Lastinspectspecies, c.Locationname, c.Locationnumber, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.Usetype, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Jurisdiction, c.Updated, - } -} - -type fsRodentlocationIndexes struct { - FSRodentlocationPkey index -} - -func (i fsRodentlocationIndexes) AsSlice() []index { - return []index{ - i.FSRodentlocationPkey, - } -} - -type fsRodentlocationForeignKeys struct { - FSRodentlocationFSRodentlocationOrganizationIDFkey foreignKey -} - -func (f fsRodentlocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSRodentlocationFSRodentlocationOrganizationIDFkey, - } -} - -type fsRodentlocationUniques struct{} - -func (u fsRodentlocationUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsRodentlocationChecks struct{} - -func (c fsRodentlocationChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_samplecollection.bob.go b/db/dbinfo/fs_samplecollection.bob.go deleted file mode 100644 index 2c1a9233..00000000 --- a/db/dbinfo/fs_samplecollection.bob.go +++ /dev/null @@ -1,597 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSSamplecollections = Table[ - fsSamplecollectionColumns, - fsSamplecollectionIndexes, - fsSamplecollectionForeignKeys, - fsSamplecollectionUniques, - fsSamplecollectionChecks, -]{ - Schema: "", - Name: "fs_samplecollection", - Columns: fsSamplecollectionColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Activity: column{ - Name: "activity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Avetemp: column{ - Name: "avetemp", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Chickenid: column{ - Name: "chickenid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Datesent: column{ - Name: "datesent", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Datetested: column{ - Name: "datetested", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Diseasepos: column{ - Name: "diseasepos", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Diseasetested: column{ - Name: "diseasetested", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Enddatetime: column{ - Name: "enddatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldtech: column{ - Name: "fieldtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Flockid: column{ - Name: "flockid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Gatewaysync: column{ - Name: "gatewaysync", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Lab: column{ - Name: "lab", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationname: column{ - Name: "locationname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LocID: column{ - Name: "loc_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Processed: column{ - Name: "processed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Raingauge: column{ - Name: "raingauge", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Recordstatus: column{ - Name: "recordstatus", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewed: column{ - Name: "reviewed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewedby: column{ - Name: "reviewedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Revieweddate: column{ - Name: "revieweddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Samplecond: column{ - Name: "samplecond", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Samplecount: column{ - Name: "samplecount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sampleid: column{ - Name: "sampleid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sampletype: column{ - Name: "sampletype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sex: column{ - Name: "sex", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sitecond: column{ - Name: "sitecond", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Species: column{ - Name: "species", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Startdatetime: column{ - Name: "startdatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Survtech: column{ - Name: "survtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Testmethod: column{ - Name: "testmethod", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Testtech: column{ - Name: "testtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Winddir: column{ - Name: "winddir", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Windspeed: column{ - Name: "windspeed", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsSamplecollectionIndexes{ - FSSamplecollectionPkey: index{ - Type: "btree", - Name: "fs_samplecollection_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_samplecollection_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsSamplecollectionForeignKeys{ - FSSamplecollectionFSSamplecollectionOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_samplecollection.fs_samplecollection_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsSamplecollectionColumns struct { - OrganizationID column - Activity column - Avetemp column - Chickenid column - Comments column - Creationdate column - Creator column - Datesent column - Datetested column - Diseasepos column - Diseasetested column - Enddatetime column - Editdate column - Editor column - Fieldtech column - Flockid column - Gatewaysync column - Globalid column - Lab column - Locationname column - LocID column - Objectid column - Processed column - Raingauge column - Recordstatus column - Reviewed column - Reviewedby column - Revieweddate column - Samplecond column - Samplecount column - Sampleid column - Sampletype column - Sex column - Sitecond column - Species column - Startdatetime column - Survtech column - Testmethod column - Testtech column - Winddir column - Windspeed column - Zone column - Zone2 column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Updated column -} - -func (c fsSamplecollectionColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Activity, c.Avetemp, c.Chickenid, c.Comments, c.Creationdate, c.Creator, c.Datesent, c.Datetested, c.Diseasepos, c.Diseasetested, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Flockid, c.Gatewaysync, c.Globalid, c.Lab, c.Locationname, c.LocID, c.Objectid, c.Processed, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Samplecond, c.Samplecount, c.Sampleid, c.Sampletype, c.Sex, c.Sitecond, c.Species, c.Startdatetime, c.Survtech, c.Testmethod, c.Testtech, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Updated, - } -} - -type fsSamplecollectionIndexes struct { - FSSamplecollectionPkey index -} - -func (i fsSamplecollectionIndexes) AsSlice() []index { - return []index{ - i.FSSamplecollectionPkey, - } -} - -type fsSamplecollectionForeignKeys struct { - FSSamplecollectionFSSamplecollectionOrganizationIDFkey foreignKey -} - -func (f fsSamplecollectionForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSSamplecollectionFSSamplecollectionOrganizationIDFkey, - } -} - -type fsSamplecollectionUniques struct{} - -func (u fsSamplecollectionUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsSamplecollectionChecks struct{} - -func (c fsSamplecollectionChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_samplelocation.bob.go b/db/dbinfo/fs_samplelocation.bob.go deleted file mode 100644 index b49ea82a..00000000 --- a/db/dbinfo/fs_samplelocation.bob.go +++ /dev/null @@ -1,377 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSSamplelocations = Table[ - fsSamplelocationColumns, - fsSamplelocationIndexes, - fsSamplelocationForeignKeys, - fsSamplelocationUniques, - fsSamplelocationChecks, -]{ - Schema: "", - Name: "fs_samplelocation", - Columns: fsSamplelocationColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accessdesc: column{ - Name: "accessdesc", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Active: column{ - Name: "active", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Description: column{ - Name: "description", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Gatewaysync: column{ - Name: "gatewaysync", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Habitat: column{ - Name: "habitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationnumber: column{ - Name: "locationnumber", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nextactiondatescheduled: column{ - Name: "nextactiondatescheduled", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Usetype: column{ - Name: "usetype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsSamplelocationIndexes{ - FSSamplelocationPkey: index{ - Type: "btree", - Name: "fs_samplelocation_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_samplelocation_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsSamplelocationForeignKeys{ - FSSamplelocationFSSamplelocationOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_samplelocation.fs_samplelocation_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsSamplelocationColumns struct { - OrganizationID column - Accessdesc column - Active column - Comments column - Creationdate column - Creator column - Description column - Externalid column - Editdate column - Editor column - Gatewaysync column - Globalid column - Habitat column - Locationnumber column - Name column - Nextactiondatescheduled column - Objectid column - Priority column - Usetype column - Zone column - Zone2 column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Updated column -} - -func (c fsSamplelocationColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Habitat, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Usetype, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Updated, - } -} - -type fsSamplelocationIndexes struct { - FSSamplelocationPkey index -} - -func (i fsSamplelocationIndexes) AsSlice() []index { - return []index{ - i.FSSamplelocationPkey, - } -} - -type fsSamplelocationForeignKeys struct { - FSSamplelocationFSSamplelocationOrganizationIDFkey foreignKey -} - -func (f fsSamplelocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSSamplelocationFSSamplelocationOrganizationIDFkey, - } -} - -type fsSamplelocationUniques struct{} - -func (u fsSamplelocationUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsSamplelocationChecks struct{} - -func (c fsSamplelocationChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_servicerequest.bob.go b/db/dbinfo/fs_servicerequest.bob.go deleted file mode 100644 index dcad51e9..00000000 --- a/db/dbinfo/fs_servicerequest.bob.go +++ /dev/null @@ -1,997 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSServicerequests = Table[ - fsServicerequestColumns, - fsServicerequestIndexes, - fsServicerequestForeignKeys, - fsServicerequestUniques, - fsServicerequestChecks, -]{ - Schema: "", - Name: "fs_servicerequest", - Columns: fsServicerequestColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accepted: column{ - Name: "accepted", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Acceptedby: column{ - Name: "acceptedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Accepteddate: column{ - Name: "accepteddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Allowed: column{ - Name: "allowed", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Assignedtech: column{ - Name: "assignedtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clraddr1: column{ - Name: "clraddr1", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clraddr2: column{ - Name: "clraddr2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clranon: column{ - Name: "clranon", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrcity: column{ - Name: "clrcity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrcompany: column{ - Name: "clrcompany", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrcontpref: column{ - Name: "clrcontpref", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clremail: column{ - Name: "clremail", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrfname: column{ - Name: "clrfname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrother: column{ - Name: "clrother", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrphone1: column{ - Name: "clrphone1", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrphone2: column{ - Name: "clrphone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrstate: column{ - Name: "clrstate", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrzip: column{ - Name: "clrzip", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Datetimeclosed: column{ - Name: "datetimeclosed", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Duedate: column{ - Name: "duedate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Entrytech: column{ - Name: "entrytech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Estcompletedate: column{ - Name: "estcompletedate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalerror: column{ - Name: "externalerror", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Firstresponsedate: column{ - Name: "firstresponsedate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Issuesreported: column{ - Name: "issuesreported", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Jurisdiction: column{ - Name: "jurisdiction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nextaction: column{ - Name: "nextaction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Notificationtimestamp: column{ - Name: "notificationtimestamp", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Notified: column{ - Name: "notified", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Notifieddate: column{ - Name: "notifieddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Pointlocid: column{ - Name: "pointlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Recdatetime: column{ - Name: "recdatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Recordstatus: column{ - Name: "recordstatus", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Rejectedby: column{ - Name: "rejectedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Rejecteddate: column{ - Name: "rejecteddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Rejectedreason: column{ - Name: "rejectedreason", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqaddr1: column{ - Name: "reqaddr1", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqaddr2: column{ - Name: "reqaddr2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqcity: column{ - Name: "reqcity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqcompany: column{ - Name: "reqcompany", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqcrossst: column{ - Name: "reqcrossst", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqdescr: column{ - Name: "reqdescr", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqfldnotes: column{ - Name: "reqfldnotes", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqmapgrid: column{ - Name: "reqmapgrid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqnotesforcust: column{ - Name: "reqnotesforcust", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqnotesfortech: column{ - Name: "reqnotesfortech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqpermission: column{ - Name: "reqpermission", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqprogramactions: column{ - Name: "reqprogramactions", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqstate: column{ - Name: "reqstate", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqsubdiv: column{ - Name: "reqsubdiv", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqtarget: column{ - Name: "reqtarget", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqzip: column{ - Name: "reqzip", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Responsedaycount: column{ - Name: "responsedaycount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewed: column{ - Name: "reviewed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewedby: column{ - Name: "reviewedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Revieweddate: column{ - Name: "revieweddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Scheduled: column{ - Name: "scheduled", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Scheduleddate: column{ - Name: "scheduleddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Source: column{ - Name: "source", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - SRNumber: column{ - Name: "sr_number", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Status: column{ - Name: "status", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Supervisor: column{ - Name: "supervisor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Techclosed: column{ - Name: "techclosed", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Validx: column{ - Name: "validx", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Validy: column{ - Name: "validy", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Xvalue: column{ - Name: "xvalue", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Yvalue: column{ - Name: "yvalue", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Dog: column{ - Name: "dog", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Spanish: column{ - Name: "spanish", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ScheduleNotes: column{ - Name: "schedule_notes", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - SchedulePeriod: column{ - Name: "schedule_period", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsServicerequestIndexes{ - FSServicerequestPkey: index{ - Type: "btree", - Name: "fs_servicerequest_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_servicerequest_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsServicerequestForeignKeys{ - FSServicerequestFSServicerequestOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_servicerequest.fs_servicerequest_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsServicerequestColumns struct { - OrganizationID column - Accepted column - Acceptedby column - Accepteddate column - Allowed column - Assignedtech column - Clraddr1 column - Clraddr2 column - Clranon column - Clrcity column - Clrcompany column - Clrcontpref column - Clremail column - Clrfname column - Clrother column - Clrphone1 column - Clrphone2 column - Clrstate column - Clrzip column - Comments column - Creationdate column - Creator column - Datetimeclosed column - Duedate column - Entrytech column - Estcompletedate column - Externalerror column - Externalid column - Editdate column - Editor column - Firstresponsedate column - Globalid column - Issuesreported column - Jurisdiction column - Nextaction column - Notificationtimestamp column - Notified column - Notifieddate column - Objectid column - Pointlocid column - Priority column - Recdatetime column - Recordstatus column - Rejectedby column - Rejecteddate column - Rejectedreason column - Reqaddr1 column - Reqaddr2 column - Reqcity column - Reqcompany column - Reqcrossst column - Reqdescr column - Reqfldnotes column - Reqmapgrid column - Reqnotesforcust column - Reqnotesfortech column - Reqpermission column - Reqprogramactions column - Reqstate column - Reqsubdiv column - Reqtarget column - Reqzip column - Responsedaycount column - Reviewed column - Reviewedby column - Revieweddate column - Scheduled column - Scheduleddate column - Source column - SRNumber column - Status column - Supervisor column - Techclosed column - Validx column - Validy column - Xvalue column - Yvalue column - Zone column - Zone2 column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Dog column - Spanish column - ScheduleNotes column - SchedulePeriod column - Updated column -} - -func (c fsServicerequestColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accepted, c.Acceptedby, c.Accepteddate, c.Allowed, c.Assignedtech, c.Clraddr1, c.Clraddr2, c.Clranon, c.Clrcity, c.Clrcompany, c.Clrcontpref, c.Clremail, c.Clrfname, c.Clrother, c.Clrphone1, c.Clrphone2, c.Clrstate, c.Clrzip, c.Comments, c.Creationdate, c.Creator, c.Datetimeclosed, c.Duedate, c.Entrytech, c.Estcompletedate, c.Externalerror, c.Externalid, c.Editdate, c.Editor, c.Firstresponsedate, c.Globalid, c.Issuesreported, c.Jurisdiction, c.Nextaction, c.Notificationtimestamp, c.Notified, c.Notifieddate, c.Objectid, c.Pointlocid, c.Priority, c.Recdatetime, c.Recordstatus, c.Rejectedby, c.Rejecteddate, c.Rejectedreason, c.Reqaddr1, c.Reqaddr2, c.Reqcity, c.Reqcompany, c.Reqcrossst, c.Reqdescr, c.Reqfldnotes, c.Reqmapgrid, c.Reqnotesforcust, c.Reqnotesfortech, c.Reqpermission, c.Reqprogramactions, c.Reqstate, c.Reqsubdiv, c.Reqtarget, c.Reqzip, c.Responsedaycount, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Scheduled, c.Scheduleddate, c.Source, c.SRNumber, c.Status, c.Supervisor, c.Techclosed, c.Validx, c.Validy, c.Xvalue, c.Yvalue, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Dog, c.Spanish, c.ScheduleNotes, c.SchedulePeriod, c.Updated, - } -} - -type fsServicerequestIndexes struct { - FSServicerequestPkey index -} - -func (i fsServicerequestIndexes) AsSlice() []index { - return []index{ - i.FSServicerequestPkey, - } -} - -type fsServicerequestForeignKeys struct { - FSServicerequestFSServicerequestOrganizationIDFkey foreignKey -} - -func (f fsServicerequestForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSServicerequestFSServicerequestOrganizationIDFkey, - } -} - -type fsServicerequestUniques struct{} - -func (u fsServicerequestUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsServicerequestChecks struct{} - -func (c fsServicerequestChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_speciesabundance.bob.go b/db/dbinfo/fs_speciesabundance.bob.go deleted file mode 100644 index e36a479f..00000000 --- a/db/dbinfo/fs_speciesabundance.bob.go +++ /dev/null @@ -1,427 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSSpeciesabundances = Table[ - fsSpeciesabundanceColumns, - fsSpeciesabundanceIndexes, - fsSpeciesabundanceForeignKeys, - fsSpeciesabundanceUniques, - fsSpeciesabundanceChecks, -]{ - Schema: "", - Name: "fs_speciesabundance", - Columns: fsSpeciesabundanceColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Bloodedfem: column{ - Name: "bloodedfem", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Eggs: column{ - Name: "eggs", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Females: column{ - Name: "females", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Gravidfem: column{ - Name: "gravidfem", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Larvae: column{ - Name: "larvae", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Males: column{ - Name: "males", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Poolstogen: column{ - Name: "poolstogen", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Processed: column{ - Name: "processed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Pupae: column{ - Name: "pupae", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Species: column{ - Name: "species", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Total: column{ - Name: "total", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - TrapdataID: column{ - Name: "trapdata_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Unknown: column{ - Name: "unknown", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalzscore: column{ - Name: "globalzscore", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - H3R7: column{ - Name: "h3r7", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - H3R8: column{ - Name: "h3r8", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - R7score: column{ - Name: "r7score", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - R8score: column{ - Name: "r8score", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Yearweek: column{ - Name: "yearweek", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsSpeciesabundanceIndexes{ - FSSpeciesabundancePkey: index{ - Type: "btree", - Name: "fs_speciesabundance_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_speciesabundance_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsSpeciesabundanceForeignKeys{ - FSSpeciesabundanceFSSpeciesabundanceOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_speciesabundance.fs_speciesabundance_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsSpeciesabundanceColumns struct { - OrganizationID column - Bloodedfem column - Creationdate column - Creator column - Eggs column - Editdate column - Editor column - Females column - Gravidfem column - Globalid column - Larvae column - Males column - Objectid column - Poolstogen column - Processed column - Pupae column - Species column - Total column - TrapdataID column - Unknown column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Globalzscore column - H3R7 column - H3R8 column - R7score column - R8score column - Yearweek column - Updated column -} - -func (c fsSpeciesabundanceColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Bloodedfem, c.Creationdate, c.Creator, c.Eggs, c.Editdate, c.Editor, c.Females, c.Gravidfem, c.Globalid, c.Larvae, c.Males, c.Objectid, c.Poolstogen, c.Processed, c.Pupae, c.Species, c.Total, c.TrapdataID, c.Unknown, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Globalzscore, c.H3R7, c.H3R8, c.R7score, c.R8score, c.Yearweek, c.Updated, - } -} - -type fsSpeciesabundanceIndexes struct { - FSSpeciesabundancePkey index -} - -func (i fsSpeciesabundanceIndexes) AsSlice() []index { - return []index{ - i.FSSpeciesabundancePkey, - } -} - -type fsSpeciesabundanceForeignKeys struct { - FSSpeciesabundanceFSSpeciesabundanceOrganizationIDFkey foreignKey -} - -func (f fsSpeciesabundanceForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSSpeciesabundanceFSSpeciesabundanceOrganizationIDFkey, - } -} - -type fsSpeciesabundanceUniques struct{} - -func (u fsSpeciesabundanceUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsSpeciesabundanceChecks struct{} - -func (c fsSpeciesabundanceChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_stormdrain.bob.go b/db/dbinfo/fs_stormdrain.bob.go deleted file mode 100644 index 3cd4f51d..00000000 --- a/db/dbinfo/fs_stormdrain.bob.go +++ /dev/null @@ -1,327 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSStormdrains = Table[ - fsStormdrainColumns, - fsStormdrainIndexes, - fsStormdrainForeignKeys, - fsStormdrainUniques, - fsStormdrainChecks, -]{ - Schema: "", - Name: "fs_stormdrain", - Columns: fsStormdrainColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Jurisdiction: column{ - Name: "jurisdiction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastaction: column{ - Name: "lastaction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Laststatus: column{ - Name: "laststatus", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatdate: column{ - Name: "lasttreatdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nexttreatmentdate: column{ - Name: "nexttreatmentdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Symbology: column{ - Name: "symbology", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Type: column{ - Name: "type", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsStormdrainIndexes{ - FSStormdrainPkey: index{ - Type: "btree", - Name: "fs_stormdrain_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_stormdrain_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsStormdrainForeignKeys{ - FSStormdrainFSStormdrainOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_stormdrain.fs_stormdrain_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsStormdrainColumns struct { - OrganizationID column - Creationdate column - Creator column - Editdate column - Editor column - Globalid column - Jurisdiction column - Lastaction column - Laststatus column - Lasttreatdate column - Nexttreatmentdate column - Objectid column - Symbology column - Type column - Zone column - Zone2 column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Updated column -} - -func (c fsStormdrainColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Jurisdiction, c.Lastaction, c.Laststatus, c.Lasttreatdate, c.Nexttreatmentdate, c.Objectid, c.Symbology, c.Type, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Updated, - } -} - -type fsStormdrainIndexes struct { - FSStormdrainPkey index -} - -func (i fsStormdrainIndexes) AsSlice() []index { - return []index{ - i.FSStormdrainPkey, - } -} - -type fsStormdrainForeignKeys struct { - FSStormdrainFSStormdrainOrganizationIDFkey foreignKey -} - -func (f fsStormdrainForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSStormdrainFSStormdrainOrganizationIDFkey, - } -} - -type fsStormdrainUniques struct{} - -func (u fsStormdrainUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsStormdrainChecks struct{} - -func (c fsStormdrainChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_timecard.bob.go b/db/dbinfo/fs_timecard.bob.go deleted file mode 100644 index d240c0b8..00000000 --- a/db/dbinfo/fs_timecard.bob.go +++ /dev/null @@ -1,417 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSTimecards = Table[ - fsTimecardColumns, - fsTimecardIndexes, - fsTimecardForeignKeys, - fsTimecardUniques, - fsTimecardChecks, -]{ - Schema: "", - Name: "fs_timecard", - Columns: fsTimecardColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Activity: column{ - Name: "activity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Enddatetime: column{ - Name: "enddatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Equiptype: column{ - Name: "equiptype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldtech: column{ - Name: "fieldtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Lclocid: column{ - Name: "lclocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Linelocid: column{ - Name: "linelocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationname: column{ - Name: "locationname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Pointlocid: column{ - Name: "pointlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Polygonlocid: column{ - Name: "polygonlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Samplelocid: column{ - Name: "samplelocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Srid: column{ - Name: "srid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Startdatetime: column{ - Name: "startdatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Traplocid: column{ - Name: "traplocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Rodentlocid: column{ - Name: "rodentlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsTimecardIndexes{ - FSTimecardPkey: index{ - Type: "btree", - Name: "fs_timecard_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_timecard_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsTimecardForeignKeys{ - FSTimecardFSTimecardOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_timecard.fs_timecard_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsTimecardColumns struct { - OrganizationID column - Activity column - Comments column - Creationdate column - Creator column - Enddatetime column - Equiptype column - Externalid column - Editdate column - Editor column - Fieldtech column - Globalid column - Lclocid column - Linelocid column - Locationname column - Objectid column - Pointlocid column - Polygonlocid column - Samplelocid column - Srid column - Startdatetime column - Traplocid column - Zone column - Zone2 column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Rodentlocid column - Updated column -} - -func (c fsTimecardColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Activity, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Equiptype, c.Externalid, c.Editdate, c.Editor, c.Fieldtech, c.Globalid, c.Lclocid, c.Linelocid, c.Locationname, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Samplelocid, c.Srid, c.Startdatetime, c.Traplocid, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Rodentlocid, c.Updated, - } -} - -type fsTimecardIndexes struct { - FSTimecardPkey index -} - -func (i fsTimecardIndexes) AsSlice() []index { - return []index{ - i.FSTimecardPkey, - } -} - -type fsTimecardForeignKeys struct { - FSTimecardFSTimecardOrganizationIDFkey foreignKey -} - -func (f fsTimecardForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSTimecardFSTimecardOrganizationIDFkey, - } -} - -type fsTimecardUniques struct{} - -func (u fsTimecardUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsTimecardChecks struct{} - -func (c fsTimecardChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_trapdata.bob.go b/db/dbinfo/fs_trapdata.bob.go deleted file mode 100644 index 36f61eec..00000000 --- a/db/dbinfo/fs_trapdata.bob.go +++ /dev/null @@ -1,557 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSTrapdata = Table[ - fsTrapdatumColumns, - fsTrapdatumIndexes, - fsTrapdatumForeignKeys, - fsTrapdatumUniques, - fsTrapdatumChecks, -]{ - Schema: "", - Name: "fs_trapdata", - Columns: fsTrapdatumColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Avetemp: column{ - Name: "avetemp", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Enddatetime: column{ - Name: "enddatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldtech: column{ - Name: "fieldtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Field: column{ - Name: "field", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Gatewaysync: column{ - Name: "gatewaysync", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Idbytech: column{ - Name: "idbytech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationname: column{ - Name: "locationname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LocID: column{ - Name: "loc_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LR: column{ - Name: "lr", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Processed: column{ - Name: "processed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Raingauge: column{ - Name: "raingauge", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Recordstatus: column{ - Name: "recordstatus", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewed: column{ - Name: "reviewed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewedby: column{ - Name: "reviewedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Revieweddate: column{ - Name: "revieweddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sitecond: column{ - Name: "sitecond", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sortbytech: column{ - Name: "sortbytech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Srid: column{ - Name: "srid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Startdatetime: column{ - Name: "startdatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Trapactivitytype: column{ - Name: "trapactivitytype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Trapcondition: column{ - Name: "trapcondition", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Trapnights: column{ - Name: "trapnights", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Traptype: column{ - Name: "traptype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Voltage: column{ - Name: "voltage", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Winddir: column{ - Name: "winddir", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Windspeed: column{ - Name: "windspeed", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lure: column{ - Name: "lure", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vectorsurvtrapdataid: column{ - Name: "vectorsurvtrapdataid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vectorsurvtraplocationid: column{ - Name: "vectorsurvtraplocationid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsTrapdatumIndexes{ - FSTrapdataPkey: index{ - Type: "btree", - Name: "fs_trapdata_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_trapdata_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsTrapdatumForeignKeys{ - FSTrapdataFSTrapdataOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_trapdata.fs_trapdata_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsTrapdatumColumns struct { - OrganizationID column - Avetemp column - Comments column - Creationdate column - Creator column - Enddatetime column - Editdate column - Editor column - Fieldtech column - Field column - Gatewaysync column - Globalid column - Idbytech column - Locationname column - LocID column - LR column - Objectid column - Processed column - Raingauge column - Recordstatus column - Reviewed column - Reviewedby column - Revieweddate column - Sitecond column - Sortbytech column - Srid column - Startdatetime column - Trapactivitytype column - Trapcondition column - Trapnights column - Traptype column - Voltage column - Winddir column - Windspeed column - Zone column - Zone2 column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Lure column - Vectorsurvtrapdataid column - Vectorsurvtraplocationid column - Updated column -} - -func (c fsTrapdatumColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Avetemp, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Field, c.Gatewaysync, c.Globalid, c.Idbytech, c.Locationname, c.LocID, c.LR, c.Objectid, c.Processed, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sitecond, c.Sortbytech, c.Srid, c.Startdatetime, c.Trapactivitytype, c.Trapcondition, c.Trapnights, c.Traptype, c.Voltage, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Lure, c.Vectorsurvtrapdataid, c.Vectorsurvtraplocationid, c.Updated, - } -} - -type fsTrapdatumIndexes struct { - FSTrapdataPkey index -} - -func (i fsTrapdatumIndexes) AsSlice() []index { - return []index{ - i.FSTrapdataPkey, - } -} - -type fsTrapdatumForeignKeys struct { - FSTrapdataFSTrapdataOrganizationIDFkey foreignKey -} - -func (f fsTrapdatumForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSTrapdataFSTrapdataOrganizationIDFkey, - } -} - -type fsTrapdatumUniques struct{} - -func (u fsTrapdatumUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsTrapdatumChecks struct{} - -func (c fsTrapdatumChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_traplocation.bob.go b/db/dbinfo/fs_traplocation.bob.go deleted file mode 100644 index b037287a..00000000 --- a/db/dbinfo/fs_traplocation.bob.go +++ /dev/null @@ -1,465 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSTraplocations = Table[ - fsTraplocationColumns, - fsTraplocationIndexes, - fsTraplocationForeignKeys, - fsTraplocationUniques, - fsTraplocationChecks, -]{ - Schema: "", - Name: "fs_traplocation", - Columns: fsTraplocationColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accessdesc: column{ - Name: "accessdesc", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Active: column{ - Name: "active", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Description: column{ - Name: "description", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Gatewaysync: column{ - Name: "gatewaysync", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Habitat: column{ - Name: "habitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationnumber: column{ - Name: "locationnumber", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nextactiondatescheduled: column{ - Name: "nextactiondatescheduled", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Usetype: column{ - Name: "usetype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Route: column{ - Name: "route", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - RouteOrder: column{ - Name: "route_order", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - SetDow: column{ - Name: "set_dow", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vectorsurvsiteid: column{ - Name: "vectorsurvsiteid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - H3R7: column{ - Name: "h3r7", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - H3R8: column{ - Name: "h3r8", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Geom: column{ - Name: "geom", - DBType: "geometry", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsTraplocationIndexes{ - FSTraplocationPkey: index{ - Type: "btree", - Name: "fs_traplocation_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - IdxFSTraplocationGeom: index{ - Type: "gist", - Name: "idx_fs_traplocation_geom", - Columns: []indexColumn{ - { - Name: "geom", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: false, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_traplocation_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsTraplocationForeignKeys{ - FSTraplocationFSTraplocationOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_traplocation.fs_traplocation_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsTraplocationColumns struct { - OrganizationID column - Accessdesc column - Active column - Comments column - Creationdate column - Creator column - Description column - Externalid column - Editdate column - Editor column - Gatewaysync column - Globalid column - Habitat column - Locationnumber column - Name column - Nextactiondatescheduled column - Objectid column - Priority column - Usetype column - Zone column - Zone2 column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Route column - RouteOrder column - SetDow column - Vectorsurvsiteid column - H3R7 column - H3R8 column - Updated column - Geom column -} - -func (c fsTraplocationColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Habitat, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Usetype, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Route, c.RouteOrder, c.SetDow, c.Vectorsurvsiteid, c.H3R7, c.H3R8, c.Updated, c.Geom, - } -} - -type fsTraplocationIndexes struct { - FSTraplocationPkey index - IdxFSTraplocationGeom index -} - -func (i fsTraplocationIndexes) AsSlice() []index { - return []index{ - i.FSTraplocationPkey, i.IdxFSTraplocationGeom, - } -} - -type fsTraplocationForeignKeys struct { - FSTraplocationFSTraplocationOrganizationIDFkey foreignKey -} - -func (f fsTraplocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSTraplocationFSTraplocationOrganizationIDFkey, - } -} - -type fsTraplocationUniques struct{} - -func (u fsTraplocationUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsTraplocationChecks struct{} - -func (c fsTraplocationChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_treatment.bob.go b/db/dbinfo/fs_treatment.bob.go deleted file mode 100644 index 0007d2b1..00000000 --- a/db/dbinfo/fs_treatment.bob.go +++ /dev/null @@ -1,705 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSTreatments = Table[ - fsTreatmentColumns, - fsTreatmentIndexes, - fsTreatmentForeignKeys, - fsTreatmentUniques, - fsTreatmentChecks, -]{ - Schema: "", - Name: "fs_treatment", - Columns: fsTreatmentColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Activity: column{ - Name: "activity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Areaunit: column{ - Name: "areaunit", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Avetemp: column{ - Name: "avetemp", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Barrierrouteid: column{ - Name: "barrierrouteid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Cbcount: column{ - Name: "cbcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Containercount: column{ - Name: "containercount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Enddatetime: column{ - Name: "enddatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Equiptype: column{ - Name: "equiptype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldtech: column{ - Name: "fieldtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Flowrate: column{ - Name: "flowrate", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Habitat: column{ - Name: "habitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - InspID: column{ - Name: "insp_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Invloc: column{ - Name: "invloc", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Linelocid: column{ - Name: "linelocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationname: column{ - Name: "locationname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Method: column{ - Name: "method", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Pointlocid: column{ - Name: "pointlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Polygonlocid: column{ - Name: "polygonlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Product: column{ - Name: "product", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Ptaid: column{ - Name: "ptaid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Qty: column{ - Name: "qty", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Qtyunit: column{ - Name: "qtyunit", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Raingauge: column{ - Name: "raingauge", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Recordstatus: column{ - Name: "recordstatus", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewed: column{ - Name: "reviewed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewedby: column{ - Name: "reviewedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Revieweddate: column{ - Name: "revieweddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sdid: column{ - Name: "sdid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sitecond: column{ - Name: "sitecond", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Srid: column{ - Name: "srid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Startdatetime: column{ - Name: "startdatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Targetspecies: column{ - Name: "targetspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Tirecount: column{ - Name: "tirecount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Treatacres: column{ - Name: "treatacres", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Treatarea: column{ - Name: "treatarea", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Treathectares: column{ - Name: "treathectares", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Treatmenthours: column{ - Name: "treatmenthours", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Treatmentlength: column{ - Name: "treatmentlength", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Treatmentlengthunits: column{ - Name: "treatmentlengthunits", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Totalcostprodcut: column{ - Name: "totalcostprodcut", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Ulvrouteid: column{ - Name: "ulvrouteid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Warningoverride: column{ - Name: "warningoverride", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Winddir: column{ - Name: "winddir", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Windspeed: column{ - Name: "windspeed", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - TempSitecond: column{ - Name: "temp_sitecond", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Geom: column{ - Name: "geom", - DBType: "geometry", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsTreatmentIndexes{ - FSTreatmentPkey: index{ - Type: "btree", - Name: "fs_treatment_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - IdxFSTreatmentGeom: index{ - Type: "gist", - Name: "idx_fs_treatment_geom", - Columns: []indexColumn{ - { - Name: "geom", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: false, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_treatment_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsTreatmentForeignKeys{ - FSTreatmentFSTreatmentOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_treatment.fs_treatment_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsTreatmentColumns struct { - OrganizationID column - Activity column - Areaunit column - Avetemp column - Barrierrouteid column - Cbcount column - Comments column - Containercount column - Creationdate column - Creator column - Enddatetime column - Equiptype column - Editdate column - Editor column - Fieldtech column - Flowrate column - Globalid column - Habitat column - InspID column - Invloc column - Linelocid column - Locationname column - Method column - Objectid column - Pointlocid column - Polygonlocid column - Product column - Ptaid column - Qty column - Qtyunit column - Raingauge column - Recordstatus column - Reviewed column - Reviewedby column - Revieweddate column - Sdid column - Sitecond column - Srid column - Startdatetime column - Targetspecies column - Tirecount column - Treatacres column - Treatarea column - Treathectares column - Treatmenthours column - Treatmentlength column - Treatmentlengthunits column - Totalcostprodcut column - Ulvrouteid column - Warningoverride column - Winddir column - Windspeed column - Zone column - Zone2 column - GeometryX column - GeometryY column - TempSitecond column - Updated column - Geom column -} - -func (c fsTreatmentColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Activity, c.Areaunit, c.Avetemp, c.Barrierrouteid, c.Cbcount, c.Comments, c.Containercount, c.Creationdate, c.Creator, c.Enddatetime, c.Equiptype, c.Editdate, c.Editor, c.Fieldtech, c.Flowrate, c.Globalid, c.Habitat, c.InspID, c.Invloc, c.Linelocid, c.Locationname, c.Method, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Product, c.Ptaid, c.Qty, c.Qtyunit, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sdid, c.Sitecond, c.Srid, c.Startdatetime, c.Targetspecies, c.Tirecount, c.Treatacres, c.Treatarea, c.Treathectares, c.Treatmenthours, c.Treatmentlength, c.Treatmentlengthunits, c.Totalcostprodcut, c.Ulvrouteid, c.Warningoverride, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.TempSitecond, c.Updated, c.Geom, - } -} - -type fsTreatmentIndexes struct { - FSTreatmentPkey index - IdxFSTreatmentGeom index -} - -func (i fsTreatmentIndexes) AsSlice() []index { - return []index{ - i.FSTreatmentPkey, i.IdxFSTreatmentGeom, - } -} - -type fsTreatmentForeignKeys struct { - FSTreatmentFSTreatmentOrganizationIDFkey foreignKey -} - -func (f fsTreatmentForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSTreatmentFSTreatmentOrganizationIDFkey, - } -} - -type fsTreatmentUniques struct{} - -func (u fsTreatmentUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsTreatmentChecks struct{} - -func (c fsTreatmentChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_treatmentarea.bob.go b/db/dbinfo/fs_treatmentarea.bob.go deleted file mode 100644 index a4a51ab3..00000000 --- a/db/dbinfo/fs_treatmentarea.bob.go +++ /dev/null @@ -1,317 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSTreatmentareas = Table[ - fsTreatmentareaColumns, - fsTreatmentareaIndexes, - fsTreatmentareaForeignKeys, - fsTreatmentareaUniques, - fsTreatmentareaChecks, -]{ - Schema: "", - Name: "fs_treatmentarea", - Columns: fsTreatmentareaColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Notified: column{ - Name: "notified", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - SessionID: column{ - Name: "session_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeArea: column{ - Name: "shape__area", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeLength: column{ - Name: "shape__length", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Treatdate: column{ - Name: "treatdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - TreatID: column{ - Name: "treat_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Type: column{ - Name: "type", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsTreatmentareaIndexes{ - FSTreatmentareaPkey: index{ - Type: "btree", - Name: "fs_treatmentarea_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_treatmentarea_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsTreatmentareaForeignKeys{ - FSTreatmentareaFSTreatmentareaOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_treatmentarea.fs_treatmentarea_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsTreatmentareaColumns struct { - OrganizationID column - Comments column - Creationdate column - Creator column - Editdate column - Editor column - Globalid column - Notified column - Objectid column - SessionID column - ShapeArea column - ShapeLength column - Treatdate column - TreatID column - Type column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Updated column -} - -func (c fsTreatmentareaColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Notified, c.Objectid, c.SessionID, c.ShapeArea, c.ShapeLength, c.Treatdate, c.TreatID, c.Type, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Updated, - } -} - -type fsTreatmentareaIndexes struct { - FSTreatmentareaPkey index -} - -func (i fsTreatmentareaIndexes) AsSlice() []index { - return []index{ - i.FSTreatmentareaPkey, - } -} - -type fsTreatmentareaForeignKeys struct { - FSTreatmentareaFSTreatmentareaOrganizationIDFkey foreignKey -} - -func (f fsTreatmentareaForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSTreatmentareaFSTreatmentareaOrganizationIDFkey, - } -} - -type fsTreatmentareaUniques struct{} - -func (u fsTreatmentareaUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsTreatmentareaChecks struct{} - -func (c fsTreatmentareaChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_zones.bob.go b/db/dbinfo/fs_zones.bob.go deleted file mode 100644 index 43b67b62..00000000 --- a/db/dbinfo/fs_zones.bob.go +++ /dev/null @@ -1,277 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSZones = Table[ - fsZoneColumns, - fsZoneIndexes, - fsZoneForeignKeys, - fsZoneUniques, - fsZoneChecks, -]{ - Schema: "", - Name: "fs_zones", - Columns: fsZoneColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Active: column{ - Name: "active", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - ShapeArea: column{ - Name: "shape__area", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeLength: column{ - Name: "shape__length", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsZoneIndexes{ - FSZonesPkey: index{ - Type: "btree", - Name: "fs_zones_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_zones_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsZoneForeignKeys{ - FSZonesFSZonesOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_zones.fs_zones_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsZoneColumns struct { - OrganizationID column - Active column - Creationdate column - Creator column - Editdate column - Editor column - Globalid column - Name column - Objectid column - ShapeArea column - ShapeLength column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Updated column -} - -func (c fsZoneColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Active, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Name, c.Objectid, c.ShapeArea, c.ShapeLength, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Updated, - } -} - -type fsZoneIndexes struct { - FSZonesPkey index -} - -func (i fsZoneIndexes) AsSlice() []index { - return []index{ - i.FSZonesPkey, - } -} - -type fsZoneForeignKeys struct { - FSZonesFSZonesOrganizationIDFkey foreignKey -} - -func (f fsZoneForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSZonesFSZonesOrganizationIDFkey, - } -} - -type fsZoneUniques struct{} - -func (u fsZoneUniques) AsSlice() []constraint { - return []constraint{} -} - -type fsZoneChecks struct{} - -func (c fsZoneChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/fs_zones2.bob.go b/db/dbinfo/fs_zones2.bob.go deleted file mode 100644 index 072f99c1..00000000 --- a/db/dbinfo/fs_zones2.bob.go +++ /dev/null @@ -1,267 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 FSZones2s = Table[ - fsZones2Columns, - fsZones2Indexes, - fsZones2ForeignKeys, - fsZones2Uniques, - fsZones2Checks, -]{ - Schema: "", - Name: "fs_zones2", - Columns: fsZones2Columns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - ShapeArea: column{ - Name: "shape__area", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeLength: column{ - Name: "shape__length", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Updated: column{ - Name: "updated", - DBType: "timestamp without time zone", - Default: "CURRENT_TIMESTAMP", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: fsZones2Indexes{ - FSZones2Pkey: index{ - Type: "btree", - Name: "fs_zones2_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "fs_zones2_pkey", - Columns: []string{"objectid"}, - Comment: "", - }, - ForeignKeys: fsZones2ForeignKeys{ - FSZones2FSZones2OrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "fs_zones2.fs_zones2_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type fsZones2Columns struct { - OrganizationID column - Creationdate column - Creator column - Editdate column - Editor column - Globalid column - Name column - Objectid column - ShapeArea column - ShapeLength column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Updated column -} - -func (c fsZones2Columns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Name, c.Objectid, c.ShapeArea, c.ShapeLength, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Updated, - } -} - -type fsZones2Indexes struct { - FSZones2Pkey index -} - -func (i fsZones2Indexes) AsSlice() []index { - return []index{ - i.FSZones2Pkey, - } -} - -type fsZones2ForeignKeys struct { - FSZones2FSZones2OrganizationIDFkey foreignKey -} - -func (f fsZones2ForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.FSZones2FSZones2OrganizationIDFkey, - } -} - -type fsZones2Uniques struct{} - -func (u fsZones2Uniques) AsSlice() []constraint { - return []constraint{} -} - -type fsZones2Checks struct{} - -func (c fsZones2Checks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/geography_columns.bob.go b/db/dbinfo/geography_columns.bob.go index d25dd407..70691691 100644 --- a/db/dbinfo/geography_columns.bob.go +++ b/db/dbinfo/geography_columns.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo diff --git a/db/dbinfo/geometry_columns.bob.go b/db/dbinfo/geometry_columns.bob.go index b2dd56f7..4894efba 100644 --- a/db/dbinfo/geometry_columns.bob.go +++ b/db/dbinfo/geometry_columns.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo diff --git a/db/dbinfo/goose_db_version.bob.go b/db/dbinfo/goose_db_version.bob.go index 2446c32d..08b9f23d 100644 --- a/db/dbinfo/goose_db_version.bob.go +++ b/db/dbinfo/goose_db_version.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo diff --git a/db/dbinfo/h3_aggregation.bob.go b/db/dbinfo/h3_aggregation.bob.go index 40976a4e..fb93a0f7 100644 --- a/db/dbinfo/h3_aggregation.bob.go +++ b/db/dbinfo/h3_aggregation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo diff --git a/db/dbinfo/history_containerrelate.bob.go b/db/dbinfo/history_containerrelate.bob.go deleted file mode 100644 index 4eee2159..00000000 --- a/db/dbinfo/history_containerrelate.bob.go +++ /dev/null @@ -1,292 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryContainerrelates = Table[ - historyContainerrelateColumns, - historyContainerrelateIndexes, - historyContainerrelateForeignKeys, - historyContainerrelateUniques, - historyContainerrelateChecks, -]{ - Schema: "", - Name: "history_containerrelate", - Columns: historyContainerrelateColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Containertype: column{ - Name: "containertype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Inspsampleid: column{ - Name: "inspsampleid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Mosquitoinspid: column{ - Name: "mosquitoinspid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Treatmentid: column{ - Name: "treatmentid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyContainerrelateIndexes{ - HistoryContainerrelatePkey: index{ - Type: "btree", - Name: "history_containerrelate_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_containerrelate_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyContainerrelateForeignKeys{ - HistoryContainerrelateHistoryContainerrelateOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_containerrelate.history_containerrelate_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyContainerrelateColumns struct { - OrganizationID column - Containertype column - Creationdate column - Creator column - Editdate column - Editor column - Globalid column - Inspsampleid column - Mosquitoinspid column - Objectid column - Treatmentid column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Version column -} - -func (c historyContainerrelateColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Containertype, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Inspsampleid, c.Mosquitoinspid, c.Objectid, c.Treatmentid, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, - } -} - -type historyContainerrelateIndexes struct { - HistoryContainerrelatePkey index -} - -func (i historyContainerrelateIndexes) AsSlice() []index { - return []index{ - i.HistoryContainerrelatePkey, - } -} - -type historyContainerrelateForeignKeys struct { - HistoryContainerrelateHistoryContainerrelateOrganizationIDFkey foreignKey -} - -func (f historyContainerrelateForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryContainerrelateHistoryContainerrelateOrganizationIDFkey, - } -} - -type historyContainerrelateUniques struct{} - -func (u historyContainerrelateUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyContainerrelateChecks struct{} - -func (c historyContainerrelateChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_fieldscoutinglog.bob.go b/db/dbinfo/history_fieldscoutinglog.bob.go deleted file mode 100644 index 8e3fc9ab..00000000 --- a/db/dbinfo/history_fieldscoutinglog.bob.go +++ /dev/null @@ -1,262 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryFieldscoutinglogs = Table[ - historyFieldscoutinglogColumns, - historyFieldscoutinglogIndexes, - historyFieldscoutinglogForeignKeys, - historyFieldscoutinglogUniques, - historyFieldscoutinglogChecks, -]{ - Schema: "", - Name: "history_fieldscoutinglog", - Columns: historyFieldscoutinglogColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Status: column{ - Name: "status", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyFieldscoutinglogIndexes{ - HistoryFieldscoutinglogPkey: index{ - Type: "btree", - Name: "history_fieldscoutinglog_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_fieldscoutinglog_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyFieldscoutinglogForeignKeys{ - HistoryFieldscoutinglogHistoryFieldscoutinglogOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_fieldscoutinglog.history_fieldscoutinglog_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyFieldscoutinglogColumns struct { - OrganizationID column - Creationdate column - Creator column - Editdate column - Editor column - Globalid column - Objectid column - Status column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Version column -} - -func (c historyFieldscoutinglogColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Objectid, c.Status, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, - } -} - -type historyFieldscoutinglogIndexes struct { - HistoryFieldscoutinglogPkey index -} - -func (i historyFieldscoutinglogIndexes) AsSlice() []index { - return []index{ - i.HistoryFieldscoutinglogPkey, - } -} - -type historyFieldscoutinglogForeignKeys struct { - HistoryFieldscoutinglogHistoryFieldscoutinglogOrganizationIDFkey foreignKey -} - -func (f historyFieldscoutinglogForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryFieldscoutinglogHistoryFieldscoutinglogOrganizationIDFkey, - } -} - -type historyFieldscoutinglogUniques struct{} - -func (u historyFieldscoutinglogUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyFieldscoutinglogChecks struct{} - -func (c historyFieldscoutinglogChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_habitatrelate.bob.go b/db/dbinfo/history_habitatrelate.bob.go deleted file mode 100644 index 6e6d3f2f..00000000 --- a/db/dbinfo/history_habitatrelate.bob.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryHabitatrelates = Table[ - historyHabitatrelateColumns, - historyHabitatrelateIndexes, - historyHabitatrelateForeignKeys, - historyHabitatrelateUniques, - historyHabitatrelateChecks, -]{ - Schema: "", - Name: "history_habitatrelate", - Columns: historyHabitatrelateColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ForeignID: column{ - Name: "foreign_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Habitattype: column{ - Name: "habitattype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyHabitatrelateIndexes{ - HistoryHabitatrelatePkey: index{ - Type: "btree", - Name: "history_habitatrelate_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_habitatrelate_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyHabitatrelateForeignKeys{ - HistoryHabitatrelateHistoryHabitatrelateOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_habitatrelate.history_habitatrelate_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyHabitatrelateColumns struct { - OrganizationID column - Creationdate column - Creator column - Editdate column - Editor column - ForeignID column - Globalid column - Habitattype column - Objectid column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Version column -} - -func (c historyHabitatrelateColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.ForeignID, c.Globalid, c.Habitattype, c.Objectid, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, - } -} - -type historyHabitatrelateIndexes struct { - HistoryHabitatrelatePkey index -} - -func (i historyHabitatrelateIndexes) AsSlice() []index { - return []index{ - i.HistoryHabitatrelatePkey, - } -} - -type historyHabitatrelateForeignKeys struct { - HistoryHabitatrelateHistoryHabitatrelateOrganizationIDFkey foreignKey -} - -func (f historyHabitatrelateForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryHabitatrelateHistoryHabitatrelateOrganizationIDFkey, - } -} - -type historyHabitatrelateUniques struct{} - -func (u historyHabitatrelateUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyHabitatrelateChecks struct{} - -func (c historyHabitatrelateChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_inspectionsample.bob.go b/db/dbinfo/history_inspectionsample.bob.go deleted file mode 100644 index 7153cea0..00000000 --- a/db/dbinfo/history_inspectionsample.bob.go +++ /dev/null @@ -1,292 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryInspectionsamples = Table[ - historyInspectionsampleColumns, - historyInspectionsampleIndexes, - historyInspectionsampleForeignKeys, - historyInspectionsampleUniques, - historyInspectionsampleChecks, -]{ - Schema: "", - Name: "history_inspectionsample", - Columns: historyInspectionsampleColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Idbytech: column{ - Name: "idbytech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - InspID: column{ - Name: "insp_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Processed: column{ - Name: "processed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sampleid: column{ - Name: "sampleid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyInspectionsampleIndexes{ - HistoryInspectionsamplePkey: index{ - Type: "btree", - Name: "history_inspectionsample_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_inspectionsample_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyInspectionsampleForeignKeys{ - HistoryInspectionsampleHistoryInspectionsampleOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_inspectionsample.history_inspectionsample_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyInspectionsampleColumns struct { - OrganizationID column - Creationdate column - Creator column - Editdate column - Editor column - Globalid column - Idbytech column - InspID column - Objectid column - Processed column - Sampleid column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Version column -} - -func (c historyInspectionsampleColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Idbytech, c.InspID, c.Objectid, c.Processed, c.Sampleid, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, - } -} - -type historyInspectionsampleIndexes struct { - HistoryInspectionsamplePkey index -} - -func (i historyInspectionsampleIndexes) AsSlice() []index { - return []index{ - i.HistoryInspectionsamplePkey, - } -} - -type historyInspectionsampleForeignKeys struct { - HistoryInspectionsampleHistoryInspectionsampleOrganizationIDFkey foreignKey -} - -func (f historyInspectionsampleForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryInspectionsampleHistoryInspectionsampleOrganizationIDFkey, - } -} - -type historyInspectionsampleUniques struct{} - -func (u historyInspectionsampleUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyInspectionsampleChecks struct{} - -func (c historyInspectionsampleChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_inspectionsampledetail.bob.go b/db/dbinfo/history_inspectionsampledetail.bob.go deleted file mode 100644 index e05398f4..00000000 --- a/db/dbinfo/history_inspectionsampledetail.bob.go +++ /dev/null @@ -1,402 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryInspectionsampledetails = Table[ - historyInspectionsampledetailColumns, - historyInspectionsampledetailIndexes, - historyInspectionsampledetailForeignKeys, - historyInspectionsampledetailUniques, - historyInspectionsampledetailChecks, -]{ - Schema: "", - Name: "history_inspectionsampledetail", - Columns: historyInspectionsampledetailColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fadultact: column{ - Name: "fadultact", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fdomstage: column{ - Name: "fdomstage", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Feggcount: column{ - Name: "feggcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldspecies: column{ - Name: "fieldspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Flarvcount: column{ - Name: "flarvcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Flstages: column{ - Name: "flstages", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fpupcount: column{ - Name: "fpupcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - InspsampleID: column{ - Name: "inspsample_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Labspecies: column{ - Name: "labspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Ldomstage: column{ - Name: "ldomstage", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Leggcount: column{ - Name: "leggcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Llarvcount: column{ - Name: "llarvcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lpupcount: column{ - Name: "lpupcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Processed: column{ - Name: "processed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyInspectionsampledetailIndexes{ - HistoryInspectionsampledetailPkey: index{ - Type: "btree", - Name: "history_inspectionsampledetail_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_inspectionsampledetail_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyInspectionsampledetailForeignKeys{ - HistoryInspectionsampledetailHistoryInspectionsampledetailOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_inspectionsampledetail.history_inspectionsampledetail_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyInspectionsampledetailColumns struct { - OrganizationID column - Comments column - Creationdate column - Creator column - Editdate column - Editor column - Fadultact column - Fdomstage column - Feggcount column - Fieldspecies column - Flarvcount column - Flstages column - Fpupcount column - Globalid column - InspsampleID column - Labspecies column - Ldomstage column - Leggcount column - Llarvcount column - Lpupcount column - Objectid column - Processed column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Version column -} - -func (c historyInspectionsampledetailColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Fadultact, c.Fdomstage, c.Feggcount, c.Fieldspecies, c.Flarvcount, c.Flstages, c.Fpupcount, c.Globalid, c.InspsampleID, c.Labspecies, c.Ldomstage, c.Leggcount, c.Llarvcount, c.Lpupcount, c.Objectid, c.Processed, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, - } -} - -type historyInspectionsampledetailIndexes struct { - HistoryInspectionsampledetailPkey index -} - -func (i historyInspectionsampledetailIndexes) AsSlice() []index { - return []index{ - i.HistoryInspectionsampledetailPkey, - } -} - -type historyInspectionsampledetailForeignKeys struct { - HistoryInspectionsampledetailHistoryInspectionsampledetailOrganizationIDFkey foreignKey -} - -func (f historyInspectionsampledetailForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryInspectionsampledetailHistoryInspectionsampledetailOrganizationIDFkey, - } -} - -type historyInspectionsampledetailUniques struct{} - -func (u historyInspectionsampledetailUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyInspectionsampledetailChecks struct{} - -func (c historyInspectionsampledetailChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_linelocation.bob.go b/db/dbinfo/history_linelocation.bob.go deleted file mode 100644 index 4f8d80c8..00000000 --- a/db/dbinfo/history_linelocation.bob.go +++ /dev/null @@ -1,632 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryLinelocations = Table[ - historyLinelocationColumns, - historyLinelocationIndexes, - historyLinelocationForeignKeys, - historyLinelocationUniques, - historyLinelocationChecks, -]{ - Schema: "", - Name: "history_linelocation", - Columns: historyLinelocationColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accessdesc: column{ - Name: "accessdesc", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Acres: column{ - Name: "acres", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Active: column{ - Name: "active", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Description: column{ - Name: "description", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Habitat: column{ - Name: "habitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Hectares: column{ - Name: "hectares", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Jurisdiction: column{ - Name: "jurisdiction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvinspectinterval: column{ - Name: "larvinspectinterval", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectactiontaken: column{ - Name: "lastinspectactiontaken", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectactivity: column{ - Name: "lastinspectactivity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectavglarvae: column{ - Name: "lastinspectavglarvae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectavgpupae: column{ - Name: "lastinspectavgpupae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectbreeding: column{ - Name: "lastinspectbreeding", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectconditions: column{ - Name: "lastinspectconditions", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectdate: column{ - Name: "lastinspectdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectfieldspecies: column{ - Name: "lastinspectfieldspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectlstages: column{ - Name: "lastinspectlstages", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatactivity: column{ - Name: "lasttreatactivity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatdate: column{ - Name: "lasttreatdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatproduct: column{ - Name: "lasttreatproduct", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqty: column{ - Name: "lasttreatqty", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqtyunit: column{ - Name: "lasttreatqtyunit", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LengthFT: column{ - Name: "length_ft", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LengthMeters: column{ - Name: "length_meters", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationnumber: column{ - Name: "locationnumber", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nextactiondatescheduled: column{ - Name: "nextactiondatescheduled", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Symbology: column{ - Name: "symbology", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeLength: column{ - Name: "shape__length", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Usetype: column{ - Name: "usetype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Waterorigin: column{ - Name: "waterorigin", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - WidthFT: column{ - Name: "width_ft", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - WidthMeters: column{ - Name: "width_meters", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyLinelocationIndexes{ - HistoryLinelocationPkey: index{ - Type: "btree", - Name: "history_linelocation_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_linelocation_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyLinelocationForeignKeys{ - HistoryLinelocationHistoryLinelocationOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_linelocation.history_linelocation_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyLinelocationColumns struct { - OrganizationID column - Accessdesc column - Acres column - Active column - Comments column - Creationdate column - Creator column - Description column - Externalid column - Editdate column - Editor column - Globalid column - Habitat column - Hectares column - Jurisdiction column - Larvinspectinterval column - Lastinspectactiontaken column - Lastinspectactivity column - Lastinspectavglarvae column - Lastinspectavgpupae column - Lastinspectbreeding column - Lastinspectconditions column - Lastinspectdate column - Lastinspectfieldspecies column - Lastinspectlstages column - Lasttreatactivity column - Lasttreatdate column - Lasttreatproduct column - Lasttreatqty column - Lasttreatqtyunit column - LengthFT column - LengthMeters column - Locationnumber column - Name column - Nextactiondatescheduled column - Objectid column - Priority column - Symbology column - ShapeLength column - Usetype column - Waterorigin column - WidthFT column - WidthMeters column - Zone column - Zone2 column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Version column -} - -func (c historyLinelocationColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accessdesc, c.Acres, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Globalid, c.Habitat, c.Hectares, c.Jurisdiction, c.Larvinspectinterval, c.Lastinspectactiontaken, c.Lastinspectactivity, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectbreeding, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectfieldspecies, c.Lastinspectlstages, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.LengthFT, c.LengthMeters, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.ShapeLength, c.Usetype, c.Waterorigin, c.WidthFT, c.WidthMeters, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, - } -} - -type historyLinelocationIndexes struct { - HistoryLinelocationPkey index -} - -func (i historyLinelocationIndexes) AsSlice() []index { - return []index{ - i.HistoryLinelocationPkey, - } -} - -type historyLinelocationForeignKeys struct { - HistoryLinelocationHistoryLinelocationOrganizationIDFkey foreignKey -} - -func (f historyLinelocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryLinelocationHistoryLinelocationOrganizationIDFkey, - } -} - -type historyLinelocationUniques struct{} - -func (u historyLinelocationUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyLinelocationChecks struct{} - -func (c historyLinelocationChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_locationtracking.bob.go b/db/dbinfo/history_locationtracking.bob.go deleted file mode 100644 index 29fe80b1..00000000 --- a/db/dbinfo/history_locationtracking.bob.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryLocationtrackings = Table[ - historyLocationtrackingColumns, - historyLocationtrackingIndexes, - historyLocationtrackingForeignKeys, - historyLocationtrackingUniques, - historyLocationtrackingChecks, -]{ - Schema: "", - Name: "history_locationtracking", - Columns: historyLocationtrackingColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accuracy: column{ - Name: "accuracy", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldtech: column{ - Name: "fieldtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyLocationtrackingIndexes{ - HistoryLocationtrackingPkey: index{ - Type: "btree", - Name: "history_locationtracking_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_locationtracking_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyLocationtrackingForeignKeys{ - HistoryLocationtrackingHistoryLocationtrackingOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_locationtracking.history_locationtracking_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyLocationtrackingColumns struct { - OrganizationID column - Accuracy column - Creationdate column - Creator column - Editdate column - Editor column - Fieldtech column - Globalid column - Objectid column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Version column -} - -func (c historyLocationtrackingColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accuracy, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Fieldtech, c.Globalid, c.Objectid, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, - } -} - -type historyLocationtrackingIndexes struct { - HistoryLocationtrackingPkey index -} - -func (i historyLocationtrackingIndexes) AsSlice() []index { - return []index{ - i.HistoryLocationtrackingPkey, - } -} - -type historyLocationtrackingForeignKeys struct { - HistoryLocationtrackingHistoryLocationtrackingOrganizationIDFkey foreignKey -} - -func (f historyLocationtrackingForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryLocationtrackingHistoryLocationtrackingOrganizationIDFkey, - } -} - -type historyLocationtrackingUniques struct{} - -func (u historyLocationtrackingUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyLocationtrackingChecks struct{} - -func (c historyLocationtrackingChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_mosquitoinspection.bob.go b/db/dbinfo/history_mosquitoinspection.bob.go deleted file mode 100644 index c34a3072..00000000 --- a/db/dbinfo/history_mosquitoinspection.bob.go +++ /dev/null @@ -1,722 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryMosquitoinspections = Table[ - historyMosquitoinspectionColumns, - historyMosquitoinspectionIndexes, - historyMosquitoinspectionForeignKeys, - historyMosquitoinspectionUniques, - historyMosquitoinspectionChecks, -]{ - Schema: "", - Name: "history_mosquitoinspection", - Columns: historyMosquitoinspectionColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Actiontaken: column{ - Name: "actiontaken", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Activity: column{ - Name: "activity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Adultact: column{ - Name: "adultact", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Avetemp: column{ - Name: "avetemp", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Avglarvae: column{ - Name: "avglarvae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Avgpupae: column{ - Name: "avgpupae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Breeding: column{ - Name: "breeding", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Cbcount: column{ - Name: "cbcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Containercount: column{ - Name: "containercount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Domstage: column{ - Name: "domstage", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Eggs: column{ - Name: "eggs", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Enddatetime: column{ - Name: "enddatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldspecies: column{ - Name: "fieldspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldtech: column{ - Name: "fieldtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Jurisdiction: column{ - Name: "jurisdiction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvaepresent: column{ - Name: "larvaepresent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Linelocid: column{ - Name: "linelocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationname: column{ - Name: "locationname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lstages: column{ - Name: "lstages", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Numdips: column{ - Name: "numdips", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Personalcontact: column{ - Name: "personalcontact", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Pointlocid: column{ - Name: "pointlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Polygonlocid: column{ - Name: "polygonlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Posdips: column{ - Name: "posdips", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Positivecontainercount: column{ - Name: "positivecontainercount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Pupaepresent: column{ - Name: "pupaepresent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Raingauge: column{ - Name: "raingauge", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Recordstatus: column{ - Name: "recordstatus", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewed: column{ - Name: "reviewed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewedby: column{ - Name: "reviewedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Revieweddate: column{ - Name: "revieweddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sdid: column{ - Name: "sdid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sitecond: column{ - Name: "sitecond", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Srid: column{ - Name: "srid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Startdatetime: column{ - Name: "startdatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Tirecount: column{ - Name: "tirecount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Totlarvae: column{ - Name: "totlarvae", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Totpupae: column{ - Name: "totpupae", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Visualmonitoring: column{ - Name: "visualmonitoring", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vmcomments: column{ - Name: "vmcomments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Winddir: column{ - Name: "winddir", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Windspeed: column{ - Name: "windspeed", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Adminaction: column{ - Name: "adminaction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Ptaid: column{ - Name: "ptaid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyMosquitoinspectionIndexes{ - HistoryMosquitoinspectionPkey: index{ - Type: "btree", - Name: "history_mosquitoinspection_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_mosquitoinspection_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyMosquitoinspectionForeignKeys{ - HistoryMosquitoinspectionHistoryMosquitoinspectionOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_mosquitoinspection.history_mosquitoinspection_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyMosquitoinspectionColumns struct { - OrganizationID column - Actiontaken column - Activity column - Adultact column - Avetemp column - Avglarvae column - Avgpupae column - Breeding column - Cbcount column - Comments column - Containercount column - Creationdate column - Creator column - Domstage column - Eggs column - Enddatetime column - Editdate column - Editor column - Fieldspecies column - Fieldtech column - Globalid column - Jurisdiction column - Larvaepresent column - Linelocid column - Locationname column - Lstages column - Numdips column - Objectid column - Personalcontact column - Pointlocid column - Polygonlocid column - Posdips column - Positivecontainercount column - Pupaepresent column - Raingauge column - Recordstatus column - Reviewed column - Reviewedby column - Revieweddate column - Sdid column - Sitecond column - Srid column - Startdatetime column - Tirecount column - Totlarvae column - Totpupae column - Visualmonitoring column - Vmcomments column - Winddir column - Windspeed column - Zone column - Zone2 column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Adminaction column - Ptaid column - Version column -} - -func (c historyMosquitoinspectionColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Actiontaken, c.Activity, c.Adultact, c.Avetemp, c.Avglarvae, c.Avgpupae, c.Breeding, c.Cbcount, c.Comments, c.Containercount, c.Creationdate, c.Creator, c.Domstage, c.Eggs, c.Enddatetime, c.Editdate, c.Editor, c.Fieldspecies, c.Fieldtech, c.Globalid, c.Jurisdiction, c.Larvaepresent, c.Linelocid, c.Locationname, c.Lstages, c.Numdips, c.Objectid, c.Personalcontact, c.Pointlocid, c.Polygonlocid, c.Posdips, c.Positivecontainercount, c.Pupaepresent, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sdid, c.Sitecond, c.Srid, c.Startdatetime, c.Tirecount, c.Totlarvae, c.Totpupae, c.Visualmonitoring, c.Vmcomments, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Adminaction, c.Ptaid, c.Version, - } -} - -type historyMosquitoinspectionIndexes struct { - HistoryMosquitoinspectionPkey index -} - -func (i historyMosquitoinspectionIndexes) AsSlice() []index { - return []index{ - i.HistoryMosquitoinspectionPkey, - } -} - -type historyMosquitoinspectionForeignKeys struct { - HistoryMosquitoinspectionHistoryMosquitoinspectionOrganizationIDFkey foreignKey -} - -func (f historyMosquitoinspectionForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryMosquitoinspectionHistoryMosquitoinspectionOrganizationIDFkey, - } -} - -type historyMosquitoinspectionUniques struct{} - -func (u historyMosquitoinspectionUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyMosquitoinspectionChecks struct{} - -func (c historyMosquitoinspectionChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_pointlocation.bob.go b/db/dbinfo/history_pointlocation.bob.go deleted file mode 100644 index 010a294c..00000000 --- a/db/dbinfo/history_pointlocation.bob.go +++ /dev/null @@ -1,592 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryPointlocations = Table[ - historyPointlocationColumns, - historyPointlocationIndexes, - historyPointlocationForeignKeys, - historyPointlocationUniques, - historyPointlocationChecks, -]{ - Schema: "", - Name: "history_pointlocation", - Columns: historyPointlocationColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accessdesc: column{ - Name: "accessdesc", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Active: column{ - Name: "active", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Description: column{ - Name: "description", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Habitat: column{ - Name: "habitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Jurisdiction: column{ - Name: "jurisdiction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvinspectinterval: column{ - Name: "larvinspectinterval", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectactiontaken: column{ - Name: "lastinspectactiontaken", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectactivity: column{ - Name: "lastinspectactivity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectavglarvae: column{ - Name: "lastinspectavglarvae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectavgpupae: column{ - Name: "lastinspectavgpupae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectbreeding: column{ - Name: "lastinspectbreeding", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectconditions: column{ - Name: "lastinspectconditions", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectdate: column{ - Name: "lastinspectdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectfieldspecies: column{ - Name: "lastinspectfieldspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectlstages: column{ - Name: "lastinspectlstages", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatactivity: column{ - Name: "lasttreatactivity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatdate: column{ - Name: "lasttreatdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatproduct: column{ - Name: "lasttreatproduct", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqty: column{ - Name: "lasttreatqty", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqtyunit: column{ - Name: "lasttreatqtyunit", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationnumber: column{ - Name: "locationnumber", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nextactiondatescheduled: column{ - Name: "nextactiondatescheduled", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Stype: column{ - Name: "stype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Symbology: column{ - Name: "symbology", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Usetype: column{ - Name: "usetype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Waterorigin: column{ - Name: "waterorigin", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - X: column{ - Name: "x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Y: column{ - Name: "y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Assignedtech: column{ - Name: "assignedtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - DeactivateReason: column{ - Name: "deactivate_reason", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Scalarpriority: column{ - Name: "scalarpriority", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sourcestatus: column{ - Name: "sourcestatus", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyPointlocationIndexes{ - HistoryPointlocationPkey: index{ - Type: "btree", - Name: "history_pointlocation_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_pointlocation_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyPointlocationForeignKeys{ - HistoryPointlocationHistoryPointlocationOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_pointlocation.history_pointlocation_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyPointlocationColumns struct { - OrganizationID column - Accessdesc column - Active column - Comments column - Created column - Creationdate column - Creator column - Description column - Externalid column - Editdate column - Editor column - Globalid column - Habitat column - Jurisdiction column - Larvinspectinterval column - Lastinspectactiontaken column - Lastinspectactivity column - Lastinspectavglarvae column - Lastinspectavgpupae column - Lastinspectbreeding column - Lastinspectconditions column - Lastinspectdate column - Lastinspectfieldspecies column - Lastinspectlstages column - Lasttreatactivity column - Lasttreatdate column - Lasttreatproduct column - Lasttreatqty column - Lasttreatqtyunit column - Locationnumber column - Name column - Nextactiondatescheduled column - Objectid column - Priority column - Stype column - Symbology column - Usetype column - Waterorigin column - X column - Y column - Zone column - Zone2 column - GeometryX column - GeometryY column - Assignedtech column - DeactivateReason column - Scalarpriority column - Sourcestatus column - Version column -} - -func (c historyPointlocationColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Created, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Globalid, c.Habitat, c.Jurisdiction, c.Larvinspectinterval, c.Lastinspectactiontaken, c.Lastinspectactivity, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectbreeding, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectfieldspecies, c.Lastinspectlstages, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Stype, c.Symbology, c.Usetype, c.Waterorigin, c.X, c.Y, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.Assignedtech, c.DeactivateReason, c.Scalarpriority, c.Sourcestatus, c.Version, - } -} - -type historyPointlocationIndexes struct { - HistoryPointlocationPkey index -} - -func (i historyPointlocationIndexes) AsSlice() []index { - return []index{ - i.HistoryPointlocationPkey, - } -} - -type historyPointlocationForeignKeys struct { - HistoryPointlocationHistoryPointlocationOrganizationIDFkey foreignKey -} - -func (f historyPointlocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryPointlocationHistoryPointlocationOrganizationIDFkey, - } -} - -type historyPointlocationUniques struct{} - -func (u historyPointlocationUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyPointlocationChecks struct{} - -func (c historyPointlocationChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_polygonlocation.bob.go b/db/dbinfo/history_polygonlocation.bob.go deleted file mode 100644 index 2b18ccfb..00000000 --- a/db/dbinfo/history_polygonlocation.bob.go +++ /dev/null @@ -1,572 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryPolygonlocations = Table[ - historyPolygonlocationColumns, - historyPolygonlocationIndexes, - historyPolygonlocationForeignKeys, - historyPolygonlocationUniques, - historyPolygonlocationChecks, -]{ - Schema: "", - Name: "history_polygonlocation", - Columns: historyPolygonlocationColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accessdesc: column{ - Name: "accessdesc", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Acres: column{ - Name: "acres", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Active: column{ - Name: "active", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Description: column{ - Name: "description", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Filter: column{ - Name: "filter", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Habitat: column{ - Name: "habitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Hectares: column{ - Name: "hectares", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Jurisdiction: column{ - Name: "jurisdiction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvinspectinterval: column{ - Name: "larvinspectinterval", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectactiontaken: column{ - Name: "lastinspectactiontaken", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectactivity: column{ - Name: "lastinspectactivity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectavglarvae: column{ - Name: "lastinspectavglarvae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectavgpupae: column{ - Name: "lastinspectavgpupae", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectbreeding: column{ - Name: "lastinspectbreeding", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectconditions: column{ - Name: "lastinspectconditions", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectdate: column{ - Name: "lastinspectdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectfieldspecies: column{ - Name: "lastinspectfieldspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectlstages: column{ - Name: "lastinspectlstages", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatactivity: column{ - Name: "lasttreatactivity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatdate: column{ - Name: "lasttreatdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatproduct: column{ - Name: "lasttreatproduct", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqty: column{ - Name: "lasttreatqty", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqtyunit: column{ - Name: "lasttreatqtyunit", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationnumber: column{ - Name: "locationnumber", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nextactiondatescheduled: column{ - Name: "nextactiondatescheduled", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Symbology: column{ - Name: "symbology", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeArea: column{ - Name: "shape__area", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeLength: column{ - Name: "shape__length", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Usetype: column{ - Name: "usetype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Waterorigin: column{ - Name: "waterorigin", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyPolygonlocationIndexes{ - HistoryPolygonlocationPkey: index{ - Type: "btree", - Name: "history_polygonlocation_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_polygonlocation_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyPolygonlocationForeignKeys{ - HistoryPolygonlocationHistoryPolygonlocationOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_polygonlocation.history_polygonlocation_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyPolygonlocationColumns struct { - OrganizationID column - Accessdesc column - Acres column - Active column - Comments column - Creationdate column - Creator column - Description column - Externalid column - Editdate column - Editor column - Filter column - Globalid column - Habitat column - Hectares column - Jurisdiction column - Larvinspectinterval column - Lastinspectactiontaken column - Lastinspectactivity column - Lastinspectavglarvae column - Lastinspectavgpupae column - Lastinspectbreeding column - Lastinspectconditions column - Lastinspectdate column - Lastinspectfieldspecies column - Lastinspectlstages column - Lasttreatactivity column - Lasttreatdate column - Lasttreatproduct column - Lasttreatqty column - Lasttreatqtyunit column - Locationnumber column - Name column - Nextactiondatescheduled column - Objectid column - Priority column - Symbology column - ShapeArea column - ShapeLength column - Usetype column - Waterorigin column - Zone column - Zone2 column - GeometryX column - GeometryY column - Version column - Created column -} - -func (c historyPolygonlocationColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accessdesc, c.Acres, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Filter, c.Globalid, c.Habitat, c.Hectares, c.Jurisdiction, c.Larvinspectinterval, c.Lastinspectactiontaken, c.Lastinspectactivity, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectbreeding, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectfieldspecies, c.Lastinspectlstages, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.ShapeArea, c.ShapeLength, c.Usetype, c.Waterorigin, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.Version, c.Created, - } -} - -type historyPolygonlocationIndexes struct { - HistoryPolygonlocationPkey index -} - -func (i historyPolygonlocationIndexes) AsSlice() []index { - return []index{ - i.HistoryPolygonlocationPkey, - } -} - -type historyPolygonlocationForeignKeys struct { - HistoryPolygonlocationHistoryPolygonlocationOrganizationIDFkey foreignKey -} - -func (f historyPolygonlocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryPolygonlocationHistoryPolygonlocationOrganizationIDFkey, - } -} - -type historyPolygonlocationUniques struct{} - -func (u historyPolygonlocationUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyPolygonlocationChecks struct{} - -func (c historyPolygonlocationChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_pool.bob.go b/db/dbinfo/history_pool.bob.go deleted file mode 100644 index a19bfcc2..00000000 --- a/db/dbinfo/history_pool.bob.go +++ /dev/null @@ -1,432 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryPools = Table[ - historyPoolColumns, - historyPoolIndexes, - historyPoolForeignKeys, - historyPoolUniques, - historyPoolChecks, -]{ - Schema: "", - Name: "history_pool", - Columns: historyPoolColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Datesent: column{ - Name: "datesent", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Datetested: column{ - Name: "datetested", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Diseasepos: column{ - Name: "diseasepos", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Diseasetested: column{ - Name: "diseasetested", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Gatewaysync: column{ - Name: "gatewaysync", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lab: column{ - Name: "lab", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LabID: column{ - Name: "lab_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Poolyear: column{ - Name: "poolyear", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Processed: column{ - Name: "processed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sampleid: column{ - Name: "sampleid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Survtech: column{ - Name: "survtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Testmethod: column{ - Name: "testmethod", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Testtech: column{ - Name: "testtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - TrapdataID: column{ - Name: "trapdata_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vectorsurvcollectionid: column{ - Name: "vectorsurvcollectionid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vectorsurvpoolid: column{ - Name: "vectorsurvpoolid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vectorsurvtrapdataid: column{ - Name: "vectorsurvtrapdataid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyPoolIndexes{ - HistoryPoolPkey: index{ - Type: "btree", - Name: "history_pool_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_pool_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyPoolForeignKeys{ - HistoryPoolHistoryPoolOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_pool.history_pool_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyPoolColumns struct { - OrganizationID column - Comments column - Creationdate column - Creator column - Datesent column - Datetested column - Diseasepos column - Diseasetested column - Editdate column - Editor column - Gatewaysync column - Globalid column - Lab column - LabID column - Objectid column - Poolyear column - Processed column - Sampleid column - Survtech column - Testmethod column - Testtech column - TrapdataID column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Vectorsurvcollectionid column - Vectorsurvpoolid column - Vectorsurvtrapdataid column - Version column -} - -func (c historyPoolColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Datesent, c.Datetested, c.Diseasepos, c.Diseasetested, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Lab, c.LabID, c.Objectid, c.Poolyear, c.Processed, c.Sampleid, c.Survtech, c.Testmethod, c.Testtech, c.TrapdataID, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Vectorsurvcollectionid, c.Vectorsurvpoolid, c.Vectorsurvtrapdataid, c.Version, - } -} - -type historyPoolIndexes struct { - HistoryPoolPkey index -} - -func (i historyPoolIndexes) AsSlice() []index { - return []index{ - i.HistoryPoolPkey, - } -} - -type historyPoolForeignKeys struct { - HistoryPoolHistoryPoolOrganizationIDFkey foreignKey -} - -func (f historyPoolForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryPoolHistoryPoolOrganizationIDFkey, - } -} - -type historyPoolUniques struct{} - -func (u historyPoolUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyPoolChecks struct{} - -func (c historyPoolChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_pooldetail.bob.go b/db/dbinfo/history_pooldetail.bob.go deleted file mode 100644 index 4e9f5116..00000000 --- a/db/dbinfo/history_pooldetail.bob.go +++ /dev/null @@ -1,292 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryPooldetails = Table[ - historyPooldetailColumns, - historyPooldetailIndexes, - historyPooldetailForeignKeys, - historyPooldetailUniques, - historyPooldetailChecks, -]{ - Schema: "", - Name: "history_pooldetail", - Columns: historyPooldetailColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Females: column{ - Name: "females", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - PoolID: column{ - Name: "pool_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Species: column{ - Name: "species", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - TrapdataID: column{ - Name: "trapdata_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyPooldetailIndexes{ - HistoryPooldetailPkey: index{ - Type: "btree", - Name: "history_pooldetail_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_pooldetail_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyPooldetailForeignKeys{ - HistoryPooldetailHistoryPooldetailOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_pooldetail.history_pooldetail_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyPooldetailColumns struct { - OrganizationID column - Creationdate column - Creator column - Editdate column - Editor column - Females column - Globalid column - Objectid column - PoolID column - Species column - TrapdataID column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Version column -} - -func (c historyPooldetailColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Females, c.Globalid, c.Objectid, c.PoolID, c.Species, c.TrapdataID, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, - } -} - -type historyPooldetailIndexes struct { - HistoryPooldetailPkey index -} - -func (i historyPooldetailIndexes) AsSlice() []index { - return []index{ - i.HistoryPooldetailPkey, - } -} - -type historyPooldetailForeignKeys struct { - HistoryPooldetailHistoryPooldetailOrganizationIDFkey foreignKey -} - -func (f historyPooldetailForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryPooldetailHistoryPooldetailOrganizationIDFkey, - } -} - -type historyPooldetailUniques struct{} - -func (u historyPooldetailUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyPooldetailChecks struct{} - -func (c historyPooldetailChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_proposedtreatmentarea.bob.go b/db/dbinfo/history_proposedtreatmentarea.bob.go deleted file mode 100644 index e2d54a8a..00000000 --- a/db/dbinfo/history_proposedtreatmentarea.bob.go +++ /dev/null @@ -1,482 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryProposedtreatmentareas = Table[ - historyProposedtreatmentareaColumns, - historyProposedtreatmentareaIndexes, - historyProposedtreatmentareaForeignKeys, - historyProposedtreatmentareaUniques, - historyProposedtreatmentareaChecks, -]{ - Schema: "", - Name: "history_proposedtreatmentarea", - Columns: historyProposedtreatmentareaColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Acres: column{ - Name: "acres", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Completed: column{ - Name: "completed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Completedby: column{ - Name: "completedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Completeddate: column{ - Name: "completeddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Duedate: column{ - Name: "duedate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Exported: column{ - Name: "exported", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Hectares: column{ - Name: "hectares", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Issprayroute: column{ - Name: "issprayroute", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatactivity: column{ - Name: "lasttreatactivity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatdate: column{ - Name: "lasttreatdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatproduct: column{ - Name: "lasttreatproduct", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqty: column{ - Name: "lasttreatqty", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatqtyunit: column{ - Name: "lasttreatqtyunit", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Method: column{ - Name: "method", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewed: column{ - Name: "reviewed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewedby: column{ - Name: "reviewedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Revieweddate: column{ - Name: "revieweddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeArea: column{ - Name: "shape__area", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeLength: column{ - Name: "shape__length", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Targetapprate: column{ - Name: "targetapprate", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Targetproduct: column{ - Name: "targetproduct", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Targetspecies: column{ - Name: "targetspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyProposedtreatmentareaIndexes{ - HistoryProposedtreatmentareaPkey: index{ - Type: "btree", - Name: "history_proposedtreatmentarea_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_proposedtreatmentarea_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyProposedtreatmentareaForeignKeys{ - HistoryProposedtreatmentareaHistoryProposedtreatmentareaOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_proposedtreatmentarea.history_proposedtreatmentarea_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyProposedtreatmentareaColumns struct { - OrganizationID column - Acres column - Comments column - Completed column - Completedby column - Completeddate column - Creationdate column - Creator column - Duedate column - Exported column - Editdate column - Editor column - Globalid column - Hectares column - Issprayroute column - Lasttreatactivity column - Lasttreatdate column - Lasttreatproduct column - Lasttreatqty column - Lasttreatqtyunit column - Method column - Name column - Objectid column - Priority column - Reviewed column - Reviewedby column - Revieweddate column - ShapeArea column - ShapeLength column - Targetapprate column - Targetproduct column - Targetspecies column - Zone column - Zone2 column - GeometryX column - GeometryY column - Version column - Created column -} - -func (c historyProposedtreatmentareaColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Acres, c.Comments, c.Completed, c.Completedby, c.Completeddate, c.Creationdate, c.Creator, c.Duedate, c.Exported, c.Editdate, c.Editor, c.Globalid, c.Hectares, c.Issprayroute, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.Method, c.Name, c.Objectid, c.Priority, c.Reviewed, c.Reviewedby, c.Revieweddate, c.ShapeArea, c.ShapeLength, c.Targetapprate, c.Targetproduct, c.Targetspecies, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.Version, c.Created, - } -} - -type historyProposedtreatmentareaIndexes struct { - HistoryProposedtreatmentareaPkey index -} - -func (i historyProposedtreatmentareaIndexes) AsSlice() []index { - return []index{ - i.HistoryProposedtreatmentareaPkey, - } -} - -type historyProposedtreatmentareaForeignKeys struct { - HistoryProposedtreatmentareaHistoryProposedtreatmentareaOrganizationIDFkey foreignKey -} - -func (f historyProposedtreatmentareaForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryProposedtreatmentareaHistoryProposedtreatmentareaOrganizationIDFkey, - } -} - -type historyProposedtreatmentareaUniques struct{} - -func (u historyProposedtreatmentareaUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyProposedtreatmentareaChecks struct{} - -func (c historyProposedtreatmentareaChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_qamosquitoinspection.bob.go b/db/dbinfo/history_qamosquitoinspection.bob.go deleted file mode 100644 index 3c48e09e..00000000 --- a/db/dbinfo/history_qamosquitoinspection.bob.go +++ /dev/null @@ -1,772 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryQamosquitoinspections = Table[ - historyQamosquitoinspectionColumns, - historyQamosquitoinspectionIndexes, - historyQamosquitoinspectionForeignKeys, - historyQamosquitoinspectionUniques, - historyQamosquitoinspectionChecks, -]{ - Schema: "", - Name: "history_qamosquitoinspection", - Columns: historyQamosquitoinspectionColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Acresbreeding: column{ - Name: "acresbreeding", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Actiontaken: column{ - Name: "actiontaken", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Adultactivity: column{ - Name: "adultactivity", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Aquaticorganisms: column{ - Name: "aquaticorganisms", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Avetemp: column{ - Name: "avetemp", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Breedingpotential: column{ - Name: "breedingpotential", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Enddatetime: column{ - Name: "enddatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldtech: column{ - Name: "fieldtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fish: column{ - Name: "fish", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Habvalue1: column{ - Name: "habvalue1", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Habvalue1percent: column{ - Name: "habvalue1percent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Habvalue2: column{ - Name: "habvalue2", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Habvalue2percent: column{ - Name: "habvalue2percent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvaeinsidetreatedarea: column{ - Name: "larvaeinsidetreatedarea", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvaeoutsidetreatedarea: column{ - Name: "larvaeoutsidetreatedarea", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvaepresent: column{ - Name: "larvaepresent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvaereason: column{ - Name: "larvaereason", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Linelocid: column{ - Name: "linelocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationname: column{ - Name: "locationname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LR: column{ - Name: "lr", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Mosquitohabitat: column{ - Name: "mosquitohabitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Movingwater: column{ - Name: "movingwater", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Negdips: column{ - Name: "negdips", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nowaterever: column{ - Name: "nowaterever", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Pointlocid: column{ - Name: "pointlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Polygonlocid: column{ - Name: "polygonlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Posdips: column{ - Name: "posdips", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Potential: column{ - Name: "potential", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Raingauge: column{ - Name: "raingauge", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Recordstatus: column{ - Name: "recordstatus", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewed: column{ - Name: "reviewed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewedby: column{ - Name: "reviewedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Revieweddate: column{ - Name: "revieweddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sitetype: column{ - Name: "sitetype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Soilconditions: column{ - Name: "soilconditions", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sourcereduction: column{ - Name: "sourcereduction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Startdatetime: column{ - Name: "startdatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Totalacres: column{ - Name: "totalacres", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vegetation: column{ - Name: "vegetation", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Waterconditions: column{ - Name: "waterconditions", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Waterduration: column{ - Name: "waterduration", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Watermovement1: column{ - Name: "watermovement1", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Watermovement1percent: column{ - Name: "watermovement1percent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Watermovement2: column{ - Name: "watermovement2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Watermovement2percent: column{ - Name: "watermovement2percent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Waterpresent: column{ - Name: "waterpresent", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Watersource: column{ - Name: "watersource", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Winddir: column{ - Name: "winddir", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Windspeed: column{ - Name: "windspeed", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyQamosquitoinspectionIndexes{ - HistoryQamosquitoinspectionPkey: index{ - Type: "btree", - Name: "history_qamosquitoinspection_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_qamosquitoinspection_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyQamosquitoinspectionForeignKeys{ - HistoryQamosquitoinspectionHistoryQamosquitoinspectionOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_qamosquitoinspection.history_qamosquitoinspection_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyQamosquitoinspectionColumns struct { - OrganizationID column - Acresbreeding column - Actiontaken column - Adultactivity column - Aquaticorganisms column - Avetemp column - Breedingpotential column - Comments column - Creationdate column - Creator column - Enddatetime column - Editdate column - Editor column - Fieldtech column - Fish column - Globalid column - Habvalue1 column - Habvalue1percent column - Habvalue2 column - Habvalue2percent column - Larvaeinsidetreatedarea column - Larvaeoutsidetreatedarea column - Larvaepresent column - Larvaereason column - Linelocid column - Locationname column - LR column - Mosquitohabitat column - Movingwater column - Negdips column - Nowaterever column - Objectid column - Pointlocid column - Polygonlocid column - Posdips column - Potential column - Raingauge column - Recordstatus column - Reviewed column - Reviewedby column - Revieweddate column - Sitetype column - Soilconditions column - Sourcereduction column - Startdatetime column - Totalacres column - Vegetation column - Waterconditions column - Waterduration column - Watermovement1 column - Watermovement1percent column - Watermovement2 column - Watermovement2percent column - Waterpresent column - Watersource column - Winddir column - Windspeed column - Zone column - Zone2 column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Version column -} - -func (c historyQamosquitoinspectionColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Acresbreeding, c.Actiontaken, c.Adultactivity, c.Aquaticorganisms, c.Avetemp, c.Breedingpotential, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Fish, c.Globalid, c.Habvalue1, c.Habvalue1percent, c.Habvalue2, c.Habvalue2percent, c.Larvaeinsidetreatedarea, c.Larvaeoutsidetreatedarea, c.Larvaepresent, c.Larvaereason, c.Linelocid, c.Locationname, c.LR, c.Mosquitohabitat, c.Movingwater, c.Negdips, c.Nowaterever, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Posdips, c.Potential, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sitetype, c.Soilconditions, c.Sourcereduction, c.Startdatetime, c.Totalacres, c.Vegetation, c.Waterconditions, c.Waterduration, c.Watermovement1, c.Watermovement1percent, c.Watermovement2, c.Watermovement2percent, c.Waterpresent, c.Watersource, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, - } -} - -type historyQamosquitoinspectionIndexes struct { - HistoryQamosquitoinspectionPkey index -} - -func (i historyQamosquitoinspectionIndexes) AsSlice() []index { - return []index{ - i.HistoryQamosquitoinspectionPkey, - } -} - -type historyQamosquitoinspectionForeignKeys struct { - HistoryQamosquitoinspectionHistoryQamosquitoinspectionOrganizationIDFkey foreignKey -} - -func (f historyQamosquitoinspectionForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryQamosquitoinspectionHistoryQamosquitoinspectionOrganizationIDFkey, - } -} - -type historyQamosquitoinspectionUniques struct{} - -func (u historyQamosquitoinspectionUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyQamosquitoinspectionChecks struct{} - -func (c historyQamosquitoinspectionChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_rodentlocation.bob.go b/db/dbinfo/history_rodentlocation.bob.go deleted file mode 100644 index 14feb7fb..00000000 --- a/db/dbinfo/history_rodentlocation.bob.go +++ /dev/null @@ -1,452 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryRodentlocations = Table[ - historyRodentlocationColumns, - historyRodentlocationIndexes, - historyRodentlocationForeignKeys, - historyRodentlocationUniques, - historyRodentlocationChecks, -]{ - Schema: "", - Name: "history_rodentlocation", - Columns: historyRodentlocationColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accessdesc: column{ - Name: "accessdesc", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Active: column{ - Name: "active", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Description: column{ - Name: "description", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Habitat: column{ - Name: "habitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectaction: column{ - Name: "lastinspectaction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectconditions: column{ - Name: "lastinspectconditions", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectdate: column{ - Name: "lastinspectdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectrodentevidence: column{ - Name: "lastinspectrodentevidence", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastinspectspecies: column{ - Name: "lastinspectspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationname: column{ - Name: "locationname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationnumber: column{ - Name: "locationnumber", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nextactiondatescheduled: column{ - Name: "nextactiondatescheduled", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Symbology: column{ - Name: "symbology", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Usetype: column{ - Name: "usetype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Jurisdiction: column{ - Name: "jurisdiction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyRodentlocationIndexes{ - HistoryRodentlocationPkey: index{ - Type: "btree", - Name: "history_rodentlocation_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_rodentlocation_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyRodentlocationForeignKeys{ - HistoryRodentlocationHistoryRodentlocationOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_rodentlocation.history_rodentlocation_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyRodentlocationColumns struct { - OrganizationID column - Accessdesc column - Active column - Comments column - Creationdate column - Creator column - Description column - Externalid column - Editdate column - Editor column - Globalid column - Habitat column - Lastinspectaction column - Lastinspectconditions column - Lastinspectdate column - Lastinspectrodentevidence column - Lastinspectspecies column - Locationname column - Locationnumber column - Nextactiondatescheduled column - Objectid column - Priority column - Symbology column - Usetype column - Zone column - Zone2 column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Jurisdiction column - Version column -} - -func (c historyRodentlocationColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Globalid, c.Habitat, c.Lastinspectaction, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectrodentevidence, c.Lastinspectspecies, c.Locationname, c.Locationnumber, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.Usetype, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Jurisdiction, c.Version, - } -} - -type historyRodentlocationIndexes struct { - HistoryRodentlocationPkey index -} - -func (i historyRodentlocationIndexes) AsSlice() []index { - return []index{ - i.HistoryRodentlocationPkey, - } -} - -type historyRodentlocationForeignKeys struct { - HistoryRodentlocationHistoryRodentlocationOrganizationIDFkey foreignKey -} - -func (f historyRodentlocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryRodentlocationHistoryRodentlocationOrganizationIDFkey, - } -} - -type historyRodentlocationUniques struct{} - -func (u historyRodentlocationUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyRodentlocationChecks struct{} - -func (c historyRodentlocationChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_samplecollection.bob.go b/db/dbinfo/history_samplecollection.bob.go deleted file mode 100644 index 37d8c4f3..00000000 --- a/db/dbinfo/history_samplecollection.bob.go +++ /dev/null @@ -1,612 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistorySamplecollections = Table[ - historySamplecollectionColumns, - historySamplecollectionIndexes, - historySamplecollectionForeignKeys, - historySamplecollectionUniques, - historySamplecollectionChecks, -]{ - Schema: "", - Name: "history_samplecollection", - Columns: historySamplecollectionColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Activity: column{ - Name: "activity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Avetemp: column{ - Name: "avetemp", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Chickenid: column{ - Name: "chickenid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Datesent: column{ - Name: "datesent", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Datetested: column{ - Name: "datetested", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Diseasepos: column{ - Name: "diseasepos", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Diseasetested: column{ - Name: "diseasetested", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Enddatetime: column{ - Name: "enddatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldtech: column{ - Name: "fieldtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Flockid: column{ - Name: "flockid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Gatewaysync: column{ - Name: "gatewaysync", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lab: column{ - Name: "lab", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationname: column{ - Name: "locationname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LocID: column{ - Name: "loc_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Processed: column{ - Name: "processed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Raingauge: column{ - Name: "raingauge", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Recordstatus: column{ - Name: "recordstatus", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewed: column{ - Name: "reviewed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewedby: column{ - Name: "reviewedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Revieweddate: column{ - Name: "revieweddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Samplecond: column{ - Name: "samplecond", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Samplecount: column{ - Name: "samplecount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sampleid: column{ - Name: "sampleid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sampletype: column{ - Name: "sampletype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sex: column{ - Name: "sex", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sitecond: column{ - Name: "sitecond", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Species: column{ - Name: "species", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Startdatetime: column{ - Name: "startdatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Survtech: column{ - Name: "survtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Testmethod: column{ - Name: "testmethod", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Testtech: column{ - Name: "testtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Winddir: column{ - Name: "winddir", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Windspeed: column{ - Name: "windspeed", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historySamplecollectionIndexes{ - HistorySamplecollectionPkey: index{ - Type: "btree", - Name: "history_samplecollection_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_samplecollection_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historySamplecollectionForeignKeys{ - HistorySamplecollectionHistorySamplecollectionOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_samplecollection.history_samplecollection_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historySamplecollectionColumns struct { - OrganizationID column - Activity column - Avetemp column - Chickenid column - Comments column - Creationdate column - Creator column - Datesent column - Datetested column - Diseasepos column - Diseasetested column - Enddatetime column - Editdate column - Editor column - Fieldtech column - Flockid column - Gatewaysync column - Globalid column - Lab column - Locationname column - LocID column - Objectid column - Processed column - Raingauge column - Recordstatus column - Reviewed column - Reviewedby column - Revieweddate column - Samplecond column - Samplecount column - Sampleid column - Sampletype column - Sex column - Sitecond column - Species column - Startdatetime column - Survtech column - Testmethod column - Testtech column - Winddir column - Windspeed column - Zone column - Zone2 column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Version column -} - -func (c historySamplecollectionColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Activity, c.Avetemp, c.Chickenid, c.Comments, c.Creationdate, c.Creator, c.Datesent, c.Datetested, c.Diseasepos, c.Diseasetested, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Flockid, c.Gatewaysync, c.Globalid, c.Lab, c.Locationname, c.LocID, c.Objectid, c.Processed, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Samplecond, c.Samplecount, c.Sampleid, c.Sampletype, c.Sex, c.Sitecond, c.Species, c.Startdatetime, c.Survtech, c.Testmethod, c.Testtech, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, - } -} - -type historySamplecollectionIndexes struct { - HistorySamplecollectionPkey index -} - -func (i historySamplecollectionIndexes) AsSlice() []index { - return []index{ - i.HistorySamplecollectionPkey, - } -} - -type historySamplecollectionForeignKeys struct { - HistorySamplecollectionHistorySamplecollectionOrganizationIDFkey foreignKey -} - -func (f historySamplecollectionForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistorySamplecollectionHistorySamplecollectionOrganizationIDFkey, - } -} - -type historySamplecollectionUniques struct{} - -func (u historySamplecollectionUniques) AsSlice() []constraint { - return []constraint{} -} - -type historySamplecollectionChecks struct{} - -func (c historySamplecollectionChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_samplelocation.bob.go b/db/dbinfo/history_samplelocation.bob.go deleted file mode 100644 index 0422f402..00000000 --- a/db/dbinfo/history_samplelocation.bob.go +++ /dev/null @@ -1,392 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistorySamplelocations = Table[ - historySamplelocationColumns, - historySamplelocationIndexes, - historySamplelocationForeignKeys, - historySamplelocationUniques, - historySamplelocationChecks, -]{ - Schema: "", - Name: "history_samplelocation", - Columns: historySamplelocationColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accessdesc: column{ - Name: "accessdesc", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Active: column{ - Name: "active", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Description: column{ - Name: "description", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Gatewaysync: column{ - Name: "gatewaysync", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Habitat: column{ - Name: "habitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationnumber: column{ - Name: "locationnumber", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nextactiondatescheduled: column{ - Name: "nextactiondatescheduled", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Usetype: column{ - Name: "usetype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historySamplelocationIndexes{ - HistorySamplelocationPkey: index{ - Type: "btree", - Name: "history_samplelocation_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_samplelocation_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historySamplelocationForeignKeys{ - HistorySamplelocationHistorySamplelocationOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_samplelocation.history_samplelocation_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historySamplelocationColumns struct { - OrganizationID column - Accessdesc column - Active column - Comments column - Creationdate column - Creator column - Description column - Externalid column - Editdate column - Editor column - Gatewaysync column - Globalid column - Habitat column - Locationnumber column - Name column - Nextactiondatescheduled column - Objectid column - Priority column - Usetype column - Zone column - Zone2 column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Version column -} - -func (c historySamplelocationColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Habitat, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Usetype, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, - } -} - -type historySamplelocationIndexes struct { - HistorySamplelocationPkey index -} - -func (i historySamplelocationIndexes) AsSlice() []index { - return []index{ - i.HistorySamplelocationPkey, - } -} - -type historySamplelocationForeignKeys struct { - HistorySamplelocationHistorySamplelocationOrganizationIDFkey foreignKey -} - -func (f historySamplelocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistorySamplelocationHistorySamplelocationOrganizationIDFkey, - } -} - -type historySamplelocationUniques struct{} - -func (u historySamplelocationUniques) AsSlice() []constraint { - return []constraint{} -} - -type historySamplelocationChecks struct{} - -func (c historySamplelocationChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_servicerequest.bob.go b/db/dbinfo/history_servicerequest.bob.go deleted file mode 100644 index 6757c5a3..00000000 --- a/db/dbinfo/history_servicerequest.bob.go +++ /dev/null @@ -1,1012 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryServicerequests = Table[ - historyServicerequestColumns, - historyServicerequestIndexes, - historyServicerequestForeignKeys, - historyServicerequestUniques, - historyServicerequestChecks, -]{ - Schema: "", - Name: "history_servicerequest", - Columns: historyServicerequestColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accepted: column{ - Name: "accepted", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Acceptedby: column{ - Name: "acceptedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Accepteddate: column{ - Name: "accepteddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Allowed: column{ - Name: "allowed", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Assignedtech: column{ - Name: "assignedtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clraddr1: column{ - Name: "clraddr1", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clraddr2: column{ - Name: "clraddr2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clranon: column{ - Name: "clranon", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrcity: column{ - Name: "clrcity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrcompany: column{ - Name: "clrcompany", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrcontpref: column{ - Name: "clrcontpref", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clremail: column{ - Name: "clremail", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrfname: column{ - Name: "clrfname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrother: column{ - Name: "clrother", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrphone1: column{ - Name: "clrphone1", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrphone2: column{ - Name: "clrphone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrstate: column{ - Name: "clrstate", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Clrzip: column{ - Name: "clrzip", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Datetimeclosed: column{ - Name: "datetimeclosed", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Duedate: column{ - Name: "duedate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Entrytech: column{ - Name: "entrytech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Estcompletedate: column{ - Name: "estcompletedate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalerror: column{ - Name: "externalerror", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Firstresponsedate: column{ - Name: "firstresponsedate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Issuesreported: column{ - Name: "issuesreported", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Jurisdiction: column{ - Name: "jurisdiction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nextaction: column{ - Name: "nextaction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Notificationtimestamp: column{ - Name: "notificationtimestamp", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Notified: column{ - Name: "notified", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Notifieddate: column{ - Name: "notifieddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Pointlocid: column{ - Name: "pointlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Recdatetime: column{ - Name: "recdatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Recordstatus: column{ - Name: "recordstatus", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Rejectedby: column{ - Name: "rejectedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Rejecteddate: column{ - Name: "rejecteddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Rejectedreason: column{ - Name: "rejectedreason", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqaddr1: column{ - Name: "reqaddr1", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqaddr2: column{ - Name: "reqaddr2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqcity: column{ - Name: "reqcity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqcompany: column{ - Name: "reqcompany", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqcrossst: column{ - Name: "reqcrossst", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqdescr: column{ - Name: "reqdescr", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqfldnotes: column{ - Name: "reqfldnotes", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqmapgrid: column{ - Name: "reqmapgrid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqnotesforcust: column{ - Name: "reqnotesforcust", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqnotesfortech: column{ - Name: "reqnotesfortech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqpermission: column{ - Name: "reqpermission", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqprogramactions: column{ - Name: "reqprogramactions", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqstate: column{ - Name: "reqstate", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqsubdiv: column{ - Name: "reqsubdiv", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqtarget: column{ - Name: "reqtarget", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reqzip: column{ - Name: "reqzip", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Responsedaycount: column{ - Name: "responsedaycount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewed: column{ - Name: "reviewed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewedby: column{ - Name: "reviewedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Revieweddate: column{ - Name: "revieweddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Scheduled: column{ - Name: "scheduled", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Scheduleddate: column{ - Name: "scheduleddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Source: column{ - Name: "source", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - SRNumber: column{ - Name: "sr_number", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Status: column{ - Name: "status", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Supervisor: column{ - Name: "supervisor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Techclosed: column{ - Name: "techclosed", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Validx: column{ - Name: "validx", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Validy: column{ - Name: "validy", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Xvalue: column{ - Name: "xvalue", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Yvalue: column{ - Name: "yvalue", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Dog: column{ - Name: "dog", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Spanish: column{ - Name: "spanish", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ScheduleNotes: column{ - Name: "schedule_notes", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - SchedulePeriod: column{ - Name: "schedule_period", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyServicerequestIndexes{ - HistoryServicerequestPkey: index{ - Type: "btree", - Name: "history_servicerequest_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_servicerequest_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyServicerequestForeignKeys{ - HistoryServicerequestHistoryServicerequestOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_servicerequest.history_servicerequest_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyServicerequestColumns struct { - OrganizationID column - Accepted column - Acceptedby column - Accepteddate column - Allowed column - Assignedtech column - Clraddr1 column - Clraddr2 column - Clranon column - Clrcity column - Clrcompany column - Clrcontpref column - Clremail column - Clrfname column - Clrother column - Clrphone1 column - Clrphone2 column - Clrstate column - Clrzip column - Comments column - Creationdate column - Creator column - Datetimeclosed column - Duedate column - Entrytech column - Estcompletedate column - Externalerror column - Externalid column - Editdate column - Editor column - Firstresponsedate column - Globalid column - Issuesreported column - Jurisdiction column - Nextaction column - Notificationtimestamp column - Notified column - Notifieddate column - Objectid column - Pointlocid column - Priority column - Recdatetime column - Recordstatus column - Rejectedby column - Rejecteddate column - Rejectedreason column - Reqaddr1 column - Reqaddr2 column - Reqcity column - Reqcompany column - Reqcrossst column - Reqdescr column - Reqfldnotes column - Reqmapgrid column - Reqnotesforcust column - Reqnotesfortech column - Reqpermission column - Reqprogramactions column - Reqstate column - Reqsubdiv column - Reqtarget column - Reqzip column - Responsedaycount column - Reviewed column - Reviewedby column - Revieweddate column - Scheduled column - Scheduleddate column - Source column - SRNumber column - Status column - Supervisor column - Techclosed column - Validx column - Validy column - Xvalue column - Yvalue column - Zone column - Zone2 column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Dog column - Spanish column - ScheduleNotes column - SchedulePeriod column - Version column -} - -func (c historyServicerequestColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accepted, c.Acceptedby, c.Accepteddate, c.Allowed, c.Assignedtech, c.Clraddr1, c.Clraddr2, c.Clranon, c.Clrcity, c.Clrcompany, c.Clrcontpref, c.Clremail, c.Clrfname, c.Clrother, c.Clrphone1, c.Clrphone2, c.Clrstate, c.Clrzip, c.Comments, c.Creationdate, c.Creator, c.Datetimeclosed, c.Duedate, c.Entrytech, c.Estcompletedate, c.Externalerror, c.Externalid, c.Editdate, c.Editor, c.Firstresponsedate, c.Globalid, c.Issuesreported, c.Jurisdiction, c.Nextaction, c.Notificationtimestamp, c.Notified, c.Notifieddate, c.Objectid, c.Pointlocid, c.Priority, c.Recdatetime, c.Recordstatus, c.Rejectedby, c.Rejecteddate, c.Rejectedreason, c.Reqaddr1, c.Reqaddr2, c.Reqcity, c.Reqcompany, c.Reqcrossst, c.Reqdescr, c.Reqfldnotes, c.Reqmapgrid, c.Reqnotesforcust, c.Reqnotesfortech, c.Reqpermission, c.Reqprogramactions, c.Reqstate, c.Reqsubdiv, c.Reqtarget, c.Reqzip, c.Responsedaycount, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Scheduled, c.Scheduleddate, c.Source, c.SRNumber, c.Status, c.Supervisor, c.Techclosed, c.Validx, c.Validy, c.Xvalue, c.Yvalue, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Dog, c.Spanish, c.ScheduleNotes, c.SchedulePeriod, c.Version, - } -} - -type historyServicerequestIndexes struct { - HistoryServicerequestPkey index -} - -func (i historyServicerequestIndexes) AsSlice() []index { - return []index{ - i.HistoryServicerequestPkey, - } -} - -type historyServicerequestForeignKeys struct { - HistoryServicerequestHistoryServicerequestOrganizationIDFkey foreignKey -} - -func (f historyServicerequestForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryServicerequestHistoryServicerequestOrganizationIDFkey, - } -} - -type historyServicerequestUniques struct{} - -func (u historyServicerequestUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyServicerequestChecks struct{} - -func (c historyServicerequestChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_speciesabundance.bob.go b/db/dbinfo/history_speciesabundance.bob.go deleted file mode 100644 index befabce4..00000000 --- a/db/dbinfo/history_speciesabundance.bob.go +++ /dev/null @@ -1,442 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistorySpeciesabundances = Table[ - historySpeciesabundanceColumns, - historySpeciesabundanceIndexes, - historySpeciesabundanceForeignKeys, - historySpeciesabundanceUniques, - historySpeciesabundanceChecks, -]{ - Schema: "", - Name: "history_speciesabundance", - Columns: historySpeciesabundanceColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Bloodedfem: column{ - Name: "bloodedfem", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Eggs: column{ - Name: "eggs", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Females: column{ - Name: "females", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Gravidfem: column{ - Name: "gravidfem", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Larvae: column{ - Name: "larvae", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Males: column{ - Name: "males", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Poolstogen: column{ - Name: "poolstogen", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Processed: column{ - Name: "processed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Pupae: column{ - Name: "pupae", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Species: column{ - Name: "species", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Total: column{ - Name: "total", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - TrapdataID: column{ - Name: "trapdata_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Unknown: column{ - Name: "unknown", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalzscore: column{ - Name: "globalzscore", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - H3R7: column{ - Name: "h3r7", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - H3R8: column{ - Name: "h3r8", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - R7score: column{ - Name: "r7score", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - R8score: column{ - Name: "r8score", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Yearweek: column{ - Name: "yearweek", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historySpeciesabundanceIndexes{ - HistorySpeciesabundancePkey: index{ - Type: "btree", - Name: "history_speciesabundance_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_speciesabundance_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historySpeciesabundanceForeignKeys{ - HistorySpeciesabundanceHistorySpeciesabundanceOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_speciesabundance.history_speciesabundance_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historySpeciesabundanceColumns struct { - OrganizationID column - Bloodedfem column - Creationdate column - Creator column - Eggs column - Editdate column - Editor column - Females column - Gravidfem column - Globalid column - Larvae column - Males column - Objectid column - Poolstogen column - Processed column - Pupae column - Species column - Total column - TrapdataID column - Unknown column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Globalzscore column - H3R7 column - H3R8 column - R7score column - R8score column - Yearweek column - Version column -} - -func (c historySpeciesabundanceColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Bloodedfem, c.Creationdate, c.Creator, c.Eggs, c.Editdate, c.Editor, c.Females, c.Gravidfem, c.Globalid, c.Larvae, c.Males, c.Objectid, c.Poolstogen, c.Processed, c.Pupae, c.Species, c.Total, c.TrapdataID, c.Unknown, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Globalzscore, c.H3R7, c.H3R8, c.R7score, c.R8score, c.Yearweek, c.Version, - } -} - -type historySpeciesabundanceIndexes struct { - HistorySpeciesabundancePkey index -} - -func (i historySpeciesabundanceIndexes) AsSlice() []index { - return []index{ - i.HistorySpeciesabundancePkey, - } -} - -type historySpeciesabundanceForeignKeys struct { - HistorySpeciesabundanceHistorySpeciesabundanceOrganizationIDFkey foreignKey -} - -func (f historySpeciesabundanceForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistorySpeciesabundanceHistorySpeciesabundanceOrganizationIDFkey, - } -} - -type historySpeciesabundanceUniques struct{} - -func (u historySpeciesabundanceUniques) AsSlice() []constraint { - return []constraint{} -} - -type historySpeciesabundanceChecks struct{} - -func (c historySpeciesabundanceChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_stormdrain.bob.go b/db/dbinfo/history_stormdrain.bob.go deleted file mode 100644 index 312bb6d5..00000000 --- a/db/dbinfo/history_stormdrain.bob.go +++ /dev/null @@ -1,342 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryStormdrains = Table[ - historyStormdrainColumns, - historyStormdrainIndexes, - historyStormdrainForeignKeys, - historyStormdrainUniques, - historyStormdrainChecks, -]{ - Schema: "", - Name: "history_stormdrain", - Columns: historyStormdrainColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Jurisdiction: column{ - Name: "jurisdiction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lastaction: column{ - Name: "lastaction", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Laststatus: column{ - Name: "laststatus", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lasttreatdate: column{ - Name: "lasttreatdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nexttreatmentdate: column{ - Name: "nexttreatmentdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Symbology: column{ - Name: "symbology", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Type: column{ - Name: "type", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyStormdrainIndexes{ - HistoryStormdrainPkey: index{ - Type: "btree", - Name: "history_stormdrain_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_stormdrain_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyStormdrainForeignKeys{ - HistoryStormdrainHistoryStormdrainOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_stormdrain.history_stormdrain_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyStormdrainColumns struct { - OrganizationID column - Creationdate column - Creator column - Editdate column - Editor column - Globalid column - Jurisdiction column - Lastaction column - Laststatus column - Lasttreatdate column - Nexttreatmentdate column - Objectid column - Symbology column - Type column - Zone column - Zone2 column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Version column -} - -func (c historyStormdrainColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Jurisdiction, c.Lastaction, c.Laststatus, c.Lasttreatdate, c.Nexttreatmentdate, c.Objectid, c.Symbology, c.Type, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, - } -} - -type historyStormdrainIndexes struct { - HistoryStormdrainPkey index -} - -func (i historyStormdrainIndexes) AsSlice() []index { - return []index{ - i.HistoryStormdrainPkey, - } -} - -type historyStormdrainForeignKeys struct { - HistoryStormdrainHistoryStormdrainOrganizationIDFkey foreignKey -} - -func (f historyStormdrainForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryStormdrainHistoryStormdrainOrganizationIDFkey, - } -} - -type historyStormdrainUniques struct{} - -func (u historyStormdrainUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyStormdrainChecks struct{} - -func (c historyStormdrainChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_timecard.bob.go b/db/dbinfo/history_timecard.bob.go deleted file mode 100644 index feb4cd38..00000000 --- a/db/dbinfo/history_timecard.bob.go +++ /dev/null @@ -1,432 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryTimecards = Table[ - historyTimecardColumns, - historyTimecardIndexes, - historyTimecardForeignKeys, - historyTimecardUniques, - historyTimecardChecks, -]{ - Schema: "", - Name: "history_timecard", - Columns: historyTimecardColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Activity: column{ - Name: "activity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Enddatetime: column{ - Name: "enddatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Equiptype: column{ - Name: "equiptype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldtech: column{ - Name: "fieldtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lclocid: column{ - Name: "lclocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Linelocid: column{ - Name: "linelocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationname: column{ - Name: "locationname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Pointlocid: column{ - Name: "pointlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Polygonlocid: column{ - Name: "polygonlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Samplelocid: column{ - Name: "samplelocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Srid: column{ - Name: "srid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Startdatetime: column{ - Name: "startdatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Traplocid: column{ - Name: "traplocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Rodentlocid: column{ - Name: "rodentlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyTimecardIndexes{ - HistoryTimecardPkey: index{ - Type: "btree", - Name: "history_timecard_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_timecard_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyTimecardForeignKeys{ - HistoryTimecardHistoryTimecardOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_timecard.history_timecard_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyTimecardColumns struct { - OrganizationID column - Activity column - Comments column - Creationdate column - Creator column - Enddatetime column - Equiptype column - Externalid column - Editdate column - Editor column - Fieldtech column - Globalid column - Lclocid column - Linelocid column - Locationname column - Objectid column - Pointlocid column - Polygonlocid column - Samplelocid column - Srid column - Startdatetime column - Traplocid column - Zone column - Zone2 column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Rodentlocid column - Version column -} - -func (c historyTimecardColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Activity, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Equiptype, c.Externalid, c.Editdate, c.Editor, c.Fieldtech, c.Globalid, c.Lclocid, c.Linelocid, c.Locationname, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Samplelocid, c.Srid, c.Startdatetime, c.Traplocid, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Rodentlocid, c.Version, - } -} - -type historyTimecardIndexes struct { - HistoryTimecardPkey index -} - -func (i historyTimecardIndexes) AsSlice() []index { - return []index{ - i.HistoryTimecardPkey, - } -} - -type historyTimecardForeignKeys struct { - HistoryTimecardHistoryTimecardOrganizationIDFkey foreignKey -} - -func (f historyTimecardForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryTimecardHistoryTimecardOrganizationIDFkey, - } -} - -type historyTimecardUniques struct{} - -func (u historyTimecardUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyTimecardChecks struct{} - -func (c historyTimecardChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_trapdata.bob.go b/db/dbinfo/history_trapdata.bob.go deleted file mode 100644 index bb33dc63..00000000 --- a/db/dbinfo/history_trapdata.bob.go +++ /dev/null @@ -1,572 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryTrapdata = Table[ - historyTrapdatumColumns, - historyTrapdatumIndexes, - historyTrapdatumForeignKeys, - historyTrapdatumUniques, - historyTrapdatumChecks, -]{ - Schema: "", - Name: "history_trapdata", - Columns: historyTrapdatumColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Avetemp: column{ - Name: "avetemp", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Enddatetime: column{ - Name: "enddatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldtech: column{ - Name: "fieldtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Field: column{ - Name: "field", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Gatewaysync: column{ - Name: "gatewaysync", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Idbytech: column{ - Name: "idbytech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationname: column{ - Name: "locationname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LocID: column{ - Name: "loc_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LR: column{ - Name: "lr", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Processed: column{ - Name: "processed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Raingauge: column{ - Name: "raingauge", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Recordstatus: column{ - Name: "recordstatus", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewed: column{ - Name: "reviewed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewedby: column{ - Name: "reviewedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Revieweddate: column{ - Name: "revieweddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sitecond: column{ - Name: "sitecond", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sortbytech: column{ - Name: "sortbytech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Srid: column{ - Name: "srid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Startdatetime: column{ - Name: "startdatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Trapactivitytype: column{ - Name: "trapactivitytype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Trapcondition: column{ - Name: "trapcondition", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Trapnights: column{ - Name: "trapnights", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Traptype: column{ - Name: "traptype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Voltage: column{ - Name: "voltage", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Winddir: column{ - Name: "winddir", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Windspeed: column{ - Name: "windspeed", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Lure: column{ - Name: "lure", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vectorsurvtrapdataid: column{ - Name: "vectorsurvtrapdataid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vectorsurvtraplocationid: column{ - Name: "vectorsurvtraplocationid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyTrapdatumIndexes{ - HistoryTrapdataPkey: index{ - Type: "btree", - Name: "history_trapdata_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_trapdata_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyTrapdatumForeignKeys{ - HistoryTrapdataHistoryTrapdataOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_trapdata.history_trapdata_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyTrapdatumColumns struct { - OrganizationID column - Avetemp column - Comments column - Creationdate column - Creator column - Enddatetime column - Editdate column - Editor column - Fieldtech column - Field column - Gatewaysync column - Globalid column - Idbytech column - Locationname column - LocID column - LR column - Objectid column - Processed column - Raingauge column - Recordstatus column - Reviewed column - Reviewedby column - Revieweddate column - Sitecond column - Sortbytech column - Srid column - Startdatetime column - Trapactivitytype column - Trapcondition column - Trapnights column - Traptype column - Voltage column - Winddir column - Windspeed column - Zone column - Zone2 column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Lure column - Vectorsurvtrapdataid column - Vectorsurvtraplocationid column - Version column -} - -func (c historyTrapdatumColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Avetemp, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Field, c.Gatewaysync, c.Globalid, c.Idbytech, c.Locationname, c.LocID, c.LR, c.Objectid, c.Processed, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sitecond, c.Sortbytech, c.Srid, c.Startdatetime, c.Trapactivitytype, c.Trapcondition, c.Trapnights, c.Traptype, c.Voltage, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Lure, c.Vectorsurvtrapdataid, c.Vectorsurvtraplocationid, c.Version, - } -} - -type historyTrapdatumIndexes struct { - HistoryTrapdataPkey index -} - -func (i historyTrapdatumIndexes) AsSlice() []index { - return []index{ - i.HistoryTrapdataPkey, - } -} - -type historyTrapdatumForeignKeys struct { - HistoryTrapdataHistoryTrapdataOrganizationIDFkey foreignKey -} - -func (f historyTrapdatumForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryTrapdataHistoryTrapdataOrganizationIDFkey, - } -} - -type historyTrapdatumUniques struct{} - -func (u historyTrapdatumUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyTrapdatumChecks struct{} - -func (c historyTrapdatumChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_traplocation.bob.go b/db/dbinfo/history_traplocation.bob.go deleted file mode 100644 index 84d27014..00000000 --- a/db/dbinfo/history_traplocation.bob.go +++ /dev/null @@ -1,452 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryTraplocations = Table[ - historyTraplocationColumns, - historyTraplocationIndexes, - historyTraplocationForeignKeys, - historyTraplocationUniques, - historyTraplocationChecks, -]{ - Schema: "", - Name: "history_traplocation", - Columns: historyTraplocationColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Accessdesc: column{ - Name: "accessdesc", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Active: column{ - Name: "active", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Description: column{ - Name: "description", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Externalid: column{ - Name: "externalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Gatewaysync: column{ - Name: "gatewaysync", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Habitat: column{ - Name: "habitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationnumber: column{ - Name: "locationnumber", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Nextactiondatescheduled: column{ - Name: "nextactiondatescheduled", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Priority: column{ - Name: "priority", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Usetype: column{ - Name: "usetype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Route: column{ - Name: "route", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - RouteOrder: column{ - Name: "route_order", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - SetDow: column{ - Name: "set_dow", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Vectorsurvsiteid: column{ - Name: "vectorsurvsiteid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - H3R7: column{ - Name: "h3r7", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - H3R8: column{ - Name: "h3r8", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyTraplocationIndexes{ - HistoryTraplocationPkey: index{ - Type: "btree", - Name: "history_traplocation_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_traplocation_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyTraplocationForeignKeys{ - HistoryTraplocationHistoryTraplocationOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_traplocation.history_traplocation_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyTraplocationColumns struct { - OrganizationID column - Accessdesc column - Active column - Comments column - Creationdate column - Creator column - Description column - Externalid column - Editdate column - Editor column - Gatewaysync column - Globalid column - Habitat column - Locationnumber column - Name column - Nextactiondatescheduled column - Objectid column - Priority column - Usetype column - Zone column - Zone2 column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Route column - RouteOrder column - SetDow column - Vectorsurvsiteid column - H3R7 column - H3R8 column - Version column -} - -func (c historyTraplocationColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Habitat, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Usetype, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Route, c.RouteOrder, c.SetDow, c.Vectorsurvsiteid, c.H3R7, c.H3R8, c.Version, - } -} - -type historyTraplocationIndexes struct { - HistoryTraplocationPkey index -} - -func (i historyTraplocationIndexes) AsSlice() []index { - return []index{ - i.HistoryTraplocationPkey, - } -} - -type historyTraplocationForeignKeys struct { - HistoryTraplocationHistoryTraplocationOrganizationIDFkey foreignKey -} - -func (f historyTraplocationForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryTraplocationHistoryTraplocationOrganizationIDFkey, - } -} - -type historyTraplocationUniques struct{} - -func (u historyTraplocationUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyTraplocationChecks struct{} - -func (c historyTraplocationChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_treatment.bob.go b/db/dbinfo/history_treatment.bob.go deleted file mode 100644 index 1cfb6398..00000000 --- a/db/dbinfo/history_treatment.bob.go +++ /dev/null @@ -1,692 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryTreatments = Table[ - historyTreatmentColumns, - historyTreatmentIndexes, - historyTreatmentForeignKeys, - historyTreatmentUniques, - historyTreatmentChecks, -]{ - Schema: "", - Name: "history_treatment", - Columns: historyTreatmentColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Activity: column{ - Name: "activity", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Areaunit: column{ - Name: "areaunit", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Avetemp: column{ - Name: "avetemp", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Barrierrouteid: column{ - Name: "barrierrouteid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Cbcount: column{ - Name: "cbcount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Containercount: column{ - Name: "containercount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Enddatetime: column{ - Name: "enddatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Equiptype: column{ - Name: "equiptype", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Fieldtech: column{ - Name: "fieldtech", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Flowrate: column{ - Name: "flowrate", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Habitat: column{ - Name: "habitat", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - InspID: column{ - Name: "insp_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Invloc: column{ - Name: "invloc", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Linelocid: column{ - Name: "linelocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Locationname: column{ - Name: "locationname", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Method: column{ - Name: "method", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Pointlocid: column{ - Name: "pointlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Polygonlocid: column{ - Name: "polygonlocid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Product: column{ - Name: "product", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Ptaid: column{ - Name: "ptaid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Qty: column{ - Name: "qty", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Qtyunit: column{ - Name: "qtyunit", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Raingauge: column{ - Name: "raingauge", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Recordstatus: column{ - Name: "recordstatus", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewed: column{ - Name: "reviewed", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Reviewedby: column{ - Name: "reviewedby", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Revieweddate: column{ - Name: "revieweddate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sdid: column{ - Name: "sdid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Sitecond: column{ - Name: "sitecond", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Srid: column{ - Name: "srid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Startdatetime: column{ - Name: "startdatetime", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Targetspecies: column{ - Name: "targetspecies", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Tirecount: column{ - Name: "tirecount", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Treatacres: column{ - Name: "treatacres", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Treatarea: column{ - Name: "treatarea", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Treathectares: column{ - Name: "treathectares", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Treatmenthours: column{ - Name: "treatmenthours", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Treatmentlength: column{ - Name: "treatmentlength", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Treatmentlengthunits: column{ - Name: "treatmentlengthunits", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Totalcostprodcut: column{ - Name: "totalcostprodcut", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Ulvrouteid: column{ - Name: "ulvrouteid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Warningoverride: column{ - Name: "warningoverride", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Winddir: column{ - Name: "winddir", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Windspeed: column{ - Name: "windspeed", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone: column{ - Name: "zone", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Zone2: column{ - Name: "zone2", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - TempSitecond: column{ - Name: "temp_sitecond", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyTreatmentIndexes{ - HistoryTreatmentPkey: index{ - Type: "btree", - Name: "history_treatment_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_treatment_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyTreatmentForeignKeys{ - HistoryTreatmentHistoryTreatmentOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_treatment.history_treatment_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyTreatmentColumns struct { - OrganizationID column - Activity column - Areaunit column - Avetemp column - Barrierrouteid column - Cbcount column - Comments column - Containercount column - Creationdate column - Creator column - Enddatetime column - Equiptype column - Editdate column - Editor column - Fieldtech column - Flowrate column - Globalid column - Habitat column - InspID column - Invloc column - Linelocid column - Locationname column - Method column - Objectid column - Pointlocid column - Polygonlocid column - Product column - Ptaid column - Qty column - Qtyunit column - Raingauge column - Recordstatus column - Reviewed column - Reviewedby column - Revieweddate column - Sdid column - Sitecond column - Srid column - Startdatetime column - Targetspecies column - Tirecount column - Treatacres column - Treatarea column - Treathectares column - Treatmenthours column - Treatmentlength column - Treatmentlengthunits column - Totalcostprodcut column - Ulvrouteid column - Warningoverride column - Winddir column - Windspeed column - Zone column - Zone2 column - GeometryX column - GeometryY column - TempSitecond column - Version column - Created column -} - -func (c historyTreatmentColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Activity, c.Areaunit, c.Avetemp, c.Barrierrouteid, c.Cbcount, c.Comments, c.Containercount, c.Creationdate, c.Creator, c.Enddatetime, c.Equiptype, c.Editdate, c.Editor, c.Fieldtech, c.Flowrate, c.Globalid, c.Habitat, c.InspID, c.Invloc, c.Linelocid, c.Locationname, c.Method, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Product, c.Ptaid, c.Qty, c.Qtyunit, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sdid, c.Sitecond, c.Srid, c.Startdatetime, c.Targetspecies, c.Tirecount, c.Treatacres, c.Treatarea, c.Treathectares, c.Treatmenthours, c.Treatmentlength, c.Treatmentlengthunits, c.Totalcostprodcut, c.Ulvrouteid, c.Warningoverride, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.GeometryX, c.GeometryY, c.TempSitecond, c.Version, c.Created, - } -} - -type historyTreatmentIndexes struct { - HistoryTreatmentPkey index -} - -func (i historyTreatmentIndexes) AsSlice() []index { - return []index{ - i.HistoryTreatmentPkey, - } -} - -type historyTreatmentForeignKeys struct { - HistoryTreatmentHistoryTreatmentOrganizationIDFkey foreignKey -} - -func (f historyTreatmentForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryTreatmentHistoryTreatmentOrganizationIDFkey, - } -} - -type historyTreatmentUniques struct{} - -func (u historyTreatmentUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyTreatmentChecks struct{} - -func (c historyTreatmentChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_treatmentarea.bob.go b/db/dbinfo/history_treatmentarea.bob.go deleted file mode 100644 index 7e9d0726..00000000 --- a/db/dbinfo/history_treatmentarea.bob.go +++ /dev/null @@ -1,332 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryTreatmentareas = Table[ - historyTreatmentareaColumns, - historyTreatmentareaIndexes, - historyTreatmentareaForeignKeys, - historyTreatmentareaUniques, - historyTreatmentareaChecks, -]{ - Schema: "", - Name: "history_treatmentarea", - Columns: historyTreatmentareaColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Comments: column{ - Name: "comments", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Notified: column{ - Name: "notified", - DBType: "smallint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - SessionID: column{ - Name: "session_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeArea: column{ - Name: "shape__area", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeLength: column{ - Name: "shape__length", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Treatdate: column{ - Name: "treatdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - TreatID: column{ - Name: "treat_id", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Type: column{ - Name: "type", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyTreatmentareaIndexes{ - HistoryTreatmentareaPkey: index{ - Type: "btree", - Name: "history_treatmentarea_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_treatmentarea_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyTreatmentareaForeignKeys{ - HistoryTreatmentareaHistoryTreatmentareaOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_treatmentarea.history_treatmentarea_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyTreatmentareaColumns struct { - OrganizationID column - Comments column - Creationdate column - Creator column - Editdate column - Editor column - Globalid column - Notified column - Objectid column - SessionID column - ShapeArea column - ShapeLength column - Treatdate column - TreatID column - Type column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Version column -} - -func (c historyTreatmentareaColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Notified, c.Objectid, c.SessionID, c.ShapeArea, c.ShapeLength, c.Treatdate, c.TreatID, c.Type, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, - } -} - -type historyTreatmentareaIndexes struct { - HistoryTreatmentareaPkey index -} - -func (i historyTreatmentareaIndexes) AsSlice() []index { - return []index{ - i.HistoryTreatmentareaPkey, - } -} - -type historyTreatmentareaForeignKeys struct { - HistoryTreatmentareaHistoryTreatmentareaOrganizationIDFkey foreignKey -} - -func (f historyTreatmentareaForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryTreatmentareaHistoryTreatmentareaOrganizationIDFkey, - } -} - -type historyTreatmentareaUniques struct{} - -func (u historyTreatmentareaUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyTreatmentareaChecks struct{} - -func (c historyTreatmentareaChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_zones.bob.go b/db/dbinfo/history_zones.bob.go deleted file mode 100644 index f9966ddf..00000000 --- a/db/dbinfo/history_zones.bob.go +++ /dev/null @@ -1,292 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryZones = Table[ - historyZoneColumns, - historyZoneIndexes, - historyZoneForeignKeys, - historyZoneUniques, - historyZoneChecks, -]{ - Schema: "", - Name: "history_zones", - Columns: historyZoneColumns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Active: column{ - Name: "active", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - ShapeArea: column{ - Name: "shape__area", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeLength: column{ - Name: "shape__length", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyZoneIndexes{ - HistoryZonesPkey: index{ - Type: "btree", - Name: "history_zones_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_zones_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyZoneForeignKeys{ - HistoryZonesHistoryZonesOrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_zones.history_zones_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyZoneColumns struct { - OrganizationID column - Active column - Creationdate column - Creator column - Editdate column - Editor column - Globalid column - Name column - Objectid column - ShapeArea column - ShapeLength column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Version column -} - -func (c historyZoneColumns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Active, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Name, c.Objectid, c.ShapeArea, c.ShapeLength, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, - } -} - -type historyZoneIndexes struct { - HistoryZonesPkey index -} - -func (i historyZoneIndexes) AsSlice() []index { - return []index{ - i.HistoryZonesPkey, - } -} - -type historyZoneForeignKeys struct { - HistoryZonesHistoryZonesOrganizationIDFkey foreignKey -} - -func (f historyZoneForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryZonesHistoryZonesOrganizationIDFkey, - } -} - -type historyZoneUniques struct{} - -func (u historyZoneUniques) AsSlice() []constraint { - return []constraint{} -} - -type historyZoneChecks struct{} - -func (c historyZoneChecks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/history_zones2.bob.go b/db/dbinfo/history_zones2.bob.go deleted file mode 100644 index 78d2abd3..00000000 --- a/db/dbinfo/history_zones2.bob.go +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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 HistoryZones2s = Table[ - historyZones2Columns, - historyZones2Indexes, - historyZones2ForeignKeys, - historyZones2Uniques, - historyZones2Checks, -]{ - Schema: "", - Name: "history_zones2", - Columns: historyZones2Columns{ - OrganizationID: column{ - Name: "organization_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Creationdate: column{ - Name: "creationdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Creator: column{ - Name: "creator", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editdate: column{ - Name: "editdate", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Editor: column{ - Name: "editor", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Globalid: column{ - Name: "globalid", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Name: column{ - Name: "name", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Objectid: column{ - Name: "objectid", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - ShapeArea: column{ - Name: "shape__area", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - ShapeLength: column{ - Name: "shape__length", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Created: column{ - Name: "created", - DBType: "timestamp without time zone", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedDate: column{ - Name: "created_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - CreatedUser: column{ - Name: "created_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryX: column{ - Name: "geometry_x", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - GeometryY: column{ - Name: "geometry_y", - DBType: "double precision", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedDate: column{ - Name: "last_edited_date", - DBType: "bigint", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - LastEditedUser: column{ - Name: "last_edited_user", - DBType: "text", - Default: "NULL", - Comment: "", - Nullable: true, - Generated: false, - AutoIncr: false, - }, - Version: column{ - Name: "version", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - Indexes: historyZones2Indexes{ - HistoryZones2Pkey: index{ - Type: "btree", - Name: "history_zones2_pkey", - Columns: []indexColumn{ - { - Name: "objectid", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - { - Name: "version", - Desc: null.FromCond(false, true), - IsExpression: false, - }, - }, - Unique: true, - Comment: "", - NullsFirst: []bool{false, false}, - NullsDistinct: false, - Where: "", - Include: []string{}, - }, - }, - PrimaryKey: &constraint{ - Name: "history_zones2_pkey", - Columns: []string{"objectid", "version"}, - Comment: "", - }, - ForeignKeys: historyZones2ForeignKeys{ - HistoryZones2HistoryZones2OrganizationIDFkey: foreignKey{ - constraint: constraint{ - Name: "history_zones2.history_zones2_organization_id_fkey", - Columns: []string{"organization_id"}, - Comment: "", - }, - ForeignTable: "organization", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type historyZones2Columns struct { - OrganizationID column - Creationdate column - Creator column - Editdate column - Editor column - Globalid column - Name column - Objectid column - ShapeArea column - ShapeLength column - Created column - CreatedDate column - CreatedUser column - GeometryX column - GeometryY column - LastEditedDate column - LastEditedUser column - Version column -} - -func (c historyZones2Columns) AsSlice() []column { - return []column{ - c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Name, c.Objectid, c.ShapeArea, c.ShapeLength, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version, - } -} - -type historyZones2Indexes struct { - HistoryZones2Pkey index -} - -func (i historyZones2Indexes) AsSlice() []index { - return []index{ - i.HistoryZones2Pkey, - } -} - -type historyZones2ForeignKeys struct { - HistoryZones2HistoryZones2OrganizationIDFkey foreignKey -} - -func (f historyZones2ForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.HistoryZones2HistoryZones2OrganizationIDFkey, - } -} - -type historyZones2Uniques struct{} - -func (u historyZones2Uniques) AsSlice() []constraint { - return []constraint{} -} - -type historyZones2Checks struct{} - -func (c historyZones2Checks) AsSlice() []check { - return []check{} -} diff --git a/db/dbinfo/note_audio.bob.go b/db/dbinfo/note_audio.bob.go new file mode 100644 index 00000000..9e050de1 --- /dev/null +++ b/db/dbinfo/note_audio.bob.go @@ -0,0 +1,222 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dbinfo + +import "github.com/aarondl/opt/null" + +var NoteAudios = Table[ + noteAudioColumns, + noteAudioIndexes, + noteAudioForeignKeys, + noteAudioUniques, + noteAudioChecks, +]{ + Schema: "", + Name: "note_audio", + Columns: noteAudioColumns{ + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + CreatorID: column{ + Name: "creator_id", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Deleted: column{ + Name: "deleted", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + DeletorID: column{ + Name: "deletor_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Duration: column{ + Name: "duration", + DBType: "real", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Transcription: column{ + Name: "transcription", + DBType: "text", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + TranscriptionUserEdited: column{ + Name: "transcription_user_edited", + DBType: "boolean", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + UUID: column{ + Name: "uuid", + DBType: "uuid", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: noteAudioIndexes{ + NoteAudioPkey: index{ + Type: "btree", + Name: "note_audio_pkey", + Columns: []indexColumn{ + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "uuid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "note_audio_pkey", + Columns: []string{"version", "uuid"}, + Comment: "", + }, + ForeignKeys: noteAudioForeignKeys{ + NoteAudioNoteAudioCreatorIDFkey: foreignKey{ + constraint: constraint{ + Name: "note_audio.note_audio_creator_id_fkey", + Columns: []string{"creator_id"}, + Comment: "", + }, + ForeignTable: "user_", + ForeignColumns: []string{"id"}, + }, + NoteAudioNoteAudioDeletorIDFkey: foreignKey{ + constraint: constraint{ + Name: "note_audio.note_audio_deletor_id_fkey", + Columns: []string{"deletor_id"}, + Comment: "", + }, + ForeignTable: "user_", + ForeignColumns: []string{"id"}, + }, + NoteAudioNoteAudioOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "note_audio.note_audio_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type noteAudioColumns struct { + Created column + CreatorID column + Deleted column + DeletorID column + Duration column + OrganizationID column + Transcription column + TranscriptionUserEdited column + Version column + UUID column +} + +func (c noteAudioColumns) AsSlice() []column { + return []column{ + c.Created, c.CreatorID, c.Deleted, c.DeletorID, c.Duration, c.OrganizationID, c.Transcription, c.TranscriptionUserEdited, c.Version, c.UUID, + } +} + +type noteAudioIndexes struct { + NoteAudioPkey index +} + +func (i noteAudioIndexes) AsSlice() []index { + return []index{ + i.NoteAudioPkey, + } +} + +type noteAudioForeignKeys struct { + NoteAudioNoteAudioCreatorIDFkey foreignKey + NoteAudioNoteAudioDeletorIDFkey foreignKey + NoteAudioNoteAudioOrganizationIDFkey foreignKey +} + +func (f noteAudioForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.NoteAudioNoteAudioCreatorIDFkey, f.NoteAudioNoteAudioDeletorIDFkey, f.NoteAudioNoteAudioOrganizationIDFkey, + } +} + +type noteAudioUniques struct{} + +func (u noteAudioUniques) AsSlice() []constraint { + return []constraint{} +} + +type noteAudioChecks struct{} + +func (c noteAudioChecks) AsSlice() []check { + return []check{} +} diff --git a/db/dbinfo/note_audio_breadcrumb.bob.go b/db/dbinfo/note_audio_breadcrumb.bob.go new file mode 100644 index 00000000..970909c7 --- /dev/null +++ b/db/dbinfo/note_audio_breadcrumb.bob.go @@ -0,0 +1,167 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dbinfo + +import "github.com/aarondl/opt/null" + +var NoteAudioBreadcrumbs = Table[ + noteAudioBreadcrumbColumns, + noteAudioBreadcrumbIndexes, + noteAudioBreadcrumbForeignKeys, + noteAudioBreadcrumbUniques, + noteAudioBreadcrumbChecks, +]{ + Schema: "", + Name: "note_audio_breadcrumb", + Columns: noteAudioBreadcrumbColumns{ + Cell: column{ + Name: "cell", + DBType: "h3index", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + ManuallySelected: column{ + Name: "manually_selected", + DBType: "boolean", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + NoteAudioVersion: column{ + Name: "note_audio_version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + NoteAudioUUID: column{ + Name: "note_audio_uuid", + DBType: "uuid", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Position: column{ + Name: "position", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: noteAudioBreadcrumbIndexes{ + NoteAudioBreadcrumbPkey: index{ + Type: "btree", + Name: "note_audio_breadcrumb_pkey", + Columns: []indexColumn{ + { + Name: "note_audio_version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "note_audio_uuid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "\"position\"", + Desc: null.FromCond(false, true), + IsExpression: true, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "note_audio_breadcrumb_pkey", + Columns: []string{"note_audio_version", "note_audio_uuid", "position"}, + Comment: "", + }, + ForeignKeys: noteAudioBreadcrumbForeignKeys{ + NoteAudioBreadcrumbNoteAudioBreadcrumbNoteAudioVersionNoteAudioUUIDFkey: foreignKey{ + constraint: constraint{ + Name: "note_audio_breadcrumb.note_audio_breadcrumb_note_audio_version_note_audio_uuid_fkey", + Columns: []string{"note_audio_version", "note_audio_uuid"}, + Comment: "", + }, + ForeignTable: "note_audio", + ForeignColumns: []string{"version", "uuid"}, + }, + }, + + Comment: "", +} + +type noteAudioBreadcrumbColumns struct { + Cell column + Created column + ManuallySelected column + NoteAudioVersion column + NoteAudioUUID column + Position column +} + +func (c noteAudioBreadcrumbColumns) AsSlice() []column { + return []column{ + c.Cell, c.Created, c.ManuallySelected, c.NoteAudioVersion, c.NoteAudioUUID, c.Position, + } +} + +type noteAudioBreadcrumbIndexes struct { + NoteAudioBreadcrumbPkey index +} + +func (i noteAudioBreadcrumbIndexes) AsSlice() []index { + return []index{ + i.NoteAudioBreadcrumbPkey, + } +} + +type noteAudioBreadcrumbForeignKeys struct { + NoteAudioBreadcrumbNoteAudioBreadcrumbNoteAudioVersionNoteAudioUUIDFkey foreignKey +} + +func (f noteAudioBreadcrumbForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.NoteAudioBreadcrumbNoteAudioBreadcrumbNoteAudioVersionNoteAudioUUIDFkey, + } +} + +type noteAudioBreadcrumbUniques struct{} + +func (u noteAudioBreadcrumbUniques) AsSlice() []constraint { + return []constraint{} +} + +type noteAudioBreadcrumbChecks struct{} + +func (c noteAudioBreadcrumbChecks) AsSlice() []check { + return []check{} +} diff --git a/db/dbinfo/note_audio_data.bob.go b/db/dbinfo/note_audio_data.bob.go new file mode 100644 index 00000000..00d2f51c --- /dev/null +++ b/db/dbinfo/note_audio_data.bob.go @@ -0,0 +1,147 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dbinfo + +import "github.com/aarondl/opt/null" + +var NoteAudioData = Table[ + noteAudioDatumColumns, + noteAudioDatumIndexes, + noteAudioDatumForeignKeys, + noteAudioDatumUniques, + noteAudioDatumChecks, +]{ + Schema: "", + Name: "note_audio_data", + Columns: noteAudioDatumColumns{ + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + NoteAudioVersion: column{ + Name: "note_audio_version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + NoteAudioUUID: column{ + Name: "note_audio_uuid", + DBType: "uuid", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Type: column{ + Name: "type_", + DBType: "public.audiodatatype", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: noteAudioDatumIndexes{ + NoteAudioDataPkey: index{ + Type: "btree", + Name: "note_audio_data_pkey", + Columns: []indexColumn{ + { + Name: "note_audio_version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "note_audio_uuid", + 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: "note_audio_data_pkey", + Columns: []string{"note_audio_version", "note_audio_uuid", "type_"}, + Comment: "", + }, + ForeignKeys: noteAudioDatumForeignKeys{ + NoteAudioDataNoteAudioDataNoteAudioVersionNoteAudioUUIDFkey: foreignKey{ + constraint: constraint{ + Name: "note_audio_data.note_audio_data_note_audio_version_note_audio_uuid_fkey", + Columns: []string{"note_audio_version", "note_audio_uuid"}, + Comment: "", + }, + ForeignTable: "note_audio", + ForeignColumns: []string{"version", "uuid"}, + }, + }, + + Comment: "", +} + +type noteAudioDatumColumns struct { + Created column + NoteAudioVersion column + NoteAudioUUID column + Type column +} + +func (c noteAudioDatumColumns) AsSlice() []column { + return []column{ + c.Created, c.NoteAudioVersion, c.NoteAudioUUID, c.Type, + } +} + +type noteAudioDatumIndexes struct { + NoteAudioDataPkey index +} + +func (i noteAudioDatumIndexes) AsSlice() []index { + return []index{ + i.NoteAudioDataPkey, + } +} + +type noteAudioDatumForeignKeys struct { + NoteAudioDataNoteAudioDataNoteAudioVersionNoteAudioUUIDFkey foreignKey +} + +func (f noteAudioDatumForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.NoteAudioDataNoteAudioDataNoteAudioVersionNoteAudioUUIDFkey, + } +} + +type noteAudioDatumUniques struct{} + +func (u noteAudioDatumUniques) AsSlice() []constraint { + return []constraint{} +} + +type noteAudioDatumChecks struct{} + +func (c noteAudioDatumChecks) AsSlice() []check { + return []check{} +} diff --git a/db/dbinfo/note_image.bob.go b/db/dbinfo/note_image.bob.go new file mode 100644 index 00000000..a7383d6b --- /dev/null +++ b/db/dbinfo/note_image.bob.go @@ -0,0 +1,192 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dbinfo + +import "github.com/aarondl/opt/null" + +var NoteImages = Table[ + noteImageColumns, + noteImageIndexes, + noteImageForeignKeys, + noteImageUniques, + noteImageChecks, +]{ + Schema: "", + Name: "note_image", + Columns: noteImageColumns{ + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + CreatorID: column{ + Name: "creator_id", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Deleted: column{ + Name: "deleted", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + DeletorID: column{ + Name: "deletor_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Version: column{ + Name: "version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + UUID: column{ + Name: "uuid", + DBType: "uuid", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: noteImageIndexes{ + NoteImagePkey: index{ + Type: "btree", + Name: "note_image_pkey", + Columns: []indexColumn{ + { + Name: "version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "uuid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "note_image_pkey", + Columns: []string{"version", "uuid"}, + Comment: "", + }, + ForeignKeys: noteImageForeignKeys{ + NoteImageNoteImageCreatorIDFkey: foreignKey{ + constraint: constraint{ + Name: "note_image.note_image_creator_id_fkey", + Columns: []string{"creator_id"}, + Comment: "", + }, + ForeignTable: "user_", + ForeignColumns: []string{"id"}, + }, + NoteImageNoteImageDeletorIDFkey: foreignKey{ + constraint: constraint{ + Name: "note_image.note_image_deletor_id_fkey", + Columns: []string{"deletor_id"}, + Comment: "", + }, + ForeignTable: "user_", + ForeignColumns: []string{"id"}, + }, + NoteImageNoteImageOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "note_image.note_image_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type noteImageColumns struct { + Created column + CreatorID column + Deleted column + DeletorID column + OrganizationID column + Version column + UUID column +} + +func (c noteImageColumns) AsSlice() []column { + return []column{ + c.Created, c.CreatorID, c.Deleted, c.DeletorID, c.OrganizationID, c.Version, c.UUID, + } +} + +type noteImageIndexes struct { + NoteImagePkey index +} + +func (i noteImageIndexes) AsSlice() []index { + return []index{ + i.NoteImagePkey, + } +} + +type noteImageForeignKeys struct { + NoteImageNoteImageCreatorIDFkey foreignKey + NoteImageNoteImageDeletorIDFkey foreignKey + NoteImageNoteImageOrganizationIDFkey foreignKey +} + +func (f noteImageForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.NoteImageNoteImageCreatorIDFkey, f.NoteImageNoteImageDeletorIDFkey, f.NoteImageNoteImageOrganizationIDFkey, + } +} + +type noteImageUniques struct{} + +func (u noteImageUniques) AsSlice() []constraint { + return []constraint{} +} + +type noteImageChecks struct{} + +func (c noteImageChecks) AsSlice() []check { + return []check{} +} diff --git a/db/dbinfo/note_image_breadcrumb.bob.go b/db/dbinfo/note_image_breadcrumb.bob.go new file mode 100644 index 00000000..fffce610 --- /dev/null +++ b/db/dbinfo/note_image_breadcrumb.bob.go @@ -0,0 +1,167 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dbinfo + +import "github.com/aarondl/opt/null" + +var NoteImageBreadcrumbs = Table[ + noteImageBreadcrumbColumns, + noteImageBreadcrumbIndexes, + noteImageBreadcrumbForeignKeys, + noteImageBreadcrumbUniques, + noteImageBreadcrumbChecks, +]{ + Schema: "", + Name: "note_image_breadcrumb", + Columns: noteImageBreadcrumbColumns{ + Cell: column{ + Name: "cell", + DBType: "h3index", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + ManuallySelected: column{ + Name: "manually_selected", + DBType: "boolean", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + NoteImageVersion: column{ + Name: "note_image_version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + NoteImageUUID: column{ + Name: "note_image_uuid", + DBType: "uuid", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Position: column{ + Name: "position", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: noteImageBreadcrumbIndexes{ + NoteImageBreadcrumbPkey: index{ + Type: "btree", + Name: "note_image_breadcrumb_pkey", + Columns: []indexColumn{ + { + Name: "note_image_version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "note_image_uuid", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "\"position\"", + Desc: null.FromCond(false, true), + IsExpression: true, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false, false, false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "note_image_breadcrumb_pkey", + Columns: []string{"note_image_version", "note_image_uuid", "position"}, + Comment: "", + }, + ForeignKeys: noteImageBreadcrumbForeignKeys{ + NoteImageBreadcrumbNoteImageBreadcrumbNoteImageVersionNoteImageUUIDFkey: foreignKey{ + constraint: constraint{ + Name: "note_image_breadcrumb.note_image_breadcrumb_note_image_version_note_image_uuid_fkey", + Columns: []string{"note_image_version", "note_image_uuid"}, + Comment: "", + }, + ForeignTable: "note_image", + ForeignColumns: []string{"version", "uuid"}, + }, + }, + + Comment: "", +} + +type noteImageBreadcrumbColumns struct { + Cell column + Created column + ManuallySelected column + NoteImageVersion column + NoteImageUUID column + Position column +} + +func (c noteImageBreadcrumbColumns) AsSlice() []column { + return []column{ + c.Cell, c.Created, c.ManuallySelected, c.NoteImageVersion, c.NoteImageUUID, c.Position, + } +} + +type noteImageBreadcrumbIndexes struct { + NoteImageBreadcrumbPkey index +} + +func (i noteImageBreadcrumbIndexes) AsSlice() []index { + return []index{ + i.NoteImageBreadcrumbPkey, + } +} + +type noteImageBreadcrumbForeignKeys struct { + NoteImageBreadcrumbNoteImageBreadcrumbNoteImageVersionNoteImageUUIDFkey foreignKey +} + +func (f noteImageBreadcrumbForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.NoteImageBreadcrumbNoteImageBreadcrumbNoteImageVersionNoteImageUUIDFkey, + } +} + +type noteImageBreadcrumbUniques struct{} + +func (u noteImageBreadcrumbUniques) AsSlice() []constraint { + return []constraint{} +} + +type noteImageBreadcrumbChecks struct{} + +func (c noteImageBreadcrumbChecks) AsSlice() []check { + return []check{} +} diff --git a/db/dbinfo/note_image_data.bob.go b/db/dbinfo/note_image_data.bob.go new file mode 100644 index 00000000..d96712a7 --- /dev/null +++ b/db/dbinfo/note_image_data.bob.go @@ -0,0 +1,147 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dbinfo + +import "github.com/aarondl/opt/null" + +var NoteImageData = Table[ + noteImageDatumColumns, + noteImageDatumIndexes, + noteImageDatumForeignKeys, + noteImageDatumUniques, + noteImageDatumChecks, +]{ + Schema: "", + Name: "note_image_data", + Columns: noteImageDatumColumns{ + Created: column{ + Name: "created", + DBType: "timestamp without time zone", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + NoteImageVersion: column{ + Name: "note_image_version", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + NoteImageUUID: column{ + Name: "note_image_uuid", + DBType: "uuid", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Type: column{ + Name: "type_", + DBType: "public.audiodatatype", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: noteImageDatumIndexes{ + NoteImageDataPkey: index{ + Type: "btree", + Name: "note_image_data_pkey", + Columns: []indexColumn{ + { + Name: "note_image_version", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + { + Name: "note_image_uuid", + 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: "note_image_data_pkey", + Columns: []string{"note_image_version", "note_image_uuid", "type_"}, + Comment: "", + }, + ForeignKeys: noteImageDatumForeignKeys{ + NoteImageDataNoteImageDataNoteImageVersionNoteImageUUIDFkey: foreignKey{ + constraint: constraint{ + Name: "note_image_data.note_image_data_note_image_version_note_image_uuid_fkey", + Columns: []string{"note_image_version", "note_image_uuid"}, + Comment: "", + }, + ForeignTable: "note_image", + ForeignColumns: []string{"version", "uuid"}, + }, + }, + + Comment: "", +} + +type noteImageDatumColumns struct { + Created column + NoteImageVersion column + NoteImageUUID column + Type column +} + +func (c noteImageDatumColumns) AsSlice() []column { + return []column{ + c.Created, c.NoteImageVersion, c.NoteImageUUID, c.Type, + } +} + +type noteImageDatumIndexes struct { + NoteImageDataPkey index +} + +func (i noteImageDatumIndexes) AsSlice() []index { + return []index{ + i.NoteImageDataPkey, + } +} + +type noteImageDatumForeignKeys struct { + NoteImageDataNoteImageDataNoteImageVersionNoteImageUUIDFkey foreignKey +} + +func (f noteImageDatumForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.NoteImageDataNoteImageDataNoteImageVersionNoteImageUUIDFkey, + } +} + +type noteImageDatumUniques struct{} + +func (u noteImageDatumUniques) AsSlice() []constraint { + return []constraint{} +} + +type noteImageDatumChecks struct{} + +func (c noteImageDatumChecks) AsSlice() []check { + return []check{} +} diff --git a/db/dbinfo/notification.bob.go b/db/dbinfo/notification.bob.go index c639ebac..90ddf701 100644 --- a/db/dbinfo/notification.bob.go +++ b/db/dbinfo/notification.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo diff --git a/db/dbinfo/oauth_token.bob.go b/db/dbinfo/oauth_token.bob.go index 96f6feee..3095e160 100644 --- a/db/dbinfo/oauth_token.bob.go +++ b/db/dbinfo/oauth_token.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo diff --git a/db/dbinfo/organization.bob.go b/db/dbinfo/organization.bob.go index c871abeb..b3e95620 100644 --- a/db/dbinfo/organization.bob.go +++ b/db/dbinfo/organization.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo diff --git a/db/dbinfo/raster_columns.bob.go b/db/dbinfo/raster_columns.bob.go index 900b1aad..1614a40d 100644 --- a/db/dbinfo/raster_columns.bob.go +++ b/db/dbinfo/raster_columns.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo diff --git a/db/dbinfo/raster_overviews.bob.go b/db/dbinfo/raster_overviews.bob.go index 2d8d2936..08f626ea 100644 --- a/db/dbinfo/raster_overviews.bob.go +++ b/db/dbinfo/raster_overviews.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo diff --git a/db/dbinfo/sessions.bob.go b/db/dbinfo/sessions.bob.go index 91933caf..1ddf6b55 100644 --- a/db/dbinfo/sessions.bob.go +++ b/db/dbinfo/sessions.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo diff --git a/db/dbinfo/spatial_ref_sys.bob.go b/db/dbinfo/spatial_ref_sys.bob.go index b2282470..8ef1f8f5 100644 --- a/db/dbinfo/spatial_ref_sys.bob.go +++ b/db/dbinfo/spatial_ref_sys.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo diff --git a/db/dbinfo/user_.bob.go b/db/dbinfo/user_.bob.go index 8d0f10f4..3f640766 100644 --- a/db/dbinfo/user_.bob.go +++ b/db/dbinfo/user_.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package dbinfo diff --git a/db/enums/enums.bob.go b/db/enums/enums.bob.go index 6a003a0e..77555850 100644 --- a/db/enums/enums.bob.go +++ b/db/enums/enums.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package enums @@ -117,38 +117,32 @@ func (e *Arcgislicensetype) Scan(value any) error { return nil } -// Enum values for FieldseekerContainerrelateMosquitocontainertypeEnum +// Enum values for Audiodatatype const ( - FieldseekerContainerrelateMosquitocontainertypeEnumAquarium FieldseekerContainerrelateMosquitocontainertypeEnum = "Aquarium" - FieldseekerContainerrelateMosquitocontainertypeEnumFlowerPot FieldseekerContainerrelateMosquitocontainertypeEnum = "Flower pot" - FieldseekerContainerrelateMosquitocontainertypeEnum5GallonBucket FieldseekerContainerrelateMosquitocontainertypeEnum = "5 gallon bucket" - FieldseekerContainerrelateMosquitocontainertypeEnumFountain FieldseekerContainerrelateMosquitocontainertypeEnum = "Fountain" - FieldseekerContainerrelateMosquitocontainertypeEnumBirdBath FieldseekerContainerrelateMosquitocontainertypeEnum = "Bird bath" + AudiodatatypeRaw Audiodatatype = "raw" + AudiodatatypeRawNormalized Audiodatatype = "raw_normalized" + AudiodatatypeOgg Audiodatatype = "ogg" ) -func AllFieldseekerContainerrelateMosquitocontainertypeEnum() []FieldseekerContainerrelateMosquitocontainertypeEnum { - return []FieldseekerContainerrelateMosquitocontainertypeEnum{ - FieldseekerContainerrelateMosquitocontainertypeEnumAquarium, - FieldseekerContainerrelateMosquitocontainertypeEnumFlowerPot, - FieldseekerContainerrelateMosquitocontainertypeEnum5GallonBucket, - FieldseekerContainerrelateMosquitocontainertypeEnumFountain, - FieldseekerContainerrelateMosquitocontainertypeEnumBirdBath, +func AllAudiodatatype() []Audiodatatype { + return []Audiodatatype{ + AudiodatatypeRaw, + AudiodatatypeRawNormalized, + AudiodatatypeOgg, } } -type FieldseekerContainerrelateMosquitocontainertypeEnum string +type Audiodatatype string -func (e FieldseekerContainerrelateMosquitocontainertypeEnum) String() string { +func (e Audiodatatype) String() string { return string(e) } -func (e FieldseekerContainerrelateMosquitocontainertypeEnum) Valid() bool { +func (e Audiodatatype) Valid() bool { switch e { - case FieldseekerContainerrelateMosquitocontainertypeEnumAquarium, - FieldseekerContainerrelateMosquitocontainertypeEnumFlowerPot, - FieldseekerContainerrelateMosquitocontainertypeEnum5GallonBucket, - FieldseekerContainerrelateMosquitocontainertypeEnumFountain, - FieldseekerContainerrelateMosquitocontainertypeEnumBirdBath: + case AudiodatatypeRaw, + AudiodatatypeRawNormalized, + AudiodatatypeOgg: return true default: return false @@ -156,10744 +150,44 @@ func (e FieldseekerContainerrelateMosquitocontainertypeEnum) Valid() bool { } // useful when testing in other packages -func (e FieldseekerContainerrelateMosquitocontainertypeEnum) All() []FieldseekerContainerrelateMosquitocontainertypeEnum { - return AllFieldseekerContainerrelateMosquitocontainertypeEnum() +func (e Audiodatatype) All() []Audiodatatype { + return AllAudiodatatype() } -func (e FieldseekerContainerrelateMosquitocontainertypeEnum) MarshalText() ([]byte, error) { +func (e Audiodatatype) MarshalText() ([]byte, error) { return []byte(e), nil } -func (e *FieldseekerContainerrelateMosquitocontainertypeEnum) UnmarshalText(text []byte) error { +func (e *Audiodatatype) UnmarshalText(text []byte) error { return e.Scan(text) } -func (e FieldseekerContainerrelateMosquitocontainertypeEnum) MarshalBinary() ([]byte, error) { +func (e Audiodatatype) MarshalBinary() ([]byte, error) { return []byte(e), nil } -func (e *FieldseekerContainerrelateMosquitocontainertypeEnum) UnmarshalBinary(data []byte) error { +func (e *Audiodatatype) UnmarshalBinary(data []byte) error { return e.Scan(data) } -func (e FieldseekerContainerrelateMosquitocontainertypeEnum) Value() (driver.Value, error) { +func (e Audiodatatype) Value() (driver.Value, error) { return string(e), nil } -func (e *FieldseekerContainerrelateMosquitocontainertypeEnum) Scan(value any) error { +func (e *Audiodatatype) Scan(value any) error { switch x := value.(type) { case string: - *e = FieldseekerContainerrelateMosquitocontainertypeEnum(x) + *e = Audiodatatype(x) case []byte: - *e = FieldseekerContainerrelateMosquitocontainertypeEnum(x) + *e = Audiodatatype(x) case nil: - return fmt.Errorf("cannot nil into FieldseekerContainerrelateMosquitocontainertypeEnum") + return fmt.Errorf("cannot nil into Audiodatatype") default: return fmt.Errorf("cannot scan type %T: %v", value, value) } if !e.Valid() { - return fmt.Errorf("invalid FieldseekerContainerrelateMosquitocontainertypeEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum -const ( - FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum0 FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum = "0" - FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum1 FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum = "1" - FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum2 FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum = "2" - FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum3 FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum = "3" -) - -func AllFieldseekerFieldscoutinglogFieldscoutingsymbologyEnum() []FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum { - return []FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum{ - FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum0, - FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum1, - FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum2, - FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum3, - } -} - -type FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum string - -func (e FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum) String() string { - return string(e) -} - -func (e FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum) Valid() bool { - switch e { - case FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum0, - FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum1, - FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum2, - FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum3: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum) All() []FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum { - return AllFieldseekerFieldscoutinglogFieldscoutingsymbologyEnum() -} - -func (e FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum(x) - case []byte: - *e = FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 -const ( - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Orchard FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "orchard" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284RowCrops FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "row_crops" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284VineCrops FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "vine_crops" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284AgGrassesOrGrain FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "ag_grasses_or_grain" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Pasture FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "pasture" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284IrrigationStandpipe FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "irrigation_standpipe" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Ditch FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "ditch" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Pond FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "pond" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Sump FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "sump" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Drain FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "drain" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284DairyLagoon FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "dairy_lagoon" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284WastewaterTreatment FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "wastewater_treatment" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Trough FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "trough" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Depression FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "depression" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Gutter FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "gutter" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284RainGutter FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "rain_gutter" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Culvert FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "culvert" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Utility FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "utility" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284CatchBasin FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "catch_basin" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284StreamOrCreek FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "stream_or_creek" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Slough FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "slough" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284River FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "river" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284MarshOrWetlands FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "marsh_or_wetlands" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Containers FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "containers" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284WateringBowl FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "watering_bowl" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284PlantSaucer FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "plant_saucer" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284YardDrain FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "yard_drain" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284PlantAxil FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "plant_axil" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Treehole FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "treehole" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284FountainOrWaterFeature FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "fountain_or_water_feature" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284BirdBath FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "bird_bath" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284MiscWaterAccumulation FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "misc_water_accumulation" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284TarpOrCover FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "tarp_or_cover" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284SwimmingPool FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "swimming_pool" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284AbovegroundPool FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "aboveground_pool" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284KidPool FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "kid_pool" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284HotTub FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "hot_tub" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Appliance FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "appliance" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Tires FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "tires" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284FloodedStructure FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "flooded_structure" - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284LowPoint FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 = "low_point" -) - -func AllFieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284() []FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 { - return []FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284{ - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Orchard, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284RowCrops, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284VineCrops, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284AgGrassesOrGrain, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Pasture, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284IrrigationStandpipe, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Ditch, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Pond, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Sump, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Drain, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284DairyLagoon, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284WastewaterTreatment, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Trough, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Depression, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Gutter, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284RainGutter, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Culvert, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Utility, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284CatchBasin, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284StreamOrCreek, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Slough, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284River, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284MarshOrWetlands, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Containers, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284WateringBowl, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284PlantSaucer, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284YardDrain, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284PlantAxil, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Treehole, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284FountainOrWaterFeature, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284BirdBath, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284MiscWaterAccumulation, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284TarpOrCover, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284SwimmingPool, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284AbovegroundPool, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284KidPool, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284HotTub, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Appliance, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Tires, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284FloodedStructure, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284LowPoint, - } -} - -type FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 string - -func (e FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284) String() string { - return string(e) -} - -func (e FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284) Valid() bool { - switch e { - case FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Orchard, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284RowCrops, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284VineCrops, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284AgGrassesOrGrain, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Pasture, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284IrrigationStandpipe, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Ditch, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Pond, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Sump, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Drain, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284DairyLagoon, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284WastewaterTreatment, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Trough, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Depression, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Gutter, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284RainGutter, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Culvert, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Utility, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284CatchBasin, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284StreamOrCreek, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Slough, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284River, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284MarshOrWetlands, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Containers, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284WateringBowl, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284PlantSaucer, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284YardDrain, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284PlantAxil, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Treehole, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284FountainOrWaterFeature, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284BirdBath, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284MiscWaterAccumulation, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284TarpOrCover, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284SwimmingPool, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284AbovegroundPool, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284KidPool, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284HotTub, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Appliance, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284Tires, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284FloodedStructure, - FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284LowPoint: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284) All() []FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 { - return AllFieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284() -} - -func (e FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284(x) - case []byte: - *e = FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerInspectionsampleNotinuitFEnum -const ( - FieldseekerInspectionsampleNotinuitFEnum1 FieldseekerInspectionsampleNotinuitFEnum = "1" - FieldseekerInspectionsampleNotinuitFEnum0 FieldseekerInspectionsampleNotinuitFEnum = "0" -) - -func AllFieldseekerInspectionsampleNotinuitFEnum() []FieldseekerInspectionsampleNotinuitFEnum { - return []FieldseekerInspectionsampleNotinuitFEnum{ - FieldseekerInspectionsampleNotinuitFEnum1, - FieldseekerInspectionsampleNotinuitFEnum0, - } -} - -type FieldseekerInspectionsampleNotinuitFEnum string - -func (e FieldseekerInspectionsampleNotinuitFEnum) String() string { - return string(e) -} - -func (e FieldseekerInspectionsampleNotinuitFEnum) Valid() bool { - switch e { - case FieldseekerInspectionsampleNotinuitFEnum1, - FieldseekerInspectionsampleNotinuitFEnum0: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerInspectionsampleNotinuitFEnum) All() []FieldseekerInspectionsampleNotinuitFEnum { - return AllFieldseekerInspectionsampleNotinuitFEnum() -} - -func (e FieldseekerInspectionsampleNotinuitFEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerInspectionsampleNotinuitFEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerInspectionsampleNotinuitFEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerInspectionsampleNotinuitFEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerInspectionsampleNotinuitFEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerInspectionsampleNotinuitFEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerInspectionsampleNotinuitFEnum(x) - case []byte: - *e = FieldseekerInspectionsampleNotinuitFEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerInspectionsampleNotinuitFEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerInspectionsampleNotinuitFEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerInspectionsampledetailMosquitoadultactivityEnum -const ( - FieldseekerInspectionsampledetailMosquitoadultactivityEnumNone FieldseekerInspectionsampledetailMosquitoadultactivityEnum = "None" - FieldseekerInspectionsampledetailMosquitoadultactivityEnumLight FieldseekerInspectionsampledetailMosquitoadultactivityEnum = "Light" - FieldseekerInspectionsampledetailMosquitoadultactivityEnumModerate FieldseekerInspectionsampledetailMosquitoadultactivityEnum = "Moderate" - FieldseekerInspectionsampledetailMosquitoadultactivityEnumIntense FieldseekerInspectionsampledetailMosquitoadultactivityEnum = "Intense" -) - -func AllFieldseekerInspectionsampledetailMosquitoadultactivityEnum() []FieldseekerInspectionsampledetailMosquitoadultactivityEnum { - return []FieldseekerInspectionsampledetailMosquitoadultactivityEnum{ - FieldseekerInspectionsampledetailMosquitoadultactivityEnumNone, - FieldseekerInspectionsampledetailMosquitoadultactivityEnumLight, - FieldseekerInspectionsampledetailMosquitoadultactivityEnumModerate, - FieldseekerInspectionsampledetailMosquitoadultactivityEnumIntense, - } -} - -type FieldseekerInspectionsampledetailMosquitoadultactivityEnum string - -func (e FieldseekerInspectionsampledetailMosquitoadultactivityEnum) String() string { - return string(e) -} - -func (e FieldseekerInspectionsampledetailMosquitoadultactivityEnum) Valid() bool { - switch e { - case FieldseekerInspectionsampledetailMosquitoadultactivityEnumNone, - FieldseekerInspectionsampledetailMosquitoadultactivityEnumLight, - FieldseekerInspectionsampledetailMosquitoadultactivityEnumModerate, - FieldseekerInspectionsampledetailMosquitoadultactivityEnumIntense: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerInspectionsampledetailMosquitoadultactivityEnum) All() []FieldseekerInspectionsampledetailMosquitoadultactivityEnum { - return AllFieldseekerInspectionsampledetailMosquitoadultactivityEnum() -} - -func (e FieldseekerInspectionsampledetailMosquitoadultactivityEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerInspectionsampledetailMosquitoadultactivityEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerInspectionsampledetailMosquitoadultactivityEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerInspectionsampledetailMosquitoadultactivityEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerInspectionsampledetailMosquitoadultactivityEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerInspectionsampledetailMosquitoadultactivityEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerInspectionsampledetailMosquitoadultactivityEnum(x) - case []byte: - *e = FieldseekerInspectionsampledetailMosquitoadultactivityEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerInspectionsampledetailMosquitoadultactivityEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerInspectionsampledetailMosquitoadultactivityEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerInspectionsampledetailMosquitodominantstageEnum -const ( - FieldseekerInspectionsampledetailMosquitodominantstageEnum1 FieldseekerInspectionsampledetailMosquitodominantstageEnum = "1" - FieldseekerInspectionsampledetailMosquitodominantstageEnum2 FieldseekerInspectionsampledetailMosquitodominantstageEnum = "2" - FieldseekerInspectionsampledetailMosquitodominantstageEnum3 FieldseekerInspectionsampledetailMosquitodominantstageEnum = "3" - FieldseekerInspectionsampledetailMosquitodominantstageEnum4 FieldseekerInspectionsampledetailMosquitodominantstageEnum = "4" - FieldseekerInspectionsampledetailMosquitodominantstageEnum1_2 FieldseekerInspectionsampledetailMosquitodominantstageEnum = "1-2" - FieldseekerInspectionsampledetailMosquitodominantstageEnum3_4 FieldseekerInspectionsampledetailMosquitodominantstageEnum = "3-4" -) - -func AllFieldseekerInspectionsampledetailMosquitodominantstageEnum() []FieldseekerInspectionsampledetailMosquitodominantstageEnum { - return []FieldseekerInspectionsampledetailMosquitodominantstageEnum{ - FieldseekerInspectionsampledetailMosquitodominantstageEnum1, - FieldseekerInspectionsampledetailMosquitodominantstageEnum2, - FieldseekerInspectionsampledetailMosquitodominantstageEnum3, - FieldseekerInspectionsampledetailMosquitodominantstageEnum4, - FieldseekerInspectionsampledetailMosquitodominantstageEnum1_2, - FieldseekerInspectionsampledetailMosquitodominantstageEnum3_4, - } -} - -type FieldseekerInspectionsampledetailMosquitodominantstageEnum string - -func (e FieldseekerInspectionsampledetailMosquitodominantstageEnum) String() string { - return string(e) -} - -func (e FieldseekerInspectionsampledetailMosquitodominantstageEnum) Valid() bool { - switch e { - case FieldseekerInspectionsampledetailMosquitodominantstageEnum1, - FieldseekerInspectionsampledetailMosquitodominantstageEnum2, - FieldseekerInspectionsampledetailMosquitodominantstageEnum3, - FieldseekerInspectionsampledetailMosquitodominantstageEnum4, - FieldseekerInspectionsampledetailMosquitodominantstageEnum1_2, - FieldseekerInspectionsampledetailMosquitodominantstageEnum3_4: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerInspectionsampledetailMosquitodominantstageEnum) All() []FieldseekerInspectionsampledetailMosquitodominantstageEnum { - return AllFieldseekerInspectionsampledetailMosquitodominantstageEnum() -} - -func (e FieldseekerInspectionsampledetailMosquitodominantstageEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerInspectionsampledetailMosquitodominantstageEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerInspectionsampledetailMosquitodominantstageEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerInspectionsampledetailMosquitodominantstageEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerInspectionsampledetailMosquitodominantstageEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerInspectionsampledetailMosquitodominantstageEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerInspectionsampledetailMosquitodominantstageEnum(x) - case []byte: - *e = FieldseekerInspectionsampledetailMosquitodominantstageEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerInspectionsampledetailMosquitodominantstageEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerInspectionsampledetailMosquitodominantstageEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerInspectionsampledetailMosquitofieldspeciesEnum -const ( - FieldseekerInspectionsampledetailMosquitofieldspeciesEnumAedes FieldseekerInspectionsampledetailMosquitofieldspeciesEnum = "Aedes" - FieldseekerInspectionsampledetailMosquitofieldspeciesEnumCulex FieldseekerInspectionsampledetailMosquitofieldspeciesEnum = "Culex" -) - -func AllFieldseekerInspectionsampledetailMosquitofieldspeciesEnum() []FieldseekerInspectionsampledetailMosquitofieldspeciesEnum { - return []FieldseekerInspectionsampledetailMosquitofieldspeciesEnum{ - FieldseekerInspectionsampledetailMosquitofieldspeciesEnumAedes, - FieldseekerInspectionsampledetailMosquitofieldspeciesEnumCulex, - } -} - -type FieldseekerInspectionsampledetailMosquitofieldspeciesEnum string - -func (e FieldseekerInspectionsampledetailMosquitofieldspeciesEnum) String() string { - return string(e) -} - -func (e FieldseekerInspectionsampledetailMosquitofieldspeciesEnum) Valid() bool { - switch e { - case FieldseekerInspectionsampledetailMosquitofieldspeciesEnumAedes, - FieldseekerInspectionsampledetailMosquitofieldspeciesEnumCulex: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerInspectionsampledetailMosquitofieldspeciesEnum) All() []FieldseekerInspectionsampledetailMosquitofieldspeciesEnum { - return AllFieldseekerInspectionsampledetailMosquitofieldspeciesEnum() -} - -func (e FieldseekerInspectionsampledetailMosquitofieldspeciesEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerInspectionsampledetailMosquitofieldspeciesEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerInspectionsampledetailMosquitofieldspeciesEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerInspectionsampledetailMosquitofieldspeciesEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerInspectionsampledetailMosquitofieldspeciesEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerInspectionsampledetailMosquitofieldspeciesEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerInspectionsampledetailMosquitofieldspeciesEnum(x) - case []byte: - *e = FieldseekerInspectionsampledetailMosquitofieldspeciesEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerInspectionsampledetailMosquitofieldspeciesEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerInspectionsampledetailMosquitofieldspeciesEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 -const ( - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Orchard FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "orchard" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418RowCrops FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "row_crops" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418VineCrops FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "vine_crops" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418AgGrassesOrGrain FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "ag_grasses_or_grain" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Pasture FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "pasture" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418IrrigationStandpipe FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "irrigation_standpipe" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Ditch FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "ditch" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Pond FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "pond" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Sump FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "sump" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Drain FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "drain" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418DairyLagoon FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "dairy_lagoon" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418WastewaterTreatment FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "wastewater_treatment" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Trough FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "trough" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Depression FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "depression" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Gutter FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "gutter" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418RainGutter FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "rain_gutter" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Culvert FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "culvert" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Utility FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "utility" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418CatchBasin FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "catch_basin" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418StreamOrCreek FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "stream_or_creek" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Slough FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "slough" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418River FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "river" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418MarshOrWetland FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "marsh_or_wetland" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Containers FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "containers" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418WateringBowl FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "watering_bowl" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418PlantSaucer FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "plant_saucer" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418YardDrain FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "yard_drain" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418PlantAxil FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "plant_axil" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Treehole FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "treehole" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418FountainOrWaterFeature FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "fountain_or_water_feature" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418BirdBath FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "bird_bath" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418MiscWaterAccumulation FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "misc_water_accumulation" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418TarpOrCover FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "tarp_or_cover" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418SwimmingPool FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "swimming_pool" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418AbovegroundPool FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "aboveground_pool" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418KidPool FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "kid_pool" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418HotTub FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "hot_tub" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Appliance FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "appliance" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Tires FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "tires" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418FloodedStructure FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "flooded_structure" - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418LowPoint FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 = "low_point" -) - -func AllFieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418() []FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 { - return []FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418{ - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Orchard, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418RowCrops, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418VineCrops, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418AgGrassesOrGrain, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Pasture, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418IrrigationStandpipe, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Ditch, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Pond, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Sump, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Drain, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418DairyLagoon, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418WastewaterTreatment, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Trough, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Depression, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Gutter, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418RainGutter, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Culvert, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Utility, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418CatchBasin, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418StreamOrCreek, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Slough, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418River, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418MarshOrWetland, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Containers, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418WateringBowl, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418PlantSaucer, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418YardDrain, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418PlantAxil, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Treehole, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418FountainOrWaterFeature, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418BirdBath, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418MiscWaterAccumulation, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418TarpOrCover, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418SwimmingPool, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418AbovegroundPool, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418KidPool, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418HotTub, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Appliance, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Tires, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418FloodedStructure, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418LowPoint, - } -} - -type FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 string - -func (e FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418) String() string { - return string(e) -} - -func (e FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418) Valid() bool { - switch e { - case FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Orchard, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418RowCrops, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418VineCrops, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418AgGrassesOrGrain, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Pasture, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418IrrigationStandpipe, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Ditch, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Pond, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Sump, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Drain, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418DairyLagoon, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418WastewaterTreatment, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Trough, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Depression, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Gutter, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418RainGutter, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Culvert, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Utility, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418CatchBasin, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418StreamOrCreek, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Slough, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418River, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418MarshOrWetland, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Containers, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418WateringBowl, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418PlantSaucer, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418YardDrain, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418PlantAxil, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Treehole, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418FountainOrWaterFeature, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418BirdBath, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418MiscWaterAccumulation, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418TarpOrCover, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418SwimmingPool, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418AbovegroundPool, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418KidPool, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418HotTub, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Appliance, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418Tires, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418FloodedStructure, - FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418LowPoint: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418) All() []FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 { - return AllFieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418() -} - -func (e FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418(x) - case []byte: - *e = FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 -const ( - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Residential FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 = "residential" - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Commercial FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 = "commercial" - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Industrial FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 = "industrial" - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Agricultural FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 = "agricultural" - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80MixedUse FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 = "mixed_use" - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80PublicDomain FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 = "public_domain" - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Natural FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 = "natural" - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Municipal FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 = "municipal" -) - -func AllFieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80() []FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 { - return []FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80{ - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Residential, - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Commercial, - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Industrial, - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Agricultural, - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80MixedUse, - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80PublicDomain, - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Natural, - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Municipal, - } -} - -type FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 string - -func (e FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80) String() string { - return string(e) -} - -func (e FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80) Valid() bool { - switch e { - case FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Residential, - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Commercial, - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Industrial, - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Agricultural, - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80MixedUse, - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80PublicDomain, - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Natural, - FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80Municipal: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80) All() []FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 { - return AllFieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80() -} - -func (e FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80(x) - case []byte: - *e = FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 -const ( - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16FloodIrrigation FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 = "flood_irrigation" - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16FurrowIrrigation FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 = "furrow_irrigation" - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16DripIrrigation FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 = "drip_irrigation" - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16SprinklerIrrigation FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 = "sprinkler_irrigation" - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16WastewaterIrrigation FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 = "wastewater_irrigation" - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16IrrigationRunoff FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 = "irrigation_runoff" - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16RainwaterAccumulation FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 = "rainwater_accumulation" - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16Leak FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 = "leak" - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16Seepage FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 = "seepage" - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16StoredWater FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 = "stored_water" - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16WastewaterSystem FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 = "wastewater_system" - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16PermanentNaturalWater FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 = "permanent_natural_water" - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16TemporaryNaturalWater FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 = "temporary_natural_water" - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16RecreationalOrOrnamentalWater FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 = "recreational_or_ornamental_water" - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16WaterConveyance FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 = "water_conveyance" -) - -func AllFieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16() []FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 { - return []FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16{ - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16FloodIrrigation, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16FurrowIrrigation, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16DripIrrigation, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16SprinklerIrrigation, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16WastewaterIrrigation, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16IrrigationRunoff, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16RainwaterAccumulation, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16Leak, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16Seepage, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16StoredWater, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16WastewaterSystem, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16PermanentNaturalWater, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16TemporaryNaturalWater, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16RecreationalOrOrnamentalWater, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16WaterConveyance, - } -} - -type FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 string - -func (e FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16) String() string { - return string(e) -} - -func (e FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16) Valid() bool { - switch e { - case FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16FloodIrrigation, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16FurrowIrrigation, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16DripIrrigation, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16SprinklerIrrigation, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16WastewaterIrrigation, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16IrrigationRunoff, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16RainwaterAccumulation, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16Leak, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16Seepage, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16StoredWater, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16WastewaterSystem, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16PermanentNaturalWater, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16TemporaryNaturalWater, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16RecreationalOrOrnamentalWater, - FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16WaterConveyance: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16) All() []FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 { - return AllFieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16() -} - -func (e FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16(x) - case []byte: - *e = FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerLinelocationLocationpriorityEnum -const ( - FieldseekerLinelocationLocationpriorityEnumLow FieldseekerLinelocationLocationpriorityEnum = "Low" - FieldseekerLinelocationLocationpriorityEnumMedium FieldseekerLinelocationLocationpriorityEnum = "Medium" - FieldseekerLinelocationLocationpriorityEnumHigh FieldseekerLinelocationLocationpriorityEnum = "High" - FieldseekerLinelocationLocationpriorityEnumNone FieldseekerLinelocationLocationpriorityEnum = "None" -) - -func AllFieldseekerLinelocationLocationpriorityEnum() []FieldseekerLinelocationLocationpriorityEnum { - return []FieldseekerLinelocationLocationpriorityEnum{ - FieldseekerLinelocationLocationpriorityEnumLow, - FieldseekerLinelocationLocationpriorityEnumMedium, - FieldseekerLinelocationLocationpriorityEnumHigh, - FieldseekerLinelocationLocationpriorityEnumNone, - } -} - -type FieldseekerLinelocationLocationpriorityEnum string - -func (e FieldseekerLinelocationLocationpriorityEnum) String() string { - return string(e) -} - -func (e FieldseekerLinelocationLocationpriorityEnum) Valid() bool { - switch e { - case FieldseekerLinelocationLocationpriorityEnumLow, - FieldseekerLinelocationLocationpriorityEnumMedium, - FieldseekerLinelocationLocationpriorityEnumHigh, - FieldseekerLinelocationLocationpriorityEnumNone: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerLinelocationLocationpriorityEnum) All() []FieldseekerLinelocationLocationpriorityEnum { - return AllFieldseekerLinelocationLocationpriorityEnum() -} - -func (e FieldseekerLinelocationLocationpriorityEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerLinelocationLocationpriorityEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerLinelocationLocationpriorityEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerLinelocationLocationpriorityEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerLinelocationLocationpriorityEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerLinelocationLocationpriorityEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerLinelocationLocationpriorityEnum(x) - case []byte: - *e = FieldseekerLinelocationLocationpriorityEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerLinelocationLocationpriorityEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerLinelocationLocationpriorityEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerLinelocationLocationsymbologyEnum -const ( - FieldseekerLinelocationLocationsymbologyEnumAction FieldseekerLinelocationLocationsymbologyEnum = "ACTION" - FieldseekerLinelocationLocationsymbologyEnumInactive FieldseekerLinelocationLocationsymbologyEnum = "INACTIVE" - FieldseekerLinelocationLocationsymbologyEnumNone FieldseekerLinelocationLocationsymbologyEnum = "NONE" -) - -func AllFieldseekerLinelocationLocationsymbologyEnum() []FieldseekerLinelocationLocationsymbologyEnum { - return []FieldseekerLinelocationLocationsymbologyEnum{ - FieldseekerLinelocationLocationsymbologyEnumAction, - FieldseekerLinelocationLocationsymbologyEnumInactive, - FieldseekerLinelocationLocationsymbologyEnumNone, - } -} - -type FieldseekerLinelocationLocationsymbologyEnum string - -func (e FieldseekerLinelocationLocationsymbologyEnum) String() string { - return string(e) -} - -func (e FieldseekerLinelocationLocationsymbologyEnum) Valid() bool { - switch e { - case FieldseekerLinelocationLocationsymbologyEnumAction, - FieldseekerLinelocationLocationsymbologyEnumInactive, - FieldseekerLinelocationLocationsymbologyEnumNone: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerLinelocationLocationsymbologyEnum) All() []FieldseekerLinelocationLocationsymbologyEnum { - return AllFieldseekerLinelocationLocationsymbologyEnum() -} - -func (e FieldseekerLinelocationLocationsymbologyEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerLinelocationLocationsymbologyEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerLinelocationLocationsymbologyEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerLinelocationLocationsymbologyEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerLinelocationLocationsymbologyEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerLinelocationLocationsymbologyEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerLinelocationLocationsymbologyEnum(x) - case []byte: - *e = FieldseekerLinelocationLocationsymbologyEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerLinelocationLocationsymbologyEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerLinelocationLocationsymbologyEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerLinelocationNotinuitFEnum -const ( - FieldseekerLinelocationNotinuitFEnum1 FieldseekerLinelocationNotinuitFEnum = "1" - FieldseekerLinelocationNotinuitFEnum0 FieldseekerLinelocationNotinuitFEnum = "0" -) - -func AllFieldseekerLinelocationNotinuitFEnum() []FieldseekerLinelocationNotinuitFEnum { - return []FieldseekerLinelocationNotinuitFEnum{ - FieldseekerLinelocationNotinuitFEnum1, - FieldseekerLinelocationNotinuitFEnum0, - } -} - -type FieldseekerLinelocationNotinuitFEnum string - -func (e FieldseekerLinelocationNotinuitFEnum) String() string { - return string(e) -} - -func (e FieldseekerLinelocationNotinuitFEnum) Valid() bool { - switch e { - case FieldseekerLinelocationNotinuitFEnum1, - FieldseekerLinelocationNotinuitFEnum0: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerLinelocationNotinuitFEnum) All() []FieldseekerLinelocationNotinuitFEnum { - return AllFieldseekerLinelocationNotinuitFEnum() -} - -func (e FieldseekerLinelocationNotinuitFEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerLinelocationNotinuitFEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerLinelocationNotinuitFEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerLinelocationNotinuitFEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerLinelocationNotinuitFEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerLinelocationNotinuitFEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerLinelocationNotinuitFEnum(x) - case []byte: - *e = FieldseekerLinelocationNotinuitFEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerLinelocationNotinuitFEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerLinelocationNotinuitFEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerMosquitoinspectionMosquitoactivityEnum -const ( - FieldseekerMosquitoinspectionMosquitoactivityEnumRoutineInspection FieldseekerMosquitoinspectionMosquitoactivityEnum = "Routine inspection" - FieldseekerMosquitoinspectionMosquitoactivityEnumPreTreatment FieldseekerMosquitoinspectionMosquitoactivityEnum = "Pre-treatment" - FieldseekerMosquitoinspectionMosquitoactivityEnumMaintenance FieldseekerMosquitoinspectionMosquitoactivityEnum = "Maintenance" - FieldseekerMosquitoinspectionMosquitoactivityEnumUlv FieldseekerMosquitoinspectionMosquitoactivityEnum = "ULV" - FieldseekerMosquitoinspectionMosquitoactivityEnumBarrier FieldseekerMosquitoinspectionMosquitoactivityEnum = "BARRIER" - FieldseekerMosquitoinspectionMosquitoactivityEnumLogin FieldseekerMosquitoinspectionMosquitoactivityEnum = "LOGIN" - FieldseekerMosquitoinspectionMosquitoactivityEnumTreatsd FieldseekerMosquitoinspectionMosquitoactivityEnum = "TREATSD" - FieldseekerMosquitoinspectionMosquitoactivityEnumSD FieldseekerMosquitoinspectionMosquitoactivityEnum = "SD" - FieldseekerMosquitoinspectionMosquitoactivityEnumSitevisit FieldseekerMosquitoinspectionMosquitoactivityEnum = "SITEVISIT" - FieldseekerMosquitoinspectionMosquitoactivityEnumOnline FieldseekerMosquitoinspectionMosquitoactivityEnum = "ONLINE" - FieldseekerMosquitoinspectionMosquitoactivityEnumSync FieldseekerMosquitoinspectionMosquitoactivityEnum = "SYNC" - FieldseekerMosquitoinspectionMosquitoactivityEnumCreatesr FieldseekerMosquitoinspectionMosquitoactivityEnum = "CREATESR" - FieldseekerMosquitoinspectionMosquitoactivityEnumLC FieldseekerMosquitoinspectionMosquitoactivityEnum = "LC" - FieldseekerMosquitoinspectionMosquitoactivityEnumAcceptsr FieldseekerMosquitoinspectionMosquitoactivityEnum = "ACCEPTSR" - FieldseekerMosquitoinspectionMosquitoactivityEnumPoint FieldseekerMosquitoinspectionMosquitoactivityEnum = "POINT" - FieldseekerMosquitoinspectionMosquitoactivityEnumDownload FieldseekerMosquitoinspectionMosquitoactivityEnum = "DOWNLOAD" - FieldseekerMosquitoinspectionMosquitoactivityEnumCompletesr FieldseekerMosquitoinspectionMosquitoactivityEnum = "COMPLETESR" - FieldseekerMosquitoinspectionMosquitoactivityEnumPolygon FieldseekerMosquitoinspectionMosquitoactivityEnum = "POLYGON" - FieldseekerMosquitoinspectionMosquitoactivityEnumTrap FieldseekerMosquitoinspectionMosquitoactivityEnum = "TRAP" - FieldseekerMosquitoinspectionMosquitoactivityEnumSample FieldseekerMosquitoinspectionMosquitoactivityEnum = "SAMPLE" - FieldseekerMosquitoinspectionMosquitoactivityEnumQa FieldseekerMosquitoinspectionMosquitoactivityEnum = "QA" - FieldseekerMosquitoinspectionMosquitoactivityEnumPta FieldseekerMosquitoinspectionMosquitoactivityEnum = "PTA" - FieldseekerMosquitoinspectionMosquitoactivityEnumFieldscouting FieldseekerMosquitoinspectionMosquitoactivityEnum = "FIELDSCOUTING" - FieldseekerMosquitoinspectionMosquitoactivityEnumOffline FieldseekerMosquitoinspectionMosquitoactivityEnum = "OFFLINE" - FieldseekerMosquitoinspectionMosquitoactivityEnumLine FieldseekerMosquitoinspectionMosquitoactivityEnum = "LINE" - FieldseekerMosquitoinspectionMosquitoactivityEnumTraplocation FieldseekerMosquitoinspectionMosquitoactivityEnum = "TRAPLOCATION" - FieldseekerMosquitoinspectionMosquitoactivityEnumSamplelocation FieldseekerMosquitoinspectionMosquitoactivityEnum = "SAMPLELOCATION" - FieldseekerMosquitoinspectionMosquitoactivityEnumLclocation FieldseekerMosquitoinspectionMosquitoactivityEnum = "LCLOCATION" -) - -func AllFieldseekerMosquitoinspectionMosquitoactivityEnum() []FieldseekerMosquitoinspectionMosquitoactivityEnum { - return []FieldseekerMosquitoinspectionMosquitoactivityEnum{ - FieldseekerMosquitoinspectionMosquitoactivityEnumRoutineInspection, - FieldseekerMosquitoinspectionMosquitoactivityEnumPreTreatment, - FieldseekerMosquitoinspectionMosquitoactivityEnumMaintenance, - FieldseekerMosquitoinspectionMosquitoactivityEnumUlv, - FieldseekerMosquitoinspectionMosquitoactivityEnumBarrier, - FieldseekerMosquitoinspectionMosquitoactivityEnumLogin, - FieldseekerMosquitoinspectionMosquitoactivityEnumTreatsd, - FieldseekerMosquitoinspectionMosquitoactivityEnumSD, - FieldseekerMosquitoinspectionMosquitoactivityEnumSitevisit, - FieldseekerMosquitoinspectionMosquitoactivityEnumOnline, - FieldseekerMosquitoinspectionMosquitoactivityEnumSync, - FieldseekerMosquitoinspectionMosquitoactivityEnumCreatesr, - FieldseekerMosquitoinspectionMosquitoactivityEnumLC, - FieldseekerMosquitoinspectionMosquitoactivityEnumAcceptsr, - FieldseekerMosquitoinspectionMosquitoactivityEnumPoint, - FieldseekerMosquitoinspectionMosquitoactivityEnumDownload, - FieldseekerMosquitoinspectionMosquitoactivityEnumCompletesr, - FieldseekerMosquitoinspectionMosquitoactivityEnumPolygon, - FieldseekerMosquitoinspectionMosquitoactivityEnumTrap, - FieldseekerMosquitoinspectionMosquitoactivityEnumSample, - FieldseekerMosquitoinspectionMosquitoactivityEnumQa, - FieldseekerMosquitoinspectionMosquitoactivityEnumPta, - FieldseekerMosquitoinspectionMosquitoactivityEnumFieldscouting, - FieldseekerMosquitoinspectionMosquitoactivityEnumOffline, - FieldseekerMosquitoinspectionMosquitoactivityEnumLine, - FieldseekerMosquitoinspectionMosquitoactivityEnumTraplocation, - FieldseekerMosquitoinspectionMosquitoactivityEnumSamplelocation, - FieldseekerMosquitoinspectionMosquitoactivityEnumLclocation, - } -} - -type FieldseekerMosquitoinspectionMosquitoactivityEnum string - -func (e FieldseekerMosquitoinspectionMosquitoactivityEnum) String() string { - return string(e) -} - -func (e FieldseekerMosquitoinspectionMosquitoactivityEnum) Valid() bool { - switch e { - case FieldseekerMosquitoinspectionMosquitoactivityEnumRoutineInspection, - FieldseekerMosquitoinspectionMosquitoactivityEnumPreTreatment, - FieldseekerMosquitoinspectionMosquitoactivityEnumMaintenance, - FieldseekerMosquitoinspectionMosquitoactivityEnumUlv, - FieldseekerMosquitoinspectionMosquitoactivityEnumBarrier, - FieldseekerMosquitoinspectionMosquitoactivityEnumLogin, - FieldseekerMosquitoinspectionMosquitoactivityEnumTreatsd, - FieldseekerMosquitoinspectionMosquitoactivityEnumSD, - FieldseekerMosquitoinspectionMosquitoactivityEnumSitevisit, - FieldseekerMosquitoinspectionMosquitoactivityEnumOnline, - FieldseekerMosquitoinspectionMosquitoactivityEnumSync, - FieldseekerMosquitoinspectionMosquitoactivityEnumCreatesr, - FieldseekerMosquitoinspectionMosquitoactivityEnumLC, - FieldseekerMosquitoinspectionMosquitoactivityEnumAcceptsr, - FieldseekerMosquitoinspectionMosquitoactivityEnumPoint, - FieldseekerMosquitoinspectionMosquitoactivityEnumDownload, - FieldseekerMosquitoinspectionMosquitoactivityEnumCompletesr, - FieldseekerMosquitoinspectionMosquitoactivityEnumPolygon, - FieldseekerMosquitoinspectionMosquitoactivityEnumTrap, - FieldseekerMosquitoinspectionMosquitoactivityEnumSample, - FieldseekerMosquitoinspectionMosquitoactivityEnumQa, - FieldseekerMosquitoinspectionMosquitoactivityEnumPta, - FieldseekerMosquitoinspectionMosquitoactivityEnumFieldscouting, - FieldseekerMosquitoinspectionMosquitoactivityEnumOffline, - FieldseekerMosquitoinspectionMosquitoactivityEnumLine, - FieldseekerMosquitoinspectionMosquitoactivityEnumTraplocation, - FieldseekerMosquitoinspectionMosquitoactivityEnumSamplelocation, - FieldseekerMosquitoinspectionMosquitoactivityEnumLclocation: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerMosquitoinspectionMosquitoactivityEnum) All() []FieldseekerMosquitoinspectionMosquitoactivityEnum { - return AllFieldseekerMosquitoinspectionMosquitoactivityEnum() -} - -func (e FieldseekerMosquitoinspectionMosquitoactivityEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoactivityEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerMosquitoinspectionMosquitoactivityEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoactivityEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerMosquitoinspectionMosquitoactivityEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoactivityEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerMosquitoinspectionMosquitoactivityEnum(x) - case []byte: - *e = FieldseekerMosquitoinspectionMosquitoactivityEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerMosquitoinspectionMosquitoactivityEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerMosquitoinspectionMosquitoactivityEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerMosquitoinspectionMosquitoadultactivityEnum -const ( - FieldseekerMosquitoinspectionMosquitoadultactivityEnumNone FieldseekerMosquitoinspectionMosquitoadultactivityEnum = "None" - FieldseekerMosquitoinspectionMosquitoadultactivityEnumLight FieldseekerMosquitoinspectionMosquitoadultactivityEnum = "Light" - FieldseekerMosquitoinspectionMosquitoadultactivityEnumModerate FieldseekerMosquitoinspectionMosquitoadultactivityEnum = "Moderate" - FieldseekerMosquitoinspectionMosquitoadultactivityEnumIntense FieldseekerMosquitoinspectionMosquitoadultactivityEnum = "Intense" -) - -func AllFieldseekerMosquitoinspectionMosquitoadultactivityEnum() []FieldseekerMosquitoinspectionMosquitoadultactivityEnum { - return []FieldseekerMosquitoinspectionMosquitoadultactivityEnum{ - FieldseekerMosquitoinspectionMosquitoadultactivityEnumNone, - FieldseekerMosquitoinspectionMosquitoadultactivityEnumLight, - FieldseekerMosquitoinspectionMosquitoadultactivityEnumModerate, - FieldseekerMosquitoinspectionMosquitoadultactivityEnumIntense, - } -} - -type FieldseekerMosquitoinspectionMosquitoadultactivityEnum string - -func (e FieldseekerMosquitoinspectionMosquitoadultactivityEnum) String() string { - return string(e) -} - -func (e FieldseekerMosquitoinspectionMosquitoadultactivityEnum) Valid() bool { - switch e { - case FieldseekerMosquitoinspectionMosquitoadultactivityEnumNone, - FieldseekerMosquitoinspectionMosquitoadultactivityEnumLight, - FieldseekerMosquitoinspectionMosquitoadultactivityEnumModerate, - FieldseekerMosquitoinspectionMosquitoadultactivityEnumIntense: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerMosquitoinspectionMosquitoadultactivityEnum) All() []FieldseekerMosquitoinspectionMosquitoadultactivityEnum { - return AllFieldseekerMosquitoinspectionMosquitoadultactivityEnum() -} - -func (e FieldseekerMosquitoinspectionMosquitoadultactivityEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoadultactivityEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerMosquitoinspectionMosquitoadultactivityEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoadultactivityEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerMosquitoinspectionMosquitoadultactivityEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoadultactivityEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerMosquitoinspectionMosquitoadultactivityEnum(x) - case []byte: - *e = FieldseekerMosquitoinspectionMosquitoadultactivityEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerMosquitoinspectionMosquitoadultactivityEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerMosquitoinspectionMosquitoadultactivityEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerMosquitoinspectionMosquitobreedingEnum -const ( - FieldseekerMosquitoinspectionMosquitobreedingEnumNone FieldseekerMosquitoinspectionMosquitobreedingEnum = "None" - FieldseekerMosquitoinspectionMosquitobreedingEnumLight FieldseekerMosquitoinspectionMosquitobreedingEnum = "Light" - FieldseekerMosquitoinspectionMosquitobreedingEnumModerate FieldseekerMosquitoinspectionMosquitobreedingEnum = "Moderate" - FieldseekerMosquitoinspectionMosquitobreedingEnumIntense FieldseekerMosquitoinspectionMosquitobreedingEnum = "Intense" -) - -func AllFieldseekerMosquitoinspectionMosquitobreedingEnum() []FieldseekerMosquitoinspectionMosquitobreedingEnum { - return []FieldseekerMosquitoinspectionMosquitobreedingEnum{ - FieldseekerMosquitoinspectionMosquitobreedingEnumNone, - FieldseekerMosquitoinspectionMosquitobreedingEnumLight, - FieldseekerMosquitoinspectionMosquitobreedingEnumModerate, - FieldseekerMosquitoinspectionMosquitobreedingEnumIntense, - } -} - -type FieldseekerMosquitoinspectionMosquitobreedingEnum string - -func (e FieldseekerMosquitoinspectionMosquitobreedingEnum) String() string { - return string(e) -} - -func (e FieldseekerMosquitoinspectionMosquitobreedingEnum) Valid() bool { - switch e { - case FieldseekerMosquitoinspectionMosquitobreedingEnumNone, - FieldseekerMosquitoinspectionMosquitobreedingEnumLight, - FieldseekerMosquitoinspectionMosquitobreedingEnumModerate, - FieldseekerMosquitoinspectionMosquitobreedingEnumIntense: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerMosquitoinspectionMosquitobreedingEnum) All() []FieldseekerMosquitoinspectionMosquitobreedingEnum { - return AllFieldseekerMosquitoinspectionMosquitobreedingEnum() -} - -func (e FieldseekerMosquitoinspectionMosquitobreedingEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitobreedingEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerMosquitoinspectionMosquitobreedingEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitobreedingEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerMosquitoinspectionMosquitobreedingEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitobreedingEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerMosquitoinspectionMosquitobreedingEnum(x) - case []byte: - *e = FieldseekerMosquitoinspectionMosquitobreedingEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerMosquitoinspectionMosquitobreedingEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerMosquitoinspectionMosquitobreedingEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerMosquitoinspectionMosquitofieldspeciesEnum -const ( - FieldseekerMosquitoinspectionMosquitofieldspeciesEnumAedes FieldseekerMosquitoinspectionMosquitofieldspeciesEnum = "Aedes" - FieldseekerMosquitoinspectionMosquitofieldspeciesEnumCulex FieldseekerMosquitoinspectionMosquitofieldspeciesEnum = "Culex" -) - -func AllFieldseekerMosquitoinspectionMosquitofieldspeciesEnum() []FieldseekerMosquitoinspectionMosquitofieldspeciesEnum { - return []FieldseekerMosquitoinspectionMosquitofieldspeciesEnum{ - FieldseekerMosquitoinspectionMosquitofieldspeciesEnumAedes, - FieldseekerMosquitoinspectionMosquitofieldspeciesEnumCulex, - } -} - -type FieldseekerMosquitoinspectionMosquitofieldspeciesEnum string - -func (e FieldseekerMosquitoinspectionMosquitofieldspeciesEnum) String() string { - return string(e) -} - -func (e FieldseekerMosquitoinspectionMosquitofieldspeciesEnum) Valid() bool { - switch e { - case FieldseekerMosquitoinspectionMosquitofieldspeciesEnumAedes, - FieldseekerMosquitoinspectionMosquitofieldspeciesEnumCulex: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerMosquitoinspectionMosquitofieldspeciesEnum) All() []FieldseekerMosquitoinspectionMosquitofieldspeciesEnum { - return AllFieldseekerMosquitoinspectionMosquitofieldspeciesEnum() -} - -func (e FieldseekerMosquitoinspectionMosquitofieldspeciesEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitofieldspeciesEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerMosquitoinspectionMosquitofieldspeciesEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitofieldspeciesEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerMosquitoinspectionMosquitofieldspeciesEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitofieldspeciesEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerMosquitoinspectionMosquitofieldspeciesEnum(x) - case []byte: - *e = FieldseekerMosquitoinspectionMosquitofieldspeciesEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerMosquitoinspectionMosquitofieldspeciesEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerMosquitoinspectionMosquitofieldspeciesEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4 -const ( - FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4Treatment FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4 = "Treatment" - FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4MechanicalOrBiologicalTreatment FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4 = "Mechanical or Biological Treatment" - FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4ResidentScheduleRequest FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4 = "Resident Schedule Request" - FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4Administrative FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4 = "Administrative" -) - -func AllFieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4() []FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4 { - return []FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4{ - FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4Treatment, - FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4MechanicalOrBiologicalTreatment, - FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4ResidentScheduleRequest, - FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4Administrative, - } -} - -type FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4 string - -func (e FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4) String() string { - return string(e) -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4) Valid() bool { - switch e { - case FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4Treatment, - FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4MechanicalOrBiologicalTreatment, - FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4ResidentScheduleRequest, - FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4Administrative: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4) All() []FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4 { - return AllFieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4() -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4(x) - case []byte: - *e = FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4 value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B -const ( - FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98BYes FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B = "yes" - FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98BNo FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B = "no" -) - -func AllFieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B() []FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B { - return []FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B{ - FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98BYes, - FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98BNo, - } -} - -type FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B string - -func (e FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B) String() string { - return string(e) -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B) Valid() bool { - switch e { - case FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98BYes, - FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98BNo: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B) All() []FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B { - return AllFieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B() -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B(x) - case []byte: - *e = FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 -const ( - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a21 FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 = "1" - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a22 FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 = "2" - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a23 FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 = "3" - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a24 FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 = "4" - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a25 FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 = "5" - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a21_2 FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 = "1-2" - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a22_3 FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 = "2-3" - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a23_4 FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 = "3-4" -) - -func AllFieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2() []FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 { - return []FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2{ - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a21, - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a22, - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a23, - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a24, - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a25, - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a21_2, - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a22_3, - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a23_4, - } -} - -type FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 string - -func (e FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2) String() string { - return string(e) -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2) Valid() bool { - switch e { - case FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a21, - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a22, - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a23, - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a24, - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a25, - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a21_2, - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a22_3, - FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a23_4: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2) All() []FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 { - return AllFieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2() -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2(x) - case []byte: - *e = FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 -const ( - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Dry FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 = "Dry" - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Flowing FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 = "Flowing" - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Maintained FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 = "Maintained" - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Unmaintained FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 = "Unmaintained" - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540HighOrganic FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 = "High Organic" - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Unknown FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 = "Unknown" - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Stagnant FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 = "Stagnant" - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540NeedsMonitoring FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 = "Needs Monitoring" - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540DryingOut FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 = "Drying Out" - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540AppearsVacant FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 = "Appears Vacant" - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540EntryDenied FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 = "Entry Denied" - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540PoolRemoved FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 = "Pool Removed" - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540FalsePool FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 = "False Pool" -) - -func AllFieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540() []FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 { - return []FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540{ - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Dry, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Flowing, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Maintained, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Unmaintained, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540HighOrganic, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Unknown, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Stagnant, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540NeedsMonitoring, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540DryingOut, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540AppearsVacant, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540EntryDenied, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540PoolRemoved, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540FalsePool, - } -} - -type FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 string - -func (e FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540) String() string { - return string(e) -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540) Valid() bool { - switch e { - case FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Dry, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Flowing, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Maintained, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Unmaintained, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540HighOrganic, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Unknown, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540Stagnant, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540NeedsMonitoring, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540DryingOut, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540AppearsVacant, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540EntryDenied, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540PoolRemoved, - FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540FalsePool: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540) All() []FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 { - return AllFieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540() -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540(x) - case []byte: - *e = FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerMosquitoinspectionNotinuitFEnum -const ( - FieldseekerMosquitoinspectionNotinuitFEnum1 FieldseekerMosquitoinspectionNotinuitFEnum = "1" - FieldseekerMosquitoinspectionNotinuitFEnum0 FieldseekerMosquitoinspectionNotinuitFEnum = "0" -) - -func AllFieldseekerMosquitoinspectionNotinuitFEnum() []FieldseekerMosquitoinspectionNotinuitFEnum { - return []FieldseekerMosquitoinspectionNotinuitFEnum{ - FieldseekerMosquitoinspectionNotinuitFEnum1, - FieldseekerMosquitoinspectionNotinuitFEnum0, - } -} - -type FieldseekerMosquitoinspectionNotinuitFEnum string - -func (e FieldseekerMosquitoinspectionNotinuitFEnum) String() string { - return string(e) -} - -func (e FieldseekerMosquitoinspectionNotinuitFEnum) Valid() bool { - switch e { - case FieldseekerMosquitoinspectionNotinuitFEnum1, - FieldseekerMosquitoinspectionNotinuitFEnum0: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerMosquitoinspectionNotinuitFEnum) All() []FieldseekerMosquitoinspectionNotinuitFEnum { - return AllFieldseekerMosquitoinspectionNotinuitFEnum() -} - -func (e FieldseekerMosquitoinspectionNotinuitFEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionNotinuitFEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerMosquitoinspectionNotinuitFEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionNotinuitFEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerMosquitoinspectionNotinuitFEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerMosquitoinspectionNotinuitFEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerMosquitoinspectionNotinuitFEnum(x) - case []byte: - *e = FieldseekerMosquitoinspectionNotinuitFEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerMosquitoinspectionNotinuitFEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerMosquitoinspectionNotinuitFEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerMosquitoinspectionNotinuiwinddirectionEnum -const ( - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumN FieldseekerMosquitoinspectionNotinuiwinddirectionEnum = "N" - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumNe FieldseekerMosquitoinspectionNotinuiwinddirectionEnum = "NE" - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumE FieldseekerMosquitoinspectionNotinuiwinddirectionEnum = "E" - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumSe FieldseekerMosquitoinspectionNotinuiwinddirectionEnum = "SE" - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumS FieldseekerMosquitoinspectionNotinuiwinddirectionEnum = "S" - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumSW FieldseekerMosquitoinspectionNotinuiwinddirectionEnum = "SW" - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumW FieldseekerMosquitoinspectionNotinuiwinddirectionEnum = "W" - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumNW FieldseekerMosquitoinspectionNotinuiwinddirectionEnum = "NW" -) - -func AllFieldseekerMosquitoinspectionNotinuiwinddirectionEnum() []FieldseekerMosquitoinspectionNotinuiwinddirectionEnum { - return []FieldseekerMosquitoinspectionNotinuiwinddirectionEnum{ - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumN, - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumNe, - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumE, - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumSe, - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumS, - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumSW, - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumW, - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumNW, - } -} - -type FieldseekerMosquitoinspectionNotinuiwinddirectionEnum string - -func (e FieldseekerMosquitoinspectionNotinuiwinddirectionEnum) String() string { - return string(e) -} - -func (e FieldseekerMosquitoinspectionNotinuiwinddirectionEnum) Valid() bool { - switch e { - case FieldseekerMosquitoinspectionNotinuiwinddirectionEnumN, - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumNe, - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumE, - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumSe, - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumS, - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumSW, - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumW, - FieldseekerMosquitoinspectionNotinuiwinddirectionEnumNW: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerMosquitoinspectionNotinuiwinddirectionEnum) All() []FieldseekerMosquitoinspectionNotinuiwinddirectionEnum { - return AllFieldseekerMosquitoinspectionNotinuiwinddirectionEnum() -} - -func (e FieldseekerMosquitoinspectionNotinuiwinddirectionEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionNotinuiwinddirectionEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerMosquitoinspectionNotinuiwinddirectionEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerMosquitoinspectionNotinuiwinddirectionEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerMosquitoinspectionNotinuiwinddirectionEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerMosquitoinspectionNotinuiwinddirectionEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerMosquitoinspectionNotinuiwinddirectionEnum(x) - case []byte: - *e = FieldseekerMosquitoinspectionNotinuiwinddirectionEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerMosquitoinspectionNotinuiwinddirectionEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerMosquitoinspectionNotinuiwinddirectionEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPointlocationLocationpriorityEnum -const ( - FieldseekerPointlocationLocationpriorityEnumLow FieldseekerPointlocationLocationpriorityEnum = "Low" - FieldseekerPointlocationLocationpriorityEnumMedium FieldseekerPointlocationLocationpriorityEnum = "Medium" - FieldseekerPointlocationLocationpriorityEnumHigh FieldseekerPointlocationLocationpriorityEnum = "High" - FieldseekerPointlocationLocationpriorityEnumNone FieldseekerPointlocationLocationpriorityEnum = "None" -) - -func AllFieldseekerPointlocationLocationpriorityEnum() []FieldseekerPointlocationLocationpriorityEnum { - return []FieldseekerPointlocationLocationpriorityEnum{ - FieldseekerPointlocationLocationpriorityEnumLow, - FieldseekerPointlocationLocationpriorityEnumMedium, - FieldseekerPointlocationLocationpriorityEnumHigh, - FieldseekerPointlocationLocationpriorityEnumNone, - } -} - -type FieldseekerPointlocationLocationpriorityEnum string - -func (e FieldseekerPointlocationLocationpriorityEnum) String() string { - return string(e) -} - -func (e FieldseekerPointlocationLocationpriorityEnum) Valid() bool { - switch e { - case FieldseekerPointlocationLocationpriorityEnumLow, - FieldseekerPointlocationLocationpriorityEnumMedium, - FieldseekerPointlocationLocationpriorityEnumHigh, - FieldseekerPointlocationLocationpriorityEnumNone: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPointlocationLocationpriorityEnum) All() []FieldseekerPointlocationLocationpriorityEnum { - return AllFieldseekerPointlocationLocationpriorityEnum() -} - -func (e FieldseekerPointlocationLocationpriorityEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationLocationpriorityEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPointlocationLocationpriorityEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationLocationpriorityEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPointlocationLocationpriorityEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPointlocationLocationpriorityEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPointlocationLocationpriorityEnum(x) - case []byte: - *e = FieldseekerPointlocationLocationpriorityEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPointlocationLocationpriorityEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPointlocationLocationpriorityEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPointlocationLocationsymbologyEnum -const ( - FieldseekerPointlocationLocationsymbologyEnumAction FieldseekerPointlocationLocationsymbologyEnum = "ACTION" - FieldseekerPointlocationLocationsymbologyEnumInactive FieldseekerPointlocationLocationsymbologyEnum = "INACTIVE" - FieldseekerPointlocationLocationsymbologyEnumNone FieldseekerPointlocationLocationsymbologyEnum = "NONE" -) - -func AllFieldseekerPointlocationLocationsymbologyEnum() []FieldseekerPointlocationLocationsymbologyEnum { - return []FieldseekerPointlocationLocationsymbologyEnum{ - FieldseekerPointlocationLocationsymbologyEnumAction, - FieldseekerPointlocationLocationsymbologyEnumInactive, - FieldseekerPointlocationLocationsymbologyEnumNone, - } -} - -type FieldseekerPointlocationLocationsymbologyEnum string - -func (e FieldseekerPointlocationLocationsymbologyEnum) String() string { - return string(e) -} - -func (e FieldseekerPointlocationLocationsymbologyEnum) Valid() bool { - switch e { - case FieldseekerPointlocationLocationsymbologyEnumAction, - FieldseekerPointlocationLocationsymbologyEnumInactive, - FieldseekerPointlocationLocationsymbologyEnumNone: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPointlocationLocationsymbologyEnum) All() []FieldseekerPointlocationLocationsymbologyEnum { - return AllFieldseekerPointlocationLocationsymbologyEnum() -} - -func (e FieldseekerPointlocationLocationsymbologyEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationLocationsymbologyEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPointlocationLocationsymbologyEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationLocationsymbologyEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPointlocationLocationsymbologyEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPointlocationLocationsymbologyEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPointlocationLocationsymbologyEnum(x) - case []byte: - *e = FieldseekerPointlocationLocationsymbologyEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPointlocationLocationsymbologyEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPointlocationLocationsymbologyEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPointlocationNotinuitFEnum -const ( - FieldseekerPointlocationNotinuitFEnum1 FieldseekerPointlocationNotinuitFEnum = "1" - FieldseekerPointlocationNotinuitFEnum0 FieldseekerPointlocationNotinuitFEnum = "0" -) - -func AllFieldseekerPointlocationNotinuitFEnum() []FieldseekerPointlocationNotinuitFEnum { - return []FieldseekerPointlocationNotinuitFEnum{ - FieldseekerPointlocationNotinuitFEnum1, - FieldseekerPointlocationNotinuitFEnum0, - } -} - -type FieldseekerPointlocationNotinuitFEnum string - -func (e FieldseekerPointlocationNotinuitFEnum) String() string { - return string(e) -} - -func (e FieldseekerPointlocationNotinuitFEnum) Valid() bool { - switch e { - case FieldseekerPointlocationNotinuitFEnum1, - FieldseekerPointlocationNotinuitFEnum0: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPointlocationNotinuitFEnum) All() []FieldseekerPointlocationNotinuitFEnum { - return AllFieldseekerPointlocationNotinuitFEnum() -} - -func (e FieldseekerPointlocationNotinuitFEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationNotinuitFEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPointlocationNotinuitFEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationNotinuitFEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPointlocationNotinuitFEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPointlocationNotinuitFEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPointlocationNotinuitFEnum(x) - case []byte: - *e = FieldseekerPointlocationNotinuitFEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPointlocationNotinuitFEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPointlocationNotinuitFEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B -const ( - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BBryanFeguson FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Bryan Feguson" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BRickAlverez FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Rick Alverez" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BAlysiaDavis FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Alysia Davis" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BBryanRuiz FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Bryan Ruiz" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BKoryWilson FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Kory Wilson" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BAdrianSifuentes FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Adrian Sifuentes" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BMarcoMartinez FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Marco Martinez" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BCarlosRodriguez FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Carlos Rodriguez" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BLandonMcgill FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Landon McGill" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BTedMcgill FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Ted McGill" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BMarioSanchez FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Mario Sanchez" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BJorgePerez FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Jorge Perez" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BArturoGarciaTrejo FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Arturo Garcia-Trejo" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BLisaSalgado FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Lisa Salgado" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BLawrenceGuzman FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Lawrence Guzman" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BTriciaSnowden FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Tricia Snowden" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BRyanSpratt FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Ryan Spratt" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BAndreaTroupin FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Andrea Troupin" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BMarkNakata FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Mark Nakata" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BPabloOrtega FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Pablo Ortega" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BBenjaminSperry FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Benjamin Sperry" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BFatimaHidalgo FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Fatima Hidalgo" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BZackeryBarragan FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Zackery Barragan" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BYajairaGodinez FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Yajaira Godinez" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BJakeMaldonado FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Jake Maldonado" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BRafaelRamirez FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Rafael Ramirez" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BCarlosPalacios FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Carlos Palacios" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BAaronFredrick FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Aaron Fredrick" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BJoshMalone FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Josh Malone" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BAlecCaposella FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Alec Caposella" - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BLauraRamos FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B = "Laura Ramos" -) - -func AllFieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B() []FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B { - return []FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B{ - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BBryanFeguson, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BRickAlverez, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BAlysiaDavis, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BBryanRuiz, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BKoryWilson, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BAdrianSifuentes, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BMarcoMartinez, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BCarlosRodriguez, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BLandonMcgill, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BTedMcgill, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BMarioSanchez, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BJorgePerez, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BArturoGarciaTrejo, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BLisaSalgado, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BLawrenceGuzman, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BTriciaSnowden, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BRyanSpratt, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BAndreaTroupin, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BMarkNakata, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BPabloOrtega, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BBenjaminSperry, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BFatimaHidalgo, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BZackeryBarragan, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BYajairaGodinez, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BJakeMaldonado, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BRafaelRamirez, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BCarlosPalacios, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BAaronFredrick, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BJoshMalone, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BAlecCaposella, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BLauraRamos, - } -} - -type FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B string - -func (e FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B) String() string { - return string(e) -} - -func (e FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B) Valid() bool { - switch e { - case FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BBryanFeguson, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BRickAlverez, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BAlysiaDavis, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BBryanRuiz, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BKoryWilson, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BAdrianSifuentes, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BMarcoMartinez, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BCarlosRodriguez, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BLandonMcgill, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BTedMcgill, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BMarioSanchez, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BJorgePerez, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BArturoGarciaTrejo, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BLisaSalgado, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BLawrenceGuzman, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BTriciaSnowden, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BRyanSpratt, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BAndreaTroupin, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BMarkNakata, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BPabloOrtega, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BBenjaminSperry, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BFatimaHidalgo, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BZackeryBarragan, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BYajairaGodinez, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BJakeMaldonado, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BRafaelRamirez, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BCarlosPalacios, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BAaronFredrick, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BJoshMalone, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BAlecCaposella, - FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85BLauraRamos: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B) All() []FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B { - return AllFieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B() -} - -func (e FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B(x) - case []byte: - *e = FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489 -const ( - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489SourceRemoved FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489 = "Source Removed" - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489PoolMaintained FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489 = "Pool Maintained" - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489SourceScreened FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489 = "Source Screened" - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489CropChange FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489 = "Crop Change" - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489LowOrNoMosquitoActivity FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489 = "Low or No Mosquito Activity" - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489ConsistentFishPresence FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489 = "Consistent Fish Presence" -) - -func AllFieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489() []FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489 { - return []FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489{ - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489SourceRemoved, - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489PoolMaintained, - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489SourceScreened, - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489CropChange, - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489LowOrNoMosquitoActivity, - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489ConsistentFishPresence, - } -} - -type FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489 string - -func (e FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489) String() string { - return string(e) -} - -func (e FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489) Valid() bool { - switch e { - case FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489SourceRemoved, - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489PoolMaintained, - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489SourceScreened, - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489CropChange, - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489LowOrNoMosquitoActivity, - FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489ConsistentFishPresence: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489) All() []FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489 { - return AllFieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489() -} - -func (e FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489(x) - case []byte: - *e = FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489 value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e -const ( - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eOrchard FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "orchard" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eRowCrops FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "row_crops" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eVineCrops FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "vine_crops" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eAgGrassesOrGrain FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "ag_grasses_or_grain" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367ePasture FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "pasture" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eIrrigationStandpipe FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "irrigation_standpipe" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eDitch FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "ditch" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367ePond FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "pond" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eSump FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "sump" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eDrain FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "drain" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eDairyLagoon FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "dairy_lagoon" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eWastewaterTreatment FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "wastewater_treatment" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eTrough FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "trough" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eDepression FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "depression" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eGutter FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "gutter" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eRainGutter FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "rain_gutter" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eCulvert FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "culvert" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eUtility FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "utility" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eCatchBasin FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "catch_basin" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eStreamOrCreek FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "stream_or_creek" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eSlough FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "slough" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eRiver FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "river" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eMarshOrWetlands FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "marsh_or_wetlands" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eContainers FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "containers" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eWateringBowl FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "watering_bowl" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367ePlantSaucer FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "plant_saucer" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eYardDrain FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "yard_drain" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367ePlantAxil FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "plant_axil" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eTreehole FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "treehole" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eFountainOrWaterFeature FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "fountain_or_water_feature" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eBirdBath FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "bird_bath" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eMiscWaterAccumulation FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "misc_water_accumulation" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eTarpOrCover FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "tarp_or_cover" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eSwimmingPool FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "swimming_pool" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eAbovegroundPool FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "aboveground_pool" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eKidPool FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "kid_pool" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eHotTub FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "hot_tub" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eAppliance FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "appliance" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eTires FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "tires" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eFloodedStructure FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "flooded_structure" - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eLowPoint FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e = "low_point" -) - -func AllFieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e() []FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e { - return []FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e{ - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eOrchard, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eRowCrops, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eVineCrops, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eAgGrassesOrGrain, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367ePasture, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eIrrigationStandpipe, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eDitch, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367ePond, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eSump, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eDrain, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eDairyLagoon, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eWastewaterTreatment, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eTrough, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eDepression, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eGutter, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eRainGutter, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eCulvert, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eUtility, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eCatchBasin, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eStreamOrCreek, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eSlough, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eRiver, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eMarshOrWetlands, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eContainers, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eWateringBowl, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367ePlantSaucer, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eYardDrain, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367ePlantAxil, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eTreehole, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eFountainOrWaterFeature, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eBirdBath, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eMiscWaterAccumulation, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eTarpOrCover, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eSwimmingPool, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eAbovegroundPool, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eKidPool, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eHotTub, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eAppliance, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eTires, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eFloodedStructure, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eLowPoint, - } -} - -type FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e string - -func (e FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e) String() string { - return string(e) -} - -func (e FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e) Valid() bool { - switch e { - case FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eOrchard, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eRowCrops, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eVineCrops, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eAgGrassesOrGrain, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367ePasture, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eIrrigationStandpipe, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eDitch, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367ePond, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eSump, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eDrain, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eDairyLagoon, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eWastewaterTreatment, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eTrough, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eDepression, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eGutter, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eRainGutter, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eCulvert, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eUtility, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eCatchBasin, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eStreamOrCreek, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eSlough, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eRiver, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eMarshOrWetlands, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eContainers, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eWateringBowl, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367ePlantSaucer, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eYardDrain, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367ePlantAxil, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eTreehole, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eFountainOrWaterFeature, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eBirdBath, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eMiscWaterAccumulation, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eTarpOrCover, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eSwimmingPool, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eAbovegroundPool, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eKidPool, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eHotTub, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eAppliance, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eTires, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eFloodedStructure, - FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367eLowPoint: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e) All() []FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e { - return AllFieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e() -} - -func (e FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e(x) - case []byte: - *e = FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 -const ( - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Residential FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 = "residential" - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Commercial FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 = "commercial" - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Agricultural FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 = "agricultural" - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Industrial FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 = "industrial" - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86MixedUse FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 = "mixed_use" - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86PublicDomain FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 = "public_domain" - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Natural FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 = "natural" - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Municipal FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 = "municipal" -) - -func AllFieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86() []FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 { - return []FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86{ - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Residential, - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Commercial, - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Agricultural, - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Industrial, - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86MixedUse, - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86PublicDomain, - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Natural, - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Municipal, - } -} - -type FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 string - -func (e FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86) String() string { - return string(e) -} - -func (e FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86) Valid() bool { - switch e { - case FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Residential, - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Commercial, - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Agricultural, - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Industrial, - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86MixedUse, - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86PublicDomain, - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Natural, - FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86Municipal: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86) All() []FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 { - return AllFieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86() -} - -func (e FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86(x) - case []byte: - *e = FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 -const ( - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899FloodIrrigation FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "flood_irrigation" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899FurrowIrrigation FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "furrow_irrigation" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899DripIrrigation FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "drip_irrigation" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899SprinklerIrrigation FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "sprinkler_irrigation" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899WastewaterIrrigation FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "wastewater_irrigation" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899IrrigationRunoff FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "irrigation_runoff" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899StormwaterOrMunicipalRunoff FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "stormwater_or_municipal_runoff" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899IndustrialRunoff FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "industrial_runoff" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899RainwaterAccumulation FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "rainwater_accumulation" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899Leak FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "leak" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899Seepage FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "seepage" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899StoredWater FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "stored_water" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899WastewaterSystem FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "wastewater_system" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899PermanentNaturalWater FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "permanent_natural_water" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899TemporaryNaturalWater FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "temporary_natural_water" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899RecreationalOrOrenamentalWater FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "recreational_or_orenamental_water" - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899WaterConveyance FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 = "water_conveyance" -) - -func AllFieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899() []FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 { - return []FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899{ - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899FloodIrrigation, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899FurrowIrrigation, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899DripIrrigation, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899SprinklerIrrigation, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899WastewaterIrrigation, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899IrrigationRunoff, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899StormwaterOrMunicipalRunoff, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899IndustrialRunoff, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899RainwaterAccumulation, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899Leak, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899Seepage, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899StoredWater, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899WastewaterSystem, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899PermanentNaturalWater, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899TemporaryNaturalWater, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899RecreationalOrOrenamentalWater, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899WaterConveyance, - } -} - -type FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 string - -func (e FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899) String() string { - return string(e) -} - -func (e FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899) Valid() bool { - switch e { - case FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899FloodIrrigation, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899FurrowIrrigation, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899DripIrrigation, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899SprinklerIrrigation, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899WastewaterIrrigation, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899IrrigationRunoff, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899StormwaterOrMunicipalRunoff, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899IndustrialRunoff, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899RainwaterAccumulation, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899Leak, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899Seepage, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899StoredWater, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899WastewaterSystem, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899PermanentNaturalWater, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899TemporaryNaturalWater, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899RecreationalOrOrenamentalWater, - FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899WaterConveyance: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899) All() []FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 { - return AllFieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899() -} - -func (e FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899(x) - case []byte: - *e = FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPolygonlocationLocationpriorityEnum -const ( - FieldseekerPolygonlocationLocationpriorityEnumLow FieldseekerPolygonlocationLocationpriorityEnum = "Low" - FieldseekerPolygonlocationLocationpriorityEnumMedium FieldseekerPolygonlocationLocationpriorityEnum = "Medium" - FieldseekerPolygonlocationLocationpriorityEnumHigh FieldseekerPolygonlocationLocationpriorityEnum = "High" - FieldseekerPolygonlocationLocationpriorityEnumNone FieldseekerPolygonlocationLocationpriorityEnum = "None" -) - -func AllFieldseekerPolygonlocationLocationpriorityEnum() []FieldseekerPolygonlocationLocationpriorityEnum { - return []FieldseekerPolygonlocationLocationpriorityEnum{ - FieldseekerPolygonlocationLocationpriorityEnumLow, - FieldseekerPolygonlocationLocationpriorityEnumMedium, - FieldseekerPolygonlocationLocationpriorityEnumHigh, - FieldseekerPolygonlocationLocationpriorityEnumNone, - } -} - -type FieldseekerPolygonlocationLocationpriorityEnum string - -func (e FieldseekerPolygonlocationLocationpriorityEnum) String() string { - return string(e) -} - -func (e FieldseekerPolygonlocationLocationpriorityEnum) Valid() bool { - switch e { - case FieldseekerPolygonlocationLocationpriorityEnumLow, - FieldseekerPolygonlocationLocationpriorityEnumMedium, - FieldseekerPolygonlocationLocationpriorityEnumHigh, - FieldseekerPolygonlocationLocationpriorityEnumNone: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPolygonlocationLocationpriorityEnum) All() []FieldseekerPolygonlocationLocationpriorityEnum { - return AllFieldseekerPolygonlocationLocationpriorityEnum() -} - -func (e FieldseekerPolygonlocationLocationpriorityEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPolygonlocationLocationpriorityEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPolygonlocationLocationpriorityEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPolygonlocationLocationpriorityEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPolygonlocationLocationpriorityEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPolygonlocationLocationpriorityEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPolygonlocationLocationpriorityEnum(x) - case []byte: - *e = FieldseekerPolygonlocationLocationpriorityEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPolygonlocationLocationpriorityEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPolygonlocationLocationpriorityEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPolygonlocationLocationsymbologyEnum -const ( - FieldseekerPolygonlocationLocationsymbologyEnumAction FieldseekerPolygonlocationLocationsymbologyEnum = "ACTION" - FieldseekerPolygonlocationLocationsymbologyEnumInactive FieldseekerPolygonlocationLocationsymbologyEnum = "INACTIVE" - FieldseekerPolygonlocationLocationsymbologyEnumNone FieldseekerPolygonlocationLocationsymbologyEnum = "NONE" -) - -func AllFieldseekerPolygonlocationLocationsymbologyEnum() []FieldseekerPolygonlocationLocationsymbologyEnum { - return []FieldseekerPolygonlocationLocationsymbologyEnum{ - FieldseekerPolygonlocationLocationsymbologyEnumAction, - FieldseekerPolygonlocationLocationsymbologyEnumInactive, - FieldseekerPolygonlocationLocationsymbologyEnumNone, - } -} - -type FieldseekerPolygonlocationLocationsymbologyEnum string - -func (e FieldseekerPolygonlocationLocationsymbologyEnum) String() string { - return string(e) -} - -func (e FieldseekerPolygonlocationLocationsymbologyEnum) Valid() bool { - switch e { - case FieldseekerPolygonlocationLocationsymbologyEnumAction, - FieldseekerPolygonlocationLocationsymbologyEnumInactive, - FieldseekerPolygonlocationLocationsymbologyEnumNone: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPolygonlocationLocationsymbologyEnum) All() []FieldseekerPolygonlocationLocationsymbologyEnum { - return AllFieldseekerPolygonlocationLocationsymbologyEnum() -} - -func (e FieldseekerPolygonlocationLocationsymbologyEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPolygonlocationLocationsymbologyEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPolygonlocationLocationsymbologyEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPolygonlocationLocationsymbologyEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPolygonlocationLocationsymbologyEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPolygonlocationLocationsymbologyEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPolygonlocationLocationsymbologyEnum(x) - case []byte: - *e = FieldseekerPolygonlocationLocationsymbologyEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPolygonlocationLocationsymbologyEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPolygonlocationLocationsymbologyEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPolygonlocationNotinuitFEnum -const ( - FieldseekerPolygonlocationNotinuitFEnum1 FieldseekerPolygonlocationNotinuitFEnum = "1" - FieldseekerPolygonlocationNotinuitFEnum0 FieldseekerPolygonlocationNotinuitFEnum = "0" -) - -func AllFieldseekerPolygonlocationNotinuitFEnum() []FieldseekerPolygonlocationNotinuitFEnum { - return []FieldseekerPolygonlocationNotinuitFEnum{ - FieldseekerPolygonlocationNotinuitFEnum1, - FieldseekerPolygonlocationNotinuitFEnum0, - } -} - -type FieldseekerPolygonlocationNotinuitFEnum string - -func (e FieldseekerPolygonlocationNotinuitFEnum) String() string { - return string(e) -} - -func (e FieldseekerPolygonlocationNotinuitFEnum) Valid() bool { - switch e { - case FieldseekerPolygonlocationNotinuitFEnum1, - FieldseekerPolygonlocationNotinuitFEnum0: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPolygonlocationNotinuitFEnum) All() []FieldseekerPolygonlocationNotinuitFEnum { - return AllFieldseekerPolygonlocationNotinuitFEnum() -} - -func (e FieldseekerPolygonlocationNotinuitFEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPolygonlocationNotinuitFEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPolygonlocationNotinuitFEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPolygonlocationNotinuitFEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPolygonlocationNotinuitFEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPolygonlocationNotinuitFEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPolygonlocationNotinuitFEnum(x) - case []byte: - *e = FieldseekerPolygonlocationNotinuitFEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPolygonlocationNotinuitFEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPolygonlocationNotinuitFEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 -const ( - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Orchard FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "orchard" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65RowCrops FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "row_crops" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65VineCrops FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "vine_crops" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65AgGrassesOrGrain FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "ag_grasses_or_grain" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Pasture FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "pasture" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65IrrigationStandpipe FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "irrigation_standpipe" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Ditch FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "ditch" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65DairyLagoon FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "dairy_lagoon" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65WastewaterTreatment FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "wastewater_treatment" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Trough FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "trough" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Depression FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "depression" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Gutter FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "gutter" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65RainGutter FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "rain_gutter" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Culvert FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "culvert" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Utility FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "utility" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65CatchBasin FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "catch_basin" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65StreamOrCreek FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "stream_or_creek" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Slough FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "slough" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65River FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "river" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65MarshOrWetland FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "marsh_or_wetland" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Containers FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "containers" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65WateringBowl FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "watering_bowl" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65PlantSaucer FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "plant_saucer" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65YardDrain FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "yard_drain" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65PlantAxil FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "plant_axil" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Treehole FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "treehole" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65FountainOrWaterFeature FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "fountain_or_water_feature" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65BirdBath FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "bird_bath" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65MiscWaterAccumulation FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "misc_water_accumulation" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65TarpOrCover FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "tarp_or_cover" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65SwimmingPool FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "swimming_pool" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65AbovegroundPool FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "aboveground_pool" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65KidPool FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "kid_pool" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65HotTub FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "hot_tub" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Appliance FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "appliance" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Tires FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "tires" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65FloodedStructure FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "flooded_structure" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65LowPoint FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "low_point" - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Unknown FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 = "unknown" -) - -func AllFieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65() []FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 { - return []FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65{ - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Orchard, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65RowCrops, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65VineCrops, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65AgGrassesOrGrain, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Pasture, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65IrrigationStandpipe, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Ditch, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65DairyLagoon, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65WastewaterTreatment, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Trough, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Depression, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Gutter, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65RainGutter, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Culvert, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Utility, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65CatchBasin, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65StreamOrCreek, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Slough, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65River, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65MarshOrWetland, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Containers, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65WateringBowl, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65PlantSaucer, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65YardDrain, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65PlantAxil, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Treehole, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65FountainOrWaterFeature, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65BirdBath, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65MiscWaterAccumulation, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65TarpOrCover, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65SwimmingPool, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65AbovegroundPool, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65KidPool, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65HotTub, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Appliance, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Tires, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65FloodedStructure, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65LowPoint, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Unknown, - } -} - -type FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 string - -func (e FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65) String() string { - return string(e) -} - -func (e FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65) Valid() bool { - switch e { - case FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Orchard, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65RowCrops, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65VineCrops, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65AgGrassesOrGrain, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Pasture, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65IrrigationStandpipe, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Ditch, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65DairyLagoon, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65WastewaterTreatment, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Trough, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Depression, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Gutter, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65RainGutter, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Culvert, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Utility, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65CatchBasin, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65StreamOrCreek, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Slough, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65River, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65MarshOrWetland, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Containers, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65WateringBowl, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65PlantSaucer, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65YardDrain, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65PlantAxil, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Treehole, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65FountainOrWaterFeature, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65BirdBath, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65MiscWaterAccumulation, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65TarpOrCover, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65SwimmingPool, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65AbovegroundPool, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65KidPool, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65HotTub, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Appliance, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Tires, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65FloodedStructure, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65LowPoint, - FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65Unknown: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65) All() []FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 { - return AllFieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65() -} - -func (e FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65(x) - case []byte: - *e = FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 -const ( - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Residential FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 = "residential" - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Commercial FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 = "commercial" - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Industrial FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 = "industrial" - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Agricultural FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 = "agricultural" - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13MixedUse FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 = "mixed_use" - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13PublicDomain FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 = "public_domain" - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Natural FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 = "natural" - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Municipal FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 = "municipal" -) - -func AllFieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13() []FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 { - return []FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13{ - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Residential, - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Commercial, - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Industrial, - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Agricultural, - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13MixedUse, - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13PublicDomain, - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Natural, - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Municipal, - } -} - -type FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 string - -func (e FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13) String() string { - return string(e) -} - -func (e FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13) Valid() bool { - switch e { - case FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Residential, - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Commercial, - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Industrial, - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Agricultural, - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13MixedUse, - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13PublicDomain, - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Natural, - FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13Municipal: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13) All() []FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 { - return AllFieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13() -} - -func (e FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13(x) - case []byte: - *e = FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 -const ( - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9FloodIrrigation FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 = "flood_irrigation" - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9FurrowIrrigation FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 = "furrow_irrigation" - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9DripIrritation FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 = "drip_irritation" - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9SprinklerIrrigation FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 = "sprinkler_irrigation" - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9WastewaterIrrigation FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 = "wastewater_irrigation" - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9IrrigationRunoff FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 = "irrigation_runoff" - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9RainwaterAccumulation FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 = "rainwater_accumulation" - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9Leak FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 = "leak" - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9Seepage FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 = "seepage" - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9StoredWater FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 = "stored_water" - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9WastewaterSystem FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 = "wastewater_system" - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9PermanentNaturalWater FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 = "permanent_natural_water" - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9TemporaryNaturalWater FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 = "temporary_natural_water" - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9RecreationalOrOrnamentalWater FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 = "recreational_or_ornamental_water" - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9WaterConveyance FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 = "water_conveyance" -) - -func AllFieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9() []FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 { - return []FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9{ - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9FloodIrrigation, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9FurrowIrrigation, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9DripIrritation, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9SprinklerIrrigation, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9WastewaterIrrigation, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9IrrigationRunoff, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9RainwaterAccumulation, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9Leak, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9Seepage, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9StoredWater, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9WastewaterSystem, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9PermanentNaturalWater, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9TemporaryNaturalWater, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9RecreationalOrOrnamentalWater, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9WaterConveyance, - } -} - -type FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 string - -func (e FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9) String() string { - return string(e) -} - -func (e FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9) Valid() bool { - switch e { - case FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9FloodIrrigation, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9FurrowIrrigation, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9DripIrritation, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9SprinklerIrrigation, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9WastewaterIrrigation, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9IrrigationRunoff, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9RainwaterAccumulation, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9Leak, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9Seepage, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9StoredWater, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9WastewaterSystem, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9PermanentNaturalWater, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9TemporaryNaturalWater, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9RecreationalOrOrnamentalWater, - FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9WaterConveyance: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9) All() []FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 { - return AllFieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9() -} - -func (e FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9(x) - case []byte: - *e = FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPoolMosquitolabnameEnum -const ( - FieldseekerPoolMosquitolabnameEnumInternalLab FieldseekerPoolMosquitolabnameEnum = "Internal Lab" - FieldseekerPoolMosquitolabnameEnumStateLab FieldseekerPoolMosquitolabnameEnum = "State Lab" -) - -func AllFieldseekerPoolMosquitolabnameEnum() []FieldseekerPoolMosquitolabnameEnum { - return []FieldseekerPoolMosquitolabnameEnum{ - FieldseekerPoolMosquitolabnameEnumInternalLab, - FieldseekerPoolMosquitolabnameEnumStateLab, - } -} - -type FieldseekerPoolMosquitolabnameEnum string - -func (e FieldseekerPoolMosquitolabnameEnum) String() string { - return string(e) -} - -func (e FieldseekerPoolMosquitolabnameEnum) Valid() bool { - switch e { - case FieldseekerPoolMosquitolabnameEnumInternalLab, - FieldseekerPoolMosquitolabnameEnumStateLab: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPoolMosquitolabnameEnum) All() []FieldseekerPoolMosquitolabnameEnum { - return AllFieldseekerPoolMosquitolabnameEnum() -} - -func (e FieldseekerPoolMosquitolabnameEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPoolMosquitolabnameEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPoolMosquitolabnameEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPoolMosquitolabnameEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPoolMosquitolabnameEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPoolMosquitolabnameEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPoolMosquitolabnameEnum(x) - case []byte: - *e = FieldseekerPoolMosquitolabnameEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPoolMosquitolabnameEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPoolMosquitolabnameEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPoolNotinuitFEnum -const ( - FieldseekerPoolNotinuitFEnum1 FieldseekerPoolNotinuitFEnum = "1" - FieldseekerPoolNotinuitFEnum0 FieldseekerPoolNotinuitFEnum = "0" -) - -func AllFieldseekerPoolNotinuitFEnum() []FieldseekerPoolNotinuitFEnum { - return []FieldseekerPoolNotinuitFEnum{ - FieldseekerPoolNotinuitFEnum1, - FieldseekerPoolNotinuitFEnum0, - } -} - -type FieldseekerPoolNotinuitFEnum string - -func (e FieldseekerPoolNotinuitFEnum) String() string { - return string(e) -} - -func (e FieldseekerPoolNotinuitFEnum) Valid() bool { - switch e { - case FieldseekerPoolNotinuitFEnum1, - FieldseekerPoolNotinuitFEnum0: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPoolNotinuitFEnum) All() []FieldseekerPoolNotinuitFEnum { - return AllFieldseekerPoolNotinuitFEnum() -} - -func (e FieldseekerPoolNotinuitFEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPoolNotinuitFEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPoolNotinuitFEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPoolNotinuitFEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPoolNotinuitFEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPoolNotinuitFEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPoolNotinuitFEnum(x) - case []byte: - *e = FieldseekerPoolNotinuitFEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPoolNotinuitFEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPoolNotinuitFEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum -const ( - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumWNV FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum = "WNV" - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumSlev FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum = "SLEV" - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumWeev FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum = "WEEV" - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumDenv FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum = "DENV" - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumZikv FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum = "ZIKV" - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumChikv FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum = "CHIKV" - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumWnvU2fslev FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum = "WNV/SLEV" -) - -func AllFieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum() []FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum { - return []FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum{ - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumWNV, - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumSlev, - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumWeev, - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumDenv, - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumZikv, - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumChikv, - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumWnvU2fslev, - } -} - -type FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum string - -func (e FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum) String() string { - return string(e) -} - -func (e FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum) Valid() bool { - switch e { - case FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumWNV, - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumSlev, - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumWeev, - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumDenv, - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumZikv, - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumChikv, - FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnumWnvU2fslev: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum) All() []FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum { - return AllFieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum() -} - -func (e FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum(x) - case []byte: - *e = FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum -const ( - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumWNV FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum = "WNV" - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumSlev FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum = "SLEV" - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumWeev FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum = "WEEV" - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumDenv FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum = "DENV" - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumZikv FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum = "ZIKV" - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumChikv FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum = "CHIKV" -) - -func AllFieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum() []FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum { - return []FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum{ - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumWNV, - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumSlev, - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumWeev, - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumDenv, - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumZikv, - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumChikv, - } -} - -type FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum string - -func (e FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum) String() string { - return string(e) -} - -func (e FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum) Valid() bool { - switch e { - case FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumWNV, - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumSlev, - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumWeev, - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumDenv, - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumZikv, - FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97EnumChikv: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum) All() []FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum { - return AllFieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum() -} - -func (e FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum(x) - case []byte: - *e = FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum -const ( - FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnumRTPCR FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum = "RT-PCR" -) - -func AllFieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum() []FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum { - return []FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum{ - FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnumRTPCR, - } -} - -type FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum string - -func (e FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum) String() string { - return string(e) -} - -func (e FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum) Valid() bool { - switch e { - case FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnumRTPCR: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum) All() []FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum { - return AllFieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum() -} - -func (e FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum(x) - case []byte: - *e = FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerProposedtreatmentareaLocationpriorityEnum -const ( - FieldseekerProposedtreatmentareaLocationpriorityEnumLow FieldseekerProposedtreatmentareaLocationpriorityEnum = "Low" - FieldseekerProposedtreatmentareaLocationpriorityEnumMedium FieldseekerProposedtreatmentareaLocationpriorityEnum = "Medium" - FieldseekerProposedtreatmentareaLocationpriorityEnumHigh FieldseekerProposedtreatmentareaLocationpriorityEnum = "High" - FieldseekerProposedtreatmentareaLocationpriorityEnumNone FieldseekerProposedtreatmentareaLocationpriorityEnum = "None" -) - -func AllFieldseekerProposedtreatmentareaLocationpriorityEnum() []FieldseekerProposedtreatmentareaLocationpriorityEnum { - return []FieldseekerProposedtreatmentareaLocationpriorityEnum{ - FieldseekerProposedtreatmentareaLocationpriorityEnumLow, - FieldseekerProposedtreatmentareaLocationpriorityEnumMedium, - FieldseekerProposedtreatmentareaLocationpriorityEnumHigh, - FieldseekerProposedtreatmentareaLocationpriorityEnumNone, - } -} - -type FieldseekerProposedtreatmentareaLocationpriorityEnum string - -func (e FieldseekerProposedtreatmentareaLocationpriorityEnum) String() string { - return string(e) -} - -func (e FieldseekerProposedtreatmentareaLocationpriorityEnum) Valid() bool { - switch e { - case FieldseekerProposedtreatmentareaLocationpriorityEnumLow, - FieldseekerProposedtreatmentareaLocationpriorityEnumMedium, - FieldseekerProposedtreatmentareaLocationpriorityEnumHigh, - FieldseekerProposedtreatmentareaLocationpriorityEnumNone: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerProposedtreatmentareaLocationpriorityEnum) All() []FieldseekerProposedtreatmentareaLocationpriorityEnum { - return AllFieldseekerProposedtreatmentareaLocationpriorityEnum() -} - -func (e FieldseekerProposedtreatmentareaLocationpriorityEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerProposedtreatmentareaLocationpriorityEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerProposedtreatmentareaLocationpriorityEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerProposedtreatmentareaLocationpriorityEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerProposedtreatmentareaLocationpriorityEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerProposedtreatmentareaLocationpriorityEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerProposedtreatmentareaLocationpriorityEnum(x) - case []byte: - *e = FieldseekerProposedtreatmentareaLocationpriorityEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerProposedtreatmentareaLocationpriorityEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerProposedtreatmentareaLocationpriorityEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum -const ( - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumArgo FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum = "Argo" - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumAtv FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum = "ATV" - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumBackpack FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum = "Backpack" - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumDrone FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum = "Drone" - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumManual FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum = "Manual" - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumTruck FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum = "Truck" - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumUlv FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum = "ULV" - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumEnhancedSurveillance FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum = "Enhanced_Surveillance" -) - -func AllFieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum() []FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum { - return []FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum{ - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumArgo, - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumAtv, - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumBackpack, - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumDrone, - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumManual, - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumTruck, - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumUlv, - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumEnhancedSurveillance, - } -} - -type FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum string - -func (e FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum) String() string { - return string(e) -} - -func (e FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum) Valid() bool { - switch e { - case FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumArgo, - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumAtv, - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumBackpack, - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumDrone, - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumManual, - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumTruck, - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumUlv, - FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnumEnhancedSurveillance: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum) All() []FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum { - return AllFieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum() -} - -func (e FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum(x) - case []byte: - *e = FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerProposedtreatmentareaNotinuitFEnum -const ( - FieldseekerProposedtreatmentareaNotinuitFEnum1 FieldseekerProposedtreatmentareaNotinuitFEnum = "1" - FieldseekerProposedtreatmentareaNotinuitFEnum0 FieldseekerProposedtreatmentareaNotinuitFEnum = "0" -) - -func AllFieldseekerProposedtreatmentareaNotinuitFEnum() []FieldseekerProposedtreatmentareaNotinuitFEnum { - return []FieldseekerProposedtreatmentareaNotinuitFEnum{ - FieldseekerProposedtreatmentareaNotinuitFEnum1, - FieldseekerProposedtreatmentareaNotinuitFEnum0, - } -} - -type FieldseekerProposedtreatmentareaNotinuitFEnum string - -func (e FieldseekerProposedtreatmentareaNotinuitFEnum) String() string { - return string(e) -} - -func (e FieldseekerProposedtreatmentareaNotinuitFEnum) Valid() bool { - switch e { - case FieldseekerProposedtreatmentareaNotinuitFEnum1, - FieldseekerProposedtreatmentareaNotinuitFEnum0: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerProposedtreatmentareaNotinuitFEnum) All() []FieldseekerProposedtreatmentareaNotinuitFEnum { - return AllFieldseekerProposedtreatmentareaNotinuitFEnum() -} - -func (e FieldseekerProposedtreatmentareaNotinuitFEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerProposedtreatmentareaNotinuitFEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerProposedtreatmentareaNotinuitFEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerProposedtreatmentareaNotinuitFEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerProposedtreatmentareaNotinuitFEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerProposedtreatmentareaNotinuitFEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerProposedtreatmentareaNotinuitFEnum(x) - case []byte: - *e = FieldseekerProposedtreatmentareaNotinuitFEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerProposedtreatmentareaNotinuitFEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerProposedtreatmentareaNotinuitFEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerQamosquitoinspectionMosquitoactionEnum -const ( - FieldseekerQamosquitoinspectionMosquitoactionEnumTreatment FieldseekerQamosquitoinspectionMosquitoactionEnum = "Treatment" - FieldseekerQamosquitoinspectionMosquitoactionEnumCoveredContainer FieldseekerQamosquitoinspectionMosquitoactionEnum = "Covered container" - FieldseekerQamosquitoinspectionMosquitoactionEnumClearedDebris FieldseekerQamosquitoinspectionMosquitoactionEnum = "Cleared debris" - FieldseekerQamosquitoinspectionMosquitoactionEnumMaintenance FieldseekerQamosquitoinspectionMosquitoactionEnum = "Maintenance" -) - -func AllFieldseekerQamosquitoinspectionMosquitoactionEnum() []FieldseekerQamosquitoinspectionMosquitoactionEnum { - return []FieldseekerQamosquitoinspectionMosquitoactionEnum{ - FieldseekerQamosquitoinspectionMosquitoactionEnumTreatment, - FieldseekerQamosquitoinspectionMosquitoactionEnumCoveredContainer, - FieldseekerQamosquitoinspectionMosquitoactionEnumClearedDebris, - FieldseekerQamosquitoinspectionMosquitoactionEnumMaintenance, - } -} - -type FieldseekerQamosquitoinspectionMosquitoactionEnum string - -func (e FieldseekerQamosquitoinspectionMosquitoactionEnum) String() string { - return string(e) -} - -func (e FieldseekerQamosquitoinspectionMosquitoactionEnum) Valid() bool { - switch e { - case FieldseekerQamosquitoinspectionMosquitoactionEnumTreatment, - FieldseekerQamosquitoinspectionMosquitoactionEnumCoveredContainer, - FieldseekerQamosquitoinspectionMosquitoactionEnumClearedDebris, - FieldseekerQamosquitoinspectionMosquitoactionEnumMaintenance: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerQamosquitoinspectionMosquitoactionEnum) All() []FieldseekerQamosquitoinspectionMosquitoactionEnum { - return AllFieldseekerQamosquitoinspectionMosquitoactionEnum() -} - -func (e FieldseekerQamosquitoinspectionMosquitoactionEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionMosquitoactionEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerQamosquitoinspectionMosquitoactionEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionMosquitoactionEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerQamosquitoinspectionMosquitoactionEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerQamosquitoinspectionMosquitoactionEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerQamosquitoinspectionMosquitoactionEnum(x) - case []byte: - *e = FieldseekerQamosquitoinspectionMosquitoactionEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerQamosquitoinspectionMosquitoactionEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerQamosquitoinspectionMosquitoactionEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerQamosquitoinspectionNotinuitFEnum -const ( - FieldseekerQamosquitoinspectionNotinuitFEnum1 FieldseekerQamosquitoinspectionNotinuitFEnum = "1" - FieldseekerQamosquitoinspectionNotinuitFEnum0 FieldseekerQamosquitoinspectionNotinuitFEnum = "0" -) - -func AllFieldseekerQamosquitoinspectionNotinuitFEnum() []FieldseekerQamosquitoinspectionNotinuitFEnum { - return []FieldseekerQamosquitoinspectionNotinuitFEnum{ - FieldseekerQamosquitoinspectionNotinuitFEnum1, - FieldseekerQamosquitoinspectionNotinuitFEnum0, - } -} - -type FieldseekerQamosquitoinspectionNotinuitFEnum string - -func (e FieldseekerQamosquitoinspectionNotinuitFEnum) String() string { - return string(e) -} - -func (e FieldseekerQamosquitoinspectionNotinuitFEnum) Valid() bool { - switch e { - case FieldseekerQamosquitoinspectionNotinuitFEnum1, - FieldseekerQamosquitoinspectionNotinuitFEnum0: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerQamosquitoinspectionNotinuitFEnum) All() []FieldseekerQamosquitoinspectionNotinuitFEnum { - return AllFieldseekerQamosquitoinspectionNotinuitFEnum() -} - -func (e FieldseekerQamosquitoinspectionNotinuitFEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionNotinuitFEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerQamosquitoinspectionNotinuitFEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionNotinuitFEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerQamosquitoinspectionNotinuitFEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerQamosquitoinspectionNotinuitFEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerQamosquitoinspectionNotinuitFEnum(x) - case []byte: - *e = FieldseekerQamosquitoinspectionNotinuitFEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerQamosquitoinspectionNotinuitFEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerQamosquitoinspectionNotinuitFEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerQamosquitoinspectionQaaquaticorganismsEnum -const ( - FieldseekerQamosquitoinspectionQaaquaticorganismsEnumFish FieldseekerQamosquitoinspectionQaaquaticorganismsEnum = "fish" - FieldseekerQamosquitoinspectionQaaquaticorganismsEnumScuds FieldseekerQamosquitoinspectionQaaquaticorganismsEnum = "scuds" - FieldseekerQamosquitoinspectionQaaquaticorganismsEnumSnails FieldseekerQamosquitoinspectionQaaquaticorganismsEnum = "snails" -) - -func AllFieldseekerQamosquitoinspectionQaaquaticorganismsEnum() []FieldseekerQamosquitoinspectionQaaquaticorganismsEnum { - return []FieldseekerQamosquitoinspectionQaaquaticorganismsEnum{ - FieldseekerQamosquitoinspectionQaaquaticorganismsEnumFish, - FieldseekerQamosquitoinspectionQaaquaticorganismsEnumScuds, - FieldseekerQamosquitoinspectionQaaquaticorganismsEnumSnails, - } -} - -type FieldseekerQamosquitoinspectionQaaquaticorganismsEnum string - -func (e FieldseekerQamosquitoinspectionQaaquaticorganismsEnum) String() string { - return string(e) -} - -func (e FieldseekerQamosquitoinspectionQaaquaticorganismsEnum) Valid() bool { - switch e { - case FieldseekerQamosquitoinspectionQaaquaticorganismsEnumFish, - FieldseekerQamosquitoinspectionQaaquaticorganismsEnumScuds, - FieldseekerQamosquitoinspectionQaaquaticorganismsEnumSnails: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerQamosquitoinspectionQaaquaticorganismsEnum) All() []FieldseekerQamosquitoinspectionQaaquaticorganismsEnum { - return AllFieldseekerQamosquitoinspectionQaaquaticorganismsEnum() -} - -func (e FieldseekerQamosquitoinspectionQaaquaticorganismsEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQaaquaticorganismsEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerQamosquitoinspectionQaaquaticorganismsEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQaaquaticorganismsEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerQamosquitoinspectionQaaquaticorganismsEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQaaquaticorganismsEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerQamosquitoinspectionQaaquaticorganismsEnum(x) - case []byte: - *e = FieldseekerQamosquitoinspectionQaaquaticorganismsEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerQamosquitoinspectionQaaquaticorganismsEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerQamosquitoinspectionQaaquaticorganismsEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerQamosquitoinspectionQabreedingpotentialEnum -const ( - FieldseekerQamosquitoinspectionQabreedingpotentialEnumHigh FieldseekerQamosquitoinspectionQabreedingpotentialEnum = "High" - FieldseekerQamosquitoinspectionQabreedingpotentialEnumLow FieldseekerQamosquitoinspectionQabreedingpotentialEnum = "Low" - FieldseekerQamosquitoinspectionQabreedingpotentialEnumMedium FieldseekerQamosquitoinspectionQabreedingpotentialEnum = "Medium" - FieldseekerQamosquitoinspectionQabreedingpotentialEnumRare FieldseekerQamosquitoinspectionQabreedingpotentialEnum = "Rare" -) - -func AllFieldseekerQamosquitoinspectionQabreedingpotentialEnum() []FieldseekerQamosquitoinspectionQabreedingpotentialEnum { - return []FieldseekerQamosquitoinspectionQabreedingpotentialEnum{ - FieldseekerQamosquitoinspectionQabreedingpotentialEnumHigh, - FieldseekerQamosquitoinspectionQabreedingpotentialEnumLow, - FieldseekerQamosquitoinspectionQabreedingpotentialEnumMedium, - FieldseekerQamosquitoinspectionQabreedingpotentialEnumRare, - } -} - -type FieldseekerQamosquitoinspectionQabreedingpotentialEnum string - -func (e FieldseekerQamosquitoinspectionQabreedingpotentialEnum) String() string { - return string(e) -} - -func (e FieldseekerQamosquitoinspectionQabreedingpotentialEnum) Valid() bool { - switch e { - case FieldseekerQamosquitoinspectionQabreedingpotentialEnumHigh, - FieldseekerQamosquitoinspectionQabreedingpotentialEnumLow, - FieldseekerQamosquitoinspectionQabreedingpotentialEnumMedium, - FieldseekerQamosquitoinspectionQabreedingpotentialEnumRare: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerQamosquitoinspectionQabreedingpotentialEnum) All() []FieldseekerQamosquitoinspectionQabreedingpotentialEnum { - return AllFieldseekerQamosquitoinspectionQabreedingpotentialEnum() -} - -func (e FieldseekerQamosquitoinspectionQabreedingpotentialEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQabreedingpotentialEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerQamosquitoinspectionQabreedingpotentialEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQabreedingpotentialEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerQamosquitoinspectionQabreedingpotentialEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQabreedingpotentialEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerQamosquitoinspectionQabreedingpotentialEnum(x) - case []byte: - *e = FieldseekerQamosquitoinspectionQabreedingpotentialEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerQamosquitoinspectionQabreedingpotentialEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerQamosquitoinspectionQabreedingpotentialEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerQamosquitoinspectionQalarvaereasonEnum -const ( - FieldseekerQamosquitoinspectionQalarvaereasonEnumMissedArea FieldseekerQamosquitoinspectionQalarvaereasonEnum = "Missed Area" - FieldseekerQamosquitoinspectionQalarvaereasonEnumNewSite FieldseekerQamosquitoinspectionQalarvaereasonEnum = "New Site" - FieldseekerQamosquitoinspectionQalarvaereasonEnumNotVisited FieldseekerQamosquitoinspectionQalarvaereasonEnum = "Not Visited" - FieldseekerQamosquitoinspectionQalarvaereasonEnumRateLow FieldseekerQamosquitoinspectionQalarvaereasonEnum = "Rate Low" - FieldseekerQamosquitoinspectionQalarvaereasonEnumTreatedRecently FieldseekerQamosquitoinspectionQalarvaereasonEnum = "Treated Recently" - FieldseekerQamosquitoinspectionQalarvaereasonEnumUnknown FieldseekerQamosquitoinspectionQalarvaereasonEnum = "Unknown" - FieldseekerQamosquitoinspectionQalarvaereasonEnumWrongProduct FieldseekerQamosquitoinspectionQalarvaereasonEnum = "Wrong Product" -) - -func AllFieldseekerQamosquitoinspectionQalarvaereasonEnum() []FieldseekerQamosquitoinspectionQalarvaereasonEnum { - return []FieldseekerQamosquitoinspectionQalarvaereasonEnum{ - FieldseekerQamosquitoinspectionQalarvaereasonEnumMissedArea, - FieldseekerQamosquitoinspectionQalarvaereasonEnumNewSite, - FieldseekerQamosquitoinspectionQalarvaereasonEnumNotVisited, - FieldseekerQamosquitoinspectionQalarvaereasonEnumRateLow, - FieldseekerQamosquitoinspectionQalarvaereasonEnumTreatedRecently, - FieldseekerQamosquitoinspectionQalarvaereasonEnumUnknown, - FieldseekerQamosquitoinspectionQalarvaereasonEnumWrongProduct, - } -} - -type FieldseekerQamosquitoinspectionQalarvaereasonEnum string - -func (e FieldseekerQamosquitoinspectionQalarvaereasonEnum) String() string { - return string(e) -} - -func (e FieldseekerQamosquitoinspectionQalarvaereasonEnum) Valid() bool { - switch e { - case FieldseekerQamosquitoinspectionQalarvaereasonEnumMissedArea, - FieldseekerQamosquitoinspectionQalarvaereasonEnumNewSite, - FieldseekerQamosquitoinspectionQalarvaereasonEnumNotVisited, - FieldseekerQamosquitoinspectionQalarvaereasonEnumRateLow, - FieldseekerQamosquitoinspectionQalarvaereasonEnumTreatedRecently, - FieldseekerQamosquitoinspectionQalarvaereasonEnumUnknown, - FieldseekerQamosquitoinspectionQalarvaereasonEnumWrongProduct: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerQamosquitoinspectionQalarvaereasonEnum) All() []FieldseekerQamosquitoinspectionQalarvaereasonEnum { - return AllFieldseekerQamosquitoinspectionQalarvaereasonEnum() -} - -func (e FieldseekerQamosquitoinspectionQalarvaereasonEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQalarvaereasonEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerQamosquitoinspectionQalarvaereasonEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQalarvaereasonEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerQamosquitoinspectionQalarvaereasonEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQalarvaereasonEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerQamosquitoinspectionQalarvaereasonEnum(x) - case []byte: - *e = FieldseekerQamosquitoinspectionQalarvaereasonEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerQamosquitoinspectionQalarvaereasonEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerQamosquitoinspectionQalarvaereasonEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerQamosquitoinspectionQamosquitohabitatEnum -const ( - FieldseekerQamosquitoinspectionQamosquitohabitatEnumDepressions FieldseekerQamosquitoinspectionQamosquitohabitatEnum = "Depressions" - FieldseekerQamosquitoinspectionQamosquitohabitatEnumDetritusPresent FieldseekerQamosquitoinspectionQamosquitohabitatEnum = "Detritus present" - FieldseekerQamosquitoinspectionQamosquitohabitatEnumFast FieldseekerQamosquitoinspectionQamosquitohabitatEnum = "Fast" - FieldseekerQamosquitoinspectionQamosquitohabitatEnumFewPredators FieldseekerQamosquitoinspectionQamosquitohabitatEnum = "Few predators" - FieldseekerQamosquitoinspectionQamosquitohabitatEnumFluctuatingLevels FieldseekerQamosquitoinspectionQamosquitohabitatEnum = "Fluctuating levels" - FieldseekerQamosquitoinspectionQamosquitohabitatEnumH20U3C6U22 FieldseekerQamosquitoinspectionQamosquitohabitatEnum = "H20<6\"" - FieldseekerQamosquitoinspectionQamosquitohabitatEnumLowWavePotential FieldseekerQamosquitoinspectionQamosquitohabitatEnum = "Low wave potential" - FieldseekerQamosquitoinspectionQamosquitohabitatEnumNoFish FieldseekerQamosquitoinspectionQamosquitohabitatEnum = "No fish" - FieldseekerQamosquitoinspectionQamosquitohabitatEnumShallowEdges FieldseekerQamosquitoinspectionQamosquitohabitatEnum = "Shallow edges" - FieldseekerQamosquitoinspectionQamosquitohabitatEnumStillWaterEdges FieldseekerQamosquitoinspectionQamosquitohabitatEnum = "Still water edges" - FieldseekerQamosquitoinspectionQamosquitohabitatEnumStillWaterWhole FieldseekerQamosquitoinspectionQamosquitohabitatEnum = "Still water whole" - FieldseekerQamosquitoinspectionQamosquitohabitatEnumVegU2eOnEdges FieldseekerQamosquitoinspectionQamosquitohabitatEnum = "Veg. on edges" -) - -func AllFieldseekerQamosquitoinspectionQamosquitohabitatEnum() []FieldseekerQamosquitoinspectionQamosquitohabitatEnum { - return []FieldseekerQamosquitoinspectionQamosquitohabitatEnum{ - FieldseekerQamosquitoinspectionQamosquitohabitatEnumDepressions, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumDetritusPresent, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumFast, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumFewPredators, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumFluctuatingLevels, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumH20U3C6U22, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumLowWavePotential, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumNoFish, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumShallowEdges, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumStillWaterEdges, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumStillWaterWhole, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumVegU2eOnEdges, - } -} - -type FieldseekerQamosquitoinspectionQamosquitohabitatEnum string - -func (e FieldseekerQamosquitoinspectionQamosquitohabitatEnum) String() string { - return string(e) -} - -func (e FieldseekerQamosquitoinspectionQamosquitohabitatEnum) Valid() bool { - switch e { - case FieldseekerQamosquitoinspectionQamosquitohabitatEnumDepressions, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumDetritusPresent, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumFast, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumFewPredators, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumFluctuatingLevels, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumH20U3C6U22, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumLowWavePotential, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumNoFish, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumShallowEdges, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumStillWaterEdges, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumStillWaterWhole, - FieldseekerQamosquitoinspectionQamosquitohabitatEnumVegU2eOnEdges: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerQamosquitoinspectionQamosquitohabitatEnum) All() []FieldseekerQamosquitoinspectionQamosquitohabitatEnum { - return AllFieldseekerQamosquitoinspectionQamosquitohabitatEnum() -} - -func (e FieldseekerQamosquitoinspectionQamosquitohabitatEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQamosquitohabitatEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerQamosquitoinspectionQamosquitohabitatEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQamosquitohabitatEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerQamosquitoinspectionQamosquitohabitatEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQamosquitohabitatEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerQamosquitoinspectionQamosquitohabitatEnum(x) - case []byte: - *e = FieldseekerQamosquitoinspectionQamosquitohabitatEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerQamosquitoinspectionQamosquitohabitatEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerQamosquitoinspectionQamosquitohabitatEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerQamosquitoinspectionQasitetypeEnum -const ( - FieldseekerQamosquitoinspectionQasitetypeEnumDetentionPond FieldseekerQamosquitoinspectionQasitetypeEnum = "Detention Pond" - FieldseekerQamosquitoinspectionQasitetypeEnumDitch FieldseekerQamosquitoinspectionQasitetypeEnum = "Ditch" - FieldseekerQamosquitoinspectionQasitetypeEnumLowArea FieldseekerQamosquitoinspectionQasitetypeEnum = "Low Area" - FieldseekerQamosquitoinspectionQasitetypeEnumMangroveEdge FieldseekerQamosquitoinspectionQasitetypeEnum = "Mangrove Edge" - FieldseekerQamosquitoinspectionQasitetypeEnumPond FieldseekerQamosquitoinspectionQasitetypeEnum = "Pond" - FieldseekerQamosquitoinspectionQasitetypeEnumPondEdge FieldseekerQamosquitoinspectionQasitetypeEnum = "Pond Edge" - FieldseekerQamosquitoinspectionQasitetypeEnumSwale FieldseekerQamosquitoinspectionQasitetypeEnum = "Swale" -) - -func AllFieldseekerQamosquitoinspectionQasitetypeEnum() []FieldseekerQamosquitoinspectionQasitetypeEnum { - return []FieldseekerQamosquitoinspectionQasitetypeEnum{ - FieldseekerQamosquitoinspectionQasitetypeEnumDetentionPond, - FieldseekerQamosquitoinspectionQasitetypeEnumDitch, - FieldseekerQamosquitoinspectionQasitetypeEnumLowArea, - FieldseekerQamosquitoinspectionQasitetypeEnumMangroveEdge, - FieldseekerQamosquitoinspectionQasitetypeEnumPond, - FieldseekerQamosquitoinspectionQasitetypeEnumPondEdge, - FieldseekerQamosquitoinspectionQasitetypeEnumSwale, - } -} - -type FieldseekerQamosquitoinspectionQasitetypeEnum string - -func (e FieldseekerQamosquitoinspectionQasitetypeEnum) String() string { - return string(e) -} - -func (e FieldseekerQamosquitoinspectionQasitetypeEnum) Valid() bool { - switch e { - case FieldseekerQamosquitoinspectionQasitetypeEnumDetentionPond, - FieldseekerQamosquitoinspectionQasitetypeEnumDitch, - FieldseekerQamosquitoinspectionQasitetypeEnumLowArea, - FieldseekerQamosquitoinspectionQasitetypeEnumMangroveEdge, - FieldseekerQamosquitoinspectionQasitetypeEnumPond, - FieldseekerQamosquitoinspectionQasitetypeEnumPondEdge, - FieldseekerQamosquitoinspectionQasitetypeEnumSwale: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerQamosquitoinspectionQasitetypeEnum) All() []FieldseekerQamosquitoinspectionQasitetypeEnum { - return AllFieldseekerQamosquitoinspectionQasitetypeEnum() -} - -func (e FieldseekerQamosquitoinspectionQasitetypeEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQasitetypeEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerQamosquitoinspectionQasitetypeEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQasitetypeEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerQamosquitoinspectionQasitetypeEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQasitetypeEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerQamosquitoinspectionQasitetypeEnum(x) - case []byte: - *e = FieldseekerQamosquitoinspectionQasitetypeEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerQamosquitoinspectionQasitetypeEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerQamosquitoinspectionQasitetypeEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerQamosquitoinspectionQasoilconditionEnum -const ( - FieldseekerQamosquitoinspectionQasoilconditionEnumCracked FieldseekerQamosquitoinspectionQasoilconditionEnum = "Cracked" - FieldseekerQamosquitoinspectionQasoilconditionEnumDry FieldseekerQamosquitoinspectionQasoilconditionEnum = "Dry" - FieldseekerQamosquitoinspectionQasoilconditionEnumInundated FieldseekerQamosquitoinspectionQasoilconditionEnum = "Inundated" - FieldseekerQamosquitoinspectionQasoilconditionEnumSaturated FieldseekerQamosquitoinspectionQasoilconditionEnum = "Saturated" - FieldseekerQamosquitoinspectionQasoilconditionEnumSurfaceMoist FieldseekerQamosquitoinspectionQasoilconditionEnum = "Surface Moist" -) - -func AllFieldseekerQamosquitoinspectionQasoilconditionEnum() []FieldseekerQamosquitoinspectionQasoilconditionEnum { - return []FieldseekerQamosquitoinspectionQasoilconditionEnum{ - FieldseekerQamosquitoinspectionQasoilconditionEnumCracked, - FieldseekerQamosquitoinspectionQasoilconditionEnumDry, - FieldseekerQamosquitoinspectionQasoilconditionEnumInundated, - FieldseekerQamosquitoinspectionQasoilconditionEnumSaturated, - FieldseekerQamosquitoinspectionQasoilconditionEnumSurfaceMoist, - } -} - -type FieldseekerQamosquitoinspectionQasoilconditionEnum string - -func (e FieldseekerQamosquitoinspectionQasoilconditionEnum) String() string { - return string(e) -} - -func (e FieldseekerQamosquitoinspectionQasoilconditionEnum) Valid() bool { - switch e { - case FieldseekerQamosquitoinspectionQasoilconditionEnumCracked, - FieldseekerQamosquitoinspectionQasoilconditionEnumDry, - FieldseekerQamosquitoinspectionQasoilconditionEnumInundated, - FieldseekerQamosquitoinspectionQasoilconditionEnumSaturated, - FieldseekerQamosquitoinspectionQasoilconditionEnumSurfaceMoist: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerQamosquitoinspectionQasoilconditionEnum) All() []FieldseekerQamosquitoinspectionQasoilconditionEnum { - return AllFieldseekerQamosquitoinspectionQasoilconditionEnum() -} - -func (e FieldseekerQamosquitoinspectionQasoilconditionEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQasoilconditionEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerQamosquitoinspectionQasoilconditionEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQasoilconditionEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerQamosquitoinspectionQasoilconditionEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQasoilconditionEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerQamosquitoinspectionQasoilconditionEnum(x) - case []byte: - *e = FieldseekerQamosquitoinspectionQasoilconditionEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerQamosquitoinspectionQasoilconditionEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerQamosquitoinspectionQasoilconditionEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerQamosquitoinspectionQasourcereductionEnum -const ( - FieldseekerQamosquitoinspectionQasourcereductionEnum1TractorU3CDay FieldseekerQamosquitoinspectionQasourcereductionEnum = "1 tractor < day" - FieldseekerQamosquitoinspectionQasourcereductionEnumAdjustFloodIrrigation FieldseekerQamosquitoinspectionQasourcereductionEnum = "adjust flood irrigation" - FieldseekerQamosquitoinspectionQasourcereductionEnumAdjustTurfIrrigation FieldseekerQamosquitoinspectionQasourcereductionEnum = "adjust turf irrigation" - FieldseekerQamosquitoinspectionQasourcereductionEnumClearOutflow FieldseekerQamosquitoinspectionQasourcereductionEnum = "clear outflow" - FieldseekerQamosquitoinspectionQasourcereductionEnumCutDitch FieldseekerQamosquitoinspectionQasourcereductionEnum = "cut ditch" - FieldseekerQamosquitoinspectionQasourcereductionEnumHandGrading FieldseekerQamosquitoinspectionQasourcereductionEnum = "hand grading" - FieldseekerQamosquitoinspectionQasourcereductionEnumLaserLeveling FieldseekerQamosquitoinspectionQasourcereductionEnum = "laser leveling" - FieldseekerQamosquitoinspectionQasourcereductionEnumMultipleLoadsSoil FieldseekerQamosquitoinspectionQasourcereductionEnum = "multiple loads soil" - FieldseekerQamosquitoinspectionQasourcereductionEnumNone FieldseekerQamosquitoinspectionQasourcereductionEnum = "none" -) - -func AllFieldseekerQamosquitoinspectionQasourcereductionEnum() []FieldseekerQamosquitoinspectionQasourcereductionEnum { - return []FieldseekerQamosquitoinspectionQasourcereductionEnum{ - FieldseekerQamosquitoinspectionQasourcereductionEnum1TractorU3CDay, - FieldseekerQamosquitoinspectionQasourcereductionEnumAdjustFloodIrrigation, - FieldseekerQamosquitoinspectionQasourcereductionEnumAdjustTurfIrrigation, - FieldseekerQamosquitoinspectionQasourcereductionEnumClearOutflow, - FieldseekerQamosquitoinspectionQasourcereductionEnumCutDitch, - FieldseekerQamosquitoinspectionQasourcereductionEnumHandGrading, - FieldseekerQamosquitoinspectionQasourcereductionEnumLaserLeveling, - FieldseekerQamosquitoinspectionQasourcereductionEnumMultipleLoadsSoil, - FieldseekerQamosquitoinspectionQasourcereductionEnumNone, - } -} - -type FieldseekerQamosquitoinspectionQasourcereductionEnum string - -func (e FieldseekerQamosquitoinspectionQasourcereductionEnum) String() string { - return string(e) -} - -func (e FieldseekerQamosquitoinspectionQasourcereductionEnum) Valid() bool { - switch e { - case FieldseekerQamosquitoinspectionQasourcereductionEnum1TractorU3CDay, - FieldseekerQamosquitoinspectionQasourcereductionEnumAdjustFloodIrrigation, - FieldseekerQamosquitoinspectionQasourcereductionEnumAdjustTurfIrrigation, - FieldseekerQamosquitoinspectionQasourcereductionEnumClearOutflow, - FieldseekerQamosquitoinspectionQasourcereductionEnumCutDitch, - FieldseekerQamosquitoinspectionQasourcereductionEnumHandGrading, - FieldseekerQamosquitoinspectionQasourcereductionEnumLaserLeveling, - FieldseekerQamosquitoinspectionQasourcereductionEnumMultipleLoadsSoil, - FieldseekerQamosquitoinspectionQasourcereductionEnumNone: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerQamosquitoinspectionQasourcereductionEnum) All() []FieldseekerQamosquitoinspectionQasourcereductionEnum { - return AllFieldseekerQamosquitoinspectionQasourcereductionEnum() -} - -func (e FieldseekerQamosquitoinspectionQasourcereductionEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQasourcereductionEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerQamosquitoinspectionQasourcereductionEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQasourcereductionEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerQamosquitoinspectionQasourcereductionEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQasourcereductionEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerQamosquitoinspectionQasourcereductionEnum(x) - case []byte: - *e = FieldseekerQamosquitoinspectionQasourcereductionEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerQamosquitoinspectionQasourcereductionEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerQamosquitoinspectionQasourcereductionEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerQamosquitoinspectionQavegetationEnum -const ( - FieldseekerQamosquitoinspectionQavegetationEnumAlgae FieldseekerQamosquitoinspectionQavegetationEnum = "Algae" - FieldseekerQamosquitoinspectionQavegetationEnumCattails FieldseekerQamosquitoinspectionQavegetationEnum = "Cattails" - FieldseekerQamosquitoinspectionQavegetationEnumDuckweed FieldseekerQamosquitoinspectionQavegetationEnum = "Duckweed" - FieldseekerQamosquitoinspectionQavegetationEnumGlasswort FieldseekerQamosquitoinspectionQavegetationEnum = "Glasswort" - FieldseekerQamosquitoinspectionQavegetationEnumGrassOnEdge FieldseekerQamosquitoinspectionQavegetationEnum = "Grass on edge" - FieldseekerQamosquitoinspectionQavegetationEnumMangrove FieldseekerQamosquitoinspectionQavegetationEnum = "Mangrove" - FieldseekerQamosquitoinspectionQavegetationEnumMosquitoFern FieldseekerQamosquitoinspectionQavegetationEnum = "Mosquito fern" - FieldseekerQamosquitoinspectionQavegetationEnumMuskgrass FieldseekerQamosquitoinspectionQavegetationEnum = "Muskgrass" - FieldseekerQamosquitoinspectionQavegetationEnumMyriophyllum FieldseekerQamosquitoinspectionQavegetationEnum = "Myriophyllum" - FieldseekerQamosquitoinspectionQavegetationEnumOther FieldseekerQamosquitoinspectionQavegetationEnum = "Other" - FieldseekerQamosquitoinspectionQavegetationEnumRottingVegetation FieldseekerQamosquitoinspectionQavegetationEnum = "Rotting vegetation" - FieldseekerQamosquitoinspectionQavegetationEnumSaltwort FieldseekerQamosquitoinspectionQavegetationEnum = "Saltwort" - FieldseekerQamosquitoinspectionQavegetationEnumSedges FieldseekerQamosquitoinspectionQavegetationEnum = "Sedges" -) - -func AllFieldseekerQamosquitoinspectionQavegetationEnum() []FieldseekerQamosquitoinspectionQavegetationEnum { - return []FieldseekerQamosquitoinspectionQavegetationEnum{ - FieldseekerQamosquitoinspectionQavegetationEnumAlgae, - FieldseekerQamosquitoinspectionQavegetationEnumCattails, - FieldseekerQamosquitoinspectionQavegetationEnumDuckweed, - FieldseekerQamosquitoinspectionQavegetationEnumGlasswort, - FieldseekerQamosquitoinspectionQavegetationEnumGrassOnEdge, - FieldseekerQamosquitoinspectionQavegetationEnumMangrove, - FieldseekerQamosquitoinspectionQavegetationEnumMosquitoFern, - FieldseekerQamosquitoinspectionQavegetationEnumMuskgrass, - FieldseekerQamosquitoinspectionQavegetationEnumMyriophyllum, - FieldseekerQamosquitoinspectionQavegetationEnumOther, - FieldseekerQamosquitoinspectionQavegetationEnumRottingVegetation, - FieldseekerQamosquitoinspectionQavegetationEnumSaltwort, - FieldseekerQamosquitoinspectionQavegetationEnumSedges, - } -} - -type FieldseekerQamosquitoinspectionQavegetationEnum string - -func (e FieldseekerQamosquitoinspectionQavegetationEnum) String() string { - return string(e) -} - -func (e FieldseekerQamosquitoinspectionQavegetationEnum) Valid() bool { - switch e { - case FieldseekerQamosquitoinspectionQavegetationEnumAlgae, - FieldseekerQamosquitoinspectionQavegetationEnumCattails, - FieldseekerQamosquitoinspectionQavegetationEnumDuckweed, - FieldseekerQamosquitoinspectionQavegetationEnumGlasswort, - FieldseekerQamosquitoinspectionQavegetationEnumGrassOnEdge, - FieldseekerQamosquitoinspectionQavegetationEnumMangrove, - FieldseekerQamosquitoinspectionQavegetationEnumMosquitoFern, - FieldseekerQamosquitoinspectionQavegetationEnumMuskgrass, - FieldseekerQamosquitoinspectionQavegetationEnumMyriophyllum, - FieldseekerQamosquitoinspectionQavegetationEnumOther, - FieldseekerQamosquitoinspectionQavegetationEnumRottingVegetation, - FieldseekerQamosquitoinspectionQavegetationEnumSaltwort, - FieldseekerQamosquitoinspectionQavegetationEnumSedges: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerQamosquitoinspectionQavegetationEnum) All() []FieldseekerQamosquitoinspectionQavegetationEnum { - return AllFieldseekerQamosquitoinspectionQavegetationEnum() -} - -func (e FieldseekerQamosquitoinspectionQavegetationEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQavegetationEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerQamosquitoinspectionQavegetationEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQavegetationEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerQamosquitoinspectionQavegetationEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQavegetationEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerQamosquitoinspectionQavegetationEnum(x) - case []byte: - *e = FieldseekerQamosquitoinspectionQavegetationEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerQamosquitoinspectionQavegetationEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerQamosquitoinspectionQavegetationEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerQamosquitoinspectionQawaterconditionsEnum -const ( - FieldseekerQamosquitoinspectionQawaterconditionsEnumU22rustU22Material FieldseekerQamosquitoinspectionQawaterconditionsEnum = "\"rust\" material" - FieldseekerQamosquitoinspectionQawaterconditionsEnumClear FieldseekerQamosquitoinspectionQawaterconditionsEnum = "Clear" - FieldseekerQamosquitoinspectionQawaterconditionsEnumCloudyU2ffines FieldseekerQamosquitoinspectionQawaterconditionsEnum = "Cloudy/fines" - FieldseekerQamosquitoinspectionQawaterconditionsEnumFloatingDebris FieldseekerQamosquitoinspectionQawaterconditionsEnum = "Floating debris" - FieldseekerQamosquitoinspectionQawaterconditionsEnumSubmergedU2fdecomU2eDebris FieldseekerQamosquitoinspectionQawaterconditionsEnum = "Submerged/decom. debris" -) - -func AllFieldseekerQamosquitoinspectionQawaterconditionsEnum() []FieldseekerQamosquitoinspectionQawaterconditionsEnum { - return []FieldseekerQamosquitoinspectionQawaterconditionsEnum{ - FieldseekerQamosquitoinspectionQawaterconditionsEnumU22rustU22Material, - FieldseekerQamosquitoinspectionQawaterconditionsEnumClear, - FieldseekerQamosquitoinspectionQawaterconditionsEnumCloudyU2ffines, - FieldseekerQamosquitoinspectionQawaterconditionsEnumFloatingDebris, - FieldseekerQamosquitoinspectionQawaterconditionsEnumSubmergedU2fdecomU2eDebris, - } -} - -type FieldseekerQamosquitoinspectionQawaterconditionsEnum string - -func (e FieldseekerQamosquitoinspectionQawaterconditionsEnum) String() string { - return string(e) -} - -func (e FieldseekerQamosquitoinspectionQawaterconditionsEnum) Valid() bool { - switch e { - case FieldseekerQamosquitoinspectionQawaterconditionsEnumU22rustU22Material, - FieldseekerQamosquitoinspectionQawaterconditionsEnumClear, - FieldseekerQamosquitoinspectionQawaterconditionsEnumCloudyU2ffines, - FieldseekerQamosquitoinspectionQawaterconditionsEnumFloatingDebris, - FieldseekerQamosquitoinspectionQawaterconditionsEnumSubmergedU2fdecomU2eDebris: - return true - default: - return false - } -} - -// useful when testing in other packages -func (e FieldseekerQamosquitoinspectionQawaterconditionsEnum) All() []FieldseekerQamosquitoinspectionQawaterconditionsEnum { - return AllFieldseekerQamosquitoinspectionQawaterconditionsEnum() -} - -func (e FieldseekerQamosquitoinspectionQawaterconditionsEnum) MarshalText() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQawaterconditionsEnum) UnmarshalText(text []byte) error { - return e.Scan(text) -} - -func (e FieldseekerQamosquitoinspectionQawaterconditionsEnum) MarshalBinary() ([]byte, error) { - return []byte(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQawaterconditionsEnum) UnmarshalBinary(data []byte) error { - return e.Scan(data) -} - -func (e FieldseekerQamosquitoinspectionQawaterconditionsEnum) Value() (driver.Value, error) { - return string(e), nil -} - -func (e *FieldseekerQamosquitoinspectionQawaterconditionsEnum) Scan(value any) error { - switch x := value.(type) { - case string: - *e = FieldseekerQamosquitoinspectionQawaterconditionsEnum(x) - case []byte: - *e = FieldseekerQamosquitoinspectionQawaterconditionsEnum(x) - case nil: - return fmt.Errorf("cannot nil into FieldseekerQamosquitoinspectionQawaterconditionsEnum") - default: - return fmt.Errorf("cannot scan type %T: %v", value, value) - } - - if !e.Valid() { - return fmt.Errorf("invalid FieldseekerQamosquitoinspectionQawaterconditionsEnum value: %s", *e) - } - - return nil -} - -// Enum values for FieldseekerQamosquitoinspectionQawaterdurationEnum -const ( - FieldseekerQamosquitoinspectionQawaterdurationEnumU7emonth FieldseekerQamosquitoinspectionQawaterdurationEnum = "~month" - FieldseekerQamosquitoinspectionQawaterdurationEnumU7eweek FieldseekerQamosquitoinspectionQawaterdurationEnum = "~week" - FieldseekerQamosquitoinspectionQawaterdurationEnumU3C1Week FieldseekerQamosquitoinspectionQawaterdurationEnum = "<1 week" - FieldseekerQamosquitoinspectionQawaterdurationEnumU3cday FieldseekerQamosquitoinspectionQawaterdurationEnum = " 0 { + NoteAudioMods.AddExistingNoteAudioBreadcrumbs(m.R.NoteAudioBreadcrumbs...).Apply(ctx, o) + } + if len(m.R.NoteAudioData) > 0 { + NoteAudioMods.AddExistingNoteAudioData(m.R.NoteAudioData...).Apply(ctx, o) } return o } -func (f *Factory) NewHistoryFieldscoutinglog(mods ...HistoryFieldscoutinglogMod) *HistoryFieldscoutinglogTemplate { - return f.NewHistoryFieldscoutinglogWithContext(context.Background(), mods...) +func (f *Factory) NewNoteAudioBreadcrumb(mods ...NoteAudioBreadcrumbMod) *NoteAudioBreadcrumbTemplate { + return f.NewNoteAudioBreadcrumbWithContext(context.Background(), mods...) } -func (f *Factory) NewHistoryFieldscoutinglogWithContext(ctx context.Context, mods ...HistoryFieldscoutinglogMod) *HistoryFieldscoutinglogTemplate { - o := &HistoryFieldscoutinglogTemplate{f: f} +func (f *Factory) NewNoteAudioBreadcrumbWithContext(ctx context.Context, mods ...NoteAudioBreadcrumbMod) *NoteAudioBreadcrumbTemplate { + o := &NoteAudioBreadcrumbTemplate{f: f} if f != nil { - f.baseHistoryFieldscoutinglogMods.Apply(ctx, o) + f.baseNoteAudioBreadcrumbMods.Apply(ctx, o) } - HistoryFieldscoutinglogModSlice(mods).Apply(ctx, o) + NoteAudioBreadcrumbModSlice(mods).Apply(ctx, o) return o } -func (f *Factory) FromExistingHistoryFieldscoutinglog(m *models.HistoryFieldscoutinglog) *HistoryFieldscoutinglogTemplate { - o := &HistoryFieldscoutinglogTemplate{f: f, alreadyPersisted: true} +func (f *Factory) FromExistingNoteAudioBreadcrumb(m *models.NoteAudioBreadcrumb) *NoteAudioBreadcrumbTemplate { + o := &NoteAudioBreadcrumbTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - 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.Objectid = func() int32 { return m.Objectid } - o.Status = func() null.Val[int16] { return m.Status } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Version = func() int32 { return m.Version } + o.Cell = func() string { return m.Cell } + o.Created = func() time.Time { return m.Created } + o.ManuallySelected = func() bool { return m.ManuallySelected } + o.NoteAudioVersion = func() int32 { return m.NoteAudioVersion } + o.NoteAudioUUID = func() uuid.UUID { return m.NoteAudioUUID } + o.Position = func() int32 { return m.Position } ctx := context.Background() - if m.R.Organization != nil { - HistoryFieldscoutinglogMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + if m.R.NoteAudio != nil { + NoteAudioBreadcrumbMods.WithExistingNoteAudio(m.R.NoteAudio).Apply(ctx, o) } return o } -func (f *Factory) NewHistoryHabitatrelate(mods ...HistoryHabitatrelateMod) *HistoryHabitatrelateTemplate { - return f.NewHistoryHabitatrelateWithContext(context.Background(), mods...) +func (f *Factory) NewNoteAudioDatum(mods ...NoteAudioDatumMod) *NoteAudioDatumTemplate { + return f.NewNoteAudioDatumWithContext(context.Background(), mods...) } -func (f *Factory) NewHistoryHabitatrelateWithContext(ctx context.Context, mods ...HistoryHabitatrelateMod) *HistoryHabitatrelateTemplate { - o := &HistoryHabitatrelateTemplate{f: f} +func (f *Factory) NewNoteAudioDatumWithContext(ctx context.Context, mods ...NoteAudioDatumMod) *NoteAudioDatumTemplate { + o := &NoteAudioDatumTemplate{f: f} if f != nil { - f.baseHistoryHabitatrelateMods.Apply(ctx, o) + f.baseNoteAudioDatumMods.Apply(ctx, o) } - HistoryHabitatrelateModSlice(mods).Apply(ctx, o) + NoteAudioDatumModSlice(mods).Apply(ctx, o) return o } -func (f *Factory) FromExistingHistoryHabitatrelate(m *models.HistoryHabitatrelate) *HistoryHabitatrelateTemplate { - o := &HistoryHabitatrelateTemplate{f: f, alreadyPersisted: true} +func (f *Factory) FromExistingNoteAudioDatum(m *models.NoteAudioDatum) *NoteAudioDatumTemplate { + o := &NoteAudioDatumTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - 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.ForeignID = func() null.Val[string] { return m.ForeignID } - o.Globalid = func() null.Val[string] { return m.Globalid } - o.Habitattype = func() null.Val[string] { return m.Habitattype } - o.Objectid = func() int32 { return m.Objectid } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Version = func() int32 { return m.Version } + o.Created = func() time.Time { return m.Created } + o.NoteAudioVersion = func() int32 { return m.NoteAudioVersion } + o.NoteAudioUUID = func() uuid.UUID { return m.NoteAudioUUID } + o.Type = func() enums.Audiodatatype { return m.Type } ctx := context.Background() - if m.R.Organization != nil { - HistoryHabitatrelateMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + if m.R.NoteAudio != nil { + NoteAudioDatumMods.WithExistingNoteAudio(m.R.NoteAudio).Apply(ctx, o) } return o } -func (f *Factory) NewHistoryInspectionsample(mods ...HistoryInspectionsampleMod) *HistoryInspectionsampleTemplate { - return f.NewHistoryInspectionsampleWithContext(context.Background(), mods...) +func (f *Factory) NewNoteImage(mods ...NoteImageMod) *NoteImageTemplate { + return f.NewNoteImageWithContext(context.Background(), mods...) } -func (f *Factory) NewHistoryInspectionsampleWithContext(ctx context.Context, mods ...HistoryInspectionsampleMod) *HistoryInspectionsampleTemplate { - o := &HistoryInspectionsampleTemplate{f: f} +func (f *Factory) NewNoteImageWithContext(ctx context.Context, mods ...NoteImageMod) *NoteImageTemplate { + o := &NoteImageTemplate{f: f} if f != nil { - f.baseHistoryInspectionsampleMods.Apply(ctx, o) + f.baseNoteImageMods.Apply(ctx, o) } - HistoryInspectionsampleModSlice(mods).Apply(ctx, o) + NoteImageModSlice(mods).Apply(ctx, o) return o } -func (f *Factory) FromExistingHistoryInspectionsample(m *models.HistoryInspectionsample) *HistoryInspectionsampleTemplate { - o := &HistoryInspectionsampleTemplate{f: f, alreadyPersisted: true} +func (f *Factory) FromExistingNoteImage(m *models.NoteImage) *NoteImageTemplate { + o := &NoteImageTemplate{f: f, alreadyPersisted: true} + o.Created = func() time.Time { return m.Created } + o.CreatorID = func() int32 { return m.CreatorID } + o.Deleted = func() null.Val[time.Time] { return m.Deleted } + o.DeletorID = func() null.Val[int32] { return m.DeletorID } o.OrganizationID = func() int32 { return m.OrganizationID } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - 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.Idbytech = func() null.Val[string] { return m.Idbytech } - o.InspID = func() null.Val[string] { return m.InspID } - o.Objectid = func() int32 { return m.Objectid } - o.Processed = func() null.Val[int16] { return m.Processed } - o.Sampleid = func() null.Val[string] { return m.Sampleid } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } o.Version = func() int32 { return m.Version } + o.UUID = func() uuid.UUID { return m.UUID } ctx := context.Background() + if m.R.CreatorUser != nil { + NoteImageMods.WithExistingCreatorUser(m.R.CreatorUser).Apply(ctx, o) + } + if m.R.DeletorUser != nil { + NoteImageMods.WithExistingDeletorUser(m.R.DeletorUser).Apply(ctx, o) + } if m.R.Organization != nil { - HistoryInspectionsampleMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + NoteImageMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + } + if len(m.R.NoteImageBreadcrumbs) > 0 { + NoteImageMods.AddExistingNoteImageBreadcrumbs(m.R.NoteImageBreadcrumbs...).Apply(ctx, o) + } + if len(m.R.NoteImageData) > 0 { + NoteImageMods.AddExistingNoteImageData(m.R.NoteImageData...).Apply(ctx, o) } return o } -func (f *Factory) NewHistoryInspectionsampledetail(mods ...HistoryInspectionsampledetailMod) *HistoryInspectionsampledetailTemplate { - return f.NewHistoryInspectionsampledetailWithContext(context.Background(), mods...) +func (f *Factory) NewNoteImageBreadcrumb(mods ...NoteImageBreadcrumbMod) *NoteImageBreadcrumbTemplate { + return f.NewNoteImageBreadcrumbWithContext(context.Background(), mods...) } -func (f *Factory) NewHistoryInspectionsampledetailWithContext(ctx context.Context, mods ...HistoryInspectionsampledetailMod) *HistoryInspectionsampledetailTemplate { - o := &HistoryInspectionsampledetailTemplate{f: f} +func (f *Factory) NewNoteImageBreadcrumbWithContext(ctx context.Context, mods ...NoteImageBreadcrumbMod) *NoteImageBreadcrumbTemplate { + o := &NoteImageBreadcrumbTemplate{f: f} if f != nil { - f.baseHistoryInspectionsampledetailMods.Apply(ctx, o) + f.baseNoteImageBreadcrumbMods.Apply(ctx, o) } - HistoryInspectionsampledetailModSlice(mods).Apply(ctx, o) + NoteImageBreadcrumbModSlice(mods).Apply(ctx, o) return o } -func (f *Factory) FromExistingHistoryInspectionsampledetail(m *models.HistoryInspectionsampledetail) *HistoryInspectionsampledetailTemplate { - o := &HistoryInspectionsampledetailTemplate{f: f, alreadyPersisted: true} +func (f *Factory) FromExistingNoteImageBreadcrumb(m *models.NoteImageBreadcrumb) *NoteImageBreadcrumbTemplate { + o := &NoteImageBreadcrumbTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Comments = func() null.Val[string] { return m.Comments } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - 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.Fadultact = func() null.Val[string] { return m.Fadultact } - o.Fdomstage = func() null.Val[string] { return m.Fdomstage } - o.Feggcount = func() null.Val[int16] { return m.Feggcount } - o.Fieldspecies = func() null.Val[string] { return m.Fieldspecies } - 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.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 } - o.Leggcount = func() null.Val[int16] { return m.Leggcount } - o.Llarvcount = func() null.Val[int16] { return m.Llarvcount } - o.Lpupcount = func() null.Val[int16] { return m.Lpupcount } - o.Objectid = func() int32 { return m.Objectid } - o.Processed = func() null.Val[int16] { return m.Processed } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Version = func() int32 { return m.Version } + o.Cell = func() string { return m.Cell } + o.Created = func() time.Time { return m.Created } + o.ManuallySelected = func() bool { return m.ManuallySelected } + o.NoteImageVersion = func() int32 { return m.NoteImageVersion } + o.NoteImageUUID = func() uuid.UUID { return m.NoteImageUUID } + o.Position = func() int32 { return m.Position } ctx := context.Background() - if m.R.Organization != nil { - HistoryInspectionsampledetailMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + if m.R.NoteImage != nil { + NoteImageBreadcrumbMods.WithExistingNoteImage(m.R.NoteImage).Apply(ctx, o) } return o } -func (f *Factory) NewHistoryLinelocation(mods ...HistoryLinelocationMod) *HistoryLinelocationTemplate { - return f.NewHistoryLinelocationWithContext(context.Background(), mods...) +func (f *Factory) NewNoteImageDatum(mods ...NoteImageDatumMod) *NoteImageDatumTemplate { + return f.NewNoteImageDatumWithContext(context.Background(), mods...) } -func (f *Factory) NewHistoryLinelocationWithContext(ctx context.Context, mods ...HistoryLinelocationMod) *HistoryLinelocationTemplate { - o := &HistoryLinelocationTemplate{f: f} +func (f *Factory) NewNoteImageDatumWithContext(ctx context.Context, mods ...NoteImageDatumMod) *NoteImageDatumTemplate { + o := &NoteImageDatumTemplate{f: f} if f != nil { - f.baseHistoryLinelocationMods.Apply(ctx, o) + f.baseNoteImageDatumMods.Apply(ctx, o) } - HistoryLinelocationModSlice(mods).Apply(ctx, o) + NoteImageDatumModSlice(mods).Apply(ctx, o) return o } -func (f *Factory) FromExistingHistoryLinelocation(m *models.HistoryLinelocation) *HistoryLinelocationTemplate { - o := &HistoryLinelocationTemplate{f: f, alreadyPersisted: true} +func (f *Factory) FromExistingNoteImageDatum(m *models.NoteImageDatum) *NoteImageDatumTemplate { + o := &NoteImageDatumTemplate{f: f, alreadyPersisted: true} - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Accessdesc = func() null.Val[string] { return m.Accessdesc } - o.Acres = func() null.Val[float64] { return m.Acres } - o.Active = func() null.Val[int16] { return m.Active } - o.Comments = func() null.Val[string] { return m.Comments } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Description = func() null.Val[string] { return m.Description } - 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.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 } - o.Larvinspectinterval = func() null.Val[int16] { return m.Larvinspectinterval } - o.Lastinspectactiontaken = func() null.Val[string] { return m.Lastinspectactiontaken } - o.Lastinspectactivity = func() null.Val[string] { return m.Lastinspectactivity } - o.Lastinspectavglarvae = func() null.Val[float64] { return m.Lastinspectavglarvae } - o.Lastinspectavgpupae = func() null.Val[float64] { return m.Lastinspectavgpupae } - o.Lastinspectbreeding = func() null.Val[string] { return m.Lastinspectbreeding } - o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions } - o.Lastinspectdate = func() null.Val[int64] { return m.Lastinspectdate } - o.Lastinspectfieldspecies = func() null.Val[string] { return m.Lastinspectfieldspecies } - o.Lastinspectlstages = func() null.Val[string] { return m.Lastinspectlstages } - o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity } - o.Lasttreatdate = func() null.Val[int64] { return m.Lasttreatdate } - o.Lasttreatproduct = func() null.Val[string] { return m.Lasttreatproduct } - o.Lasttreatqty = func() null.Val[float64] { return m.Lasttreatqty } - o.Lasttreatqtyunit = func() null.Val[string] { return m.Lasttreatqtyunit } - o.LengthFT = func() null.Val[float64] { return m.LengthFT } - o.LengthMeters = func() null.Val[float64] { return m.LengthMeters } - o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } - o.Name = func() null.Val[string] { return m.Name } - o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } - o.Objectid = func() int32 { return m.Objectid } - o.Priority = func() null.Val[string] { return m.Priority } - o.Symbology = func() null.Val[string] { return m.Symbology } - o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } - o.Usetype = func() null.Val[string] { return m.Usetype } - o.Waterorigin = func() null.Val[string] { return m.Waterorigin } - o.WidthFT = func() null.Val[float64] { return m.WidthFT } - o.WidthMeters = func() null.Val[float64] { return m.WidthMeters } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Version = func() int32 { return m.Version } + o.Created = func() time.Time { return m.Created } + o.NoteImageVersion = func() int32 { return m.NoteImageVersion } + o.NoteImageUUID = func() uuid.UUID { return m.NoteImageUUID } + o.Type = func() enums.Audiodatatype { return m.Type } ctx := context.Background() - if m.R.Organization != nil { - HistoryLinelocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryLocationtracking(mods ...HistoryLocationtrackingMod) *HistoryLocationtrackingTemplate { - return f.NewHistoryLocationtrackingWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryLocationtrackingWithContext(ctx context.Context, mods ...HistoryLocationtrackingMod) *HistoryLocationtrackingTemplate { - o := &HistoryLocationtrackingTemplate{f: f} - - if f != nil { - f.baseHistoryLocationtrackingMods.Apply(ctx, o) - } - - HistoryLocationtrackingModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryLocationtracking(m *models.HistoryLocationtracking) *HistoryLocationtrackingTemplate { - o := &HistoryLocationtrackingTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Accuracy = func() null.Val[float64] { return m.Accuracy } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - 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.Fieldtech = func() null.Val[string] { return m.Fieldtech } - o.Globalid = func() null.Val[string] { return m.Globalid } - o.Objectid = func() int32 { return m.Objectid } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryLocationtrackingMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryMosquitoinspection(mods ...HistoryMosquitoinspectionMod) *HistoryMosquitoinspectionTemplate { - return f.NewHistoryMosquitoinspectionWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryMosquitoinspectionWithContext(ctx context.Context, mods ...HistoryMosquitoinspectionMod) *HistoryMosquitoinspectionTemplate { - o := &HistoryMosquitoinspectionTemplate{f: f} - - if f != nil { - f.baseHistoryMosquitoinspectionMods.Apply(ctx, o) - } - - HistoryMosquitoinspectionModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryMosquitoinspection(m *models.HistoryMosquitoinspection) *HistoryMosquitoinspectionTemplate { - o := &HistoryMosquitoinspectionTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Actiontaken = func() null.Val[string] { return m.Actiontaken } - o.Activity = func() null.Val[string] { return m.Activity } - o.Adultact = func() null.Val[string] { return m.Adultact } - o.Avetemp = func() null.Val[float64] { return m.Avetemp } - o.Avglarvae = func() null.Val[float64] { return m.Avglarvae } - o.Avgpupae = func() null.Val[float64] { return m.Avgpupae } - o.Breeding = func() null.Val[string] { return m.Breeding } - o.Cbcount = func() null.Val[int16] { return m.Cbcount } - o.Comments = func() null.Val[string] { return m.Comments } - o.Containercount = func() null.Val[int16] { return m.Containercount } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Domstage = func() null.Val[string] { return m.Domstage } - o.Eggs = func() null.Val[int16] { return m.Eggs } - o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } - o.Editdate = func() null.Val[int64] { return m.Editdate } - 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.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 } - o.Locationname = func() null.Val[string] { return m.Locationname } - o.Lstages = func() null.Val[string] { return m.Lstages } - o.Numdips = func() null.Val[int16] { return m.Numdips } - o.Objectid = func() int32 { return m.Objectid } - o.Personalcontact = func() null.Val[int16] { return m.Personalcontact } - o.Pointlocid = func() null.Val[string] { return m.Pointlocid } - o.Polygonlocid = func() null.Val[string] { return m.Polygonlocid } - o.Posdips = func() null.Val[int16] { return m.Posdips } - o.Positivecontainercount = func() null.Val[int16] { return m.Positivecontainercount } - o.Pupaepresent = func() null.Val[int16] { return m.Pupaepresent } - o.Raingauge = func() null.Val[float64] { return m.Raingauge } - o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } - o.Reviewed = func() null.Val[int16] { return m.Reviewed } - o.Reviewedby = func() null.Val[string] { return m.Reviewedby } - o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } - o.Sdid = func() null.Val[string] { return m.Sdid } - o.Sitecond = func() null.Val[string] { return m.Sitecond } - o.Srid = func() null.Val[string] { return m.Srid } - o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } - o.Tirecount = func() null.Val[int16] { return m.Tirecount } - o.Totlarvae = func() null.Val[int16] { return m.Totlarvae } - o.Totpupae = func() null.Val[int16] { return m.Totpupae } - o.Visualmonitoring = func() null.Val[int16] { return m.Visualmonitoring } - o.Vmcomments = func() null.Val[string] { return m.Vmcomments } - o.Winddir = func() null.Val[string] { return m.Winddir } - o.Windspeed = func() null.Val[float64] { return m.Windspeed } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Adminaction = func() null.Val[string] { return m.Adminaction } - o.Ptaid = func() null.Val[string] { return m.Ptaid } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryMosquitoinspectionMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryPointlocation(mods ...HistoryPointlocationMod) *HistoryPointlocationTemplate { - return f.NewHistoryPointlocationWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryPointlocationWithContext(ctx context.Context, mods ...HistoryPointlocationMod) *HistoryPointlocationTemplate { - o := &HistoryPointlocationTemplate{f: f} - - if f != nil { - f.baseHistoryPointlocationMods.Apply(ctx, o) - } - - HistoryPointlocationModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryPointlocation(m *models.HistoryPointlocation) *HistoryPointlocationTemplate { - o := &HistoryPointlocationTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Accessdesc = func() null.Val[string] { return m.Accessdesc } - o.Active = func() null.Val[int16] { return m.Active } - o.Comments = func() null.Val[string] { return m.Comments } - o.Created = func() null.Val[time.Time] { return m.Created } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Description = func() null.Val[string] { return m.Description } - 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.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 } - o.Lastinspectactiontaken = func() null.Val[string] { return m.Lastinspectactiontaken } - o.Lastinspectactivity = func() null.Val[string] { return m.Lastinspectactivity } - o.Lastinspectavglarvae = func() null.Val[float64] { return m.Lastinspectavglarvae } - o.Lastinspectavgpupae = func() null.Val[float64] { return m.Lastinspectavgpupae } - o.Lastinspectbreeding = func() null.Val[string] { return m.Lastinspectbreeding } - o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions } - o.Lastinspectdate = func() null.Val[int64] { return m.Lastinspectdate } - o.Lastinspectfieldspecies = func() null.Val[string] { return m.Lastinspectfieldspecies } - o.Lastinspectlstages = func() null.Val[string] { return m.Lastinspectlstages } - o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity } - o.Lasttreatdate = func() null.Val[int64] { return m.Lasttreatdate } - o.Lasttreatproduct = func() null.Val[string] { return m.Lasttreatproduct } - o.Lasttreatqty = func() null.Val[float64] { return m.Lasttreatqty } - o.Lasttreatqtyunit = func() null.Val[string] { return m.Lasttreatqtyunit } - o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } - o.Name = func() null.Val[string] { return m.Name } - o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } - o.Objectid = func() int32 { return m.Objectid } - o.Priority = func() null.Val[string] { return m.Priority } - o.Stype = func() null.Val[string] { return m.Stype } - o.Symbology = func() null.Val[string] { return m.Symbology } - o.Usetype = func() null.Val[string] { return m.Usetype } - o.Waterorigin = func() null.Val[string] { return m.Waterorigin } - o.X = func() null.Val[float64] { return m.X } - 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.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 } - o.Sourcestatus = func() null.Val[string] { return m.Sourcestatus } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryPointlocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryPolygonlocation(mods ...HistoryPolygonlocationMod) *HistoryPolygonlocationTemplate { - return f.NewHistoryPolygonlocationWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryPolygonlocationWithContext(ctx context.Context, mods ...HistoryPolygonlocationMod) *HistoryPolygonlocationTemplate { - o := &HistoryPolygonlocationTemplate{f: f} - - if f != nil { - f.baseHistoryPolygonlocationMods.Apply(ctx, o) - } - - HistoryPolygonlocationModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryPolygonlocation(m *models.HistoryPolygonlocation) *HistoryPolygonlocationTemplate { - o := &HistoryPolygonlocationTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Accessdesc = func() null.Val[string] { return m.Accessdesc } - o.Acres = func() null.Val[float64] { return m.Acres } - o.Active = func() null.Val[int16] { return m.Active } - o.Comments = func() null.Val[string] { return m.Comments } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Description = func() null.Val[string] { return m.Description } - 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.Filter = func() null.Val[string] { return m.Filter } - o.Globalid = func() null.Val[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 } - o.Larvinspectinterval = func() null.Val[int16] { return m.Larvinspectinterval } - o.Lastinspectactiontaken = func() null.Val[string] { return m.Lastinspectactiontaken } - o.Lastinspectactivity = func() null.Val[string] { return m.Lastinspectactivity } - o.Lastinspectavglarvae = func() null.Val[float64] { return m.Lastinspectavglarvae } - o.Lastinspectavgpupae = func() null.Val[float64] { return m.Lastinspectavgpupae } - o.Lastinspectbreeding = func() null.Val[string] { return m.Lastinspectbreeding } - o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions } - o.Lastinspectdate = func() null.Val[int64] { return m.Lastinspectdate } - o.Lastinspectfieldspecies = func() null.Val[string] { return m.Lastinspectfieldspecies } - o.Lastinspectlstages = func() null.Val[string] { return m.Lastinspectlstages } - o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity } - o.Lasttreatdate = func() null.Val[int64] { return m.Lasttreatdate } - o.Lasttreatproduct = func() null.Val[string] { return m.Lasttreatproduct } - o.Lasttreatqty = func() null.Val[float64] { return m.Lasttreatqty } - o.Lasttreatqtyunit = func() null.Val[string] { return m.Lasttreatqtyunit } - o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } - o.Name = func() null.Val[string] { return m.Name } - o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } - o.Objectid = func() int32 { return m.Objectid } - o.Priority = func() null.Val[string] { return m.Priority } - o.Symbology = func() null.Val[string] { return m.Symbology } - o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } - o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } - o.Usetype = func() null.Val[string] { return m.Usetype } - o.Waterorigin = func() null.Val[string] { return m.Waterorigin } - 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.Version = func() int32 { return m.Version } - o.Created = func() null.Val[time.Time] { return m.Created } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryPolygonlocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryPool(mods ...HistoryPoolMod) *HistoryPoolTemplate { - return f.NewHistoryPoolWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryPoolWithContext(ctx context.Context, mods ...HistoryPoolMod) *HistoryPoolTemplate { - o := &HistoryPoolTemplate{f: f} - - if f != nil { - f.baseHistoryPoolMods.Apply(ctx, o) - } - - HistoryPoolModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryPool(m *models.HistoryPool) *HistoryPoolTemplate { - o := &HistoryPoolTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Comments = func() null.Val[string] { return m.Comments } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Datesent = func() null.Val[int64] { return m.Datesent } - o.Datetested = func() null.Val[int64] { return m.Datetested } - o.Diseasepos = func() null.Val[string] { return m.Diseasepos } - o.Diseasetested = func() null.Val[string] { return m.Diseasetested } - 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.Lab = func() null.Val[string] { return m.Lab } - o.LabID = func() null.Val[string] { return m.LabID } - o.Objectid = func() int32 { return m.Objectid } - o.Poolyear = func() null.Val[int16] { return m.Poolyear } - o.Processed = func() null.Val[int16] { return m.Processed } - o.Sampleid = func() null.Val[string] { return m.Sampleid } - o.Survtech = func() null.Val[string] { return m.Survtech } - o.Testmethod = func() null.Val[string] { return m.Testmethod } - o.Testtech = func() null.Val[string] { return m.Testtech } - o.TrapdataID = func() null.Val[string] { return m.TrapdataID } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Vectorsurvcollectionid = func() null.Val[string] { return m.Vectorsurvcollectionid } - o.Vectorsurvpoolid = func() null.Val[string] { return m.Vectorsurvpoolid } - o.Vectorsurvtrapdataid = func() null.Val[string] { return m.Vectorsurvtrapdataid } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryPoolMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryPooldetail(mods ...HistoryPooldetailMod) *HistoryPooldetailTemplate { - return f.NewHistoryPooldetailWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryPooldetailWithContext(ctx context.Context, mods ...HistoryPooldetailMod) *HistoryPooldetailTemplate { - o := &HistoryPooldetailTemplate{f: f} - - if f != nil { - f.baseHistoryPooldetailMods.Apply(ctx, o) - } - - HistoryPooldetailModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryPooldetail(m *models.HistoryPooldetail) *HistoryPooldetailTemplate { - o := &HistoryPooldetailTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - 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.Females = func() null.Val[int16] { return m.Females } - o.Globalid = func() null.Val[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 } - o.TrapdataID = func() null.Val[string] { return m.TrapdataID } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryPooldetailMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryProposedtreatmentarea(mods ...HistoryProposedtreatmentareaMod) *HistoryProposedtreatmentareaTemplate { - return f.NewHistoryProposedtreatmentareaWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryProposedtreatmentareaWithContext(ctx context.Context, mods ...HistoryProposedtreatmentareaMod) *HistoryProposedtreatmentareaTemplate { - o := &HistoryProposedtreatmentareaTemplate{f: f} - - if f != nil { - f.baseHistoryProposedtreatmentareaMods.Apply(ctx, o) - } - - HistoryProposedtreatmentareaModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryProposedtreatmentarea(m *models.HistoryProposedtreatmentarea) *HistoryProposedtreatmentareaTemplate { - o := &HistoryProposedtreatmentareaTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Acres = func() null.Val[float64] { return m.Acres } - o.Comments = func() null.Val[string] { return m.Comments } - o.Completed = func() null.Val[int16] { return m.Completed } - o.Completedby = func() null.Val[string] { return m.Completedby } - o.Completeddate = func() null.Val[int64] { return m.Completeddate } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Duedate = func() null.Val[int64] { return m.Duedate } - 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.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 } - o.Lasttreatdate = func() null.Val[int64] { return m.Lasttreatdate } - o.Lasttreatproduct = func() null.Val[string] { return m.Lasttreatproduct } - o.Lasttreatqty = func() null.Val[float64] { return m.Lasttreatqty } - o.Lasttreatqtyunit = func() null.Val[string] { return m.Lasttreatqtyunit } - o.Method = func() null.Val[string] { return m.Method } - o.Name = func() null.Val[string] { return m.Name } - o.Objectid = func() int32 { return m.Objectid } - o.Priority = func() null.Val[string] { return m.Priority } - o.Reviewed = func() null.Val[int16] { return m.Reviewed } - o.Reviewedby = func() null.Val[string] { return m.Reviewedby } - o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } - o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } - o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } - o.Targetapprate = func() null.Val[float64] { return m.Targetapprate } - o.Targetproduct = func() null.Val[string] { return m.Targetproduct } - o.Targetspecies = func() null.Val[string] { return m.Targetspecies } - 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.Version = func() int32 { return m.Version } - o.Created = func() null.Val[time.Time] { return m.Created } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryProposedtreatmentareaMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryQamosquitoinspection(mods ...HistoryQamosquitoinspectionMod) *HistoryQamosquitoinspectionTemplate { - return f.NewHistoryQamosquitoinspectionWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryQamosquitoinspectionWithContext(ctx context.Context, mods ...HistoryQamosquitoinspectionMod) *HistoryQamosquitoinspectionTemplate { - o := &HistoryQamosquitoinspectionTemplate{f: f} - - if f != nil { - f.baseHistoryQamosquitoinspectionMods.Apply(ctx, o) - } - - HistoryQamosquitoinspectionModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryQamosquitoinspection(m *models.HistoryQamosquitoinspection) *HistoryQamosquitoinspectionTemplate { - o := &HistoryQamosquitoinspectionTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Acresbreeding = func() null.Val[float64] { return m.Acresbreeding } - o.Actiontaken = func() null.Val[string] { return m.Actiontaken } - o.Adultactivity = func() null.Val[int16] { return m.Adultactivity } - o.Aquaticorganisms = func() null.Val[string] { return m.Aquaticorganisms } - o.Avetemp = func() null.Val[float64] { return m.Avetemp } - o.Breedingpotential = func() null.Val[string] { return m.Breedingpotential } - o.Comments = func() null.Val[string] { return m.Comments } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } - 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.Fish = func() null.Val[int16] { return m.Fish } - o.Globalid = func() null.Val[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 } - o.Habvalue2percent = func() null.Val[int16] { return m.Habvalue2percent } - o.Larvaeinsidetreatedarea = func() null.Val[int16] { return m.Larvaeinsidetreatedarea } - o.Larvaeoutsidetreatedarea = func() null.Val[int16] { return m.Larvaeoutsidetreatedarea } - o.Larvaepresent = func() null.Val[int16] { return m.Larvaepresent } - o.Larvaereason = func() null.Val[string] { return m.Larvaereason } - o.Linelocid = func() null.Val[string] { return m.Linelocid } - o.Locationname = func() null.Val[string] { return m.Locationname } - o.LR = func() null.Val[int16] { return m.LR } - o.Mosquitohabitat = func() null.Val[string] { return m.Mosquitohabitat } - o.Movingwater = func() null.Val[int16] { return m.Movingwater } - o.Negdips = func() null.Val[int16] { return m.Negdips } - o.Nowaterever = func() null.Val[int16] { return m.Nowaterever } - o.Objectid = func() int32 { return m.Objectid } - o.Pointlocid = func() null.Val[string] { return m.Pointlocid } - o.Polygonlocid = func() null.Val[string] { return m.Polygonlocid } - o.Posdips = func() null.Val[int16] { return m.Posdips } - o.Potential = func() null.Val[int16] { return m.Potential } - o.Raingauge = func() null.Val[float64] { return m.Raingauge } - o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } - o.Reviewed = func() null.Val[int16] { return m.Reviewed } - o.Reviewedby = func() null.Val[string] { return m.Reviewedby } - o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } - o.Sitetype = func() null.Val[string] { return m.Sitetype } - o.Soilconditions = func() null.Val[string] { return m.Soilconditions } - o.Sourcereduction = func() null.Val[string] { return m.Sourcereduction } - o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } - o.Totalacres = func() null.Val[float64] { return m.Totalacres } - o.Vegetation = func() null.Val[string] { return m.Vegetation } - o.Waterconditions = func() null.Val[string] { return m.Waterconditions } - o.Waterduration = func() null.Val[string] { return m.Waterduration } - o.Watermovement1 = func() null.Val[string] { return m.Watermovement1 } - o.Watermovement1percent = func() null.Val[int16] { return m.Watermovement1percent } - o.Watermovement2 = func() null.Val[string] { return m.Watermovement2 } - o.Watermovement2percent = func() null.Val[int16] { return m.Watermovement2percent } - o.Waterpresent = func() null.Val[int16] { return m.Waterpresent } - o.Watersource = func() null.Val[string] { return m.Watersource } - o.Winddir = func() null.Val[string] { return m.Winddir } - o.Windspeed = func() null.Val[float64] { return m.Windspeed } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryQamosquitoinspectionMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryRodentlocation(mods ...HistoryRodentlocationMod) *HistoryRodentlocationTemplate { - return f.NewHistoryRodentlocationWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryRodentlocationWithContext(ctx context.Context, mods ...HistoryRodentlocationMod) *HistoryRodentlocationTemplate { - o := &HistoryRodentlocationTemplate{f: f} - - if f != nil { - f.baseHistoryRodentlocationMods.Apply(ctx, o) - } - - HistoryRodentlocationModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryRodentlocation(m *models.HistoryRodentlocation) *HistoryRodentlocationTemplate { - o := &HistoryRodentlocationTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Accessdesc = func() null.Val[string] { return m.Accessdesc } - o.Active = func() null.Val[int16] { return m.Active } - o.Comments = func() null.Val[string] { return m.Comments } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Description = func() null.Val[string] { return m.Description } - 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.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 } - o.Lastinspectdate = func() null.Val[int64] { return m.Lastinspectdate } - o.Lastinspectrodentevidence = func() null.Val[string] { return m.Lastinspectrodentevidence } - o.Lastinspectspecies = func() null.Val[string] { return m.Lastinspectspecies } - o.Locationname = func() null.Val[string] { return m.Locationname } - o.Locationnumber = func() null.Val[int64] { return m.Locationnumber } - o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } - o.Objectid = func() int32 { return m.Objectid } - o.Priority = func() null.Val[string] { return m.Priority } - o.Symbology = func() null.Val[string] { return m.Symbology } - o.Usetype = func() null.Val[string] { return m.Usetype } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryRodentlocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistorySamplecollection(mods ...HistorySamplecollectionMod) *HistorySamplecollectionTemplate { - return f.NewHistorySamplecollectionWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistorySamplecollectionWithContext(ctx context.Context, mods ...HistorySamplecollectionMod) *HistorySamplecollectionTemplate { - o := &HistorySamplecollectionTemplate{f: f} - - if f != nil { - f.baseHistorySamplecollectionMods.Apply(ctx, o) - } - - HistorySamplecollectionModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistorySamplecollection(m *models.HistorySamplecollection) *HistorySamplecollectionTemplate { - o := &HistorySamplecollectionTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Activity = func() null.Val[string] { return m.Activity } - o.Avetemp = func() null.Val[float64] { return m.Avetemp } - o.Chickenid = func() null.Val[string] { return m.Chickenid } - o.Comments = func() null.Val[string] { return m.Comments } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Datesent = func() null.Val[int64] { return m.Datesent } - o.Datetested = func() null.Val[int64] { return m.Datetested } - o.Diseasepos = func() null.Val[string] { return m.Diseasepos } - o.Diseasetested = func() null.Val[string] { return m.Diseasetested } - o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } - 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.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.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 } - o.Objectid = func() int32 { return m.Objectid } - o.Processed = func() null.Val[int16] { return m.Processed } - o.Raingauge = func() null.Val[float64] { return m.Raingauge } - o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } - o.Reviewed = func() null.Val[int16] { return m.Reviewed } - o.Reviewedby = func() null.Val[string] { return m.Reviewedby } - o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } - o.Samplecond = func() null.Val[string] { return m.Samplecond } - o.Samplecount = func() null.Val[int16] { return m.Samplecount } - o.Sampleid = func() null.Val[string] { return m.Sampleid } - o.Sampletype = func() null.Val[string] { return m.Sampletype } - o.Sex = func() null.Val[string] { return m.Sex } - o.Sitecond = func() null.Val[string] { return m.Sitecond } - o.Species = func() null.Val[string] { return m.Species } - o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } - o.Survtech = func() null.Val[string] { return m.Survtech } - o.Testmethod = func() null.Val[string] { return m.Testmethod } - o.Testtech = func() null.Val[string] { return m.Testtech } - o.Winddir = func() null.Val[string] { return m.Winddir } - o.Windspeed = func() null.Val[float64] { return m.Windspeed } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistorySamplecollectionMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistorySamplelocation(mods ...HistorySamplelocationMod) *HistorySamplelocationTemplate { - return f.NewHistorySamplelocationWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistorySamplelocationWithContext(ctx context.Context, mods ...HistorySamplelocationMod) *HistorySamplelocationTemplate { - o := &HistorySamplelocationTemplate{f: f} - - if f != nil { - f.baseHistorySamplelocationMods.Apply(ctx, o) - } - - HistorySamplelocationModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistorySamplelocation(m *models.HistorySamplelocation) *HistorySamplelocationTemplate { - o := &HistorySamplelocationTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Accessdesc = func() null.Val[string] { return m.Accessdesc } - o.Active = func() null.Val[int16] { return m.Active } - o.Comments = func() null.Val[string] { return m.Comments } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Description = func() null.Val[string] { return m.Description } - 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.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } - o.Globalid = func() null.Val[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 } - o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } - o.Objectid = func() int32 { return m.Objectid } - o.Priority = func() null.Val[string] { return m.Priority } - o.Usetype = func() null.Val[string] { return m.Usetype } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistorySamplelocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryServicerequest(mods ...HistoryServicerequestMod) *HistoryServicerequestTemplate { - return f.NewHistoryServicerequestWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryServicerequestWithContext(ctx context.Context, mods ...HistoryServicerequestMod) *HistoryServicerequestTemplate { - o := &HistoryServicerequestTemplate{f: f} - - if f != nil { - f.baseHistoryServicerequestMods.Apply(ctx, o) - } - - HistoryServicerequestModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryServicerequest(m *models.HistoryServicerequest) *HistoryServicerequestTemplate { - o := &HistoryServicerequestTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Accepted = func() null.Val[int16] { return m.Accepted } - o.Acceptedby = func() null.Val[string] { return m.Acceptedby } - o.Accepteddate = func() null.Val[int64] { return m.Accepteddate } - o.Allowed = func() null.Val[string] { return m.Allowed } - o.Assignedtech = func() null.Val[string] { return m.Assignedtech } - o.Clraddr1 = func() null.Val[string] { return m.Clraddr1 } - o.Clraddr2 = func() null.Val[string] { return m.Clraddr2 } - o.Clranon = func() null.Val[int16] { return m.Clranon } - o.Clrcity = func() null.Val[string] { return m.Clrcity } - o.Clrcompany = func() null.Val[string] { return m.Clrcompany } - o.Clrcontpref = func() null.Val[string] { return m.Clrcontpref } - o.Clremail = func() null.Val[string] { return m.Clremail } - o.Clrfname = func() null.Val[string] { return m.Clrfname } - o.Clrother = func() null.Val[string] { return m.Clrother } - o.Clrphone1 = func() null.Val[string] { return m.Clrphone1 } - o.Clrphone2 = func() null.Val[string] { return m.Clrphone2 } - o.Clrstate = func() null.Val[string] { return m.Clrstate } - o.Clrzip = func() null.Val[string] { return m.Clrzip } - o.Comments = func() null.Val[string] { return m.Comments } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Datetimeclosed = func() null.Val[int64] { return m.Datetimeclosed } - o.Duedate = func() null.Val[int64] { return m.Duedate } - o.Entrytech = func() null.Val[string] { return m.Entrytech } - o.Estcompletedate = func() null.Val[int64] { return m.Estcompletedate } - o.Externalerror = func() null.Val[string] { return m.Externalerror } - 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.Firstresponsedate = func() null.Val[int64] { return m.Firstresponsedate } - o.Globalid = func() null.Val[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 } - o.Notificationtimestamp = func() null.Val[string] { return m.Notificationtimestamp } - o.Notified = func() null.Val[int16] { return m.Notified } - o.Notifieddate = func() null.Val[int64] { return m.Notifieddate } - o.Objectid = func() int32 { return m.Objectid } - o.Pointlocid = func() null.Val[string] { return m.Pointlocid } - o.Priority = func() null.Val[string] { return m.Priority } - o.Recdatetime = func() null.Val[int64] { return m.Recdatetime } - o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } - o.Rejectedby = func() null.Val[string] { return m.Rejectedby } - o.Rejecteddate = func() null.Val[int64] { return m.Rejecteddate } - o.Rejectedreason = func() null.Val[string] { return m.Rejectedreason } - o.Reqaddr1 = func() null.Val[string] { return m.Reqaddr1 } - o.Reqaddr2 = func() null.Val[string] { return m.Reqaddr2 } - o.Reqcity = func() null.Val[string] { return m.Reqcity } - o.Reqcompany = func() null.Val[string] { return m.Reqcompany } - o.Reqcrossst = func() null.Val[string] { return m.Reqcrossst } - o.Reqdescr = func() null.Val[string] { return m.Reqdescr } - o.Reqfldnotes = func() null.Val[string] { return m.Reqfldnotes } - o.Reqmapgrid = func() null.Val[string] { return m.Reqmapgrid } - o.Reqnotesforcust = func() null.Val[string] { return m.Reqnotesforcust } - o.Reqnotesfortech = func() null.Val[string] { return m.Reqnotesfortech } - o.Reqpermission = func() null.Val[int16] { return m.Reqpermission } - o.Reqprogramactions = func() null.Val[string] { return m.Reqprogramactions } - o.Reqstate = func() null.Val[string] { return m.Reqstate } - o.Reqsubdiv = func() null.Val[string] { return m.Reqsubdiv } - o.Reqtarget = func() null.Val[string] { return m.Reqtarget } - o.Reqzip = func() null.Val[string] { return m.Reqzip } - o.Responsedaycount = func() null.Val[int16] { return m.Responsedaycount } - o.Reviewed = func() null.Val[int16] { return m.Reviewed } - o.Reviewedby = func() null.Val[string] { return m.Reviewedby } - o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } - o.Scheduled = func() null.Val[int16] { return m.Scheduled } - o.Scheduleddate = func() null.Val[int64] { return m.Scheduleddate } - o.Source = func() null.Val[string] { return m.Source } - o.SRNumber = func() null.Val[int64] { return m.SRNumber } - o.Status = func() null.Val[string] { return m.Status } - o.Supervisor = func() null.Val[string] { return m.Supervisor } - o.Techclosed = func() null.Val[string] { return m.Techclosed } - o.Validx = func() null.Val[string] { return m.Validx } - o.Validy = func() null.Val[string] { return m.Validy } - o.Xvalue = func() null.Val[string] { return m.Xvalue } - o.Yvalue = func() null.Val[string] { return m.Yvalue } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.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 } - o.Spanish = func() null.Val[int64] { return m.Spanish } - o.ScheduleNotes = func() null.Val[string] { return m.ScheduleNotes } - o.SchedulePeriod = func() null.Val[string] { return m.SchedulePeriod } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryServicerequestMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistorySpeciesabundance(mods ...HistorySpeciesabundanceMod) *HistorySpeciesabundanceTemplate { - return f.NewHistorySpeciesabundanceWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistorySpeciesabundanceWithContext(ctx context.Context, mods ...HistorySpeciesabundanceMod) *HistorySpeciesabundanceTemplate { - o := &HistorySpeciesabundanceTemplate{f: f} - - if f != nil { - f.baseHistorySpeciesabundanceMods.Apply(ctx, o) - } - - HistorySpeciesabundanceModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistorySpeciesabundance(m *models.HistorySpeciesabundance) *HistorySpeciesabundanceTemplate { - o := &HistorySpeciesabundanceTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Bloodedfem = func() null.Val[int16] { return m.Bloodedfem } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Eggs = func() null.Val[int16] { return m.Eggs } - o.Editdate = func() null.Val[int64] { return m.Editdate } - 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.Larvae = func() null.Val[int16] { return m.Larvae } - o.Males = func() null.Val[int16] { return m.Males } - o.Objectid = func() int32 { return m.Objectid } - o.Poolstogen = func() null.Val[int16] { return m.Poolstogen } - o.Processed = func() null.Val[int16] { return m.Processed } - o.Pupae = func() null.Val[int16] { return m.Pupae } - o.Species = func() null.Val[string] { return m.Species } - o.Total = func() null.Val[int64] { return m.Total } - o.TrapdataID = func() null.Val[string] { return m.TrapdataID } - o.Unknown = func() null.Val[int16] { return m.Unknown } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Globalzscore = func() null.Val[float64] { return m.Globalzscore } - o.H3R7 = func() null.Val[string] { return m.H3R7 } - o.H3R8 = func() null.Val[string] { return m.H3R8 } - o.R7score = func() null.Val[float64] { return m.R7score } - o.R8score = func() null.Val[float64] { return m.R8score } - o.Yearweek = func() null.Val[int64] { return m.Yearweek } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistorySpeciesabundanceMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryStormdrain(mods ...HistoryStormdrainMod) *HistoryStormdrainTemplate { - return f.NewHistoryStormdrainWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryStormdrainWithContext(ctx context.Context, mods ...HistoryStormdrainMod) *HistoryStormdrainTemplate { - o := &HistoryStormdrainTemplate{f: f} - - if f != nil { - f.baseHistoryStormdrainMods.Apply(ctx, o) - } - - HistoryStormdrainModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryStormdrain(m *models.HistoryStormdrain) *HistoryStormdrainTemplate { - o := &HistoryStormdrainTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - 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.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 } - o.Lasttreatdate = func() null.Val[int64] { return m.Lasttreatdate } - o.Nexttreatmentdate = func() null.Val[int64] { return m.Nexttreatmentdate } - o.Objectid = func() int32 { return m.Objectid } - o.Symbology = func() null.Val[string] { return m.Symbology } - o.Type = func() null.Val[string] { return m.Type } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryStormdrainMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryTimecard(mods ...HistoryTimecardMod) *HistoryTimecardTemplate { - return f.NewHistoryTimecardWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryTimecardWithContext(ctx context.Context, mods ...HistoryTimecardMod) *HistoryTimecardTemplate { - o := &HistoryTimecardTemplate{f: f} - - if f != nil { - f.baseHistoryTimecardMods.Apply(ctx, o) - } - - HistoryTimecardModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryTimecard(m *models.HistoryTimecard) *HistoryTimecardTemplate { - o := &HistoryTimecardTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Activity = func() null.Val[string] { return m.Activity } - o.Comments = func() null.Val[string] { return m.Comments } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } - o.Equiptype = func() null.Val[string] { return m.Equiptype } - 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.Fieldtech = func() null.Val[string] { return m.Fieldtech } - o.Globalid = func() null.Val[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 } - o.Objectid = func() int32 { return m.Objectid } - o.Pointlocid = func() null.Val[string] { return m.Pointlocid } - o.Polygonlocid = func() null.Val[string] { return m.Polygonlocid } - o.Samplelocid = func() null.Val[string] { return m.Samplelocid } - o.Srid = func() null.Val[string] { return m.Srid } - o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } - o.Traplocid = func() null.Val[string] { return m.Traplocid } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Rodentlocid = func() null.Val[string] { return m.Rodentlocid } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryTimecardMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryTrapdatum(mods ...HistoryTrapdatumMod) *HistoryTrapdatumTemplate { - return f.NewHistoryTrapdatumWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryTrapdatumWithContext(ctx context.Context, mods ...HistoryTrapdatumMod) *HistoryTrapdatumTemplate { - o := &HistoryTrapdatumTemplate{f: f} - - if f != nil { - f.baseHistoryTrapdatumMods.Apply(ctx, o) - } - - HistoryTrapdatumModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryTrapdatum(m *models.HistoryTrapdatum) *HistoryTrapdatumTemplate { - o := &HistoryTrapdatumTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Avetemp = func() null.Val[float64] { return m.Avetemp } - o.Comments = func() null.Val[string] { return m.Comments } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } - 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.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.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 } - o.LR = func() null.Val[int16] { return m.LR } - o.Objectid = func() int32 { return m.Objectid } - o.Processed = func() null.Val[int16] { return m.Processed } - o.Raingauge = func() null.Val[float64] { return m.Raingauge } - o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } - o.Reviewed = func() null.Val[int16] { return m.Reviewed } - o.Reviewedby = func() null.Val[string] { return m.Reviewedby } - o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } - o.Sitecond = func() null.Val[string] { return m.Sitecond } - o.Sortbytech = func() null.Val[string] { return m.Sortbytech } - o.Srid = func() null.Val[string] { return m.Srid } - o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } - o.Trapactivitytype = func() null.Val[string] { return m.Trapactivitytype } - o.Trapcondition = func() null.Val[string] { return m.Trapcondition } - o.Trapnights = func() null.Val[int16] { return m.Trapnights } - o.Traptype = func() null.Val[string] { return m.Traptype } - o.Voltage = func() null.Val[float64] { return m.Voltage } - o.Winddir = func() null.Val[string] { return m.Winddir } - o.Windspeed = func() null.Val[float64] { return m.Windspeed } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Lure = func() null.Val[string] { return m.Lure } - o.Vectorsurvtrapdataid = func() null.Val[string] { return m.Vectorsurvtrapdataid } - o.Vectorsurvtraplocationid = func() null.Val[string] { return m.Vectorsurvtraplocationid } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryTrapdatumMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryTraplocation(mods ...HistoryTraplocationMod) *HistoryTraplocationTemplate { - return f.NewHistoryTraplocationWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryTraplocationWithContext(ctx context.Context, mods ...HistoryTraplocationMod) *HistoryTraplocationTemplate { - o := &HistoryTraplocationTemplate{f: f} - - if f != nil { - f.baseHistoryTraplocationMods.Apply(ctx, o) - } - - HistoryTraplocationModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryTraplocation(m *models.HistoryTraplocation) *HistoryTraplocationTemplate { - o := &HistoryTraplocationTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Accessdesc = func() null.Val[string] { return m.Accessdesc } - o.Active = func() null.Val[int16] { return m.Active } - o.Comments = func() null.Val[string] { return m.Comments } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Description = func() null.Val[string] { return m.Description } - 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.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } - o.Globalid = func() null.Val[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 } - o.Nextactiondatescheduled = func() null.Val[int64] { return m.Nextactiondatescheduled } - o.Objectid = func() int32 { return m.Objectid } - o.Priority = func() null.Val[string] { return m.Priority } - o.Usetype = func() null.Val[string] { return m.Usetype } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Route = func() null.Val[int64] { return m.Route } - o.RouteOrder = func() null.Val[int64] { return m.RouteOrder } - o.SetDow = func() null.Val[int64] { return m.SetDow } - o.Vectorsurvsiteid = func() null.Val[string] { return m.Vectorsurvsiteid } - o.H3R7 = func() null.Val[string] { return m.H3R7 } - o.H3R8 = func() null.Val[string] { return m.H3R8 } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryTraplocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryTreatment(mods ...HistoryTreatmentMod) *HistoryTreatmentTemplate { - return f.NewHistoryTreatmentWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryTreatmentWithContext(ctx context.Context, mods ...HistoryTreatmentMod) *HistoryTreatmentTemplate { - o := &HistoryTreatmentTemplate{f: f} - - if f != nil { - f.baseHistoryTreatmentMods.Apply(ctx, o) - } - - HistoryTreatmentModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryTreatment(m *models.HistoryTreatment) *HistoryTreatmentTemplate { - o := &HistoryTreatmentTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Activity = func() null.Val[string] { return m.Activity } - o.Areaunit = func() null.Val[string] { return m.Areaunit } - o.Avetemp = func() null.Val[float64] { return m.Avetemp } - o.Barrierrouteid = func() null.Val[string] { return m.Barrierrouteid } - o.Cbcount = func() null.Val[int16] { return m.Cbcount } - o.Comments = func() null.Val[string] { return m.Comments } - o.Containercount = func() null.Val[int16] { return m.Containercount } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Enddatetime = func() null.Val[int64] { return m.Enddatetime } - o.Equiptype = func() null.Val[string] { return m.Equiptype } - 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.Flowrate = func() null.Val[float64] { return m.Flowrate } - o.Globalid = func() null.Val[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 } - o.Linelocid = func() null.Val[string] { return m.Linelocid } - o.Locationname = func() null.Val[string] { return m.Locationname } - o.Method = func() null.Val[string] { return m.Method } - o.Objectid = func() int32 { return m.Objectid } - o.Pointlocid = func() null.Val[string] { return m.Pointlocid } - o.Polygonlocid = func() null.Val[string] { return m.Polygonlocid } - o.Product = func() null.Val[string] { return m.Product } - o.Ptaid = func() null.Val[string] { return m.Ptaid } - o.Qty = func() null.Val[float64] { return m.Qty } - o.Qtyunit = func() null.Val[string] { return m.Qtyunit } - o.Raingauge = func() null.Val[float64] { return m.Raingauge } - o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } - o.Reviewed = func() null.Val[int16] { return m.Reviewed } - o.Reviewedby = func() null.Val[string] { return m.Reviewedby } - o.Revieweddate = func() null.Val[int64] { return m.Revieweddate } - o.Sdid = func() null.Val[string] { return m.Sdid } - o.Sitecond = func() null.Val[string] { return m.Sitecond } - o.Srid = func() null.Val[string] { return m.Srid } - o.Startdatetime = func() null.Val[int64] { return m.Startdatetime } - o.Targetspecies = func() null.Val[string] { return m.Targetspecies } - o.Tirecount = func() null.Val[int16] { return m.Tirecount } - o.Treatacres = func() null.Val[float64] { return m.Treatacres } - o.Treatarea = func() null.Val[float64] { return m.Treatarea } - o.Treathectares = func() null.Val[float64] { return m.Treathectares } - o.Treatmenthours = func() null.Val[float64] { return m.Treatmenthours } - o.Treatmentlength = func() null.Val[float64] { return m.Treatmentlength } - o.Treatmentlengthunits = func() null.Val[string] { return m.Treatmentlengthunits } - o.Totalcostprodcut = func() null.Val[float64] { return m.Totalcostprodcut } - o.Ulvrouteid = func() null.Val[string] { return m.Ulvrouteid } - o.Warningoverride = func() null.Val[int16] { return m.Warningoverride } - o.Winddir = func() null.Val[string] { return m.Winddir } - o.Windspeed = func() null.Val[float64] { return m.Windspeed } - 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.TempSitecond = func() null.Val[string] { return m.TempSitecond } - o.Version = func() int32 { return m.Version } - o.Created = func() null.Val[time.Time] { return m.Created } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryTreatmentMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryTreatmentarea(mods ...HistoryTreatmentareaMod) *HistoryTreatmentareaTemplate { - return f.NewHistoryTreatmentareaWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryTreatmentareaWithContext(ctx context.Context, mods ...HistoryTreatmentareaMod) *HistoryTreatmentareaTemplate { - o := &HistoryTreatmentareaTemplate{f: f} - - if f != nil { - f.baseHistoryTreatmentareaMods.Apply(ctx, o) - } - - HistoryTreatmentareaModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryTreatmentarea(m *models.HistoryTreatmentarea) *HistoryTreatmentareaTemplate { - o := &HistoryTreatmentareaTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Comments = func() null.Val[string] { return m.Comments } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - 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.Notified = func() null.Val[int16] { return m.Notified } - o.Objectid = func() int32 { return m.Objectid } - o.SessionID = func() null.Val[string] { return m.SessionID } - o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } - o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } - o.Treatdate = func() null.Val[int64] { return m.Treatdate } - o.TreatID = func() null.Val[string] { return m.TreatID } - o.Type = func() null.Val[string] { return m.Type } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryTreatmentareaMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryZone(mods ...HistoryZoneMod) *HistoryZoneTemplate { - return f.NewHistoryZoneWithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryZoneWithContext(ctx context.Context, mods ...HistoryZoneMod) *HistoryZoneTemplate { - o := &HistoryZoneTemplate{f: f} - - if f != nil { - f.baseHistoryZoneMods.Apply(ctx, o) - } - - HistoryZoneModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryZone(m *models.HistoryZone) *HistoryZoneTemplate { - o := &HistoryZoneTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Active = func() null.Val[int64] { return m.Active } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - 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.Name = func() null.Val[string] { return m.Name } - o.Objectid = func() int32 { return m.Objectid } - o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } - o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryZoneMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewHistoryZones2(mods ...HistoryZones2Mod) *HistoryZones2Template { - return f.NewHistoryZones2WithContext(context.Background(), mods...) -} - -func (f *Factory) NewHistoryZones2WithContext(ctx context.Context, mods ...HistoryZones2Mod) *HistoryZones2Template { - o := &HistoryZones2Template{f: f} - - if f != nil { - f.baseHistoryZones2Mods.Apply(ctx, o) - } - - HistoryZones2ModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingHistoryZones2(m *models.HistoryZones2) *HistoryZones2Template { - o := &HistoryZones2Template{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Creationdate = func() null.Val[int64] { return m.Creationdate } - 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.Name = func() null.Val[string] { return m.Name } - o.Objectid = func() int32 { return m.Objectid } - o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } - o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } - o.Created = func() null.Val[time.Time] { return m.Created } - 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.LastEditedDate = func() null.Val[int64] { return m.LastEditedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if m.R.Organization != nil { - HistoryZones2Mods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) + if m.R.NoteImage != nil { + NoteImageDatumMods.WithExistingNoteImage(m.R.NoteImage).Apply(ctx, o) } return o @@ -5406,173 +2266,98 @@ func (f *Factory) FromExistingOrganization(m *models.Organization) *Organization o.FieldseekerURL = func() null.Val[string] { return m.FieldseekerURL } ctx := context.Background() + if len(m.R.Containerrelates) > 0 { + OrganizationMods.AddExistingContainerrelates(m.R.Containerrelates...).Apply(ctx, o) + } + if len(m.R.Fieldscoutinglogs) > 0 { + OrganizationMods.AddExistingFieldscoutinglogs(m.R.Fieldscoutinglogs...).Apply(ctx, o) + } + if len(m.R.Habitatrelates) > 0 { + OrganizationMods.AddExistingHabitatrelates(m.R.Habitatrelates...).Apply(ctx, o) + } + if len(m.R.Inspectionsamples) > 0 { + OrganizationMods.AddExistingInspectionsamples(m.R.Inspectionsamples...).Apply(ctx, o) + } + if len(m.R.Inspectionsampledetails) > 0 { + OrganizationMods.AddExistingInspectionsampledetails(m.R.Inspectionsampledetails...).Apply(ctx, o) + } + if len(m.R.Linelocations) > 0 { + OrganizationMods.AddExistingLinelocations(m.R.Linelocations...).Apply(ctx, o) + } + if len(m.R.Locationtrackings) > 0 { + OrganizationMods.AddExistingLocationtrackings(m.R.Locationtrackings...).Apply(ctx, o) + } + if len(m.R.Mosquitoinspections) > 0 { + OrganizationMods.AddExistingMosquitoinspections(m.R.Mosquitoinspections...).Apply(ctx, o) + } + if len(m.R.Pointlocations) > 0 { + OrganizationMods.AddExistingPointlocations(m.R.Pointlocations...).Apply(ctx, o) + } + if len(m.R.Polygonlocations) > 0 { + OrganizationMods.AddExistingPolygonlocations(m.R.Polygonlocations...).Apply(ctx, o) + } + if len(m.R.Pools) > 0 { + OrganizationMods.AddExistingPools(m.R.Pools...).Apply(ctx, o) + } + if len(m.R.Pooldetails) > 0 { + OrganizationMods.AddExistingPooldetails(m.R.Pooldetails...).Apply(ctx, o) + } + if len(m.R.Proposedtreatmentareas) > 0 { + OrganizationMods.AddExistingProposedtreatmentareas(m.R.Proposedtreatmentareas...).Apply(ctx, o) + } + if len(m.R.Qamosquitoinspections) > 0 { + OrganizationMods.AddExistingQamosquitoinspections(m.R.Qamosquitoinspections...).Apply(ctx, o) + } + if len(m.R.Rodentlocations) > 0 { + OrganizationMods.AddExistingRodentlocations(m.R.Rodentlocations...).Apply(ctx, o) + } + if len(m.R.Samplecollections) > 0 { + OrganizationMods.AddExistingSamplecollections(m.R.Samplecollections...).Apply(ctx, o) + } + if len(m.R.Samplelocations) > 0 { + OrganizationMods.AddExistingSamplelocations(m.R.Samplelocations...).Apply(ctx, o) + } + if len(m.R.Servicerequests) > 0 { + OrganizationMods.AddExistingServicerequests(m.R.Servicerequests...).Apply(ctx, o) + } + if len(m.R.Speciesabundances) > 0 { + OrganizationMods.AddExistingSpeciesabundances(m.R.Speciesabundances...).Apply(ctx, o) + } + if len(m.R.Stormdrains) > 0 { + OrganizationMods.AddExistingStormdrains(m.R.Stormdrains...).Apply(ctx, o) + } + if len(m.R.Timecards) > 0 { + OrganizationMods.AddExistingTimecards(m.R.Timecards...).Apply(ctx, o) + } + if len(m.R.Trapdata) > 0 { + OrganizationMods.AddExistingTrapdata(m.R.Trapdata...).Apply(ctx, o) + } + if len(m.R.Traplocations) > 0 { + OrganizationMods.AddExistingTraplocations(m.R.Traplocations...).Apply(ctx, o) + } + if len(m.R.Treatments) > 0 { + OrganizationMods.AddExistingTreatments(m.R.Treatments...).Apply(ctx, o) + } + if len(m.R.Treatmentareas) > 0 { + OrganizationMods.AddExistingTreatmentareas(m.R.Treatmentareas...).Apply(ctx, o) + } + if len(m.R.Zones) > 0 { + OrganizationMods.AddExistingZones(m.R.Zones...).Apply(ctx, o) + } + if len(m.R.Zones2s) > 0 { + OrganizationMods.AddExistingZones2s(m.R.Zones2s...).Apply(ctx, o) + } if len(m.R.FieldseekerSyncs) > 0 { OrganizationMods.AddExistingFieldseekerSyncs(m.R.FieldseekerSyncs...).Apply(ctx, o) } - if len(m.R.FSContainerrelates) > 0 { - OrganizationMods.AddExistingFSContainerrelates(m.R.FSContainerrelates...).Apply(ctx, o) - } - if len(m.R.FSFieldscoutinglogs) > 0 { - OrganizationMods.AddExistingFSFieldscoutinglogs(m.R.FSFieldscoutinglogs...).Apply(ctx, o) - } - if len(m.R.FSHabitatrelates) > 0 { - OrganizationMods.AddExistingFSHabitatrelates(m.R.FSHabitatrelates...).Apply(ctx, o) - } - if len(m.R.FSInspectionsamples) > 0 { - OrganizationMods.AddExistingFSInspectionsamples(m.R.FSInspectionsamples...).Apply(ctx, o) - } - if len(m.R.FSInspectionsampledetails) > 0 { - OrganizationMods.AddExistingFSInspectionsampledetails(m.R.FSInspectionsampledetails...).Apply(ctx, o) - } - if len(m.R.FSLinelocations) > 0 { - OrganizationMods.AddExistingFSLinelocations(m.R.FSLinelocations...).Apply(ctx, o) - } - if len(m.R.FSLocationtrackings) > 0 { - OrganizationMods.AddExistingFSLocationtrackings(m.R.FSLocationtrackings...).Apply(ctx, o) - } - if len(m.R.FSMosquitoinspections) > 0 { - OrganizationMods.AddExistingFSMosquitoinspections(m.R.FSMosquitoinspections...).Apply(ctx, o) - } - if len(m.R.FSPointlocations) > 0 { - OrganizationMods.AddExistingFSPointlocations(m.R.FSPointlocations...).Apply(ctx, o) - } - if len(m.R.FSPolygonlocations) > 0 { - OrganizationMods.AddExistingFSPolygonlocations(m.R.FSPolygonlocations...).Apply(ctx, o) - } - if len(m.R.FSPools) > 0 { - OrganizationMods.AddExistingFSPools(m.R.FSPools...).Apply(ctx, o) - } - if len(m.R.FSPooldetails) > 0 { - OrganizationMods.AddExistingFSPooldetails(m.R.FSPooldetails...).Apply(ctx, o) - } - if len(m.R.FSProposedtreatmentareas) > 0 { - OrganizationMods.AddExistingFSProposedtreatmentareas(m.R.FSProposedtreatmentareas...).Apply(ctx, o) - } - if len(m.R.FSQamosquitoinspections) > 0 { - OrganizationMods.AddExistingFSQamosquitoinspections(m.R.FSQamosquitoinspections...).Apply(ctx, o) - } - if len(m.R.FSRodentlocations) > 0 { - OrganizationMods.AddExistingFSRodentlocations(m.R.FSRodentlocations...).Apply(ctx, o) - } - if len(m.R.FSSamplecollections) > 0 { - OrganizationMods.AddExistingFSSamplecollections(m.R.FSSamplecollections...).Apply(ctx, o) - } - if len(m.R.FSSamplelocations) > 0 { - OrganizationMods.AddExistingFSSamplelocations(m.R.FSSamplelocations...).Apply(ctx, o) - } - if len(m.R.FSServicerequests) > 0 { - OrganizationMods.AddExistingFSServicerequests(m.R.FSServicerequests...).Apply(ctx, o) - } - if len(m.R.FSSpeciesabundances) > 0 { - OrganizationMods.AddExistingFSSpeciesabundances(m.R.FSSpeciesabundances...).Apply(ctx, o) - } - if len(m.R.FSStormdrains) > 0 { - OrganizationMods.AddExistingFSStormdrains(m.R.FSStormdrains...).Apply(ctx, o) - } - if len(m.R.FSTimecards) > 0 { - OrganizationMods.AddExistingFSTimecards(m.R.FSTimecards...).Apply(ctx, o) - } - if len(m.R.FSTrapdata) > 0 { - OrganizationMods.AddExistingFSTrapdata(m.R.FSTrapdata...).Apply(ctx, o) - } - if len(m.R.FSTraplocations) > 0 { - OrganizationMods.AddExistingFSTraplocations(m.R.FSTraplocations...).Apply(ctx, o) - } - if len(m.R.FSTreatments) > 0 { - OrganizationMods.AddExistingFSTreatments(m.R.FSTreatments...).Apply(ctx, o) - } - if len(m.R.FSTreatmentareas) > 0 { - OrganizationMods.AddExistingFSTreatmentareas(m.R.FSTreatmentareas...).Apply(ctx, o) - } - if len(m.R.FSZones) > 0 { - OrganizationMods.AddExistingFSZones(m.R.FSZones...).Apply(ctx, o) - } - 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) + if len(m.R.NoteAudios) > 0 { + OrganizationMods.AddExistingNoteAudios(m.R.NoteAudios...).Apply(ctx, o) } - if len(m.R.HistoryFieldscoutinglogs) > 0 { - OrganizationMods.AddExistingHistoryFieldscoutinglogs(m.R.HistoryFieldscoutinglogs...).Apply(ctx, o) - } - if len(m.R.HistoryHabitatrelates) > 0 { - OrganizationMods.AddExistingHistoryHabitatrelates(m.R.HistoryHabitatrelates...).Apply(ctx, o) - } - if len(m.R.HistoryInspectionsamples) > 0 { - OrganizationMods.AddExistingHistoryInspectionsamples(m.R.HistoryInspectionsamples...).Apply(ctx, o) - } - if len(m.R.HistoryInspectionsampledetails) > 0 { - OrganizationMods.AddExistingHistoryInspectionsampledetails(m.R.HistoryInspectionsampledetails...).Apply(ctx, o) - } - if len(m.R.HistoryLinelocations) > 0 { - OrganizationMods.AddExistingHistoryLinelocations(m.R.HistoryLinelocations...).Apply(ctx, o) - } - if len(m.R.HistoryLocationtrackings) > 0 { - OrganizationMods.AddExistingHistoryLocationtrackings(m.R.HistoryLocationtrackings...).Apply(ctx, o) - } - if len(m.R.HistoryMosquitoinspections) > 0 { - OrganizationMods.AddExistingHistoryMosquitoinspections(m.R.HistoryMosquitoinspections...).Apply(ctx, o) - } - if len(m.R.HistoryPointlocations) > 0 { - OrganizationMods.AddExistingHistoryPointlocations(m.R.HistoryPointlocations...).Apply(ctx, o) - } - if len(m.R.HistoryPolygonlocations) > 0 { - OrganizationMods.AddExistingHistoryPolygonlocations(m.R.HistoryPolygonlocations...).Apply(ctx, o) - } - if len(m.R.HistoryPools) > 0 { - OrganizationMods.AddExistingHistoryPools(m.R.HistoryPools...).Apply(ctx, o) - } - if len(m.R.HistoryPooldetails) > 0 { - OrganizationMods.AddExistingHistoryPooldetails(m.R.HistoryPooldetails...).Apply(ctx, o) - } - if len(m.R.HistoryProposedtreatmentareas) > 0 { - OrganizationMods.AddExistingHistoryProposedtreatmentareas(m.R.HistoryProposedtreatmentareas...).Apply(ctx, o) - } - if len(m.R.HistoryQamosquitoinspections) > 0 { - OrganizationMods.AddExistingHistoryQamosquitoinspections(m.R.HistoryQamosquitoinspections...).Apply(ctx, o) - } - if len(m.R.HistoryRodentlocations) > 0 { - OrganizationMods.AddExistingHistoryRodentlocations(m.R.HistoryRodentlocations...).Apply(ctx, o) - } - if len(m.R.HistorySamplecollections) > 0 { - OrganizationMods.AddExistingHistorySamplecollections(m.R.HistorySamplecollections...).Apply(ctx, o) - } - if len(m.R.HistorySamplelocations) > 0 { - OrganizationMods.AddExistingHistorySamplelocations(m.R.HistorySamplelocations...).Apply(ctx, o) - } - if len(m.R.HistoryServicerequests) > 0 { - OrganizationMods.AddExistingHistoryServicerequests(m.R.HistoryServicerequests...).Apply(ctx, o) - } - if len(m.R.HistorySpeciesabundances) > 0 { - OrganizationMods.AddExistingHistorySpeciesabundances(m.R.HistorySpeciesabundances...).Apply(ctx, o) - } - if len(m.R.HistoryStormdrains) > 0 { - OrganizationMods.AddExistingHistoryStormdrains(m.R.HistoryStormdrains...).Apply(ctx, o) - } - if len(m.R.HistoryTimecards) > 0 { - OrganizationMods.AddExistingHistoryTimecards(m.R.HistoryTimecards...).Apply(ctx, o) - } - if len(m.R.HistoryTrapdata) > 0 { - OrganizationMods.AddExistingHistoryTrapdata(m.R.HistoryTrapdata...).Apply(ctx, o) - } - if len(m.R.HistoryTraplocations) > 0 { - OrganizationMods.AddExistingHistoryTraplocations(m.R.HistoryTraplocations...).Apply(ctx, o) - } - if len(m.R.HistoryTreatments) > 0 { - OrganizationMods.AddExistingHistoryTreatments(m.R.HistoryTreatments...).Apply(ctx, o) - } - if len(m.R.HistoryTreatmentareas) > 0 { - OrganizationMods.AddExistingHistoryTreatmentareas(m.R.HistoryTreatmentareas...).Apply(ctx, o) - } - if len(m.R.HistoryZones) > 0 { - OrganizationMods.AddExistingHistoryZones(m.R.HistoryZones...).Apply(ctx, o) - } - if len(m.R.HistoryZones2s) > 0 { - OrganizationMods.AddExistingHistoryZones2s(m.R.HistoryZones2s...).Apply(ctx, o) + if len(m.R.NoteImages) > 0 { + OrganizationMods.AddExistingNoteImages(m.R.NoteImages...).Apply(ctx, o) } if len(m.R.User) > 0 { OrganizationMods.AddExistingUser(m.R.User...).Apply(ctx, o) @@ -5740,6 +2525,18 @@ func (f *Factory) FromExistingUser(m *models.User) *UserTemplate { o.PasswordHash = func() string { return m.PasswordHash } ctx := context.Background() + if len(m.R.CreatorNoteAudios) > 0 { + UserMods.AddExistingCreatorNoteAudios(m.R.CreatorNoteAudios...).Apply(ctx, o) + } + if len(m.R.DeletorNoteAudios) > 0 { + UserMods.AddExistingDeletorNoteAudios(m.R.DeletorNoteAudios...).Apply(ctx, o) + } + if len(m.R.CreatorNoteImages) > 0 { + UserMods.AddExistingCreatorNoteImages(m.R.CreatorNoteImages...).Apply(ctx, o) + } + if len(m.R.DeletorNoteImages) > 0 { + UserMods.AddExistingDeletorNoteImages(m.R.DeletorNoteImages...).Apply(ctx, o) + } if len(m.R.UserNotifications) > 0 { UserMods.AddExistingUserNotifications(m.R.UserNotifications...).Apply(ctx, o) } @@ -5977,222 +2774,6 @@ func (f *Factory) AddBaseFieldseekerSyncMod(mods ...FieldseekerSyncMod) { f.baseFieldseekerSyncMods = append(f.baseFieldseekerSyncMods, mods...) } -func (f *Factory) ClearBaseFSContainerrelateMods() { - f.baseFSContainerrelateMods = nil -} - -func (f *Factory) AddBaseFSContainerrelateMod(mods ...FSContainerrelateMod) { - f.baseFSContainerrelateMods = append(f.baseFSContainerrelateMods, mods...) -} - -func (f *Factory) ClearBaseFSFieldscoutinglogMods() { - f.baseFSFieldscoutinglogMods = nil -} - -func (f *Factory) AddBaseFSFieldscoutinglogMod(mods ...FSFieldscoutinglogMod) { - f.baseFSFieldscoutinglogMods = append(f.baseFSFieldscoutinglogMods, mods...) -} - -func (f *Factory) ClearBaseFSHabitatrelateMods() { - f.baseFSHabitatrelateMods = nil -} - -func (f *Factory) AddBaseFSHabitatrelateMod(mods ...FSHabitatrelateMod) { - f.baseFSHabitatrelateMods = append(f.baseFSHabitatrelateMods, mods...) -} - -func (f *Factory) ClearBaseFSInspectionsampleMods() { - f.baseFSInspectionsampleMods = nil -} - -func (f *Factory) AddBaseFSInspectionsampleMod(mods ...FSInspectionsampleMod) { - f.baseFSInspectionsampleMods = append(f.baseFSInspectionsampleMods, mods...) -} - -func (f *Factory) ClearBaseFSInspectionsampledetailMods() { - f.baseFSInspectionsampledetailMods = nil -} - -func (f *Factory) AddBaseFSInspectionsampledetailMod(mods ...FSInspectionsampledetailMod) { - f.baseFSInspectionsampledetailMods = append(f.baseFSInspectionsampledetailMods, mods...) -} - -func (f *Factory) ClearBaseFSLinelocationMods() { - f.baseFSLinelocationMods = nil -} - -func (f *Factory) AddBaseFSLinelocationMod(mods ...FSLinelocationMod) { - f.baseFSLinelocationMods = append(f.baseFSLinelocationMods, mods...) -} - -func (f *Factory) ClearBaseFSLocationtrackingMods() { - f.baseFSLocationtrackingMods = nil -} - -func (f *Factory) AddBaseFSLocationtrackingMod(mods ...FSLocationtrackingMod) { - f.baseFSLocationtrackingMods = append(f.baseFSLocationtrackingMods, mods...) -} - -func (f *Factory) ClearBaseFSMosquitoinspectionMods() { - f.baseFSMosquitoinspectionMods = nil -} - -func (f *Factory) AddBaseFSMosquitoinspectionMod(mods ...FSMosquitoinspectionMod) { - f.baseFSMosquitoinspectionMods = append(f.baseFSMosquitoinspectionMods, mods...) -} - -func (f *Factory) ClearBaseFSPointlocationMods() { - f.baseFSPointlocationMods = nil -} - -func (f *Factory) AddBaseFSPointlocationMod(mods ...FSPointlocationMod) { - f.baseFSPointlocationMods = append(f.baseFSPointlocationMods, mods...) -} - -func (f *Factory) ClearBaseFSPolygonlocationMods() { - f.baseFSPolygonlocationMods = nil -} - -func (f *Factory) AddBaseFSPolygonlocationMod(mods ...FSPolygonlocationMod) { - f.baseFSPolygonlocationMods = append(f.baseFSPolygonlocationMods, mods...) -} - -func (f *Factory) ClearBaseFSPoolMods() { - f.baseFSPoolMods = nil -} - -func (f *Factory) AddBaseFSPoolMod(mods ...FSPoolMod) { - f.baseFSPoolMods = append(f.baseFSPoolMods, mods...) -} - -func (f *Factory) ClearBaseFSPooldetailMods() { - f.baseFSPooldetailMods = nil -} - -func (f *Factory) AddBaseFSPooldetailMod(mods ...FSPooldetailMod) { - f.baseFSPooldetailMods = append(f.baseFSPooldetailMods, mods...) -} - -func (f *Factory) ClearBaseFSProposedtreatmentareaMods() { - f.baseFSProposedtreatmentareaMods = nil -} - -func (f *Factory) AddBaseFSProposedtreatmentareaMod(mods ...FSProposedtreatmentareaMod) { - f.baseFSProposedtreatmentareaMods = append(f.baseFSProposedtreatmentareaMods, mods...) -} - -func (f *Factory) ClearBaseFSQamosquitoinspectionMods() { - f.baseFSQamosquitoinspectionMods = nil -} - -func (f *Factory) AddBaseFSQamosquitoinspectionMod(mods ...FSQamosquitoinspectionMod) { - f.baseFSQamosquitoinspectionMods = append(f.baseFSQamosquitoinspectionMods, mods...) -} - -func (f *Factory) ClearBaseFSRodentlocationMods() { - f.baseFSRodentlocationMods = nil -} - -func (f *Factory) AddBaseFSRodentlocationMod(mods ...FSRodentlocationMod) { - f.baseFSRodentlocationMods = append(f.baseFSRodentlocationMods, mods...) -} - -func (f *Factory) ClearBaseFSSamplecollectionMods() { - f.baseFSSamplecollectionMods = nil -} - -func (f *Factory) AddBaseFSSamplecollectionMod(mods ...FSSamplecollectionMod) { - f.baseFSSamplecollectionMods = append(f.baseFSSamplecollectionMods, mods...) -} - -func (f *Factory) ClearBaseFSSamplelocationMods() { - f.baseFSSamplelocationMods = nil -} - -func (f *Factory) AddBaseFSSamplelocationMod(mods ...FSSamplelocationMod) { - f.baseFSSamplelocationMods = append(f.baseFSSamplelocationMods, mods...) -} - -func (f *Factory) ClearBaseFSServicerequestMods() { - f.baseFSServicerequestMods = nil -} - -func (f *Factory) AddBaseFSServicerequestMod(mods ...FSServicerequestMod) { - f.baseFSServicerequestMods = append(f.baseFSServicerequestMods, mods...) -} - -func (f *Factory) ClearBaseFSSpeciesabundanceMods() { - f.baseFSSpeciesabundanceMods = nil -} - -func (f *Factory) AddBaseFSSpeciesabundanceMod(mods ...FSSpeciesabundanceMod) { - f.baseFSSpeciesabundanceMods = append(f.baseFSSpeciesabundanceMods, mods...) -} - -func (f *Factory) ClearBaseFSStormdrainMods() { - f.baseFSStormdrainMods = nil -} - -func (f *Factory) AddBaseFSStormdrainMod(mods ...FSStormdrainMod) { - f.baseFSStormdrainMods = append(f.baseFSStormdrainMods, mods...) -} - -func (f *Factory) ClearBaseFSTimecardMods() { - f.baseFSTimecardMods = nil -} - -func (f *Factory) AddBaseFSTimecardMod(mods ...FSTimecardMod) { - f.baseFSTimecardMods = append(f.baseFSTimecardMods, mods...) -} - -func (f *Factory) ClearBaseFSTrapdatumMods() { - f.baseFSTrapdatumMods = nil -} - -func (f *Factory) AddBaseFSTrapdatumMod(mods ...FSTrapdatumMod) { - f.baseFSTrapdatumMods = append(f.baseFSTrapdatumMods, mods...) -} - -func (f *Factory) ClearBaseFSTraplocationMods() { - f.baseFSTraplocationMods = nil -} - -func (f *Factory) AddBaseFSTraplocationMod(mods ...FSTraplocationMod) { - f.baseFSTraplocationMods = append(f.baseFSTraplocationMods, mods...) -} - -func (f *Factory) ClearBaseFSTreatmentMods() { - f.baseFSTreatmentMods = nil -} - -func (f *Factory) AddBaseFSTreatmentMod(mods ...FSTreatmentMod) { - f.baseFSTreatmentMods = append(f.baseFSTreatmentMods, mods...) -} - -func (f *Factory) ClearBaseFSTreatmentareaMods() { - f.baseFSTreatmentareaMods = nil -} - -func (f *Factory) AddBaseFSTreatmentareaMod(mods ...FSTreatmentareaMod) { - f.baseFSTreatmentareaMods = append(f.baseFSTreatmentareaMods, mods...) -} - -func (f *Factory) ClearBaseFSZoneMods() { - f.baseFSZoneMods = nil -} - -func (f *Factory) AddBaseFSZoneMod(mods ...FSZoneMod) { - f.baseFSZoneMods = append(f.baseFSZoneMods, mods...) -} - -func (f *Factory) ClearBaseFSZones2Mods() { - f.baseFSZones2Mods = nil -} - -func (f *Factory) AddBaseFSZones2Mod(mods ...FSZones2Mod) { - f.baseFSZones2Mods = append(f.baseFSZones2Mods, mods...) -} - func (f *Factory) ClearBaseGeographyColumnMods() { f.baseGeographyColumnMods = nil } @@ -6225,220 +2806,52 @@ func (f *Factory) AddBaseH3AggregationMod(mods ...H3AggregationMod) { f.baseH3AggregationMods = append(f.baseH3AggregationMods, mods...) } -func (f *Factory) ClearBaseHistoryContainerrelateMods() { - f.baseHistoryContainerrelateMods = nil +func (f *Factory) ClearBaseNoteAudioMods() { + f.baseNoteAudioMods = nil } -func (f *Factory) AddBaseHistoryContainerrelateMod(mods ...HistoryContainerrelateMod) { - f.baseHistoryContainerrelateMods = append(f.baseHistoryContainerrelateMods, mods...) +func (f *Factory) AddBaseNoteAudioMod(mods ...NoteAudioMod) { + f.baseNoteAudioMods = append(f.baseNoteAudioMods, mods...) } -func (f *Factory) ClearBaseHistoryFieldscoutinglogMods() { - f.baseHistoryFieldscoutinglogMods = nil +func (f *Factory) ClearBaseNoteAudioBreadcrumbMods() { + f.baseNoteAudioBreadcrumbMods = nil } -func (f *Factory) AddBaseHistoryFieldscoutinglogMod(mods ...HistoryFieldscoutinglogMod) { - f.baseHistoryFieldscoutinglogMods = append(f.baseHistoryFieldscoutinglogMods, mods...) +func (f *Factory) AddBaseNoteAudioBreadcrumbMod(mods ...NoteAudioBreadcrumbMod) { + f.baseNoteAudioBreadcrumbMods = append(f.baseNoteAudioBreadcrumbMods, mods...) } -func (f *Factory) ClearBaseHistoryHabitatrelateMods() { - f.baseHistoryHabitatrelateMods = nil +func (f *Factory) ClearBaseNoteAudioDatumMods() { + f.baseNoteAudioDatumMods = nil } -func (f *Factory) AddBaseHistoryHabitatrelateMod(mods ...HistoryHabitatrelateMod) { - f.baseHistoryHabitatrelateMods = append(f.baseHistoryHabitatrelateMods, mods...) +func (f *Factory) AddBaseNoteAudioDatumMod(mods ...NoteAudioDatumMod) { + f.baseNoteAudioDatumMods = append(f.baseNoteAudioDatumMods, mods...) } -func (f *Factory) ClearBaseHistoryInspectionsampleMods() { - f.baseHistoryInspectionsampleMods = nil +func (f *Factory) ClearBaseNoteImageMods() { + f.baseNoteImageMods = nil } -func (f *Factory) AddBaseHistoryInspectionsampleMod(mods ...HistoryInspectionsampleMod) { - f.baseHistoryInspectionsampleMods = append(f.baseHistoryInspectionsampleMods, mods...) +func (f *Factory) AddBaseNoteImageMod(mods ...NoteImageMod) { + f.baseNoteImageMods = append(f.baseNoteImageMods, mods...) } -func (f *Factory) ClearBaseHistoryInspectionsampledetailMods() { - f.baseHistoryInspectionsampledetailMods = nil +func (f *Factory) ClearBaseNoteImageBreadcrumbMods() { + f.baseNoteImageBreadcrumbMods = nil } -func (f *Factory) AddBaseHistoryInspectionsampledetailMod(mods ...HistoryInspectionsampledetailMod) { - f.baseHistoryInspectionsampledetailMods = append(f.baseHistoryInspectionsampledetailMods, mods...) +func (f *Factory) AddBaseNoteImageBreadcrumbMod(mods ...NoteImageBreadcrumbMod) { + f.baseNoteImageBreadcrumbMods = append(f.baseNoteImageBreadcrumbMods, mods...) } -func (f *Factory) ClearBaseHistoryLinelocationMods() { - f.baseHistoryLinelocationMods = nil +func (f *Factory) ClearBaseNoteImageDatumMods() { + f.baseNoteImageDatumMods = nil } -func (f *Factory) AddBaseHistoryLinelocationMod(mods ...HistoryLinelocationMod) { - f.baseHistoryLinelocationMods = append(f.baseHistoryLinelocationMods, mods...) -} - -func (f *Factory) ClearBaseHistoryLocationtrackingMods() { - f.baseHistoryLocationtrackingMods = nil -} - -func (f *Factory) AddBaseHistoryLocationtrackingMod(mods ...HistoryLocationtrackingMod) { - f.baseHistoryLocationtrackingMods = append(f.baseHistoryLocationtrackingMods, mods...) -} - -func (f *Factory) ClearBaseHistoryMosquitoinspectionMods() { - f.baseHistoryMosquitoinspectionMods = nil -} - -func (f *Factory) AddBaseHistoryMosquitoinspectionMod(mods ...HistoryMosquitoinspectionMod) { - f.baseHistoryMosquitoinspectionMods = append(f.baseHistoryMosquitoinspectionMods, mods...) -} - -func (f *Factory) ClearBaseHistoryPointlocationMods() { - f.baseHistoryPointlocationMods = nil -} - -func (f *Factory) AddBaseHistoryPointlocationMod(mods ...HistoryPointlocationMod) { - f.baseHistoryPointlocationMods = append(f.baseHistoryPointlocationMods, mods...) -} - -func (f *Factory) ClearBaseHistoryPolygonlocationMods() { - f.baseHistoryPolygonlocationMods = nil -} - -func (f *Factory) AddBaseHistoryPolygonlocationMod(mods ...HistoryPolygonlocationMod) { - f.baseHistoryPolygonlocationMods = append(f.baseHistoryPolygonlocationMods, mods...) -} - -func (f *Factory) ClearBaseHistoryPoolMods() { - f.baseHistoryPoolMods = nil -} - -func (f *Factory) AddBaseHistoryPoolMod(mods ...HistoryPoolMod) { - f.baseHistoryPoolMods = append(f.baseHistoryPoolMods, mods...) -} - -func (f *Factory) ClearBaseHistoryPooldetailMods() { - f.baseHistoryPooldetailMods = nil -} - -func (f *Factory) AddBaseHistoryPooldetailMod(mods ...HistoryPooldetailMod) { - f.baseHistoryPooldetailMods = append(f.baseHistoryPooldetailMods, mods...) -} - -func (f *Factory) ClearBaseHistoryProposedtreatmentareaMods() { - f.baseHistoryProposedtreatmentareaMods = nil -} - -func (f *Factory) AddBaseHistoryProposedtreatmentareaMod(mods ...HistoryProposedtreatmentareaMod) { - f.baseHistoryProposedtreatmentareaMods = append(f.baseHistoryProposedtreatmentareaMods, mods...) -} - -func (f *Factory) ClearBaseHistoryQamosquitoinspectionMods() { - f.baseHistoryQamosquitoinspectionMods = nil -} - -func (f *Factory) AddBaseHistoryQamosquitoinspectionMod(mods ...HistoryQamosquitoinspectionMod) { - f.baseHistoryQamosquitoinspectionMods = append(f.baseHistoryQamosquitoinspectionMods, mods...) -} - -func (f *Factory) ClearBaseHistoryRodentlocationMods() { - f.baseHistoryRodentlocationMods = nil -} - -func (f *Factory) AddBaseHistoryRodentlocationMod(mods ...HistoryRodentlocationMod) { - f.baseHistoryRodentlocationMods = append(f.baseHistoryRodentlocationMods, mods...) -} - -func (f *Factory) ClearBaseHistorySamplecollectionMods() { - f.baseHistorySamplecollectionMods = nil -} - -func (f *Factory) AddBaseHistorySamplecollectionMod(mods ...HistorySamplecollectionMod) { - f.baseHistorySamplecollectionMods = append(f.baseHistorySamplecollectionMods, mods...) -} - -func (f *Factory) ClearBaseHistorySamplelocationMods() { - f.baseHistorySamplelocationMods = nil -} - -func (f *Factory) AddBaseHistorySamplelocationMod(mods ...HistorySamplelocationMod) { - f.baseHistorySamplelocationMods = append(f.baseHistorySamplelocationMods, mods...) -} - -func (f *Factory) ClearBaseHistoryServicerequestMods() { - f.baseHistoryServicerequestMods = nil -} - -func (f *Factory) AddBaseHistoryServicerequestMod(mods ...HistoryServicerequestMod) { - f.baseHistoryServicerequestMods = append(f.baseHistoryServicerequestMods, mods...) -} - -func (f *Factory) ClearBaseHistorySpeciesabundanceMods() { - f.baseHistorySpeciesabundanceMods = nil -} - -func (f *Factory) AddBaseHistorySpeciesabundanceMod(mods ...HistorySpeciesabundanceMod) { - f.baseHistorySpeciesabundanceMods = append(f.baseHistorySpeciesabundanceMods, mods...) -} - -func (f *Factory) ClearBaseHistoryStormdrainMods() { - f.baseHistoryStormdrainMods = nil -} - -func (f *Factory) AddBaseHistoryStormdrainMod(mods ...HistoryStormdrainMod) { - f.baseHistoryStormdrainMods = append(f.baseHistoryStormdrainMods, mods...) -} - -func (f *Factory) ClearBaseHistoryTimecardMods() { - f.baseHistoryTimecardMods = nil -} - -func (f *Factory) AddBaseHistoryTimecardMod(mods ...HistoryTimecardMod) { - f.baseHistoryTimecardMods = append(f.baseHistoryTimecardMods, mods...) -} - -func (f *Factory) ClearBaseHistoryTrapdatumMods() { - f.baseHistoryTrapdatumMods = nil -} - -func (f *Factory) AddBaseHistoryTrapdatumMod(mods ...HistoryTrapdatumMod) { - f.baseHistoryTrapdatumMods = append(f.baseHistoryTrapdatumMods, mods...) -} - -func (f *Factory) ClearBaseHistoryTraplocationMods() { - f.baseHistoryTraplocationMods = nil -} - -func (f *Factory) AddBaseHistoryTraplocationMod(mods ...HistoryTraplocationMod) { - f.baseHistoryTraplocationMods = append(f.baseHistoryTraplocationMods, mods...) -} - -func (f *Factory) ClearBaseHistoryTreatmentMods() { - f.baseHistoryTreatmentMods = nil -} - -func (f *Factory) AddBaseHistoryTreatmentMod(mods ...HistoryTreatmentMod) { - f.baseHistoryTreatmentMods = append(f.baseHistoryTreatmentMods, mods...) -} - -func (f *Factory) ClearBaseHistoryTreatmentareaMods() { - f.baseHistoryTreatmentareaMods = nil -} - -func (f *Factory) AddBaseHistoryTreatmentareaMod(mods ...HistoryTreatmentareaMod) { - f.baseHistoryTreatmentareaMods = append(f.baseHistoryTreatmentareaMods, mods...) -} - -func (f *Factory) ClearBaseHistoryZoneMods() { - f.baseHistoryZoneMods = nil -} - -func (f *Factory) AddBaseHistoryZoneMod(mods ...HistoryZoneMod) { - f.baseHistoryZoneMods = append(f.baseHistoryZoneMods, mods...) -} - -func (f *Factory) ClearBaseHistoryZones2Mods() { - f.baseHistoryZones2Mods = nil -} - -func (f *Factory) AddBaseHistoryZones2Mod(mods ...HistoryZones2Mod) { - f.baseHistoryZones2Mods = append(f.baseHistoryZones2Mods, mods...) +func (f *Factory) AddBaseNoteImageDatumMod(mods ...NoteImageDatumMod) { + f.baseNoteImageDatumMods = append(f.baseNoteImageDatumMods, mods...) } func (f *Factory) ClearBaseNotificationMods() { diff --git a/db/factory/bobfactory_main.bob_test.go b/db/factory/bobfactory_main.bob_test.go index c1b37ac1..dacd8b59 100644 --- a/db/factory/bobfactory_main.bob_test.go +++ b/db/factory/bobfactory_main.bob_test.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory @@ -680,654 +680,6 @@ func TestCreateFieldseekerSync(t *testing.T) { } } -func TestCreateFSContainerrelate(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().NewFSContainerrelateWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSContainerrelate: %v", err) - } -} - -func TestCreateFSFieldscoutinglog(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().NewFSFieldscoutinglogWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSFieldscoutinglog: %v", err) - } -} - -func TestCreateFSHabitatrelate(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().NewFSHabitatrelateWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSHabitatrelate: %v", err) - } -} - -func TestCreateFSInspectionsample(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().NewFSInspectionsampleWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSInspectionsample: %v", err) - } -} - -func TestCreateFSInspectionsampledetail(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().NewFSInspectionsampledetailWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSInspectionsampledetail: %v", err) - } -} - -func TestCreateFSLinelocation(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().NewFSLinelocationWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSLinelocation: %v", err) - } -} - -func TestCreateFSLocationtracking(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().NewFSLocationtrackingWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSLocationtracking: %v", err) - } -} - -func TestCreateFSMosquitoinspection(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().NewFSMosquitoinspectionWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSMosquitoinspection: %v", err) - } -} - -func TestCreateFSPointlocation(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().NewFSPointlocationWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSPointlocation: %v", err) - } -} - -func TestCreateFSPolygonlocation(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().NewFSPolygonlocationWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSPolygonlocation: %v", err) - } -} - -func TestCreateFSPool(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().NewFSPoolWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSPool: %v", err) - } -} - -func TestCreateFSPooldetail(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().NewFSPooldetailWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSPooldetail: %v", err) - } -} - -func TestCreateFSProposedtreatmentarea(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().NewFSProposedtreatmentareaWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSProposedtreatmentarea: %v", err) - } -} - -func TestCreateFSQamosquitoinspection(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().NewFSQamosquitoinspectionWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSQamosquitoinspection: %v", err) - } -} - -func TestCreateFSRodentlocation(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().NewFSRodentlocationWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSRodentlocation: %v", err) - } -} - -func TestCreateFSSamplecollection(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().NewFSSamplecollectionWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSSamplecollection: %v", err) - } -} - -func TestCreateFSSamplelocation(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().NewFSSamplelocationWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSSamplelocation: %v", err) - } -} - -func TestCreateFSServicerequest(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().NewFSServicerequestWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSServicerequest: %v", err) - } -} - -func TestCreateFSSpeciesabundance(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().NewFSSpeciesabundanceWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSSpeciesabundance: %v", err) - } -} - -func TestCreateFSStormdrain(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().NewFSStormdrainWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSStormdrain: %v", err) - } -} - -func TestCreateFSTimecard(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().NewFSTimecardWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSTimecard: %v", err) - } -} - -func TestCreateFSTrapdatum(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().NewFSTrapdatumWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSTrapdatum: %v", err) - } -} - -func TestCreateFSTraplocation(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().NewFSTraplocationWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSTraplocation: %v", err) - } -} - -func TestCreateFSTreatment(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().NewFSTreatmentWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSTreatment: %v", err) - } -} - -func TestCreateFSTreatmentarea(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().NewFSTreatmentareaWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSTreatmentarea: %v", err) - } -} - -func TestCreateFSZone(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().NewFSZoneWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSZone: %v", err) - } -} - -func TestCreateFSZones2(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().NewFSZones2WithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating FSZones2: %v", err) - } -} - func TestCreateGooseDBVersion(t *testing.T) { if testDB == nil { t.Skip("skipping test, no DSN provided") @@ -1376,7 +728,7 @@ func TestCreateH3Aggregation(t *testing.T) { } } -func TestCreateHistoryContainerrelate(t *testing.T) { +func TestCreateNoteAudio(t *testing.T) { if testDB == nil { t.Skip("skipping test, no DSN provided") } @@ -1395,12 +747,12 @@ func TestCreateHistoryContainerrelate(t *testing.T) { } }() - if _, err := New().NewHistoryContainerrelateWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryContainerrelate: %v", err) + if _, err := New().NewNoteAudioWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating NoteAudio: %v", err) } } -func TestCreateHistoryFieldscoutinglog(t *testing.T) { +func TestCreateNoteAudioBreadcrumb(t *testing.T) { if testDB == nil { t.Skip("skipping test, no DSN provided") } @@ -1419,12 +771,12 @@ func TestCreateHistoryFieldscoutinglog(t *testing.T) { } }() - if _, err := New().NewHistoryFieldscoutinglogWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryFieldscoutinglog: %v", err) + if _, err := New().NewNoteAudioBreadcrumbWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating NoteAudioBreadcrumb: %v", err) } } -func TestCreateHistoryHabitatrelate(t *testing.T) { +func TestCreateNoteAudioDatum(t *testing.T) { if testDB == nil { t.Skip("skipping test, no DSN provided") } @@ -1443,12 +795,12 @@ func TestCreateHistoryHabitatrelate(t *testing.T) { } }() - if _, err := New().NewHistoryHabitatrelateWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryHabitatrelate: %v", err) + if _, err := New().NewNoteAudioDatumWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating NoteAudioDatum: %v", err) } } -func TestCreateHistoryInspectionsample(t *testing.T) { +func TestCreateNoteImage(t *testing.T) { if testDB == nil { t.Skip("skipping test, no DSN provided") } @@ -1467,12 +819,12 @@ func TestCreateHistoryInspectionsample(t *testing.T) { } }() - if _, err := New().NewHistoryInspectionsampleWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryInspectionsample: %v", err) + if _, err := New().NewNoteImageWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating NoteImage: %v", err) } } -func TestCreateHistoryInspectionsampledetail(t *testing.T) { +func TestCreateNoteImageBreadcrumb(t *testing.T) { if testDB == nil { t.Skip("skipping test, no DSN provided") } @@ -1491,12 +843,12 @@ func TestCreateHistoryInspectionsampledetail(t *testing.T) { } }() - if _, err := New().NewHistoryInspectionsampledetailWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryInspectionsampledetail: %v", err) + if _, err := New().NewNoteImageBreadcrumbWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating NoteImageBreadcrumb: %v", err) } } -func TestCreateHistoryLinelocation(t *testing.T) { +func TestCreateNoteImageDatum(t *testing.T) { if testDB == nil { t.Skip("skipping test, no DSN provided") } @@ -1515,512 +867,8 @@ func TestCreateHistoryLinelocation(t *testing.T) { } }() - if _, err := New().NewHistoryLinelocationWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryLinelocation: %v", err) - } -} - -func TestCreateHistoryLocationtracking(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().NewHistoryLocationtrackingWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryLocationtracking: %v", err) - } -} - -func TestCreateHistoryMosquitoinspection(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().NewHistoryMosquitoinspectionWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryMosquitoinspection: %v", err) - } -} - -func TestCreateHistoryPointlocation(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().NewHistoryPointlocationWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryPointlocation: %v", err) - } -} - -func TestCreateHistoryPolygonlocation(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().NewHistoryPolygonlocationWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryPolygonlocation: %v", err) - } -} - -func TestCreateHistoryPool(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().NewHistoryPoolWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryPool: %v", err) - } -} - -func TestCreateHistoryPooldetail(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().NewHistoryPooldetailWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryPooldetail: %v", err) - } -} - -func TestCreateHistoryProposedtreatmentarea(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().NewHistoryProposedtreatmentareaWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryProposedtreatmentarea: %v", err) - } -} - -func TestCreateHistoryQamosquitoinspection(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().NewHistoryQamosquitoinspectionWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryQamosquitoinspection: %v", err) - } -} - -func TestCreateHistoryRodentlocation(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().NewHistoryRodentlocationWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryRodentlocation: %v", err) - } -} - -func TestCreateHistorySamplecollection(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().NewHistorySamplecollectionWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistorySamplecollection: %v", err) - } -} - -func TestCreateHistorySamplelocation(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().NewHistorySamplelocationWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistorySamplelocation: %v", err) - } -} - -func TestCreateHistoryServicerequest(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().NewHistoryServicerequestWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryServicerequest: %v", err) - } -} - -func TestCreateHistorySpeciesabundance(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().NewHistorySpeciesabundanceWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistorySpeciesabundance: %v", err) - } -} - -func TestCreateHistoryStormdrain(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().NewHistoryStormdrainWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryStormdrain: %v", err) - } -} - -func TestCreateHistoryTimecard(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().NewHistoryTimecardWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryTimecard: %v", err) - } -} - -func TestCreateHistoryTrapdatum(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().NewHistoryTrapdatumWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryTrapdatum: %v", err) - } -} - -func TestCreateHistoryTraplocation(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().NewHistoryTraplocationWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryTraplocation: %v", err) - } -} - -func TestCreateHistoryTreatment(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().NewHistoryTreatmentWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryTreatment: %v", err) - } -} - -func TestCreateHistoryTreatmentarea(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().NewHistoryTreatmentareaWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryTreatmentarea: %v", err) - } -} - -func TestCreateHistoryZone(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().NewHistoryZoneWithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryZone: %v", err) - } -} - -func TestCreateHistoryZones2(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().NewHistoryZones2WithContext(ctx).Create(ctx, tx); err != nil { - t.Fatalf("Error creating HistoryZones2: %v", err) + if _, err := New().NewNoteImageDatumWithContext(ctx).Create(ctx, tx); err != nil { + t.Fatalf("Error creating NoteImageDatum: %v", err) } } diff --git a/db/factory/bobfactory_random.bob.go b/db/factory/bobfactory_random.bob.go index 780e2fa0..5466d189 100644 --- a/db/factory/bobfactory_random.bob.go +++ b/db/factory/bobfactory_random.bob.go @@ -1,18 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( + "bytes" + "encoding/json" + "fmt" "math" "strconv" "strings" "time" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/lib/pq" + "github.com/stephenafamo/bob/types" ) var defaultFaker = faker.New() @@ -43,1202 +47,12 @@ func random_enums_Arcgislicensetype(f *faker.Faker, limits ...string) enums.Arcg return all[f.IntBetween(0, len(all)-1)] } -func random_enums_FieldseekerContainerrelateMosquitocontainertypeEnum(f *faker.Faker, limits ...string) enums.FieldseekerContainerrelateMosquitocontainertypeEnum { +func random_enums_Audiodatatype(f *faker.Faker, limits ...string) enums.Audiodatatype { if f == nil { f = &defaultFaker } - var e enums.FieldseekerContainerrelateMosquitocontainertypeEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum(f *faker.Faker, limits ...string) enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284(f *faker.Faker, limits ...string) enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerInspectionsampleNotinuitFEnum(f *faker.Faker, limits ...string) enums.FieldseekerInspectionsampleNotinuitFEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerInspectionsampleNotinuitFEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerInspectionsampledetailMosquitoadultactivityEnum(f *faker.Faker, limits ...string) enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerInspectionsampledetailMosquitodominantstageEnum(f *faker.Faker, limits ...string) enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerInspectionsampledetailMosquitofieldspeciesEnum(f *faker.Faker, limits ...string) enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418(f *faker.Faker, limits ...string) enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80(f *faker.Faker, limits ...string) enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16(f *faker.Faker, limits ...string) enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerLinelocationLocationpriorityEnum(f *faker.Faker, limits ...string) enums.FieldseekerLinelocationLocationpriorityEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerLinelocationLocationpriorityEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerLinelocationLocationsymbologyEnum(f *faker.Faker, limits ...string) enums.FieldseekerLinelocationLocationsymbologyEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerLinelocationLocationsymbologyEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerLinelocationNotinuitFEnum(f *faker.Faker, limits ...string) enums.FieldseekerLinelocationNotinuitFEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerLinelocationNotinuitFEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerMosquitoinspectionMosquitoactivityEnum(f *faker.Faker, limits ...string) enums.FieldseekerMosquitoinspectionMosquitoactivityEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerMosquitoinspectionMosquitoactivityEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerMosquitoinspectionMosquitoadultactivityEnum(f *faker.Faker, limits ...string) enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerMosquitoinspectionMosquitobreedingEnum(f *faker.Faker, limits ...string) enums.FieldseekerMosquitoinspectionMosquitobreedingEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerMosquitoinspectionMosquitobreedingEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerMosquitoinspectionMosquitofieldspeciesEnum(f *faker.Faker, limits ...string) enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4(f *faker.Faker, limits ...string) enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B(f *faker.Faker, limits ...string) enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2(f *faker.Faker, limits ...string) enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540(f *faker.Faker, limits ...string) enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerMosquitoinspectionNotinuitFEnum(f *faker.Faker, limits ...string) enums.FieldseekerMosquitoinspectionNotinuitFEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerMosquitoinspectionNotinuitFEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerMosquitoinspectionNotinuiwinddirectionEnum(f *faker.Faker, limits ...string) enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPointlocationLocationpriorityEnum(f *faker.Faker, limits ...string) enums.FieldseekerPointlocationLocationpriorityEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPointlocationLocationpriorityEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPointlocationLocationsymbologyEnum(f *faker.Faker, limits ...string) enums.FieldseekerPointlocationLocationsymbologyEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPointlocationLocationsymbologyEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPointlocationNotinuitFEnum(f *faker.Faker, limits ...string) enums.FieldseekerPointlocationNotinuitFEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPointlocationNotinuitFEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B(f *faker.Faker, limits ...string) enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489(f *faker.Faker, limits ...string) enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e(f *faker.Faker, limits ...string) enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86(f *faker.Faker, limits ...string) enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899(f *faker.Faker, limits ...string) enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPolygonlocationLocationpriorityEnum(f *faker.Faker, limits ...string) enums.FieldseekerPolygonlocationLocationpriorityEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPolygonlocationLocationpriorityEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPolygonlocationLocationsymbologyEnum(f *faker.Faker, limits ...string) enums.FieldseekerPolygonlocationLocationsymbologyEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPolygonlocationLocationsymbologyEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPolygonlocationNotinuitFEnum(f *faker.Faker, limits ...string) enums.FieldseekerPolygonlocationNotinuitFEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPolygonlocationNotinuitFEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65(f *faker.Faker, limits ...string) enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13(f *faker.Faker, limits ...string) enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9(f *faker.Faker, limits ...string) enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPoolMosquitolabnameEnum(f *faker.Faker, limits ...string) enums.FieldseekerPoolMosquitolabnameEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPoolMosquitolabnameEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPoolNotinuitFEnum(f *faker.Faker, limits ...string) enums.FieldseekerPoolNotinuitFEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPoolNotinuitFEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum(f *faker.Faker, limits ...string) enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum(f *faker.Faker, limits ...string) enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum(f *faker.Faker, limits ...string) enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerProposedtreatmentareaLocationpriorityEnum(f *faker.Faker, limits ...string) enums.FieldseekerProposedtreatmentareaLocationpriorityEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerProposedtreatmentareaLocationpriorityEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum(f *faker.Faker, limits ...string) enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerProposedtreatmentareaNotinuitFEnum(f *faker.Faker, limits ...string) enums.FieldseekerProposedtreatmentareaNotinuitFEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerProposedtreatmentareaNotinuitFEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerQamosquitoinspectionMosquitoactionEnum(f *faker.Faker, limits ...string) enums.FieldseekerQamosquitoinspectionMosquitoactionEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerQamosquitoinspectionMosquitoactionEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f *faker.Faker, limits ...string) enums.FieldseekerQamosquitoinspectionNotinuitFEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerQamosquitoinspectionNotinuitFEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerQamosquitoinspectionQaaquaticorganismsEnum(f *faker.Faker, limits ...string) enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerQamosquitoinspectionQabreedingpotentialEnum(f *faker.Faker, limits ...string) enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerQamosquitoinspectionQalarvaereasonEnum(f *faker.Faker, limits ...string) enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerQamosquitoinspectionQamosquitohabitatEnum(f *faker.Faker, limits ...string) enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerQamosquitoinspectionQasitetypeEnum(f *faker.Faker, limits ...string) enums.FieldseekerQamosquitoinspectionQasitetypeEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerQamosquitoinspectionQasitetypeEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerQamosquitoinspectionQasoilconditionEnum(f *faker.Faker, limits ...string) enums.FieldseekerQamosquitoinspectionQasoilconditionEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerQamosquitoinspectionQasoilconditionEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerQamosquitoinspectionQasourcereductionEnum(f *faker.Faker, limits ...string) enums.FieldseekerQamosquitoinspectionQasourcereductionEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerQamosquitoinspectionQasourcereductionEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerQamosquitoinspectionQavegetationEnum(f *faker.Faker, limits ...string) enums.FieldseekerQamosquitoinspectionQavegetationEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerQamosquitoinspectionQavegetationEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerQamosquitoinspectionQawaterconditionsEnum(f *faker.Faker, limits ...string) enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerQamosquitoinspectionQawaterdurationEnum(f *faker.Faker, limits ...string) enums.FieldseekerQamosquitoinspectionQawaterdurationEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerQamosquitoinspectionQawaterdurationEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerQamosquitoinspectionQawatermovementEnum(f *faker.Faker, limits ...string) enums.FieldseekerQamosquitoinspectionQawatermovementEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerQamosquitoinspectionQawatermovementEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerQamosquitoinspectionQawatersourceEnum(f *faker.Faker, limits ...string) enums.FieldseekerQamosquitoinspectionQawatersourceEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerQamosquitoinspectionQawatersourceEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerRodentlocationLocationpriority1Enum(f *faker.Faker, limits ...string) enums.FieldseekerRodentlocationLocationpriority1Enum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerRodentlocationLocationpriority1Enum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerRodentlocationLocationusetype1Enum(f *faker.Faker, limits ...string) enums.FieldseekerRodentlocationLocationusetype1Enum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerRodentlocationLocationusetype1Enum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerRodentlocationNotinuitF1Enum(f *faker.Faker, limits ...string) enums.FieldseekerRodentlocationNotinuitF1Enum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerRodentlocationNotinuitF1Enum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerRodentlocationRodentlocationSymbologyEnum(f *faker.Faker, limits ...string) enums.FieldseekerRodentlocationRodentlocationSymbologyEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerRodentlocationRodentlocationSymbologyEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerRodentlocationRodentlocationhabitatEnum(f *faker.Faker, limits ...string) enums.FieldseekerRodentlocationRodentlocationhabitatEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerRodentlocationRodentlocationhabitatEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSamplecollectionMosquitoactivityEnum(f *faker.Faker, limits ...string) enums.FieldseekerSamplecollectionMosquitoactivityEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSamplecollectionMosquitoactivityEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSamplecollectionMosquitodiseaseEnum(f *faker.Faker, limits ...string) enums.FieldseekerSamplecollectionMosquitodiseaseEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSamplecollectionMosquitodiseaseEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSamplecollectionMosquitolabnameEnum(f *faker.Faker, limits ...string) enums.FieldseekerSamplecollectionMosquitolabnameEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSamplecollectionMosquitolabnameEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSamplecollectionMosquitosampleconditionEnum(f *faker.Faker, limits ...string) enums.FieldseekerSamplecollectionMosquitosampleconditionEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSamplecollectionMosquitosampleconditionEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSamplecollectionMosquitosamplespeciesEnum(f *faker.Faker, limits ...string) enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSamplecollectionMosquitosampletypeEnum(f *faker.Faker, limits ...string) enums.FieldseekerSamplecollectionMosquitosampletypeEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSamplecollectionMosquitosampletypeEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSamplecollectionMosquitositeconditionEnum(f *faker.Faker, limits ...string) enums.FieldseekerSamplecollectionMosquitositeconditionEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSamplecollectionMosquitositeconditionEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSamplecollectionMosquitotestmethodEnum(f *faker.Faker, limits ...string) enums.FieldseekerSamplecollectionMosquitotestmethodEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSamplecollectionMosquitotestmethodEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSamplecollectionNotinuisexEnum(f *faker.Faker, limits ...string) enums.FieldseekerSamplecollectionNotinuisexEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSamplecollectionNotinuisexEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSamplecollectionNotinuitFEnum(f *faker.Faker, limits ...string) enums.FieldseekerSamplecollectionNotinuitFEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSamplecollectionNotinuitFEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSamplecollectionNotinuiwinddirectionEnum(f *faker.Faker, limits ...string) enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSamplelocationLocationhabitattypeEnum(f *faker.Faker, limits ...string) enums.FieldseekerSamplelocationLocationhabitattypeEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSamplelocationLocationhabitattypeEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSamplelocationLocationpriorityEnum(f *faker.Faker, limits ...string) enums.FieldseekerSamplelocationLocationpriorityEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSamplelocationLocationpriorityEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSamplelocationNotinuitFEnum(f *faker.Faker, limits ...string) enums.FieldseekerSamplelocationNotinuitFEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSamplelocationNotinuitFEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSamplelocationSamplelocationusetypeEnum(f *faker.Faker, limits ...string) enums.FieldseekerSamplelocationSamplelocationusetypeEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSamplelocationSamplelocationusetypeEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerServicerequestNotinuitFEnum(f *faker.Faker, limits ...string) enums.FieldseekerServicerequestNotinuitFEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerServicerequestNotinuitFEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8(f *faker.Faker, limits ...string) enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31(f *faker.Faker, limits ...string) enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab(f *faker.Faker, limits ...string) enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC(f *faker.Faker, limits ...string) enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808(f *faker.Faker, limits ...string) enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerServicerequestServicerequestcontactpreferencesEnum(f *faker.Faker, limits ...string) enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerServicerequestServicerequestissuesEnum(f *faker.Faker, limits ...string) enums.FieldseekerServicerequestServicerequestissuesEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerServicerequestServicerequestissuesEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerServicerequestServicerequestnextactionEnum(f *faker.Faker, limits ...string) enums.FieldseekerServicerequestServicerequestnextactionEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerServicerequestServicerequestnextactionEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerServicerequestServicerequestpriorityEnum(f *faker.Faker, limits ...string) enums.FieldseekerServicerequestServicerequestpriorityEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerServicerequestServicerequestpriorityEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerServicerequestServicerequestregionEnum(f *faker.Faker, limits ...string) enums.FieldseekerServicerequestServicerequestregionEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerServicerequestServicerequestregionEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerServicerequestServicerequestrejectedreasonEnum(f *faker.Faker, limits ...string) enums.FieldseekerServicerequestServicerequestrejectedreasonEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerServicerequestServicerequestrejectedreasonEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerServicerequestServicerequestsourceEnum(f *faker.Faker, limits ...string) enums.FieldseekerServicerequestServicerequestsourceEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerServicerequestServicerequestsourceEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerServicerequestServicerequeststatusEnum(f *faker.Faker, limits ...string) enums.FieldseekerServicerequestServicerequeststatusEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerServicerequestServicerequeststatusEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerServicerequestServicerequesttargetEnum(f *faker.Faker, limits ...string) enums.FieldseekerServicerequestServicerequesttargetEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerServicerequestServicerequesttargetEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerSpeciesabundanceNotinuitFEnum(f *faker.Faker, limits ...string) enums.FieldseekerSpeciesabundanceNotinuitFEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerSpeciesabundanceNotinuitFEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerStormdrainStormdrainsymbologyEnum(f *faker.Faker, limits ...string) enums.FieldseekerStormdrainStormdrainsymbologyEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerStormdrainStormdrainsymbologyEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu(f *faker.Faker, limits ...string) enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTimecardTimecardequipmenttypeEnum(f *faker.Faker, limits ...string) enums.FieldseekerTimecardTimecardequipmenttypeEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTimecardTimecardequipmenttypeEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTrapdataMosquitositeconditionEnum(f *faker.Faker, limits ...string) enums.FieldseekerTrapdataMosquitositeconditionEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTrapdataMosquitositeconditionEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTrapdataMosquitotrapconditionEnum(f *faker.Faker, limits ...string) enums.FieldseekerTrapdataMosquitotrapconditionEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTrapdataMosquitotrapconditionEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTrapdataMosquitotraptypeEnum(f *faker.Faker, limits ...string) enums.FieldseekerTrapdataMosquitotraptypeEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTrapdataMosquitotraptypeEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTrapdataNotinuitFEnum(f *faker.Faker, limits ...string) enums.FieldseekerTrapdataNotinuitFEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTrapdataNotinuitFEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTrapdataNotinuitrapactivitytypeEnum(f *faker.Faker, limits ...string) enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu(f *faker.Faker, limits ...string) enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166(f *faker.Faker, limits ...string) enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTraplocationNotinuitFEnum(f *faker.Faker, limits ...string) enums.FieldseekerTraplocationNotinuitFEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTraplocationNotinuitFEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0(f *faker.Faker, limits ...string) enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e(f *faker.Faker, limits ...string) enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B(f *faker.Faker, limits ...string) enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2(f *faker.Faker, limits ...string) enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTreatmentMosquitoactivityEnum(f *faker.Faker, limits ...string) enums.FieldseekerTreatmentMosquitoactivityEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTreatmentMosquitoactivityEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTreatmentMosquitoproductareaunitEnum(f *faker.Faker, limits ...string) enums.FieldseekerTreatmentMosquitoproductareaunitEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTreatmentMosquitoproductareaunitEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTreatmentMosquitoproductmeasureunitEnum(f *faker.Faker, limits ...string) enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTreatmentNotinuitFEnum(f *faker.Faker, limits ...string) enums.FieldseekerTreatmentNotinuitFEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTreatmentNotinuitFEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTreatmentNotinuiwinddirectionEnum(f *faker.Faker, limits ...string) enums.FieldseekerTreatmentNotinuiwinddirectionEnum { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTreatmentNotinuiwinddirectionEnum - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f(f *faker.Faker, limits ...string) enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1(f *faker.Faker, limits ...string) enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1 { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1 - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu(f *faker.Faker, limits ...string) enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E(f *faker.Faker, limits ...string) enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E(f *faker.Faker, limits ...string) enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E { - if f == nil { - f = &defaultFaker - } - - var e enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E + var e enums.Audiodatatype all := e.All() return all[f.IntBetween(0, len(all)-1)] } @@ -1273,6 +87,35 @@ func random_enums_Notificationtype(f *faker.Faker, limits ...string) enums.Notif return all[f.IntBetween(0, len(all)-1)] } +func random_float32(f *faker.Faker, limits ...string) float32 { + if f == nil { + f = &defaultFaker + } + + var precision int64 = 5 + var scale int64 = 2 + + if len(limits) > 0 { + precision, _ = strconv.ParseInt(limits[0], 10, 32) + } + + if len(limits) > 1 { + scale, _ = strconv.ParseInt(limits[1], 10, 32) + } + + baseVal := f.Float64(10, -1, 1) + for baseVal == -1 || baseVal == 0 || baseVal == 1 { + baseVal = f.Float64(10, -1, 1) + } + + scaleFloat := math.Pow10(int(scale)) + + val := baseVal * math.Pow10(int(precision)) + val = math.Trunc(val) / scaleFloat + + return float32(val) +} + func random_float64(f *faker.Faker, limits ...string) float64 { if f == nil { f = &defaultFaker @@ -1389,10 +232,27 @@ func random_time_Time(f *faker.Faker, limits ...string) time.Time { return f.Time().TimeBetween(min, max) } +func random_types_JSON_json_RawMessage_(f *faker.Faker, limits ...string) types.JSON[json.RawMessage] { + if f == nil { + f = &defaultFaker + } + + s := &bytes.Buffer{} + s.WriteRune('{') + for i := range f.IntBetween(1, 5) { + if i > 0 { + fmt.Fprint(s, ", ") + } + fmt.Fprintf(s, "%q:%q", f.Lorem().Word(), f.Lorem().Word()) + } + s.WriteRune('}') + return types.NewJSON[json.RawMessage](s.Bytes()) +} + func random_uuid_UUID(f *faker.Faker, limits ...string) uuid.UUID { if f == nil { f = &defaultFaker } - return uuid.Must(uuid.NewV4()) + return uuid.New() } diff --git a/db/factory/bobfactory_random.bob_test.go b/db/factory/bobfactory_random.bob_test.go index 6f602ab7..2bef9f5b 100644 --- a/db/factory/bobfactory_random.bob_test.go +++ b/db/factory/bobfactory_random.bob_test.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory @@ -25,6 +25,17 @@ func TestRandom___byte(t *testing.T) { } } +func TestRandom_float32(t *testing.T) { + t.Parallel() + + val1 := random_float32(nil) + val2 := random_float32(nil) + + if val1 == val2 { + t.Fatalf("random_float32() returned the same value twice: %v", val1) + } +} + func TestRandom_float64(t *testing.T) { t.Parallel() @@ -113,6 +124,17 @@ func TestRandom_time_Time(t *testing.T) { } } +func TestRandom_types_JSON_json_RawMessage_(t *testing.T) { + t.Parallel() + + val1 := random_types_JSON_json_RawMessage_(nil) + val2 := random_types_JSON_json_RawMessage_(nil) + + if bytes.Equal(val1.Val, val2.Val) { + t.Fatalf("random_types_JSON_json_RawMessage_() returned the same value twice: %v", val1) + } +} + func TestRandom_uuid_UUID(t *testing.T) { t.Parallel() diff --git a/db/factory/fieldseeker.containerrelate.bob.go b/db/factory/fieldseeker.containerrelate.bob.go index d15d8601..fd272378 100644 --- a/db/factory/fieldseeker.containerrelate.bob.go +++ b/db/factory/fieldseeker.containerrelate.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerContainerrelateMod interface { @@ -48,18 +49,30 @@ type FieldseekerContainerrelateTemplate struct { Inspsampleid func() null.Val[uuid.UUID] Mosquitoinspid func() null.Val[uuid.UUID] Treatmentid func() null.Val[uuid.UUID] - Containertype func() null.Val[enums.FieldseekerContainerrelateMosquitocontainertypeEnum] + Containertype func() null.Val[string] Creationdate func() null.Val[time.Time] Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerContainerrelateR f *Factory alreadyPersisted bool } +type fieldseekerContainerrelateR struct { + Organization *fieldseekerContainerrelateROrganizationR +} + +type fieldseekerContainerrelateROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerContainerrelateTemplate func (o *FieldseekerContainerrelateTemplate) Apply(ctx context.Context, mods ...FieldseekerContainerrelateMod) { for _, mod := range mods { @@ -69,7 +82,14 @@ func (o *FieldseekerContainerrelateTemplate) Apply(ctx context.Context, mods ... // setModelRels creates and sets the relationships on *models.FieldseekerContainerrelate // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerContainerrelateTemplate) setModelRels(o *models.FieldseekerContainerrelate) {} +func (t FieldseekerContainerrelateTemplate) setModelRels(o *models.FieldseekerContainerrelate) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Containerrelates = append(rel.R.Containerrelates, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerContainerrelateSetter // this does nothing with the relationship templates @@ -132,10 +152,22 @@ func (o FieldseekerContainerrelateTemplate) BuildSetter() *models.FieldseekerCon val := o.Editor() m.Editor = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -200,9 +232,18 @@ func (o FieldseekerContainerrelateTemplate) Build() *models.FieldseekerContainer if o.Editor != nil { m.Editor = o.Editor() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -223,6 +264,14 @@ func (o FieldseekerContainerrelateTemplate) BuildMany(number int) models.Fieldse } func ensureCreatableFieldseekerContainerrelate(m *models.FieldseekerContainerrelateSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerContainerrelate @@ -241,11 +290,30 @@ func (o *FieldseekerContainerrelateTemplate) Create(ctx context.Context, exec bo opt := o.BuildSetter() ensureCreatableFieldseekerContainerrelate(opt) + if o.r.Organization == nil { + FieldseekerContainerrelateMods.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.FieldseekerContainerrelates.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 } @@ -337,7 +405,10 @@ func (m fieldseekerContainerrelateMods) RandomizeAllColumns(f *faker.Faker) Fiel FieldseekerContainerrelateMods.RandomCreator(f), FieldseekerContainerrelateMods.RandomEditdate(f), FieldseekerContainerrelateMods.RandomEditor(f), + FieldseekerContainerrelateMods.RandomGeometry(f), + FieldseekerContainerrelateMods.RandomGeospatial(f), FieldseekerContainerrelateMods.RandomVersion(f), + FieldseekerContainerrelateMods.RandomOrganizationID(f), } } @@ -797,14 +868,14 @@ func (m fieldseekerContainerrelateMods) RandomTreatmentidNotNull(f *faker.Faker) } // Set the model columns to this value -func (m fieldseekerContainerrelateMods) Containertype(val null.Val[enums.FieldseekerContainerrelateMosquitocontainertypeEnum]) FieldseekerContainerrelateMod { +func (m fieldseekerContainerrelateMods) Containertype(val null.Val[string]) FieldseekerContainerrelateMod { return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Containertype = func() null.Val[enums.FieldseekerContainerrelateMosquitocontainertypeEnum] { return val } + o.Containertype = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerContainerrelateMods) ContainertypeFunc(f func() null.Val[enums.FieldseekerContainerrelateMosquitocontainertypeEnum]) FieldseekerContainerrelateMod { +func (m fieldseekerContainerrelateMods) ContainertypeFunc(f func() null.Val[string]) FieldseekerContainerrelateMod { return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { o.Containertype = f }) @@ -822,12 +893,12 @@ func (m fieldseekerContainerrelateMods) UnsetContainertype() FieldseekerContaine // The generated value is sometimes null func (m fieldseekerContainerrelateMods) RandomContainertype(f *faker.Faker) FieldseekerContainerrelateMod { return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Containertype = func() null.Val[enums.FieldseekerContainerrelateMosquitocontainertypeEnum] { + o.Containertype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerContainerrelateMosquitocontainertypeEnum(f) + val := random_string(f, "250") return null.From(val) } }) @@ -838,12 +909,12 @@ func (m fieldseekerContainerrelateMods) RandomContainertype(f *faker.Faker) Fiel // The generated value is never null func (m fieldseekerContainerrelateMods) RandomContainertypeNotNull(f *faker.Faker) FieldseekerContainerrelateMod { return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Containertype = func() null.Val[enums.FieldseekerContainerrelateMosquitocontainertypeEnum] { + o.Containertype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerContainerrelateMosquitocontainertypeEnum(f) + val := random_string(f, "250") return null.From(val) } }) @@ -1061,6 +1132,90 @@ func (m fieldseekerContainerrelateMods) RandomEditorNotNull(f *faker.Faker) Fiel }) } +// Set the model columns to this value +func (m fieldseekerContainerrelateMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerContainerrelateMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerContainerrelateMods) UnsetGeometry() FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerContainerrelateMods) RandomGeometry(f *faker.Faker) FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerContainerrelateMods) Geospatial(val null.Val[string]) FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerContainerrelateMods) GeospatialFunc(f func() null.Val[string]) FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerContainerrelateMods) UnsetGeospatial() FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerContainerrelateMods) RandomGeospatial(f *faker.Faker) FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerContainerrelateMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { + o.Geospatial = 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 fieldseekerContainerrelateMods) Version(val int32) FieldseekerContainerrelateMod { return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { @@ -1092,11 +1247,77 @@ func (m fieldseekerContainerrelateMods) RandomVersion(f *faker.Faker) Fieldseeke }) } +// Set the model columns to this value +func (m fieldseekerContainerrelateMods) OrganizationID(val int32) FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerContainerrelateMods) OrganizationIDFunc(f func() int32) FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerContainerrelateMods) UnsetOrganizationID() FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { + 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 fieldseekerContainerrelateMods) RandomOrganizationID(f *faker.Faker) FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerContainerrelateMods) WithParentsCascading() FieldseekerContainerrelateMod { return FieldseekerContainerrelateModFunc(func(ctx context.Context, o *FieldseekerContainerrelateTemplate) { if isDone, _ := fieldseekerContainerrelateWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerContainerrelateWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerContainerrelateMods) WithOrganization(rel *OrganizationTemplate) FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(ctx context.Context, o *FieldseekerContainerrelateTemplate) { + o.r.Organization = &fieldseekerContainerrelateROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerContainerrelateMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(ctx context.Context, o *FieldseekerContainerrelateTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerContainerrelateMods) WithExistingOrganization(em *models.Organization) FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(ctx context.Context, o *FieldseekerContainerrelateTemplate) { + o.r.Organization = &fieldseekerContainerrelateROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerContainerrelateMods) WithoutOrganization() FieldseekerContainerrelateMod { + return FieldseekerContainerrelateModFunc(func(ctx context.Context, o *FieldseekerContainerrelateTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.fieldscoutinglog.bob.go b/db/factory/fieldseeker.fieldscoutinglog.bob.go index 64283691..6bf3ba50 100644 --- a/db/factory/fieldseeker.fieldscoutinglog.bob.go +++ b/db/factory/fieldseeker.fieldscoutinglog.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerFieldscoutinglogMod interface { @@ -40,7 +41,7 @@ func (mods FieldseekerFieldscoutinglogModSlice) Apply(ctx context.Context, n *Fi // all columns are optional and should be set by mods type FieldseekerFieldscoutinglogTemplate struct { Objectid func() int64 - Status func() null.Val[enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum] + Status func() null.Val[int16] Globalid func() null.Val[uuid.UUID] CreatedUser func() null.Val[string] CreatedDate func() null.Val[time.Time] @@ -50,13 +51,25 @@ type FieldseekerFieldscoutinglogTemplate struct { Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerFieldscoutinglogR f *Factory alreadyPersisted bool } +type fieldseekerFieldscoutinglogR struct { + Organization *fieldseekerFieldscoutinglogROrganizationR +} + +type fieldseekerFieldscoutinglogROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerFieldscoutinglogTemplate func (o *FieldseekerFieldscoutinglogTemplate) Apply(ctx context.Context, mods ...FieldseekerFieldscoutinglogMod) { for _, mod := range mods { @@ -66,7 +79,14 @@ func (o *FieldseekerFieldscoutinglogTemplate) Apply(ctx context.Context, mods .. // setModelRels creates and sets the relationships on *models.FieldseekerFieldscoutinglog // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerFieldscoutinglogTemplate) setModelRels(o *models.FieldseekerFieldscoutinglog) {} +func (t FieldseekerFieldscoutinglogTemplate) setModelRels(o *models.FieldseekerFieldscoutinglog) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Fieldscoutinglogs = append(rel.R.Fieldscoutinglogs, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerFieldscoutinglogSetter // this does nothing with the relationship templates @@ -117,10 +137,22 @@ func (o FieldseekerFieldscoutinglogTemplate) BuildSetter() *models.FieldseekerFi val := o.Editor() m.Editor = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -176,9 +208,18 @@ func (o FieldseekerFieldscoutinglogTemplate) Build() *models.FieldseekerFieldsco if o.Editor != nil { m.Editor = o.Editor() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -199,6 +240,14 @@ func (o FieldseekerFieldscoutinglogTemplate) BuildMany(number int) models.Fields } func ensureCreatableFieldseekerFieldscoutinglog(m *models.FieldseekerFieldscoutinglogSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerFieldscoutinglog @@ -217,11 +266,30 @@ func (o *FieldseekerFieldscoutinglogTemplate) Create(ctx context.Context, exec b opt := o.BuildSetter() ensureCreatableFieldseekerFieldscoutinglog(opt) + if o.r.Organization == nil { + FieldseekerFieldscoutinglogMods.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.FieldseekerFieldscoutinglogs.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 } @@ -310,7 +378,10 @@ func (m fieldseekerFieldscoutinglogMods) RandomizeAllColumns(f *faker.Faker) Fie FieldseekerFieldscoutinglogMods.RandomCreator(f), FieldseekerFieldscoutinglogMods.RandomEditdate(f), FieldseekerFieldscoutinglogMods.RandomEditor(f), + FieldseekerFieldscoutinglogMods.RandomGeometry(f), + FieldseekerFieldscoutinglogMods.RandomGeospatial(f), FieldseekerFieldscoutinglogMods.RandomVersion(f), + FieldseekerFieldscoutinglogMods.RandomOrganizationID(f), } } @@ -346,14 +417,14 @@ func (m fieldseekerFieldscoutinglogMods) RandomObjectid(f *faker.Faker) Fieldsee } // Set the model columns to this value -func (m fieldseekerFieldscoutinglogMods) Status(val null.Val[enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum]) FieldseekerFieldscoutinglogMod { +func (m fieldseekerFieldscoutinglogMods) Status(val null.Val[int16]) FieldseekerFieldscoutinglogMod { return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Status = func() null.Val[enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum] { return val } + o.Status = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerFieldscoutinglogMods) StatusFunc(f func() null.Val[enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum]) FieldseekerFieldscoutinglogMod { +func (m fieldseekerFieldscoutinglogMods) StatusFunc(f func() null.Val[int16]) FieldseekerFieldscoutinglogMod { return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { o.Status = f }) @@ -371,12 +442,12 @@ func (m fieldseekerFieldscoutinglogMods) UnsetStatus() FieldseekerFieldscoutingl // The generated value is sometimes null func (m fieldseekerFieldscoutinglogMods) RandomStatus(f *faker.Faker) FieldseekerFieldscoutinglogMod { return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Status = func() null.Val[enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum] { + o.Status = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -387,12 +458,12 @@ func (m fieldseekerFieldscoutinglogMods) RandomStatus(f *faker.Faker) Fieldseeke // The generated value is never null func (m fieldseekerFieldscoutinglogMods) RandomStatusNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod { return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Status = func() null.Val[enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum] { + o.Status = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -875,6 +946,90 @@ func (m fieldseekerFieldscoutinglogMods) RandomEditorNotNull(f *faker.Faker) Fie }) } +// Set the model columns to this value +func (m fieldseekerFieldscoutinglogMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerFieldscoutinglogMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerFieldscoutinglogMods) UnsetGeometry() FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerFieldscoutinglogMods) RandomGeometry(f *faker.Faker) FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerFieldscoutinglogMods) Geospatial(val null.Val[string]) FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerFieldscoutinglogMods) GeospatialFunc(f func() null.Val[string]) FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerFieldscoutinglogMods) UnsetGeospatial() FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerFieldscoutinglogMods) RandomGeospatial(f *faker.Faker) FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerFieldscoutinglogMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { + o.Geospatial = 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 fieldseekerFieldscoutinglogMods) Version(val int32) FieldseekerFieldscoutinglogMod { return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { @@ -906,11 +1061,77 @@ func (m fieldseekerFieldscoutinglogMods) RandomVersion(f *faker.Faker) Fieldseek }) } +// Set the model columns to this value +func (m fieldseekerFieldscoutinglogMods) OrganizationID(val int32) FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerFieldscoutinglogMods) OrganizationIDFunc(f func() int32) FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerFieldscoutinglogMods) UnsetOrganizationID() FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { + 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 fieldseekerFieldscoutinglogMods) RandomOrganizationID(f *faker.Faker) FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerFieldscoutinglogMods) WithParentsCascading() FieldseekerFieldscoutinglogMod { return FieldseekerFieldscoutinglogModFunc(func(ctx context.Context, o *FieldseekerFieldscoutinglogTemplate) { if isDone, _ := fieldseekerFieldscoutinglogWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerFieldscoutinglogWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerFieldscoutinglogMods) WithOrganization(rel *OrganizationTemplate) FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(ctx context.Context, o *FieldseekerFieldscoutinglogTemplate) { + o.r.Organization = &fieldseekerFieldscoutinglogROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerFieldscoutinglogMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(ctx context.Context, o *FieldseekerFieldscoutinglogTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerFieldscoutinglogMods) WithExistingOrganization(em *models.Organization) FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(ctx context.Context, o *FieldseekerFieldscoutinglogTemplate) { + o.r.Organization = &fieldseekerFieldscoutinglogROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerFieldscoutinglogMods) WithoutOrganization() FieldseekerFieldscoutinglogMod { + return FieldseekerFieldscoutinglogModFunc(func(ctx context.Context, o *FieldseekerFieldscoutinglogTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.habitatrelate.bob.go b/db/factory/fieldseeker.habitatrelate.bob.go index a33fcbd8..cc945ce0 100644 --- a/db/factory/fieldseeker.habitatrelate.bob.go +++ b/db/factory/fieldseeker.habitatrelate.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerHabitatrelateMod interface { @@ -46,18 +47,30 @@ type FieldseekerHabitatrelateTemplate struct { CreatedDate func() null.Val[time.Time] LastEditedUser func() null.Val[string] LastEditedDate func() null.Val[time.Time] - Habitattype func() null.Val[enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284] + Habitattype func() null.Val[string] Creationdate func() null.Val[time.Time] Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerHabitatrelateR f *Factory alreadyPersisted bool } +type fieldseekerHabitatrelateR struct { + Organization *fieldseekerHabitatrelateROrganizationR +} + +type fieldseekerHabitatrelateROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerHabitatrelateTemplate func (o *FieldseekerHabitatrelateTemplate) Apply(ctx context.Context, mods ...FieldseekerHabitatrelateMod) { for _, mod := range mods { @@ -67,7 +80,14 @@ func (o *FieldseekerHabitatrelateTemplate) Apply(ctx context.Context, mods ...Fi // setModelRels creates and sets the relationships on *models.FieldseekerHabitatrelate // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerHabitatrelateTemplate) setModelRels(o *models.FieldseekerHabitatrelate) {} +func (t FieldseekerHabitatrelateTemplate) setModelRels(o *models.FieldseekerHabitatrelate) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Habitatrelates = append(rel.R.Habitatrelates, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerHabitatrelateSetter // this does nothing with the relationship templates @@ -122,10 +142,22 @@ func (o FieldseekerHabitatrelateTemplate) BuildSetter() *models.FieldseekerHabit val := o.Editor() m.Editor = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -184,9 +216,18 @@ func (o FieldseekerHabitatrelateTemplate) Build() *models.FieldseekerHabitatrela if o.Editor != nil { m.Editor = o.Editor() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -207,6 +248,14 @@ func (o FieldseekerHabitatrelateTemplate) BuildMany(number int) models.Fieldseek } func ensureCreatableFieldseekerHabitatrelate(m *models.FieldseekerHabitatrelateSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerHabitatrelate @@ -225,11 +274,30 @@ func (o *FieldseekerHabitatrelateTemplate) Create(ctx context.Context, exec bob. opt := o.BuildSetter() ensureCreatableFieldseekerHabitatrelate(opt) + if o.r.Organization == nil { + FieldseekerHabitatrelateMods.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.FieldseekerHabitatrelates.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 } @@ -319,7 +387,10 @@ func (m fieldseekerHabitatrelateMods) RandomizeAllColumns(f *faker.Faker) Fields FieldseekerHabitatrelateMods.RandomCreator(f), FieldseekerHabitatrelateMods.RandomEditdate(f), FieldseekerHabitatrelateMods.RandomEditor(f), + FieldseekerHabitatrelateMods.RandomGeometry(f), + FieldseekerHabitatrelateMods.RandomGeospatial(f), FieldseekerHabitatrelateMods.RandomVersion(f), + FieldseekerHabitatrelateMods.RandomOrganizationID(f), } } @@ -673,16 +744,14 @@ func (m fieldseekerHabitatrelateMods) RandomLastEditedDateNotNull(f *faker.Faker } // Set the model columns to this value -func (m fieldseekerHabitatrelateMods) Habitattype(val null.Val[enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284]) FieldseekerHabitatrelateMod { +func (m fieldseekerHabitatrelateMods) Habitattype(val null.Val[string]) FieldseekerHabitatrelateMod { return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Habitattype = func() null.Val[enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284] { - return val - } + o.Habitattype = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerHabitatrelateMods) HabitattypeFunc(f func() null.Val[enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284]) FieldseekerHabitatrelateMod { +func (m fieldseekerHabitatrelateMods) HabitattypeFunc(f func() null.Val[string]) FieldseekerHabitatrelateMod { return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { o.Habitattype = f }) @@ -700,12 +769,12 @@ func (m fieldseekerHabitatrelateMods) UnsetHabitattype() FieldseekerHabitatrelat // The generated value is sometimes null func (m fieldseekerHabitatrelateMods) RandomHabitattype(f *faker.Faker) FieldseekerHabitatrelateMod { return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Habitattype = func() null.Val[enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284] { + o.Habitattype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284(f) + val := random_string(f, "250") return null.From(val) } }) @@ -716,12 +785,12 @@ func (m fieldseekerHabitatrelateMods) RandomHabitattype(f *faker.Faker) Fieldsee // The generated value is never null func (m fieldseekerHabitatrelateMods) RandomHabitattypeNotNull(f *faker.Faker) FieldseekerHabitatrelateMod { return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Habitattype = func() null.Val[enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284] { + o.Habitattype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284(f) + val := random_string(f, "250") return null.From(val) } }) @@ -939,6 +1008,90 @@ func (m fieldseekerHabitatrelateMods) RandomEditorNotNull(f *faker.Faker) Fields }) } +// Set the model columns to this value +func (m fieldseekerHabitatrelateMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerHabitatrelateMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerHabitatrelateMods) UnsetGeometry() FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerHabitatrelateMods) RandomGeometry(f *faker.Faker) FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerHabitatrelateMods) Geospatial(val null.Val[string]) FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerHabitatrelateMods) GeospatialFunc(f func() null.Val[string]) FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerHabitatrelateMods) UnsetGeospatial() FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerHabitatrelateMods) RandomGeospatial(f *faker.Faker) FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerHabitatrelateMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { + o.Geospatial = 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 fieldseekerHabitatrelateMods) Version(val int32) FieldseekerHabitatrelateMod { return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { @@ -970,11 +1123,77 @@ func (m fieldseekerHabitatrelateMods) RandomVersion(f *faker.Faker) FieldseekerH }) } +// Set the model columns to this value +func (m fieldseekerHabitatrelateMods) OrganizationID(val int32) FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerHabitatrelateMods) OrganizationIDFunc(f func() int32) FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerHabitatrelateMods) UnsetOrganizationID() FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { + 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 fieldseekerHabitatrelateMods) RandomOrganizationID(f *faker.Faker) FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerHabitatrelateMods) WithParentsCascading() FieldseekerHabitatrelateMod { return FieldseekerHabitatrelateModFunc(func(ctx context.Context, o *FieldseekerHabitatrelateTemplate) { if isDone, _ := fieldseekerHabitatrelateWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerHabitatrelateWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerHabitatrelateMods) WithOrganization(rel *OrganizationTemplate) FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(ctx context.Context, o *FieldseekerHabitatrelateTemplate) { + o.r.Organization = &fieldseekerHabitatrelateROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerHabitatrelateMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(ctx context.Context, o *FieldseekerHabitatrelateTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerHabitatrelateMods) WithExistingOrganization(em *models.Organization) FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(ctx context.Context, o *FieldseekerHabitatrelateTemplate) { + o.r.Organization = &fieldseekerHabitatrelateROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerHabitatrelateMods) WithoutOrganization() FieldseekerHabitatrelateMod { + return FieldseekerHabitatrelateModFunc(func(ctx context.Context, o *FieldseekerHabitatrelateTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.inspectionsample.bob.go b/db/factory/fieldseeker.inspectionsample.bob.go index 9788f79f..8830b4b2 100644 --- a/db/factory/fieldseeker.inspectionsample.bob.go +++ b/db/factory/fieldseeker.inspectionsample.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerInspectionsampleMod interface { @@ -42,7 +43,7 @@ type FieldseekerInspectionsampleTemplate struct { Objectid func() int64 InspID func() null.Val[uuid.UUID] Sampleid func() null.Val[string] - Processed func() null.Val[enums.FieldseekerInspectionsampleNotinuitFEnum] + Processed func() null.Val[int16] Idbytech func() null.Val[string] Globalid func() null.Val[uuid.UUID] CreatedUser func() null.Val[string] @@ -53,13 +54,25 @@ type FieldseekerInspectionsampleTemplate struct { Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerInspectionsampleR f *Factory alreadyPersisted bool } +type fieldseekerInspectionsampleR struct { + Organization *fieldseekerInspectionsampleROrganizationR +} + +type fieldseekerInspectionsampleROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerInspectionsampleTemplate func (o *FieldseekerInspectionsampleTemplate) Apply(ctx context.Context, mods ...FieldseekerInspectionsampleMod) { for _, mod := range mods { @@ -69,7 +82,14 @@ func (o *FieldseekerInspectionsampleTemplate) Apply(ctx context.Context, mods .. // setModelRels creates and sets the relationships on *models.FieldseekerInspectionsample // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerInspectionsampleTemplate) setModelRels(o *models.FieldseekerInspectionsample) {} +func (t FieldseekerInspectionsampleTemplate) setModelRels(o *models.FieldseekerInspectionsample) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Inspectionsamples = append(rel.R.Inspectionsamples, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerInspectionsampleSetter // this does nothing with the relationship templates @@ -132,10 +152,22 @@ func (o FieldseekerInspectionsampleTemplate) BuildSetter() *models.FieldseekerIn val := o.Editor() m.Editor = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -200,9 +232,18 @@ func (o FieldseekerInspectionsampleTemplate) Build() *models.FieldseekerInspecti if o.Editor != nil { m.Editor = o.Editor() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -223,6 +264,14 @@ func (o FieldseekerInspectionsampleTemplate) BuildMany(number int) models.Fields } func ensureCreatableFieldseekerInspectionsample(m *models.FieldseekerInspectionsampleSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerInspectionsample @@ -241,11 +290,30 @@ func (o *FieldseekerInspectionsampleTemplate) Create(ctx context.Context, exec b opt := o.BuildSetter() ensureCreatableFieldseekerInspectionsample(opt) + if o.r.Organization == nil { + FieldseekerInspectionsampleMods.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.FieldseekerInspectionsamples.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 } @@ -337,7 +405,10 @@ func (m fieldseekerInspectionsampleMods) RandomizeAllColumns(f *faker.Faker) Fie FieldseekerInspectionsampleMods.RandomCreator(f), FieldseekerInspectionsampleMods.RandomEditdate(f), FieldseekerInspectionsampleMods.RandomEditor(f), + FieldseekerInspectionsampleMods.RandomGeometry(f), + FieldseekerInspectionsampleMods.RandomGeospatial(f), FieldseekerInspectionsampleMods.RandomVersion(f), + FieldseekerInspectionsampleMods.RandomOrganizationID(f), } } @@ -479,14 +550,14 @@ func (m fieldseekerInspectionsampleMods) RandomSampleidNotNull(f *faker.Faker) F } // Set the model columns to this value -func (m fieldseekerInspectionsampleMods) Processed(val null.Val[enums.FieldseekerInspectionsampleNotinuitFEnum]) FieldseekerInspectionsampleMod { +func (m fieldseekerInspectionsampleMods) Processed(val null.Val[int16]) FieldseekerInspectionsampleMod { return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Processed = func() null.Val[enums.FieldseekerInspectionsampleNotinuitFEnum] { return val } + o.Processed = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerInspectionsampleMods) ProcessedFunc(f func() null.Val[enums.FieldseekerInspectionsampleNotinuitFEnum]) FieldseekerInspectionsampleMod { +func (m fieldseekerInspectionsampleMods) ProcessedFunc(f func() null.Val[int16]) FieldseekerInspectionsampleMod { return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { o.Processed = f }) @@ -504,12 +575,12 @@ func (m fieldseekerInspectionsampleMods) UnsetProcessed() FieldseekerInspections // The generated value is sometimes null func (m fieldseekerInspectionsampleMods) RandomProcessed(f *faker.Faker) FieldseekerInspectionsampleMod { return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Processed = func() null.Val[enums.FieldseekerInspectionsampleNotinuitFEnum] { + o.Processed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerInspectionsampleNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -520,12 +591,12 @@ func (m fieldseekerInspectionsampleMods) RandomProcessed(f *faker.Faker) Fieldse // The generated value is never null func (m fieldseekerInspectionsampleMods) RandomProcessedNotNull(f *faker.Faker) FieldseekerInspectionsampleMod { return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Processed = func() null.Val[enums.FieldseekerInspectionsampleNotinuitFEnum] { + o.Processed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerInspectionsampleNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1061,6 +1132,90 @@ func (m fieldseekerInspectionsampleMods) RandomEditorNotNull(f *faker.Faker) Fie }) } +// Set the model columns to this value +func (m fieldseekerInspectionsampleMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerInspectionsampleMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerInspectionsampleMods) UnsetGeometry() FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerInspectionsampleMods) RandomGeometry(f *faker.Faker) FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerInspectionsampleMods) Geospatial(val null.Val[string]) FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerInspectionsampleMods) GeospatialFunc(f func() null.Val[string]) FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerInspectionsampleMods) UnsetGeospatial() FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerInspectionsampleMods) RandomGeospatial(f *faker.Faker) FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerInspectionsampleMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { + o.Geospatial = 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 fieldseekerInspectionsampleMods) Version(val int32) FieldseekerInspectionsampleMod { return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { @@ -1092,11 +1247,77 @@ func (m fieldseekerInspectionsampleMods) RandomVersion(f *faker.Faker) Fieldseek }) } +// Set the model columns to this value +func (m fieldseekerInspectionsampleMods) OrganizationID(val int32) FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerInspectionsampleMods) OrganizationIDFunc(f func() int32) FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerInspectionsampleMods) UnsetOrganizationID() FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { + 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 fieldseekerInspectionsampleMods) RandomOrganizationID(f *faker.Faker) FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerInspectionsampleMods) WithParentsCascading() FieldseekerInspectionsampleMod { return FieldseekerInspectionsampleModFunc(func(ctx context.Context, o *FieldseekerInspectionsampleTemplate) { if isDone, _ := fieldseekerInspectionsampleWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerInspectionsampleWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerInspectionsampleMods) WithOrganization(rel *OrganizationTemplate) FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(ctx context.Context, o *FieldseekerInspectionsampleTemplate) { + o.r.Organization = &fieldseekerInspectionsampleROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerInspectionsampleMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(ctx context.Context, o *FieldseekerInspectionsampleTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerInspectionsampleMods) WithExistingOrganization(em *models.Organization) FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(ctx context.Context, o *FieldseekerInspectionsampleTemplate) { + o.r.Organization = &fieldseekerInspectionsampleROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerInspectionsampleMods) WithoutOrganization() FieldseekerInspectionsampleMod { + return FieldseekerInspectionsampleModFunc(func(ctx context.Context, o *FieldseekerInspectionsampleTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.inspectionsampledetail.bob.go b/db/factory/fieldseeker.inspectionsampledetail.bob.go index 1eedba3e..cffc0a17 100644 --- a/db/factory/fieldseeker.inspectionsampledetail.bob.go +++ b/db/factory/fieldseeker.inspectionsampledetail.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerInspectionsampledetailMod interface { @@ -41,18 +42,18 @@ func (mods FieldseekerInspectionsampledetailModSlice) Apply(ctx context.Context, type FieldseekerInspectionsampledetailTemplate struct { Objectid func() int64 InspsampleID func() null.Val[uuid.UUID] - Fieldspecies func() null.Val[enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum] + Fieldspecies func() null.Val[string] Flarvcount func() null.Val[int16] Fpupcount func() null.Val[int16] Feggcount func() null.Val[int16] Flstages func() null.Val[string] - Fdomstage func() null.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum] - Fadultact func() null.Val[enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum] + Fdomstage func() null.Val[string] + Fadultact func() null.Val[string] Labspecies func() null.Val[string] Llarvcount func() null.Val[int16] Lpupcount func() null.Val[int16] Leggcount func() null.Val[int16] - Ldomstage func() null.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum] + Ldomstage func() null.Val[string] Comments func() null.Val[string] Globalid func() null.Val[uuid.UUID] CreatedUser func() null.Val[string] @@ -64,13 +65,25 @@ type FieldseekerInspectionsampledetailTemplate struct { Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerInspectionsampledetailR f *Factory alreadyPersisted bool } +type fieldseekerInspectionsampledetailR struct { + Organization *fieldseekerInspectionsampledetailROrganizationR +} + +type fieldseekerInspectionsampledetailROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerInspectionsampledetailTemplate func (o *FieldseekerInspectionsampledetailTemplate) Apply(ctx context.Context, mods ...FieldseekerInspectionsampledetailMod) { for _, mod := range mods { @@ -81,6 +94,12 @@ func (o *FieldseekerInspectionsampledetailTemplate) Apply(ctx context.Context, m // setModelRels creates and sets the relationships on *models.FieldseekerInspectionsampledetail // according to the relationships in the template. Nothing is inserted into the db func (t FieldseekerInspectionsampledetailTemplate) setModelRels(o *models.FieldseekerInspectionsampledetail) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Inspectionsampledetails = append(rel.R.Inspectionsampledetails, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } } // BuildSetter returns an *models.FieldseekerInspectionsampledetailSetter @@ -188,10 +207,22 @@ func (o FieldseekerInspectionsampledetailTemplate) BuildSetter() *models.Fieldse val := o.Editor() m.Editor = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -289,9 +320,18 @@ func (o FieldseekerInspectionsampledetailTemplate) Build() *models.FieldseekerIn if o.Editor != nil { m.Editor = o.Editor() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -312,6 +352,14 @@ func (o FieldseekerInspectionsampledetailTemplate) BuildMany(number int) models. } func ensureCreatableFieldseekerInspectionsampledetail(m *models.FieldseekerInspectionsampledetailSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerInspectionsampledetail @@ -330,11 +378,30 @@ func (o *FieldseekerInspectionsampledetailTemplate) Create(ctx context.Context, opt := o.BuildSetter() ensureCreatableFieldseekerInspectionsampledetail(opt) + if o.r.Organization == nil { + FieldseekerInspectionsampledetailMods.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.FieldseekerInspectionsampledetails.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 } @@ -437,7 +504,10 @@ func (m fieldseekerInspectionsampledetailMods) RandomizeAllColumns(f *faker.Fake FieldseekerInspectionsampledetailMods.RandomCreator(f), FieldseekerInspectionsampledetailMods.RandomEditdate(f), FieldseekerInspectionsampledetailMods.RandomEditor(f), + FieldseekerInspectionsampledetailMods.RandomGeometry(f), + FieldseekerInspectionsampledetailMods.RandomGeospatial(f), FieldseekerInspectionsampledetailMods.RandomVersion(f), + FieldseekerInspectionsampledetailMods.RandomOrganizationID(f), } } @@ -526,14 +596,14 @@ func (m fieldseekerInspectionsampledetailMods) RandomInspsampleIDNotNull(f *fake } // Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) Fieldspecies(val null.Val[enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum]) FieldseekerInspectionsampledetailMod { +func (m fieldseekerInspectionsampledetailMods) Fieldspecies(val null.Val[string]) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fieldspecies = func() null.Val[enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum] { return val } + o.Fieldspecies = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) FieldspeciesFunc(f func() null.Val[enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum]) FieldseekerInspectionsampledetailMod { +func (m fieldseekerInspectionsampledetailMods) FieldspeciesFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { o.Fieldspecies = f }) @@ -551,12 +621,12 @@ func (m fieldseekerInspectionsampledetailMods) UnsetFieldspecies() FieldseekerIn // The generated value is sometimes null func (m fieldseekerInspectionsampledetailMods) RandomFieldspecies(f *faker.Faker) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fieldspecies = func() null.Val[enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum] { + o.Fieldspecies = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerInspectionsampledetailMosquitofieldspeciesEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -567,12 +637,12 @@ func (m fieldseekerInspectionsampledetailMods) RandomFieldspecies(f *faker.Faker // The generated value is never null func (m fieldseekerInspectionsampledetailMods) RandomFieldspeciesNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fieldspecies = func() null.Val[enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum] { + o.Fieldspecies = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerInspectionsampledetailMosquitofieldspeciesEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -791,14 +861,14 @@ func (m fieldseekerInspectionsampledetailMods) RandomFlstagesNotNull(f *faker.Fa } // Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) Fdomstage(val null.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum]) FieldseekerInspectionsampledetailMod { +func (m fieldseekerInspectionsampledetailMods) Fdomstage(val null.Val[string]) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fdomstage = func() null.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum] { return val } + o.Fdomstage = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) FdomstageFunc(f func() null.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum]) FieldseekerInspectionsampledetailMod { +func (m fieldseekerInspectionsampledetailMods) FdomstageFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { o.Fdomstage = f }) @@ -816,12 +886,12 @@ func (m fieldseekerInspectionsampledetailMods) UnsetFdomstage() FieldseekerInspe // The generated value is sometimes null func (m fieldseekerInspectionsampledetailMods) RandomFdomstage(f *faker.Faker) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fdomstage = func() null.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum] { + o.Fdomstage = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerInspectionsampledetailMosquitodominantstageEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -832,26 +902,26 @@ func (m fieldseekerInspectionsampledetailMods) RandomFdomstage(f *faker.Faker) F // The generated value is never null func (m fieldseekerInspectionsampledetailMods) RandomFdomstageNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fdomstage = func() null.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum] { + o.Fdomstage = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerInspectionsampledetailMosquitodominantstageEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) Fadultact(val null.Val[enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum]) FieldseekerInspectionsampledetailMod { +func (m fieldseekerInspectionsampledetailMods) Fadultact(val null.Val[string]) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fadultact = func() null.Val[enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum] { return val } + o.Fadultact = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) FadultactFunc(f func() null.Val[enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum]) FieldseekerInspectionsampledetailMod { +func (m fieldseekerInspectionsampledetailMods) FadultactFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { o.Fadultact = f }) @@ -869,12 +939,12 @@ func (m fieldseekerInspectionsampledetailMods) UnsetFadultact() FieldseekerInspe // The generated value is sometimes null func (m fieldseekerInspectionsampledetailMods) RandomFadultact(f *faker.Faker) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fadultact = func() null.Val[enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum] { + o.Fadultact = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerInspectionsampledetailMosquitoadultactivityEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -885,12 +955,12 @@ func (m fieldseekerInspectionsampledetailMods) RandomFadultact(f *faker.Faker) F // The generated value is never null func (m fieldseekerInspectionsampledetailMods) RandomFadultactNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fadultact = func() null.Val[enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum] { + o.Fadultact = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerInspectionsampledetailMosquitoadultactivityEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1109,14 +1179,14 @@ func (m fieldseekerInspectionsampledetailMods) RandomLeggcountNotNull(f *faker.F } // Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) Ldomstage(val null.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum]) FieldseekerInspectionsampledetailMod { +func (m fieldseekerInspectionsampledetailMods) Ldomstage(val null.Val[string]) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Ldomstage = func() null.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum] { return val } + o.Ldomstage = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) LdomstageFunc(f func() null.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum]) FieldseekerInspectionsampledetailMod { +func (m fieldseekerInspectionsampledetailMods) LdomstageFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { o.Ldomstage = f }) @@ -1134,12 +1204,12 @@ func (m fieldseekerInspectionsampledetailMods) UnsetLdomstage() FieldseekerInspe // The generated value is sometimes null func (m fieldseekerInspectionsampledetailMods) RandomLdomstage(f *faker.Faker) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Ldomstage = func() null.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum] { + o.Ldomstage = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerInspectionsampledetailMosquitodominantstageEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1150,12 +1220,12 @@ func (m fieldseekerInspectionsampledetailMods) RandomLdomstage(f *faker.Faker) F // The generated value is never null func (m fieldseekerInspectionsampledetailMods) RandomLdomstageNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Ldomstage = func() null.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum] { + o.Ldomstage = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerInspectionsampledetailMosquitodominantstageEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1744,6 +1814,90 @@ func (m fieldseekerInspectionsampledetailMods) RandomEditorNotNull(f *faker.Fake }) } +// Set the model columns to this value +func (m fieldseekerInspectionsampledetailMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerInspectionsampledetailMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerInspectionsampledetailMods) UnsetGeometry() FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerInspectionsampledetailMods) RandomGeometry(f *faker.Faker) FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerInspectionsampledetailMods) Geospatial(val null.Val[string]) FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerInspectionsampledetailMods) GeospatialFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerInspectionsampledetailMods) UnsetGeospatial() FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerInspectionsampledetailMods) RandomGeospatial(f *faker.Faker) FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerInspectionsampledetailMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { + o.Geospatial = 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 fieldseekerInspectionsampledetailMods) Version(val int32) FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { @@ -1775,11 +1929,77 @@ func (m fieldseekerInspectionsampledetailMods) RandomVersion(f *faker.Faker) Fie }) } +// Set the model columns to this value +func (m fieldseekerInspectionsampledetailMods) OrganizationID(val int32) FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerInspectionsampledetailMods) OrganizationIDFunc(f func() int32) FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerInspectionsampledetailMods) UnsetOrganizationID() FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { + 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 fieldseekerInspectionsampledetailMods) RandomOrganizationID(f *faker.Faker) FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerInspectionsampledetailMods) WithParentsCascading() FieldseekerInspectionsampledetailMod { return FieldseekerInspectionsampledetailModFunc(func(ctx context.Context, o *FieldseekerInspectionsampledetailTemplate) { if isDone, _ := fieldseekerInspectionsampledetailWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerInspectionsampledetailWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerInspectionsampledetailMods) WithOrganization(rel *OrganizationTemplate) FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(ctx context.Context, o *FieldseekerInspectionsampledetailTemplate) { + o.r.Organization = &fieldseekerInspectionsampledetailROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerInspectionsampledetailMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(ctx context.Context, o *FieldseekerInspectionsampledetailTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerInspectionsampledetailMods) WithExistingOrganization(em *models.Organization) FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(ctx context.Context, o *FieldseekerInspectionsampledetailTemplate) { + o.r.Organization = &fieldseekerInspectionsampledetailROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerInspectionsampledetailMods) WithoutOrganization() FieldseekerInspectionsampledetailMod { + return FieldseekerInspectionsampledetailModFunc(func(ctx context.Context, o *FieldseekerInspectionsampledetailTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.linelocation.bob.go b/db/factory/fieldseeker.linelocation.bob.go index a2f9461f..2107b869 100644 --- a/db/factory/fieldseeker.linelocation.bob.go +++ b/db/factory/fieldseeker.linelocation.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerLinelocationMod interface { @@ -42,14 +43,14 @@ type FieldseekerLinelocationTemplate struct { Objectid func() int64 Name func() null.Val[string] Zone func() null.Val[string] - Habitat func() null.Val[enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418] - Priority func() null.Val[enums.FieldseekerLinelocationLocationpriorityEnum] - Usetype func() null.Val[enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80] - Active func() null.Val[enums.FieldseekerLinelocationNotinuitFEnum] + Habitat func() null.Val[string] + Priority func() null.Val[string] + Usetype func() null.Val[string] + Active func() null.Val[int16] Description func() null.Val[string] Accessdesc func() null.Val[string] Comments func() null.Val[string] - Symbology func() null.Val[enums.FieldseekerLinelocationLocationsymbologyEnum] + Symbology func() null.Val[string] Externalid func() null.Val[string] Acres func() null.Val[float64] Nextactiondatescheduled func() null.Val[time.Time] @@ -80,20 +81,32 @@ type FieldseekerLinelocationTemplate struct { LengthMeters func() null.Val[float64] WidthMeters func() null.Val[float64] Lastinspectconditions func() null.Val[string] - Waterorigin func() null.Val[enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16] + Waterorigin func() null.Val[string] Creationdate func() null.Val[time.Time] Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] Jurisdiction func() null.Val[string] ShapeLength func() null.Val[float64] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerLinelocationR f *Factory alreadyPersisted bool } +type fieldseekerLinelocationR struct { + Organization *fieldseekerLinelocationROrganizationR +} + +type fieldseekerLinelocationROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerLinelocationTemplate func (o *FieldseekerLinelocationTemplate) Apply(ctx context.Context, mods ...FieldseekerLinelocationMod) { for _, mod := range mods { @@ -103,7 +116,14 @@ func (o *FieldseekerLinelocationTemplate) Apply(ctx context.Context, mods ...Fie // setModelRels creates and sets the relationships on *models.FieldseekerLinelocation // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerLinelocationTemplate) setModelRels(o *models.FieldseekerLinelocation) {} +func (t FieldseekerLinelocationTemplate) setModelRels(o *models.FieldseekerLinelocation) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Linelocations = append(rel.R.Linelocations, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerLinelocationSetter // this does nothing with the relationship templates @@ -302,10 +322,22 @@ func (o FieldseekerLinelocationTemplate) BuildSetter() *models.FieldseekerLinelo val := o.ShapeLength() m.ShapeLength = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -472,9 +504,18 @@ func (o FieldseekerLinelocationTemplate) Build() *models.FieldseekerLinelocation if o.ShapeLength != nil { m.ShapeLength = o.ShapeLength() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -495,6 +536,14 @@ func (o FieldseekerLinelocationTemplate) BuildMany(number int) models.Fieldseeke } func ensureCreatableFieldseekerLinelocation(m *models.FieldseekerLinelocationSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerLinelocation @@ -513,11 +562,30 @@ func (o *FieldseekerLinelocationTemplate) Create(ctx context.Context, exec bob.E opt := o.BuildSetter() ensureCreatableFieldseekerLinelocation(opt) + if o.r.Organization == nil { + FieldseekerLinelocationMods.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.FieldseekerLinelocations.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 } @@ -643,7 +711,10 @@ func (m fieldseekerLinelocationMods) RandomizeAllColumns(f *faker.Faker) Fieldse FieldseekerLinelocationMods.RandomEditor(f), FieldseekerLinelocationMods.RandomJurisdiction(f), FieldseekerLinelocationMods.RandomShapeLength(f), + FieldseekerLinelocationMods.RandomGeometry(f), + FieldseekerLinelocationMods.RandomGeospatial(f), FieldseekerLinelocationMods.RandomVersion(f), + FieldseekerLinelocationMods.RandomOrganizationID(f), } } @@ -785,16 +856,14 @@ func (m fieldseekerLinelocationMods) RandomZoneNotNull(f *faker.Faker) Fieldseek } // Set the model columns to this value -func (m fieldseekerLinelocationMods) Habitat(val null.Val[enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418]) FieldseekerLinelocationMod { +func (m fieldseekerLinelocationMods) Habitat(val null.Val[string]) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418] { - return val - } + o.Habitat = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerLinelocationMods) HabitatFunc(f func() null.Val[enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418]) FieldseekerLinelocationMod { +func (m fieldseekerLinelocationMods) HabitatFunc(f func() null.Val[string]) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { o.Habitat = f }) @@ -812,12 +881,12 @@ func (m fieldseekerLinelocationMods) UnsetHabitat() FieldseekerLinelocationMod { // The generated value is sometimes null func (m fieldseekerLinelocationMods) RandomHabitat(f *faker.Faker) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418] { + o.Habitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418(f) + val := random_string(f, "25") return null.From(val) } }) @@ -828,26 +897,26 @@ func (m fieldseekerLinelocationMods) RandomHabitat(f *faker.Faker) FieldseekerLi // The generated value is never null func (m fieldseekerLinelocationMods) RandomHabitatNotNull(f *faker.Faker) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418] { + o.Habitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerLinelocationMods) Priority(val null.Val[enums.FieldseekerLinelocationLocationpriorityEnum]) FieldseekerLinelocationMod { +func (m fieldseekerLinelocationMods) Priority(val null.Val[string]) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerLinelocationLocationpriorityEnum] { return val } + o.Priority = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerLinelocationMods) PriorityFunc(f func() null.Val[enums.FieldseekerLinelocationLocationpriorityEnum]) FieldseekerLinelocationMod { +func (m fieldseekerLinelocationMods) PriorityFunc(f func() null.Val[string]) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { o.Priority = f }) @@ -865,12 +934,12 @@ func (m fieldseekerLinelocationMods) UnsetPriority() FieldseekerLinelocationMod // The generated value is sometimes null func (m fieldseekerLinelocationMods) RandomPriority(f *faker.Faker) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerLinelocationLocationpriorityEnum] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerLinelocationLocationpriorityEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -881,28 +950,26 @@ func (m fieldseekerLinelocationMods) RandomPriority(f *faker.Faker) FieldseekerL // The generated value is never null func (m fieldseekerLinelocationMods) RandomPriorityNotNull(f *faker.Faker) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerLinelocationLocationpriorityEnum] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerLinelocationLocationpriorityEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerLinelocationMods) Usetype(val null.Val[enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80]) FieldseekerLinelocationMod { +func (m fieldseekerLinelocationMods) Usetype(val null.Val[string]) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80] { - return val - } + o.Usetype = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerLinelocationMods) UsetypeFunc(f func() null.Val[enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80]) FieldseekerLinelocationMod { +func (m fieldseekerLinelocationMods) UsetypeFunc(f func() null.Val[string]) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { o.Usetype = f }) @@ -920,12 +987,12 @@ func (m fieldseekerLinelocationMods) UnsetUsetype() FieldseekerLinelocationMod { // The generated value is sometimes null func (m fieldseekerLinelocationMods) RandomUsetype(f *faker.Faker) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80] { + o.Usetype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80(f) + val := random_string(f, "25") return null.From(val) } }) @@ -936,26 +1003,26 @@ func (m fieldseekerLinelocationMods) RandomUsetype(f *faker.Faker) FieldseekerLi // The generated value is never null func (m fieldseekerLinelocationMods) RandomUsetypeNotNull(f *faker.Faker) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80] { + o.Usetype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerLinelocationMods) Active(val null.Val[enums.FieldseekerLinelocationNotinuitFEnum]) FieldseekerLinelocationMod { +func (m fieldseekerLinelocationMods) Active(val null.Val[int16]) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerLinelocationNotinuitFEnum] { return val } + o.Active = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerLinelocationMods) ActiveFunc(f func() null.Val[enums.FieldseekerLinelocationNotinuitFEnum]) FieldseekerLinelocationMod { +func (m fieldseekerLinelocationMods) ActiveFunc(f func() null.Val[int16]) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { o.Active = f }) @@ -973,12 +1040,12 @@ func (m fieldseekerLinelocationMods) UnsetActive() FieldseekerLinelocationMod { // The generated value is sometimes null func (m fieldseekerLinelocationMods) RandomActive(f *faker.Faker) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerLinelocationNotinuitFEnum] { + o.Active = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerLinelocationNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -989,12 +1056,12 @@ func (m fieldseekerLinelocationMods) RandomActive(f *faker.Faker) FieldseekerLin // The generated value is never null func (m fieldseekerLinelocationMods) RandomActiveNotNull(f *faker.Faker) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerLinelocationNotinuitFEnum] { + o.Active = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerLinelocationNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1160,14 +1227,14 @@ func (m fieldseekerLinelocationMods) RandomCommentsNotNull(f *faker.Faker) Field } // Set the model columns to this value -func (m fieldseekerLinelocationMods) Symbology(val null.Val[enums.FieldseekerLinelocationLocationsymbologyEnum]) FieldseekerLinelocationMod { +func (m fieldseekerLinelocationMods) Symbology(val null.Val[string]) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Symbology = func() null.Val[enums.FieldseekerLinelocationLocationsymbologyEnum] { return val } + o.Symbology = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerLinelocationMods) SymbologyFunc(f func() null.Val[enums.FieldseekerLinelocationLocationsymbologyEnum]) FieldseekerLinelocationMod { +func (m fieldseekerLinelocationMods) SymbologyFunc(f func() null.Val[string]) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { o.Symbology = f }) @@ -1185,12 +1252,12 @@ func (m fieldseekerLinelocationMods) UnsetSymbology() FieldseekerLinelocationMod // The generated value is sometimes null func (m fieldseekerLinelocationMods) RandomSymbology(f *faker.Faker) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Symbology = func() null.Val[enums.FieldseekerLinelocationLocationsymbologyEnum] { + o.Symbology = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerLinelocationLocationsymbologyEnum(f) + val := random_string(f, "10") return null.From(val) } }) @@ -1201,12 +1268,12 @@ func (m fieldseekerLinelocationMods) RandomSymbology(f *faker.Faker) Fieldseeker // The generated value is never null func (m fieldseekerLinelocationMods) RandomSymbologyNotNull(f *faker.Faker) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Symbology = func() null.Val[enums.FieldseekerLinelocationLocationsymbologyEnum] { + o.Symbology = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerLinelocationLocationsymbologyEnum(f) + val := random_string(f, "10") return null.From(val) } }) @@ -2803,14 +2870,14 @@ func (m fieldseekerLinelocationMods) RandomLastinspectconditionsNotNull(f *faker } // Set the model columns to this value -func (m fieldseekerLinelocationMods) Waterorigin(val null.Val[enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16]) FieldseekerLinelocationMod { +func (m fieldseekerLinelocationMods) Waterorigin(val null.Val[string]) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Waterorigin = func() null.Val[enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16] { return val } + o.Waterorigin = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerLinelocationMods) WateroriginFunc(f func() null.Val[enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16]) FieldseekerLinelocationMod { +func (m fieldseekerLinelocationMods) WateroriginFunc(f func() null.Val[string]) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { o.Waterorigin = f }) @@ -2828,12 +2895,12 @@ func (m fieldseekerLinelocationMods) UnsetWaterorigin() FieldseekerLinelocationM // The generated value is sometimes null func (m fieldseekerLinelocationMods) RandomWaterorigin(f *faker.Faker) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Waterorigin = func() null.Val[enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16] { + o.Waterorigin = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16(f) + val := random_string(f, "50") return null.From(val) } }) @@ -2844,12 +2911,12 @@ func (m fieldseekerLinelocationMods) RandomWaterorigin(f *faker.Faker) Fieldseek // The generated value is never null func (m fieldseekerLinelocationMods) RandomWateroriginNotNull(f *faker.Faker) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Waterorigin = func() null.Val[enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16] { + o.Waterorigin = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16(f) + val := random_string(f, "50") return null.From(val) } }) @@ -3173,6 +3240,90 @@ func (m fieldseekerLinelocationMods) RandomShapeLengthNotNull(f *faker.Faker) Fi }) } +// Set the model columns to this value +func (m fieldseekerLinelocationMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerLinelocationMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerLinelocationMods) UnsetGeometry() FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerLinelocationMods) RandomGeometry(f *faker.Faker) FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerLinelocationMods) Geospatial(val null.Val[string]) FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerLinelocationMods) GeospatialFunc(f func() null.Val[string]) FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerLinelocationMods) UnsetGeospatial() FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerLinelocationMods) RandomGeospatial(f *faker.Faker) FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerLinelocationMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { + o.Geospatial = 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 fieldseekerLinelocationMods) Version(val int32) FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { @@ -3204,11 +3355,77 @@ func (m fieldseekerLinelocationMods) RandomVersion(f *faker.Faker) FieldseekerLi }) } +// Set the model columns to this value +func (m fieldseekerLinelocationMods) OrganizationID(val int32) FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerLinelocationMods) OrganizationIDFunc(f func() int32) FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerLinelocationMods) UnsetOrganizationID() FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { + 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 fieldseekerLinelocationMods) RandomOrganizationID(f *faker.Faker) FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerLinelocationMods) WithParentsCascading() FieldseekerLinelocationMod { return FieldseekerLinelocationModFunc(func(ctx context.Context, o *FieldseekerLinelocationTemplate) { if isDone, _ := fieldseekerLinelocationWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerLinelocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerLinelocationMods) WithOrganization(rel *OrganizationTemplate) FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(ctx context.Context, o *FieldseekerLinelocationTemplate) { + o.r.Organization = &fieldseekerLinelocationROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerLinelocationMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(ctx context.Context, o *FieldseekerLinelocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerLinelocationMods) WithExistingOrganization(em *models.Organization) FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(ctx context.Context, o *FieldseekerLinelocationTemplate) { + o.r.Organization = &fieldseekerLinelocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerLinelocationMods) WithoutOrganization() FieldseekerLinelocationMod { + return FieldseekerLinelocationModFunc(func(ctx context.Context, o *FieldseekerLinelocationTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.locationtracking.bob.go b/db/factory/fieldseeker.locationtracking.bob.go index 80044e87..7b72041d 100644 --- a/db/factory/fieldseeker.locationtracking.bob.go +++ b/db/factory/fieldseeker.locationtracking.bob.go @@ -1,10 +1,11 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" @@ -12,9 +13,10 @@ import ( "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerLocationtrackingMod interface { @@ -50,13 +52,25 @@ type FieldseekerLocationtrackingTemplate struct { Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerLocationtrackingR f *Factory alreadyPersisted bool } +type fieldseekerLocationtrackingR struct { + Organization *fieldseekerLocationtrackingROrganizationR +} + +type fieldseekerLocationtrackingROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerLocationtrackingTemplate func (o *FieldseekerLocationtrackingTemplate) Apply(ctx context.Context, mods ...FieldseekerLocationtrackingMod) { for _, mod := range mods { @@ -66,7 +80,14 @@ func (o *FieldseekerLocationtrackingTemplate) Apply(ctx context.Context, mods .. // setModelRels creates and sets the relationships on *models.FieldseekerLocationtracking // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerLocationtrackingTemplate) setModelRels(o *models.FieldseekerLocationtracking) {} +func (t FieldseekerLocationtrackingTemplate) setModelRels(o *models.FieldseekerLocationtracking) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Locationtrackings = append(rel.R.Locationtrackings, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerLocationtrackingSetter // this does nothing with the relationship templates @@ -121,10 +142,22 @@ func (o FieldseekerLocationtrackingTemplate) BuildSetter() *models.FieldseekerLo val := o.Editor() m.Editor = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -183,9 +216,18 @@ func (o FieldseekerLocationtrackingTemplate) Build() *models.FieldseekerLocation if o.Editor != nil { m.Editor = o.Editor() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -206,6 +248,14 @@ func (o FieldseekerLocationtrackingTemplate) BuildMany(number int) models.Fields } func ensureCreatableFieldseekerLocationtracking(m *models.FieldseekerLocationtrackingSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerLocationtracking @@ -224,11 +274,30 @@ func (o *FieldseekerLocationtrackingTemplate) Create(ctx context.Context, exec b opt := o.BuildSetter() ensureCreatableFieldseekerLocationtracking(opt) + if o.r.Organization == nil { + FieldseekerLocationtrackingMods.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.FieldseekerLocationtrackings.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 } @@ -318,7 +387,10 @@ func (m fieldseekerLocationtrackingMods) RandomizeAllColumns(f *faker.Faker) Fie FieldseekerLocationtrackingMods.RandomCreator(f), FieldseekerLocationtrackingMods.RandomEditdate(f), FieldseekerLocationtrackingMods.RandomEditor(f), + FieldseekerLocationtrackingMods.RandomGeometry(f), + FieldseekerLocationtrackingMods.RandomGeospatial(f), FieldseekerLocationtrackingMods.RandomVersion(f), + FieldseekerLocationtrackingMods.RandomOrganizationID(f), } } @@ -936,6 +1008,90 @@ func (m fieldseekerLocationtrackingMods) RandomEditorNotNull(f *faker.Faker) Fie }) } +// Set the model columns to this value +func (m fieldseekerLocationtrackingMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerLocationtrackingMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerLocationtrackingMods) UnsetGeometry() FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerLocationtrackingMods) RandomGeometry(f *faker.Faker) FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerLocationtrackingMods) Geospatial(val null.Val[string]) FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerLocationtrackingMods) GeospatialFunc(f func() null.Val[string]) FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerLocationtrackingMods) UnsetGeospatial() FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerLocationtrackingMods) RandomGeospatial(f *faker.Faker) FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerLocationtrackingMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { + o.Geospatial = 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 fieldseekerLocationtrackingMods) Version(val int32) FieldseekerLocationtrackingMod { return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { @@ -967,11 +1123,77 @@ func (m fieldseekerLocationtrackingMods) RandomVersion(f *faker.Faker) Fieldseek }) } +// Set the model columns to this value +func (m fieldseekerLocationtrackingMods) OrganizationID(val int32) FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerLocationtrackingMods) OrganizationIDFunc(f func() int32) FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerLocationtrackingMods) UnsetOrganizationID() FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { + 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 fieldseekerLocationtrackingMods) RandomOrganizationID(f *faker.Faker) FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerLocationtrackingMods) WithParentsCascading() FieldseekerLocationtrackingMod { return FieldseekerLocationtrackingModFunc(func(ctx context.Context, o *FieldseekerLocationtrackingTemplate) { if isDone, _ := fieldseekerLocationtrackingWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerLocationtrackingWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerLocationtrackingMods) WithOrganization(rel *OrganizationTemplate) FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(ctx context.Context, o *FieldseekerLocationtrackingTemplate) { + o.r.Organization = &fieldseekerLocationtrackingROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerLocationtrackingMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(ctx context.Context, o *FieldseekerLocationtrackingTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerLocationtrackingMods) WithExistingOrganization(em *models.Organization) FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(ctx context.Context, o *FieldseekerLocationtrackingTemplate) { + o.r.Organization = &fieldseekerLocationtrackingROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerLocationtrackingMods) WithoutOrganization() FieldseekerLocationtrackingMod { + return FieldseekerLocationtrackingModFunc(func(ctx context.Context, o *FieldseekerLocationtrackingTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.mosquitoinspection.bob.go b/db/factory/fieldseeker.mosquitoinspection.bob.go index fb60e556..e5d9fde5 100644 --- a/db/factory/fieldseeker.mosquitoinspection.bob.go +++ b/db/factory/fieldseeker.mosquitoinspection.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerMosquitoinspectionMod interface { @@ -41,37 +42,37 @@ func (mods FieldseekerMosquitoinspectionModSlice) Apply(ctx context.Context, n * type FieldseekerMosquitoinspectionTemplate struct { Objectid func() int64 Numdips func() null.Val[int16] - Activity func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoactivityEnum] - Breeding func() null.Val[enums.FieldseekerMosquitoinspectionMosquitobreedingEnum] + Activity func() null.Val[string] + Breeding func() null.Val[string] Totlarvae func() null.Val[int16] Totpupae func() null.Val[int16] Eggs func() null.Val[int16] Posdips func() null.Val[int16] - Adultact func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum] + Adultact func() null.Val[string] Lstages func() null.Val[string] - Domstage func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2] - Actiontaken func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4] + Domstage func() null.Val[string] + Actiontaken func() null.Val[string] Comments func() null.Val[string] Avetemp func() null.Val[float64] Windspeed func() null.Val[float64] Raingauge func() null.Val[float64] Startdatetime func() null.Val[time.Time] Enddatetime func() null.Val[time.Time] - Winddir func() null.Val[enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum] + Winddir func() null.Val[string] Avglarvae func() null.Val[float64] Avgpupae func() null.Val[float64] - Reviewed func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] + Reviewed func() null.Val[int16] Reviewedby func() null.Val[string] Revieweddate func() null.Val[time.Time] Locationname func() null.Val[string] Zone func() null.Val[string] Recordstatus func() null.Val[int16] Zone2 func() null.Val[string] - Personalcontact func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] + Personalcontact func() null.Val[int16] Tirecount func() null.Val[int16] Cbcount func() null.Val[int16] Containercount func() null.Val[int16] - Fieldspecies func() null.Val[enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum] + Fieldspecies func() null.Val[string] Globalid func() null.Val[uuid.UUID] CreatedUser func() null.Val[string] CreatedDate func() null.Val[time.Time] @@ -82,27 +83,39 @@ type FieldseekerMosquitoinspectionTemplate struct { Polygonlocid func() null.Val[uuid.UUID] Srid func() null.Val[uuid.UUID] Fieldtech func() null.Val[string] - Larvaepresent func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] - Pupaepresent func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] + Larvaepresent func() null.Val[int16] + Pupaepresent func() null.Val[int16] Sdid func() null.Val[uuid.UUID] - Sitecond func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540] + Sitecond func() null.Val[string] Positivecontainercount func() null.Val[int16] Creationdate func() null.Val[time.Time] Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] Jurisdiction func() null.Val[string] - Visualmonitoring func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] + Visualmonitoring func() null.Val[int16] Vmcomments func() null.Val[string] - Adminaction func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B] + Adminaction func() null.Val[string] Ptaid func() null.Val[uuid.UUID] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerMosquitoinspectionR f *Factory alreadyPersisted bool } +type fieldseekerMosquitoinspectionR struct { + Organization *fieldseekerMosquitoinspectionROrganizationR +} + +type fieldseekerMosquitoinspectionROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerMosquitoinspectionTemplate func (o *FieldseekerMosquitoinspectionTemplate) Apply(ctx context.Context, mods ...FieldseekerMosquitoinspectionMod) { for _, mod := range mods { @@ -113,6 +126,12 @@ func (o *FieldseekerMosquitoinspectionTemplate) Apply(ctx context.Context, mods // setModelRels creates and sets the relationships on *models.FieldseekerMosquitoinspection // according to the relationships in the template. Nothing is inserted into the db func (t FieldseekerMosquitoinspectionTemplate) setModelRels(o *models.FieldseekerMosquitoinspection) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Mosquitoinspections = append(rel.R.Mosquitoinspections, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } } // BuildSetter returns an *models.FieldseekerMosquitoinspectionSetter @@ -348,10 +367,22 @@ func (o FieldseekerMosquitoinspectionTemplate) BuildSetter() *models.Fieldseeker val := o.Ptaid() m.Ptaid = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -545,9 +576,18 @@ func (o FieldseekerMosquitoinspectionTemplate) Build() *models.FieldseekerMosqui if o.Ptaid != nil { m.Ptaid = o.Ptaid() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -568,6 +608,14 @@ func (o FieldseekerMosquitoinspectionTemplate) BuildMany(number int) models.Fiel } func ensureCreatableFieldseekerMosquitoinspection(m *models.FieldseekerMosquitoinspectionSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerMosquitoinspection @@ -586,11 +634,30 @@ func (o *FieldseekerMosquitoinspectionTemplate) Create(ctx context.Context, exec opt := o.BuildSetter() ensureCreatableFieldseekerMosquitoinspection(opt) + if o.r.Organization == nil { + FieldseekerMosquitoinspectionMods.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.FieldseekerMosquitoinspections.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 } @@ -725,7 +792,10 @@ func (m fieldseekerMosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) F FieldseekerMosquitoinspectionMods.RandomVmcomments(f), FieldseekerMosquitoinspectionMods.RandomAdminaction(f), FieldseekerMosquitoinspectionMods.RandomPtaid(f), + FieldseekerMosquitoinspectionMods.RandomGeometry(f), + FieldseekerMosquitoinspectionMods.RandomGeospatial(f), FieldseekerMosquitoinspectionMods.RandomVersion(f), + FieldseekerMosquitoinspectionMods.RandomOrganizationID(f), } } @@ -814,14 +884,14 @@ func (m fieldseekerMosquitoinspectionMods) RandomNumdipsNotNull(f *faker.Faker) } // Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Activity(val null.Val[enums.FieldseekerMosquitoinspectionMosquitoactivityEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) Activity(val null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Activity = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoactivityEnum] { return val } + o.Activity = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) ActivityFunc(f func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoactivityEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) ActivityFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { o.Activity = f }) @@ -839,12 +909,12 @@ func (m fieldseekerMosquitoinspectionMods) UnsetActivity() FieldseekerMosquitoin // The generated value is sometimes null func (m fieldseekerMosquitoinspectionMods) RandomActivity(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Activity = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoactivityEnum] { + o.Activity = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitoactivityEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -855,26 +925,26 @@ func (m fieldseekerMosquitoinspectionMods) RandomActivity(f *faker.Faker) Fields // The generated value is never null func (m fieldseekerMosquitoinspectionMods) RandomActivityNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Activity = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoactivityEnum] { + o.Activity = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitoactivityEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Breeding(val null.Val[enums.FieldseekerMosquitoinspectionMosquitobreedingEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) Breeding(val null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Breeding = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitobreedingEnum] { return val } + o.Breeding = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) BreedingFunc(f func() null.Val[enums.FieldseekerMosquitoinspectionMosquitobreedingEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) BreedingFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { o.Breeding = f }) @@ -892,12 +962,12 @@ func (m fieldseekerMosquitoinspectionMods) UnsetBreeding() FieldseekerMosquitoin // The generated value is sometimes null func (m fieldseekerMosquitoinspectionMods) RandomBreeding(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Breeding = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitobreedingEnum] { + o.Breeding = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitobreedingEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -908,12 +978,12 @@ func (m fieldseekerMosquitoinspectionMods) RandomBreeding(f *faker.Faker) Fields // The generated value is never null func (m fieldseekerMosquitoinspectionMods) RandomBreedingNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Breeding = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitobreedingEnum] { + o.Breeding = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitobreedingEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1132,14 +1202,14 @@ func (m fieldseekerMosquitoinspectionMods) RandomPosdipsNotNull(f *faker.Faker) } // Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Adultact(val null.Val[enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) Adultact(val null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Adultact = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum] { return val } + o.Adultact = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) AdultactFunc(f func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) AdultactFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { o.Adultact = f }) @@ -1157,12 +1227,12 @@ func (m fieldseekerMosquitoinspectionMods) UnsetAdultact() FieldseekerMosquitoin // The generated value is sometimes null func (m fieldseekerMosquitoinspectionMods) RandomAdultact(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Adultact = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum] { + o.Adultact = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitoadultactivityEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1173,12 +1243,12 @@ func (m fieldseekerMosquitoinspectionMods) RandomAdultact(f *faker.Faker) Fields // The generated value is never null func (m fieldseekerMosquitoinspectionMods) RandomAdultactNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Adultact = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum] { + o.Adultact = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitoadultactivityEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1238,16 +1308,14 @@ func (m fieldseekerMosquitoinspectionMods) RandomLstagesNotNull(f *faker.Faker) } // Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Domstage(val null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) Domstage(val null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Domstage = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2] { - return val - } + o.Domstage = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) DomstageFunc(f func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) DomstageFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { o.Domstage = f }) @@ -1265,12 +1333,12 @@ func (m fieldseekerMosquitoinspectionMods) UnsetDomstage() FieldseekerMosquitoin // The generated value is sometimes null func (m fieldseekerMosquitoinspectionMods) RandomDomstage(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Domstage = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2] { + o.Domstage = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1281,28 +1349,26 @@ func (m fieldseekerMosquitoinspectionMods) RandomDomstage(f *faker.Faker) Fields // The generated value is never null func (m fieldseekerMosquitoinspectionMods) RandomDomstageNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Domstage = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2] { + o.Domstage = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Actiontaken(val null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) Actiontaken(val null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4] { - return val - } + o.Actiontaken = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) ActiontakenFunc(f func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) ActiontakenFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { o.Actiontaken = f }) @@ -1320,12 +1386,12 @@ func (m fieldseekerMosquitoinspectionMods) UnsetActiontaken() FieldseekerMosquit // The generated value is sometimes null func (m fieldseekerMosquitoinspectionMods) RandomActiontaken(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4] { + o.Actiontaken = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4(f) + val := random_string(f, "50") return null.From(val) } }) @@ -1336,12 +1402,12 @@ func (m fieldseekerMosquitoinspectionMods) RandomActiontaken(f *faker.Faker) Fie // The generated value is never null func (m fieldseekerMosquitoinspectionMods) RandomActiontakenNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4] { + o.Actiontaken = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4(f) + val := random_string(f, "50") return null.From(val) } }) @@ -1666,14 +1732,14 @@ func (m fieldseekerMosquitoinspectionMods) RandomEnddatetimeNotNull(f *faker.Fak } // Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Winddir(val null.Val[enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) Winddir(val null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Winddir = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum] { return val } + o.Winddir = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) WinddirFunc(f func() null.Val[enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) WinddirFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { o.Winddir = f }) @@ -1691,12 +1757,12 @@ func (m fieldseekerMosquitoinspectionMods) UnsetWinddir() FieldseekerMosquitoins // The generated value is sometimes null func (m fieldseekerMosquitoinspectionMods) RandomWinddir(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Winddir = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum] { + o.Winddir = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionNotinuiwinddirectionEnum(f) + val := random_string(f, "3") return null.From(val) } }) @@ -1707,12 +1773,12 @@ func (m fieldseekerMosquitoinspectionMods) RandomWinddir(f *faker.Faker) Fieldse // The generated value is never null func (m fieldseekerMosquitoinspectionMods) RandomWinddirNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Winddir = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum] { + o.Winddir = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionNotinuiwinddirectionEnum(f) + val := random_string(f, "3") return null.From(val) } }) @@ -1825,14 +1891,14 @@ func (m fieldseekerMosquitoinspectionMods) RandomAvgpupaeNotNull(f *faker.Faker) } // Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Reviewed(val null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) Reviewed(val null.Val[int16]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] { return val } + o.Reviewed = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) ReviewedFunc(f func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) ReviewedFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { o.Reviewed = f }) @@ -1850,12 +1916,12 @@ func (m fieldseekerMosquitoinspectionMods) UnsetReviewed() FieldseekerMosquitoin // The generated value is sometimes null func (m fieldseekerMosquitoinspectionMods) RandomReviewed(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] { + o.Reviewed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1866,12 +1932,12 @@ func (m fieldseekerMosquitoinspectionMods) RandomReviewed(f *faker.Faker) Fields // The generated value is never null func (m fieldseekerMosquitoinspectionMods) RandomReviewedNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] { + o.Reviewed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -2196,14 +2262,14 @@ func (m fieldseekerMosquitoinspectionMods) RandomZone2NotNull(f *faker.Faker) Fi } // Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Personalcontact(val null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) Personalcontact(val null.Val[int16]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Personalcontact = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] { return val } + o.Personalcontact = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) PersonalcontactFunc(f func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) PersonalcontactFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { o.Personalcontact = f }) @@ -2221,12 +2287,12 @@ func (m fieldseekerMosquitoinspectionMods) UnsetPersonalcontact() FieldseekerMos // The generated value is sometimes null func (m fieldseekerMosquitoinspectionMods) RandomPersonalcontact(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Personalcontact = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] { + o.Personalcontact = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -2237,12 +2303,12 @@ func (m fieldseekerMosquitoinspectionMods) RandomPersonalcontact(f *faker.Faker) // The generated value is never null func (m fieldseekerMosquitoinspectionMods) RandomPersonalcontactNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Personalcontact = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] { + o.Personalcontact = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -2408,14 +2474,14 @@ func (m fieldseekerMosquitoinspectionMods) RandomContainercountNotNull(f *faker. } // Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Fieldspecies(val null.Val[enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) Fieldspecies(val null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Fieldspecies = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum] { return val } + o.Fieldspecies = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) FieldspeciesFunc(f func() null.Val[enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) FieldspeciesFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { o.Fieldspecies = f }) @@ -2433,12 +2499,12 @@ func (m fieldseekerMosquitoinspectionMods) UnsetFieldspecies() FieldseekerMosqui // The generated value is sometimes null func (m fieldseekerMosquitoinspectionMods) RandomFieldspecies(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Fieldspecies = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum] { + o.Fieldspecies = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitofieldspeciesEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -2449,12 +2515,12 @@ func (m fieldseekerMosquitoinspectionMods) RandomFieldspecies(f *faker.Faker) Fi // The generated value is never null func (m fieldseekerMosquitoinspectionMods) RandomFieldspeciesNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Fieldspecies = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum] { + o.Fieldspecies = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitofieldspeciesEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -2991,14 +3057,14 @@ func (m fieldseekerMosquitoinspectionMods) RandomFieldtechNotNull(f *faker.Faker } // Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Larvaepresent(val null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) Larvaepresent(val null.Val[int16]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] { return val } + o.Larvaepresent = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) LarvaepresentFunc(f func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) LarvaepresentFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { o.Larvaepresent = f }) @@ -3016,12 +3082,12 @@ func (m fieldseekerMosquitoinspectionMods) UnsetLarvaepresent() FieldseekerMosqu // The generated value is sometimes null func (m fieldseekerMosquitoinspectionMods) RandomLarvaepresent(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] { + o.Larvaepresent = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -3032,26 +3098,26 @@ func (m fieldseekerMosquitoinspectionMods) RandomLarvaepresent(f *faker.Faker) F // The generated value is never null func (m fieldseekerMosquitoinspectionMods) RandomLarvaepresentNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] { + o.Larvaepresent = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Pupaepresent(val null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) Pupaepresent(val null.Val[int16]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Pupaepresent = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] { return val } + o.Pupaepresent = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) PupaepresentFunc(f func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) PupaepresentFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { o.Pupaepresent = f }) @@ -3069,12 +3135,12 @@ func (m fieldseekerMosquitoinspectionMods) UnsetPupaepresent() FieldseekerMosqui // The generated value is sometimes null func (m fieldseekerMosquitoinspectionMods) RandomPupaepresent(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Pupaepresent = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] { + o.Pupaepresent = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -3085,12 +3151,12 @@ func (m fieldseekerMosquitoinspectionMods) RandomPupaepresent(f *faker.Faker) Fi // The generated value is never null func (m fieldseekerMosquitoinspectionMods) RandomPupaepresentNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Pupaepresent = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] { + o.Pupaepresent = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -3150,16 +3216,14 @@ func (m fieldseekerMosquitoinspectionMods) RandomSdidNotNull(f *faker.Faker) Fie } // Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Sitecond(val null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) Sitecond(val null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Sitecond = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540] { - return val - } + o.Sitecond = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) SitecondFunc(f func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) SitecondFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { o.Sitecond = f }) @@ -3177,12 +3241,12 @@ func (m fieldseekerMosquitoinspectionMods) UnsetSitecond() FieldseekerMosquitoin // The generated value is sometimes null func (m fieldseekerMosquitoinspectionMods) RandomSitecond(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Sitecond = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540] { + o.Sitecond = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540(f) + val := random_string(f, "250") return null.From(val) } }) @@ -3193,12 +3257,12 @@ func (m fieldseekerMosquitoinspectionMods) RandomSitecond(f *faker.Faker) Fields // The generated value is never null func (m fieldseekerMosquitoinspectionMods) RandomSitecondNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Sitecond = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540] { + o.Sitecond = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540(f) + val := random_string(f, "250") return null.From(val) } }) @@ -3523,14 +3587,14 @@ func (m fieldseekerMosquitoinspectionMods) RandomJurisdictionNotNull(f *faker.Fa } // Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Visualmonitoring(val null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) Visualmonitoring(val null.Val[int16]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Visualmonitoring = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] { return val } + o.Visualmonitoring = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) VisualmonitoringFunc(f func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) VisualmonitoringFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { o.Visualmonitoring = f }) @@ -3548,12 +3612,12 @@ func (m fieldseekerMosquitoinspectionMods) UnsetVisualmonitoring() FieldseekerMo // The generated value is sometimes null func (m fieldseekerMosquitoinspectionMods) RandomVisualmonitoring(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Visualmonitoring = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] { + o.Visualmonitoring = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -3564,12 +3628,12 @@ func (m fieldseekerMosquitoinspectionMods) RandomVisualmonitoring(f *faker.Faker // The generated value is never null func (m fieldseekerMosquitoinspectionMods) RandomVisualmonitoringNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Visualmonitoring = func() null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] { + o.Visualmonitoring = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -3629,16 +3693,14 @@ func (m fieldseekerMosquitoinspectionMods) RandomVmcommentsNotNull(f *faker.Fake } // Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Adminaction(val null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) Adminaction(val null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Adminaction = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B] { - return val - } + o.Adminaction = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) AdminactionFunc(f func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B]) FieldseekerMosquitoinspectionMod { +func (m fieldseekerMosquitoinspectionMods) AdminactionFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { o.Adminaction = f }) @@ -3656,12 +3718,12 @@ func (m fieldseekerMosquitoinspectionMods) UnsetAdminaction() FieldseekerMosquit // The generated value is sometimes null func (m fieldseekerMosquitoinspectionMods) RandomAdminaction(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Adminaction = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B] { + o.Adminaction = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B(f) + val := random_string(f, "256") return null.From(val) } }) @@ -3672,12 +3734,12 @@ func (m fieldseekerMosquitoinspectionMods) RandomAdminaction(f *faker.Faker) Fie // The generated value is never null func (m fieldseekerMosquitoinspectionMods) RandomAdminactionNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Adminaction = func() null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B] { + o.Adminaction = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B(f) + val := random_string(f, "256") return null.From(val) } }) @@ -3736,6 +3798,90 @@ func (m fieldseekerMosquitoinspectionMods) RandomPtaidNotNull(f *faker.Faker) Fi }) } +// Set the model columns to this value +func (m fieldseekerMosquitoinspectionMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerMosquitoinspectionMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerMosquitoinspectionMods) UnsetGeometry() FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerMosquitoinspectionMods) RandomGeometry(f *faker.Faker) FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerMosquitoinspectionMods) Geospatial(val null.Val[string]) FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerMosquitoinspectionMods) GeospatialFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerMosquitoinspectionMods) UnsetGeospatial() FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerMosquitoinspectionMods) RandomGeospatial(f *faker.Faker) FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerMosquitoinspectionMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { + o.Geospatial = 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 fieldseekerMosquitoinspectionMods) Version(val int32) FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { @@ -3767,11 +3913,77 @@ func (m fieldseekerMosquitoinspectionMods) RandomVersion(f *faker.Faker) Fieldse }) } +// Set the model columns to this value +func (m fieldseekerMosquitoinspectionMods) OrganizationID(val int32) FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerMosquitoinspectionMods) OrganizationIDFunc(f func() int32) FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerMosquitoinspectionMods) UnsetOrganizationID() FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { + 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 fieldseekerMosquitoinspectionMods) RandomOrganizationID(f *faker.Faker) FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerMosquitoinspectionMods) WithParentsCascading() FieldseekerMosquitoinspectionMod { return FieldseekerMosquitoinspectionModFunc(func(ctx context.Context, o *FieldseekerMosquitoinspectionTemplate) { if isDone, _ := fieldseekerMosquitoinspectionWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerMosquitoinspectionWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerMosquitoinspectionMods) WithOrganization(rel *OrganizationTemplate) FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(ctx context.Context, o *FieldseekerMosquitoinspectionTemplate) { + o.r.Organization = &fieldseekerMosquitoinspectionROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerMosquitoinspectionMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(ctx context.Context, o *FieldseekerMosquitoinspectionTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerMosquitoinspectionMods) WithExistingOrganization(em *models.Organization) FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(ctx context.Context, o *FieldseekerMosquitoinspectionTemplate) { + o.r.Organization = &fieldseekerMosquitoinspectionROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerMosquitoinspectionMods) WithoutOrganization() FieldseekerMosquitoinspectionMod { + return FieldseekerMosquitoinspectionModFunc(func(ctx context.Context, o *FieldseekerMosquitoinspectionTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.pointlocation.bob.go b/db/factory/fieldseeker.pointlocation.bob.go index 0f2047b4..33261fd0 100644 --- a/db/factory/fieldseeker.pointlocation.bob.go +++ b/db/factory/fieldseeker.pointlocation.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerPointlocationMod interface { @@ -42,14 +43,14 @@ type FieldseekerPointlocationTemplate struct { Objectid func() int64 Name func() null.Val[string] Zone func() null.Val[string] - Habitat func() null.Val[enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e] - Priority func() null.Val[enums.FieldseekerPointlocationLocationpriorityEnum] - Usetype func() null.Val[enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86] - Active func() null.Val[enums.FieldseekerPointlocationNotinuitFEnum] + Habitat func() null.Val[string] + Priority func() null.Val[string] + Usetype func() null.Val[string] + Active func() null.Val[int16] Description func() null.Val[string] Accessdesc func() null.Val[string] Comments func() null.Val[string] - Symbology func() null.Val[enums.FieldseekerPointlocationLocationsymbologyEnum] + Symbology func() null.Val[string] Externalid func() null.Val[string] Nextactiondatescheduled func() null.Val[time.Time] Larvinspectinterval func() null.Val[int16] @@ -71,25 +72,37 @@ type FieldseekerPointlocationTemplate struct { Lastinspectactivity func() null.Val[string] Lasttreatactivity func() null.Val[string] Lastinspectconditions func() null.Val[string] - Waterorigin func() null.Val[enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899] + Waterorigin func() null.Val[string] X func() null.Val[float64] Y func() null.Val[float64] - Assignedtech func() null.Val[enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B] + Assignedtech func() null.Val[string] Creationdate func() null.Val[time.Time] Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] Jurisdiction func() null.Val[string] - DeactivateReason func() null.Val[enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489] + DeactivateReason func() null.Val[string] Scalarpriority func() null.Val[int32] Sourcestatus func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerPointlocationR f *Factory alreadyPersisted bool } +type fieldseekerPointlocationR struct { + Organization *fieldseekerPointlocationROrganizationR +} + +type fieldseekerPointlocationROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerPointlocationTemplate func (o *FieldseekerPointlocationTemplate) Apply(ctx context.Context, mods ...FieldseekerPointlocationMod) { for _, mod := range mods { @@ -99,7 +112,14 @@ func (o *FieldseekerPointlocationTemplate) Apply(ctx context.Context, mods ...Fi // setModelRels creates and sets the relationships on *models.FieldseekerPointlocation // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerPointlocationTemplate) setModelRels(o *models.FieldseekerPointlocation) {} +func (t FieldseekerPointlocationTemplate) setModelRels(o *models.FieldseekerPointlocation) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Pointlocations = append(rel.R.Pointlocations, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerPointlocationSetter // this does nothing with the relationship templates @@ -282,10 +302,22 @@ func (o FieldseekerPointlocationTemplate) BuildSetter() *models.FieldseekerPoint val := o.Sourcestatus() m.Sourcestatus = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -440,9 +472,18 @@ func (o FieldseekerPointlocationTemplate) Build() *models.FieldseekerPointlocati if o.Sourcestatus != nil { m.Sourcestatus = o.Sourcestatus() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -463,6 +504,14 @@ func (o FieldseekerPointlocationTemplate) BuildMany(number int) models.Fieldseek } func ensureCreatableFieldseekerPointlocation(m *models.FieldseekerPointlocationSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerPointlocation @@ -481,11 +530,30 @@ func (o *FieldseekerPointlocationTemplate) Create(ctx context.Context, exec bob. opt := o.BuildSetter() ensureCreatableFieldseekerPointlocation(opt) + if o.r.Organization == nil { + FieldseekerPointlocationMods.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.FieldseekerPointlocations.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 } @@ -607,7 +675,10 @@ func (m fieldseekerPointlocationMods) RandomizeAllColumns(f *faker.Faker) Fields FieldseekerPointlocationMods.RandomDeactivateReason(f), FieldseekerPointlocationMods.RandomScalarpriority(f), FieldseekerPointlocationMods.RandomSourcestatus(f), + FieldseekerPointlocationMods.RandomGeometry(f), + FieldseekerPointlocationMods.RandomGeospatial(f), FieldseekerPointlocationMods.RandomVersion(f), + FieldseekerPointlocationMods.RandomOrganizationID(f), } } @@ -749,14 +820,14 @@ func (m fieldseekerPointlocationMods) RandomZoneNotNull(f *faker.Faker) Fieldsee } // Set the model columns to this value -func (m fieldseekerPointlocationMods) Habitat(val null.Val[enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) Habitat(val null.Val[string]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e] { return val } + o.Habitat = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPointlocationMods) HabitatFunc(f func() null.Val[enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) HabitatFunc(f func() null.Val[string]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { o.Habitat = f }) @@ -774,12 +845,12 @@ func (m fieldseekerPointlocationMods) UnsetHabitat() FieldseekerPointlocationMod // The generated value is sometimes null func (m fieldseekerPointlocationMods) RandomHabitat(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e] { + o.Habitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e(f) + val := random_string(f, "25") return null.From(val) } }) @@ -790,26 +861,26 @@ func (m fieldseekerPointlocationMods) RandomHabitat(f *faker.Faker) FieldseekerP // The generated value is never null func (m fieldseekerPointlocationMods) RandomHabitatNotNull(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e] { + o.Habitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerPointlocationMods) Priority(val null.Val[enums.FieldseekerPointlocationLocationpriorityEnum]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) Priority(val null.Val[string]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerPointlocationLocationpriorityEnum] { return val } + o.Priority = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPointlocationMods) PriorityFunc(f func() null.Val[enums.FieldseekerPointlocationLocationpriorityEnum]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) PriorityFunc(f func() null.Val[string]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { o.Priority = f }) @@ -827,12 +898,12 @@ func (m fieldseekerPointlocationMods) UnsetPriority() FieldseekerPointlocationMo // The generated value is sometimes null func (m fieldseekerPointlocationMods) RandomPriority(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerPointlocationLocationpriorityEnum] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationLocationpriorityEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -843,28 +914,26 @@ func (m fieldseekerPointlocationMods) RandomPriority(f *faker.Faker) Fieldseeker // The generated value is never null func (m fieldseekerPointlocationMods) RandomPriorityNotNull(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerPointlocationLocationpriorityEnum] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationLocationpriorityEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerPointlocationMods) Usetype(val null.Val[enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) Usetype(val null.Val[string]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86] { - return val - } + o.Usetype = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPointlocationMods) UsetypeFunc(f func() null.Val[enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) UsetypeFunc(f func() null.Val[string]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { o.Usetype = f }) @@ -882,12 +951,12 @@ func (m fieldseekerPointlocationMods) UnsetUsetype() FieldseekerPointlocationMod // The generated value is sometimes null func (m fieldseekerPointlocationMods) RandomUsetype(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86] { + o.Usetype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86(f) + val := random_string(f, "25") return null.From(val) } }) @@ -898,26 +967,26 @@ func (m fieldseekerPointlocationMods) RandomUsetype(f *faker.Faker) FieldseekerP // The generated value is never null func (m fieldseekerPointlocationMods) RandomUsetypeNotNull(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86] { + o.Usetype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerPointlocationMods) Active(val null.Val[enums.FieldseekerPointlocationNotinuitFEnum]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) Active(val null.Val[int16]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerPointlocationNotinuitFEnum] { return val } + o.Active = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerPointlocationMods) ActiveFunc(f func() null.Val[enums.FieldseekerPointlocationNotinuitFEnum]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) ActiveFunc(f func() null.Val[int16]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { o.Active = f }) @@ -935,12 +1004,12 @@ func (m fieldseekerPointlocationMods) UnsetActive() FieldseekerPointlocationMod // The generated value is sometimes null func (m fieldseekerPointlocationMods) RandomActive(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerPointlocationNotinuitFEnum] { + o.Active = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -951,12 +1020,12 @@ func (m fieldseekerPointlocationMods) RandomActive(f *faker.Faker) FieldseekerPo // The generated value is never null func (m fieldseekerPointlocationMods) RandomActiveNotNull(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerPointlocationNotinuitFEnum] { + o.Active = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1122,14 +1191,14 @@ func (m fieldseekerPointlocationMods) RandomCommentsNotNull(f *faker.Faker) Fiel } // Set the model columns to this value -func (m fieldseekerPointlocationMods) Symbology(val null.Val[enums.FieldseekerPointlocationLocationsymbologyEnum]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) Symbology(val null.Val[string]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Symbology = func() null.Val[enums.FieldseekerPointlocationLocationsymbologyEnum] { return val } + o.Symbology = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPointlocationMods) SymbologyFunc(f func() null.Val[enums.FieldseekerPointlocationLocationsymbologyEnum]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) SymbologyFunc(f func() null.Val[string]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { o.Symbology = f }) @@ -1147,12 +1216,12 @@ func (m fieldseekerPointlocationMods) UnsetSymbology() FieldseekerPointlocationM // The generated value is sometimes null func (m fieldseekerPointlocationMods) RandomSymbology(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Symbology = func() null.Val[enums.FieldseekerPointlocationLocationsymbologyEnum] { + o.Symbology = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationLocationsymbologyEnum(f) + val := random_string(f, "10") return null.From(val) } }) @@ -1163,12 +1232,12 @@ func (m fieldseekerPointlocationMods) RandomSymbology(f *faker.Faker) Fieldseeke // The generated value is never null func (m fieldseekerPointlocationMods) RandomSymbologyNotNull(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Symbology = func() null.Val[enums.FieldseekerPointlocationLocationsymbologyEnum] { + o.Symbology = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationLocationsymbologyEnum(f) + val := random_string(f, "10") return null.From(val) } }) @@ -2288,16 +2357,14 @@ func (m fieldseekerPointlocationMods) RandomLastinspectconditionsNotNull(f *fake } // Set the model columns to this value -func (m fieldseekerPointlocationMods) Waterorigin(val null.Val[enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) Waterorigin(val null.Val[string]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Waterorigin = func() null.Val[enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899] { - return val - } + o.Waterorigin = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPointlocationMods) WateroriginFunc(f func() null.Val[enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) WateroriginFunc(f func() null.Val[string]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { o.Waterorigin = f }) @@ -2315,12 +2382,12 @@ func (m fieldseekerPointlocationMods) UnsetWaterorigin() FieldseekerPointlocatio // The generated value is sometimes null func (m fieldseekerPointlocationMods) RandomWaterorigin(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Waterorigin = func() null.Val[enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899] { + o.Waterorigin = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899(f) + val := random_string(f, "50") return null.From(val) } }) @@ -2331,12 +2398,12 @@ func (m fieldseekerPointlocationMods) RandomWaterorigin(f *faker.Faker) Fieldsee // The generated value is never null func (m fieldseekerPointlocationMods) RandomWateroriginNotNull(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Waterorigin = func() null.Val[enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899] { + o.Waterorigin = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899(f) + val := random_string(f, "50") return null.From(val) } }) @@ -2449,16 +2516,14 @@ func (m fieldseekerPointlocationMods) RandomYNotNull(f *faker.Faker) Fieldseeker } // Set the model columns to this value -func (m fieldseekerPointlocationMods) Assignedtech(val null.Val[enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) Assignedtech(val null.Val[string]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Assignedtech = func() null.Val[enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B] { - return val - } + o.Assignedtech = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPointlocationMods) AssignedtechFunc(f func() null.Val[enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) AssignedtechFunc(f func() null.Val[string]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { o.Assignedtech = f }) @@ -2476,12 +2541,12 @@ func (m fieldseekerPointlocationMods) UnsetAssignedtech() FieldseekerPointlocati // The generated value is sometimes null func (m fieldseekerPointlocationMods) RandomAssignedtech(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Assignedtech = func() null.Val[enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B] { + o.Assignedtech = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B(f) + val := random_string(f, "256") return null.From(val) } }) @@ -2492,12 +2557,12 @@ func (m fieldseekerPointlocationMods) RandomAssignedtech(f *faker.Faker) Fieldse // The generated value is never null func (m fieldseekerPointlocationMods) RandomAssignedtechNotNull(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Assignedtech = func() null.Val[enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B] { + o.Assignedtech = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B(f) + val := random_string(f, "256") return null.From(val) } }) @@ -2769,16 +2834,14 @@ func (m fieldseekerPointlocationMods) RandomJurisdictionNotNull(f *faker.Faker) } // Set the model columns to this value -func (m fieldseekerPointlocationMods) DeactivateReason(val null.Val[enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) DeactivateReason(val null.Val[string]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.DeactivateReason = func() null.Val[enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489] { - return val - } + o.DeactivateReason = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPointlocationMods) DeactivateReasonFunc(f func() null.Val[enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489]) FieldseekerPointlocationMod { +func (m fieldseekerPointlocationMods) DeactivateReasonFunc(f func() null.Val[string]) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { o.DeactivateReason = f }) @@ -2796,12 +2859,12 @@ func (m fieldseekerPointlocationMods) UnsetDeactivateReason() FieldseekerPointlo // The generated value is sometimes null func (m fieldseekerPointlocationMods) RandomDeactivateReason(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.DeactivateReason = func() null.Val[enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489] { + o.DeactivateReason = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489(f) + val := random_string(f, "256") return null.From(val) } }) @@ -2812,12 +2875,12 @@ func (m fieldseekerPointlocationMods) RandomDeactivateReason(f *faker.Faker) Fie // The generated value is never null func (m fieldseekerPointlocationMods) RandomDeactivateReasonNotNull(f *faker.Faker) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.DeactivateReason = func() null.Val[enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489] { + o.DeactivateReason = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489(f) + val := random_string(f, "256") return null.From(val) } }) @@ -2929,6 +2992,90 @@ func (m fieldseekerPointlocationMods) RandomSourcestatusNotNull(f *faker.Faker) }) } +// Set the model columns to this value +func (m fieldseekerPointlocationMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerPointlocationMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerPointlocationMods) UnsetGeometry() FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerPointlocationMods) RandomGeometry(f *faker.Faker) FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerPointlocationMods) Geospatial(val null.Val[string]) FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerPointlocationMods) GeospatialFunc(f func() null.Val[string]) FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerPointlocationMods) UnsetGeospatial() FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerPointlocationMods) RandomGeospatial(f *faker.Faker) FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerPointlocationMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { + o.Geospatial = 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 fieldseekerPointlocationMods) Version(val int32) FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { @@ -2960,11 +3107,77 @@ func (m fieldseekerPointlocationMods) RandomVersion(f *faker.Faker) FieldseekerP }) } +// Set the model columns to this value +func (m fieldseekerPointlocationMods) OrganizationID(val int32) FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerPointlocationMods) OrganizationIDFunc(f func() int32) FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerPointlocationMods) UnsetOrganizationID() FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { + 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 fieldseekerPointlocationMods) RandomOrganizationID(f *faker.Faker) FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerPointlocationMods) WithParentsCascading() FieldseekerPointlocationMod { return FieldseekerPointlocationModFunc(func(ctx context.Context, o *FieldseekerPointlocationTemplate) { if isDone, _ := fieldseekerPointlocationWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerPointlocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerPointlocationMods) WithOrganization(rel *OrganizationTemplate) FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(ctx context.Context, o *FieldseekerPointlocationTemplate) { + o.r.Organization = &fieldseekerPointlocationROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerPointlocationMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(ctx context.Context, o *FieldseekerPointlocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerPointlocationMods) WithExistingOrganization(em *models.Organization) FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(ctx context.Context, o *FieldseekerPointlocationTemplate) { + o.r.Organization = &fieldseekerPointlocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerPointlocationMods) WithoutOrganization() FieldseekerPointlocationMod { + return FieldseekerPointlocationModFunc(func(ctx context.Context, o *FieldseekerPointlocationTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.polygonlocation.bob.go b/db/factory/fieldseeker.polygonlocation.bob.go index 0ba7d2a8..316d8a9a 100644 --- a/db/factory/fieldseeker.polygonlocation.bob.go +++ b/db/factory/fieldseeker.polygonlocation.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerPolygonlocationMod interface { @@ -42,14 +43,14 @@ type FieldseekerPolygonlocationTemplate struct { Objectid func() int64 Name func() null.Val[string] Zone func() null.Val[string] - Habitat func() null.Val[enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65] - Priority func() null.Val[enums.FieldseekerPolygonlocationLocationpriorityEnum] - Usetype func() null.Val[enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13] - Active func() null.Val[enums.FieldseekerPolygonlocationNotinuitFEnum] + Habitat func() null.Val[string] + Priority func() null.Val[string] + Usetype func() null.Val[string] + Active func() null.Val[int16] Description func() null.Val[string] Accessdesc func() null.Val[string] Comments func() null.Val[string] - Symbology func() null.Val[enums.FieldseekerPolygonlocationLocationsymbologyEnum] + Symbology func() null.Val[string] Externalid func() null.Val[string] Acres func() null.Val[float64] Nextactiondatescheduled func() null.Val[time.Time] @@ -72,7 +73,7 @@ type FieldseekerPolygonlocationTemplate struct { Lastinspectactivity func() null.Val[string] Lasttreatactivity func() null.Val[string] Lastinspectconditions func() null.Val[string] - Waterorigin func() null.Val[enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9] + Waterorigin func() null.Val[string] Filter func() null.Val[string] Creationdate func() null.Val[time.Time] Creator func() null.Val[string] @@ -81,13 +82,25 @@ type FieldseekerPolygonlocationTemplate struct { Jurisdiction func() null.Val[string] ShapeArea func() null.Val[float64] ShapeLength func() null.Val[float64] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerPolygonlocationR f *Factory alreadyPersisted bool } +type fieldseekerPolygonlocationR struct { + Organization *fieldseekerPolygonlocationROrganizationR +} + +type fieldseekerPolygonlocationROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerPolygonlocationTemplate func (o *FieldseekerPolygonlocationTemplate) Apply(ctx context.Context, mods ...FieldseekerPolygonlocationMod) { for _, mod := range mods { @@ -97,7 +110,14 @@ func (o *FieldseekerPolygonlocationTemplate) Apply(ctx context.Context, mods ... // setModelRels creates and sets the relationships on *models.FieldseekerPolygonlocation // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerPolygonlocationTemplate) setModelRels(o *models.FieldseekerPolygonlocation) {} +func (t FieldseekerPolygonlocationTemplate) setModelRels(o *models.FieldseekerPolygonlocation) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Polygonlocations = append(rel.R.Polygonlocations, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerPolygonlocationSetter // this does nothing with the relationship templates @@ -272,10 +292,22 @@ func (o FieldseekerPolygonlocationTemplate) BuildSetter() *models.FieldseekerPol val := o.ShapeLength() m.ShapeLength = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -424,9 +456,18 @@ func (o FieldseekerPolygonlocationTemplate) Build() *models.FieldseekerPolygonlo if o.ShapeLength != nil { m.ShapeLength = o.ShapeLength() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -447,6 +488,14 @@ func (o FieldseekerPolygonlocationTemplate) BuildMany(number int) models.Fieldse } func ensureCreatableFieldseekerPolygonlocation(m *models.FieldseekerPolygonlocationSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerPolygonlocation @@ -465,11 +514,30 @@ func (o *FieldseekerPolygonlocationTemplate) Create(ctx context.Context, exec bo opt := o.BuildSetter() ensureCreatableFieldseekerPolygonlocation(opt) + if o.r.Organization == nil { + FieldseekerPolygonlocationMods.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.FieldseekerPolygonlocations.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -589,7 +657,10 @@ func (m fieldseekerPolygonlocationMods) RandomizeAllColumns(f *faker.Faker) Fiel FieldseekerPolygonlocationMods.RandomJurisdiction(f), FieldseekerPolygonlocationMods.RandomShapeArea(f), FieldseekerPolygonlocationMods.RandomShapeLength(f), + FieldseekerPolygonlocationMods.RandomGeometry(f), + FieldseekerPolygonlocationMods.RandomGeospatial(f), FieldseekerPolygonlocationMods.RandomVersion(f), + FieldseekerPolygonlocationMods.RandomOrganizationID(f), } } @@ -731,16 +802,14 @@ func (m fieldseekerPolygonlocationMods) RandomZoneNotNull(f *faker.Faker) Fields } // Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Habitat(val null.Val[enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65]) FieldseekerPolygonlocationMod { +func (m fieldseekerPolygonlocationMods) Habitat(val null.Val[string]) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65] { - return val - } + o.Habitat = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPolygonlocationMods) HabitatFunc(f func() null.Val[enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65]) FieldseekerPolygonlocationMod { +func (m fieldseekerPolygonlocationMods) HabitatFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { o.Habitat = f }) @@ -758,12 +827,12 @@ func (m fieldseekerPolygonlocationMods) UnsetHabitat() FieldseekerPolygonlocatio // The generated value is sometimes null func (m fieldseekerPolygonlocationMods) RandomHabitat(f *faker.Faker) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65] { + o.Habitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65(f) + val := random_string(f, "25") return null.From(val) } }) @@ -774,26 +843,26 @@ func (m fieldseekerPolygonlocationMods) RandomHabitat(f *faker.Faker) Fieldseeke // The generated value is never null func (m fieldseekerPolygonlocationMods) RandomHabitatNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65] { + o.Habitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Priority(val null.Val[enums.FieldseekerPolygonlocationLocationpriorityEnum]) FieldseekerPolygonlocationMod { +func (m fieldseekerPolygonlocationMods) Priority(val null.Val[string]) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerPolygonlocationLocationpriorityEnum] { return val } + o.Priority = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPolygonlocationMods) PriorityFunc(f func() null.Val[enums.FieldseekerPolygonlocationLocationpriorityEnum]) FieldseekerPolygonlocationMod { +func (m fieldseekerPolygonlocationMods) PriorityFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { o.Priority = f }) @@ -811,12 +880,12 @@ func (m fieldseekerPolygonlocationMods) UnsetPriority() FieldseekerPolygonlocati // The generated value is sometimes null func (m fieldseekerPolygonlocationMods) RandomPriority(f *faker.Faker) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerPolygonlocationLocationpriorityEnum] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPolygonlocationLocationpriorityEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -827,28 +896,26 @@ func (m fieldseekerPolygonlocationMods) RandomPriority(f *faker.Faker) Fieldseek // The generated value is never null func (m fieldseekerPolygonlocationMods) RandomPriorityNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerPolygonlocationLocationpriorityEnum] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPolygonlocationLocationpriorityEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Usetype(val null.Val[enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13]) FieldseekerPolygonlocationMod { +func (m fieldseekerPolygonlocationMods) Usetype(val null.Val[string]) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13] { - return val - } + o.Usetype = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPolygonlocationMods) UsetypeFunc(f func() null.Val[enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13]) FieldseekerPolygonlocationMod { +func (m fieldseekerPolygonlocationMods) UsetypeFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { o.Usetype = f }) @@ -866,12 +933,12 @@ func (m fieldseekerPolygonlocationMods) UnsetUsetype() FieldseekerPolygonlocatio // The generated value is sometimes null func (m fieldseekerPolygonlocationMods) RandomUsetype(f *faker.Faker) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13] { + o.Usetype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13(f) + val := random_string(f, "25") return null.From(val) } }) @@ -882,26 +949,26 @@ func (m fieldseekerPolygonlocationMods) RandomUsetype(f *faker.Faker) Fieldseeke // The generated value is never null func (m fieldseekerPolygonlocationMods) RandomUsetypeNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13] { + o.Usetype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Active(val null.Val[enums.FieldseekerPolygonlocationNotinuitFEnum]) FieldseekerPolygonlocationMod { +func (m fieldseekerPolygonlocationMods) Active(val null.Val[int16]) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerPolygonlocationNotinuitFEnum] { return val } + o.Active = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerPolygonlocationMods) ActiveFunc(f func() null.Val[enums.FieldseekerPolygonlocationNotinuitFEnum]) FieldseekerPolygonlocationMod { +func (m fieldseekerPolygonlocationMods) ActiveFunc(f func() null.Val[int16]) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { o.Active = f }) @@ -919,12 +986,12 @@ func (m fieldseekerPolygonlocationMods) UnsetActive() FieldseekerPolygonlocation // The generated value is sometimes null func (m fieldseekerPolygonlocationMods) RandomActive(f *faker.Faker) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerPolygonlocationNotinuitFEnum] { + o.Active = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPolygonlocationNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -935,12 +1002,12 @@ func (m fieldseekerPolygonlocationMods) RandomActive(f *faker.Faker) Fieldseeker // The generated value is never null func (m fieldseekerPolygonlocationMods) RandomActiveNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerPolygonlocationNotinuitFEnum] { + o.Active = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPolygonlocationNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1106,14 +1173,14 @@ func (m fieldseekerPolygonlocationMods) RandomCommentsNotNull(f *faker.Faker) Fi } // Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Symbology(val null.Val[enums.FieldseekerPolygonlocationLocationsymbologyEnum]) FieldseekerPolygonlocationMod { +func (m fieldseekerPolygonlocationMods) Symbology(val null.Val[string]) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Symbology = func() null.Val[enums.FieldseekerPolygonlocationLocationsymbologyEnum] { return val } + o.Symbology = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPolygonlocationMods) SymbologyFunc(f func() null.Val[enums.FieldseekerPolygonlocationLocationsymbologyEnum]) FieldseekerPolygonlocationMod { +func (m fieldseekerPolygonlocationMods) SymbologyFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { o.Symbology = f }) @@ -1131,12 +1198,12 @@ func (m fieldseekerPolygonlocationMods) UnsetSymbology() FieldseekerPolygonlocat // The generated value is sometimes null func (m fieldseekerPolygonlocationMods) RandomSymbology(f *faker.Faker) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Symbology = func() null.Val[enums.FieldseekerPolygonlocationLocationsymbologyEnum] { + o.Symbology = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPolygonlocationLocationsymbologyEnum(f) + val := random_string(f, "10") return null.From(val) } }) @@ -1147,12 +1214,12 @@ func (m fieldseekerPolygonlocationMods) RandomSymbology(f *faker.Faker) Fieldsee // The generated value is never null func (m fieldseekerPolygonlocationMods) RandomSymbologyNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Symbology = func() null.Val[enums.FieldseekerPolygonlocationLocationsymbologyEnum] { + o.Symbology = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPolygonlocationLocationsymbologyEnum(f) + val := random_string(f, "10") return null.From(val) } }) @@ -2325,16 +2392,14 @@ func (m fieldseekerPolygonlocationMods) RandomLastinspectconditionsNotNull(f *fa } // Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Waterorigin(val null.Val[enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9]) FieldseekerPolygonlocationMod { +func (m fieldseekerPolygonlocationMods) Waterorigin(val null.Val[string]) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Waterorigin = func() null.Val[enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9] { - return val - } + o.Waterorigin = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPolygonlocationMods) WateroriginFunc(f func() null.Val[enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9]) FieldseekerPolygonlocationMod { +func (m fieldseekerPolygonlocationMods) WateroriginFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { o.Waterorigin = f }) @@ -2352,12 +2417,12 @@ func (m fieldseekerPolygonlocationMods) UnsetWaterorigin() FieldseekerPolygonloc // The generated value is sometimes null func (m fieldseekerPolygonlocationMods) RandomWaterorigin(f *faker.Faker) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Waterorigin = func() null.Val[enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9] { + o.Waterorigin = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9(f) + val := random_string(f, "50") return null.From(val) } }) @@ -2368,12 +2433,12 @@ func (m fieldseekerPolygonlocationMods) RandomWaterorigin(f *faker.Faker) Fields // The generated value is never null func (m fieldseekerPolygonlocationMods) RandomWateroriginNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Waterorigin = func() null.Val[enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9] { + o.Waterorigin = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9(f) + val := random_string(f, "50") return null.From(val) } }) @@ -2803,6 +2868,90 @@ func (m fieldseekerPolygonlocationMods) RandomShapeLengthNotNull(f *faker.Faker) }) } +// Set the model columns to this value +func (m fieldseekerPolygonlocationMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerPolygonlocationMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerPolygonlocationMods) UnsetGeometry() FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerPolygonlocationMods) RandomGeometry(f *faker.Faker) FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerPolygonlocationMods) Geospatial(val null.Val[string]) FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerPolygonlocationMods) GeospatialFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerPolygonlocationMods) UnsetGeospatial() FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerPolygonlocationMods) RandomGeospatial(f *faker.Faker) FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerPolygonlocationMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { + o.Geospatial = 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 fieldseekerPolygonlocationMods) Version(val int32) FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { @@ -2834,11 +2983,77 @@ func (m fieldseekerPolygonlocationMods) RandomVersion(f *faker.Faker) Fieldseeke }) } +// Set the model columns to this value +func (m fieldseekerPolygonlocationMods) OrganizationID(val int32) FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerPolygonlocationMods) OrganizationIDFunc(f func() int32) FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerPolygonlocationMods) UnsetOrganizationID() FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { + 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 fieldseekerPolygonlocationMods) RandomOrganizationID(f *faker.Faker) FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerPolygonlocationMods) WithParentsCascading() FieldseekerPolygonlocationMod { return FieldseekerPolygonlocationModFunc(func(ctx context.Context, o *FieldseekerPolygonlocationTemplate) { if isDone, _ := fieldseekerPolygonlocationWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerPolygonlocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerPolygonlocationMods) WithOrganization(rel *OrganizationTemplate) FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(ctx context.Context, o *FieldseekerPolygonlocationTemplate) { + o.r.Organization = &fieldseekerPolygonlocationROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerPolygonlocationMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(ctx context.Context, o *FieldseekerPolygonlocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerPolygonlocationMods) WithExistingOrganization(em *models.Organization) FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(ctx context.Context, o *FieldseekerPolygonlocationTemplate) { + o.r.Organization = &fieldseekerPolygonlocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerPolygonlocationMods) WithoutOrganization() FieldseekerPolygonlocationMod { + return FieldseekerPolygonlocationModFunc(func(ctx context.Context, o *FieldseekerPolygonlocationTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.pool.bob.go b/db/factory/fieldseeker.pool.bob.go index 47d55973..8a94cf05 100644 --- a/db/factory/fieldseeker.pool.bob.go +++ b/db/factory/fieldseeker.pool.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerPoolMod interface { @@ -47,17 +48,17 @@ type FieldseekerPoolTemplate struct { Testtech func() null.Val[string] Comments func() null.Val[string] Sampleid func() null.Val[string] - Processed func() null.Val[enums.FieldseekerPoolNotinuitFEnum] + Processed func() null.Val[int16] LabID func() null.Val[uuid.UUID] - Testmethod func() null.Val[enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum] - Diseasetested func() null.Val[enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum] - Diseasepos func() null.Val[enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum] + Testmethod func() null.Val[string] + Diseasetested func() null.Val[string] + Diseasepos func() null.Val[string] Globalid func() null.Val[uuid.UUID] CreatedUser func() null.Val[string] CreatedDate func() null.Val[time.Time] LastEditedUser func() null.Val[string] LastEditedDate func() null.Val[time.Time] - Lab func() null.Val[enums.FieldseekerPoolMosquitolabnameEnum] + Lab func() null.Val[string] Poolyear func() null.Val[int16] Gatewaysync func() null.Val[int16] Vectorsurvcollectionid func() null.Val[string] @@ -67,13 +68,25 @@ type FieldseekerPoolTemplate struct { Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerPoolR f *Factory alreadyPersisted bool } +type fieldseekerPoolR struct { + Organization *fieldseekerPoolROrganizationR +} + +type fieldseekerPoolROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerPoolTemplate func (o *FieldseekerPoolTemplate) Apply(ctx context.Context, mods ...FieldseekerPoolMod) { for _, mod := range mods { @@ -83,7 +96,14 @@ func (o *FieldseekerPoolTemplate) Apply(ctx context.Context, mods ...Fieldseeker // setModelRels creates and sets the relationships on *models.FieldseekerPool // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerPoolTemplate) setModelRels(o *models.FieldseekerPool) {} +func (t FieldseekerPoolTemplate) setModelRels(o *models.FieldseekerPool) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Pools = append(rel.R.Pools, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerPoolSetter // this does nothing with the relationship templates @@ -202,10 +222,22 @@ func (o FieldseekerPoolTemplate) BuildSetter() *models.FieldseekerPoolSetter { val := o.Editor() m.Editor = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -312,9 +344,18 @@ func (o FieldseekerPoolTemplate) Build() *models.FieldseekerPool { if o.Editor != nil { m.Editor = o.Editor() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -335,6 +376,14 @@ func (o FieldseekerPoolTemplate) BuildMany(number int) models.FieldseekerPoolSli } func ensureCreatableFieldseekerPool(m *models.FieldseekerPoolSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerPool @@ -353,11 +402,30 @@ func (o *FieldseekerPoolTemplate) Create(ctx context.Context, exec bob.Executor) opt := o.BuildSetter() ensureCreatableFieldseekerPool(opt) + if o.r.Organization == nil { + FieldseekerPoolMods.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.FieldseekerPools.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 } @@ -463,7 +531,10 @@ func (m fieldseekerPoolMods) RandomizeAllColumns(f *faker.Faker) FieldseekerPool FieldseekerPoolMods.RandomCreator(f), FieldseekerPoolMods.RandomEditdate(f), FieldseekerPoolMods.RandomEditor(f), + FieldseekerPoolMods.RandomGeometry(f), + FieldseekerPoolMods.RandomGeospatial(f), FieldseekerPoolMods.RandomVersion(f), + FieldseekerPoolMods.RandomOrganizationID(f), } } @@ -870,14 +941,14 @@ func (m fieldseekerPoolMods) RandomSampleidNotNull(f *faker.Faker) FieldseekerPo } // Set the model columns to this value -func (m fieldseekerPoolMods) Processed(val null.Val[enums.FieldseekerPoolNotinuitFEnum]) FieldseekerPoolMod { +func (m fieldseekerPoolMods) Processed(val null.Val[int16]) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Processed = func() null.Val[enums.FieldseekerPoolNotinuitFEnum] { return val } + o.Processed = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerPoolMods) ProcessedFunc(f func() null.Val[enums.FieldseekerPoolNotinuitFEnum]) FieldseekerPoolMod { +func (m fieldseekerPoolMods) ProcessedFunc(f func() null.Val[int16]) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { o.Processed = f }) @@ -895,12 +966,12 @@ func (m fieldseekerPoolMods) UnsetProcessed() FieldseekerPoolMod { // The generated value is sometimes null func (m fieldseekerPoolMods) RandomProcessed(f *faker.Faker) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Processed = func() null.Val[enums.FieldseekerPoolNotinuitFEnum] { + o.Processed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPoolNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -911,12 +982,12 @@ func (m fieldseekerPoolMods) RandomProcessed(f *faker.Faker) FieldseekerPoolMod // The generated value is never null func (m fieldseekerPoolMods) RandomProcessedNotNull(f *faker.Faker) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Processed = func() null.Val[enums.FieldseekerPoolNotinuitFEnum] { + o.Processed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPoolNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -976,14 +1047,14 @@ func (m fieldseekerPoolMods) RandomLabIDNotNull(f *faker.Faker) FieldseekerPoolM } // Set the model columns to this value -func (m fieldseekerPoolMods) Testmethod(val null.Val[enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum]) FieldseekerPoolMod { +func (m fieldseekerPoolMods) Testmethod(val null.Val[string]) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Testmethod = func() null.Val[enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum] { return val } + o.Testmethod = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPoolMods) TestmethodFunc(f func() null.Val[enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum]) FieldseekerPoolMod { +func (m fieldseekerPoolMods) TestmethodFunc(f func() null.Val[string]) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { o.Testmethod = f }) @@ -1001,12 +1072,12 @@ func (m fieldseekerPoolMods) UnsetTestmethod() FieldseekerPoolMod { // The generated value is sometimes null func (m fieldseekerPoolMods) RandomTestmethod(f *faker.Faker) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Testmethod = func() null.Val[enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum] { + o.Testmethod = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum(f) + val := random_string(f, "100") return null.From(val) } }) @@ -1017,28 +1088,26 @@ func (m fieldseekerPoolMods) RandomTestmethod(f *faker.Faker) FieldseekerPoolMod // The generated value is never null func (m fieldseekerPoolMods) RandomTestmethodNotNull(f *faker.Faker) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Testmethod = func() null.Val[enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum] { + o.Testmethod = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum(f) + val := random_string(f, "100") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerPoolMods) Diseasetested(val null.Val[enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum]) FieldseekerPoolMod { +func (m fieldseekerPoolMods) Diseasetested(val null.Val[string]) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Diseasetested = func() null.Val[enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum] { - return val - } + o.Diseasetested = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPoolMods) DiseasetestedFunc(f func() null.Val[enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum]) FieldseekerPoolMod { +func (m fieldseekerPoolMods) DiseasetestedFunc(f func() null.Val[string]) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { o.Diseasetested = f }) @@ -1056,12 +1125,12 @@ func (m fieldseekerPoolMods) UnsetDiseasetested() FieldseekerPoolMod { // The generated value is sometimes null func (m fieldseekerPoolMods) RandomDiseasetested(f *faker.Faker) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Diseasetested = func() null.Val[enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum] { + o.Diseasetested = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum(f) + val := random_string(f, "100") return null.From(val) } }) @@ -1072,26 +1141,26 @@ func (m fieldseekerPoolMods) RandomDiseasetested(f *faker.Faker) FieldseekerPool // The generated value is never null func (m fieldseekerPoolMods) RandomDiseasetestedNotNull(f *faker.Faker) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Diseasetested = func() null.Val[enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum] { + o.Diseasetested = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum(f) + val := random_string(f, "100") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerPoolMods) Diseasepos(val null.Val[enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum]) FieldseekerPoolMod { +func (m fieldseekerPoolMods) Diseasepos(val null.Val[string]) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Diseasepos = func() null.Val[enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum] { return val } + o.Diseasepos = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPoolMods) DiseaseposFunc(f func() null.Val[enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum]) FieldseekerPoolMod { +func (m fieldseekerPoolMods) DiseaseposFunc(f func() null.Val[string]) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { o.Diseasepos = f }) @@ -1109,12 +1178,12 @@ func (m fieldseekerPoolMods) UnsetDiseasepos() FieldseekerPoolMod { // The generated value is sometimes null func (m fieldseekerPoolMods) RandomDiseasepos(f *faker.Faker) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Diseasepos = func() null.Val[enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum] { + o.Diseasepos = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum(f) + val := random_string(f, "100") return null.From(val) } }) @@ -1125,12 +1194,12 @@ func (m fieldseekerPoolMods) RandomDiseasepos(f *faker.Faker) FieldseekerPoolMod // The generated value is never null func (m fieldseekerPoolMods) RandomDiseaseposNotNull(f *faker.Faker) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Diseasepos = func() null.Val[enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum] { + o.Diseasepos = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum(f) + val := random_string(f, "100") return null.From(val) } }) @@ -1402,14 +1471,14 @@ func (m fieldseekerPoolMods) RandomLastEditedDateNotNull(f *faker.Faker) Fieldse } // Set the model columns to this value -func (m fieldseekerPoolMods) Lab(val null.Val[enums.FieldseekerPoolMosquitolabnameEnum]) FieldseekerPoolMod { +func (m fieldseekerPoolMods) Lab(val null.Val[string]) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Lab = func() null.Val[enums.FieldseekerPoolMosquitolabnameEnum] { return val } + o.Lab = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerPoolMods) LabFunc(f func() null.Val[enums.FieldseekerPoolMosquitolabnameEnum]) FieldseekerPoolMod { +func (m fieldseekerPoolMods) LabFunc(f func() null.Val[string]) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { o.Lab = f }) @@ -1427,12 +1496,12 @@ func (m fieldseekerPoolMods) UnsetLab() FieldseekerPoolMod { // The generated value is sometimes null func (m fieldseekerPoolMods) RandomLab(f *faker.Faker) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Lab = func() null.Val[enums.FieldseekerPoolMosquitolabnameEnum] { + o.Lab = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPoolMosquitolabnameEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1443,12 +1512,12 @@ func (m fieldseekerPoolMods) RandomLab(f *faker.Faker) FieldseekerPoolMod { // The generated value is never null func (m fieldseekerPoolMods) RandomLabNotNull(f *faker.Faker) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Lab = func() null.Val[enums.FieldseekerPoolMosquitolabnameEnum] { + o.Lab = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerPoolMosquitolabnameEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1931,6 +2000,90 @@ func (m fieldseekerPoolMods) RandomEditorNotNull(f *faker.Faker) FieldseekerPool }) } +// Set the model columns to this value +func (m fieldseekerPoolMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerPoolMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerPoolMods) UnsetGeometry() FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerPoolMods) RandomGeometry(f *faker.Faker) FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerPoolMods) Geospatial(val null.Val[string]) FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerPoolMods) GeospatialFunc(f func() null.Val[string]) FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerPoolMods) UnsetGeospatial() FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerPoolMods) RandomGeospatial(f *faker.Faker) FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerPoolMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { + o.Geospatial = 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 fieldseekerPoolMods) Version(val int32) FieldseekerPoolMod { return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { @@ -1962,11 +2115,77 @@ func (m fieldseekerPoolMods) RandomVersion(f *faker.Faker) FieldseekerPoolMod { }) } +// Set the model columns to this value +func (m fieldseekerPoolMods) OrganizationID(val int32) FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerPoolMods) OrganizationIDFunc(f func() int32) FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerPoolMods) UnsetOrganizationID() FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { + 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 fieldseekerPoolMods) RandomOrganizationID(f *faker.Faker) FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerPoolMods) WithParentsCascading() FieldseekerPoolMod { return FieldseekerPoolModFunc(func(ctx context.Context, o *FieldseekerPoolTemplate) { if isDone, _ := fieldseekerPoolWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerPoolWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerPoolMods) WithOrganization(rel *OrganizationTemplate) FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(ctx context.Context, o *FieldseekerPoolTemplate) { + o.r.Organization = &fieldseekerPoolROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerPoolMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(ctx context.Context, o *FieldseekerPoolTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerPoolMods) WithExistingOrganization(em *models.Organization) FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(ctx context.Context, o *FieldseekerPoolTemplate) { + o.r.Organization = &fieldseekerPoolROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerPoolMods) WithoutOrganization() FieldseekerPoolMod { + return FieldseekerPoolModFunc(func(ctx context.Context, o *FieldseekerPoolTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.pooldetail.bob.go b/db/factory/fieldseeker.pooldetail.bob.go index d1432a6b..5e357128 100644 --- a/db/factory/fieldseeker.pooldetail.bob.go +++ b/db/factory/fieldseeker.pooldetail.bob.go @@ -1,10 +1,11 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" @@ -12,9 +13,10 @@ import ( "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerPooldetailMod interface { @@ -52,13 +54,25 @@ type FieldseekerPooldetailTemplate struct { Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerPooldetailR f *Factory alreadyPersisted bool } +type fieldseekerPooldetailR struct { + Organization *fieldseekerPooldetailROrganizationR +} + +type fieldseekerPooldetailROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerPooldetailTemplate func (o *FieldseekerPooldetailTemplate) Apply(ctx context.Context, mods ...FieldseekerPooldetailMod) { for _, mod := range mods { @@ -68,7 +82,14 @@ func (o *FieldseekerPooldetailTemplate) Apply(ctx context.Context, mods ...Field // setModelRels creates and sets the relationships on *models.FieldseekerPooldetail // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerPooldetailTemplate) setModelRels(o *models.FieldseekerPooldetail) {} +func (t FieldseekerPooldetailTemplate) setModelRels(o *models.FieldseekerPooldetail) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Pooldetails = append(rel.R.Pooldetails, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerPooldetailSetter // this does nothing with the relationship templates @@ -131,10 +152,22 @@ func (o FieldseekerPooldetailTemplate) BuildSetter() *models.FieldseekerPooldeta val := o.Editor() m.Editor = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -199,9 +232,18 @@ func (o FieldseekerPooldetailTemplate) Build() *models.FieldseekerPooldetail { if o.Editor != nil { m.Editor = o.Editor() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -222,6 +264,14 @@ func (o FieldseekerPooldetailTemplate) BuildMany(number int) models.FieldseekerP } func ensureCreatableFieldseekerPooldetail(m *models.FieldseekerPooldetailSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerPooldetail @@ -240,11 +290,30 @@ func (o *FieldseekerPooldetailTemplate) Create(ctx context.Context, exec bob.Exe opt := o.BuildSetter() ensureCreatableFieldseekerPooldetail(opt) + if o.r.Organization == nil { + FieldseekerPooldetailMods.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.FieldseekerPooldetails.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 } @@ -336,7 +405,10 @@ func (m fieldseekerPooldetailMods) RandomizeAllColumns(f *faker.Faker) Fieldseek FieldseekerPooldetailMods.RandomCreator(f), FieldseekerPooldetailMods.RandomEditdate(f), FieldseekerPooldetailMods.RandomEditor(f), + FieldseekerPooldetailMods.RandomGeometry(f), + FieldseekerPooldetailMods.RandomGeospatial(f), FieldseekerPooldetailMods.RandomVersion(f), + FieldseekerPooldetailMods.RandomOrganizationID(f), } } @@ -1060,6 +1132,90 @@ func (m fieldseekerPooldetailMods) RandomEditorNotNull(f *faker.Faker) Fieldseek }) } +// Set the model columns to this value +func (m fieldseekerPooldetailMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerPooldetailMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerPooldetailMods) UnsetGeometry() FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerPooldetailMods) RandomGeometry(f *faker.Faker) FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerPooldetailMods) Geospatial(val null.Val[string]) FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerPooldetailMods) GeospatialFunc(f func() null.Val[string]) FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerPooldetailMods) UnsetGeospatial() FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerPooldetailMods) RandomGeospatial(f *faker.Faker) FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerPooldetailMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { + o.Geospatial = 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 fieldseekerPooldetailMods) Version(val int32) FieldseekerPooldetailMod { return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { @@ -1091,11 +1247,77 @@ func (m fieldseekerPooldetailMods) RandomVersion(f *faker.Faker) FieldseekerPool }) } +// Set the model columns to this value +func (m fieldseekerPooldetailMods) OrganizationID(val int32) FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerPooldetailMods) OrganizationIDFunc(f func() int32) FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerPooldetailMods) UnsetOrganizationID() FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { + 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 fieldseekerPooldetailMods) RandomOrganizationID(f *faker.Faker) FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerPooldetailMods) WithParentsCascading() FieldseekerPooldetailMod { return FieldseekerPooldetailModFunc(func(ctx context.Context, o *FieldseekerPooldetailTemplate) { if isDone, _ := fieldseekerPooldetailWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerPooldetailWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerPooldetailMods) WithOrganization(rel *OrganizationTemplate) FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(ctx context.Context, o *FieldseekerPooldetailTemplate) { + o.r.Organization = &fieldseekerPooldetailROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerPooldetailMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(ctx context.Context, o *FieldseekerPooldetailTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerPooldetailMods) WithExistingOrganization(em *models.Organization) FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(ctx context.Context, o *FieldseekerPooldetailTemplate) { + o.r.Organization = &fieldseekerPooldetailROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerPooldetailMods) WithoutOrganization() FieldseekerPooldetailMod { + return FieldseekerPooldetailModFunc(func(ctx context.Context, o *FieldseekerPooldetailTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.proposedtreatmentarea.bob.go b/db/factory/fieldseeker.proposedtreatmentarea.bob.go index b08302d9..655cdcb8 100644 --- a/db/factory/fieldseeker.proposedtreatmentarea.bob.go +++ b/db/factory/fieldseeker.proposedtreatmentarea.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerProposedtreatmentareaMod interface { @@ -40,21 +41,21 @@ func (mods FieldseekerProposedtreatmentareaModSlice) Apply(ctx context.Context, // all columns are optional and should be set by mods type FieldseekerProposedtreatmentareaTemplate struct { Objectid func() int64 - Method func() null.Val[enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum] + Method func() null.Val[string] Comments func() null.Val[string] Zone func() null.Val[string] - Reviewed func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] + Reviewed func() null.Val[int16] Reviewedby func() null.Val[string] Revieweddate func() null.Val[time.Time] Zone2 func() null.Val[string] Completeddate func() null.Val[time.Time] Completedby func() null.Val[string] - Completed func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] - Issprayroute func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] + Completed func() null.Val[int16] + Issprayroute func() null.Val[int16] Name func() null.Val[string] Acres func() null.Val[float64] Globalid func() null.Val[uuid.UUID] - Exported func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] + Exported func() null.Val[int16] Targetproduct func() null.Val[string] Targetapprate func() null.Val[float64] Hectares func() null.Val[float64] @@ -63,7 +64,7 @@ type FieldseekerProposedtreatmentareaTemplate struct { Lasttreatproduct func() null.Val[string] Lasttreatqty func() null.Val[float64] Lasttreatqtyunit func() null.Val[string] - Priority func() null.Val[enums.FieldseekerProposedtreatmentareaLocationpriorityEnum] + Priority func() null.Val[string] Duedate func() null.Val[time.Time] Creationdate func() null.Val[time.Time] Creator func() null.Val[string] @@ -72,13 +73,25 @@ type FieldseekerProposedtreatmentareaTemplate struct { Targetspecies func() null.Val[string] ShapeArea func() null.Val[float64] ShapeLength func() null.Val[float64] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerProposedtreatmentareaR f *Factory alreadyPersisted bool } +type fieldseekerProposedtreatmentareaR struct { + Organization *fieldseekerProposedtreatmentareaROrganizationR +} + +type fieldseekerProposedtreatmentareaROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerProposedtreatmentareaTemplate func (o *FieldseekerProposedtreatmentareaTemplate) Apply(ctx context.Context, mods ...FieldseekerProposedtreatmentareaMod) { for _, mod := range mods { @@ -89,6 +102,12 @@ func (o *FieldseekerProposedtreatmentareaTemplate) Apply(ctx context.Context, mo // setModelRels creates and sets the relationships on *models.FieldseekerProposedtreatmentarea // according to the relationships in the template. Nothing is inserted into the db func (t FieldseekerProposedtreatmentareaTemplate) setModelRels(o *models.FieldseekerProposedtreatmentarea) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Proposedtreatmentareas = append(rel.R.Proposedtreatmentareas, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } } // BuildSetter returns an *models.FieldseekerProposedtreatmentareaSetter @@ -228,10 +247,22 @@ func (o FieldseekerProposedtreatmentareaTemplate) BuildSetter() *models.Fieldsee val := o.ShapeLength() m.ShapeLength = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -353,9 +384,18 @@ func (o FieldseekerProposedtreatmentareaTemplate) Build() *models.FieldseekerPro if o.ShapeLength != nil { m.ShapeLength = o.ShapeLength() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -376,6 +416,14 @@ func (o FieldseekerProposedtreatmentareaTemplate) BuildMany(number int) models.F } func ensureCreatableFieldseekerProposedtreatmentarea(m *models.FieldseekerProposedtreatmentareaSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerProposedtreatmentarea @@ -394,11 +442,30 @@ func (o *FieldseekerProposedtreatmentareaTemplate) Create(ctx context.Context, e opt := o.BuildSetter() ensureCreatableFieldseekerProposedtreatmentarea(opt) + if o.r.Organization == nil { + FieldseekerProposedtreatmentareaMods.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.FieldseekerProposedtreatmentareas.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 } @@ -509,7 +576,10 @@ func (m fieldseekerProposedtreatmentareaMods) RandomizeAllColumns(f *faker.Faker FieldseekerProposedtreatmentareaMods.RandomTargetspecies(f), FieldseekerProposedtreatmentareaMods.RandomShapeArea(f), FieldseekerProposedtreatmentareaMods.RandomShapeLength(f), + FieldseekerProposedtreatmentareaMods.RandomGeometry(f), + FieldseekerProposedtreatmentareaMods.RandomGeospatial(f), FieldseekerProposedtreatmentareaMods.RandomVersion(f), + FieldseekerProposedtreatmentareaMods.RandomOrganizationID(f), } } @@ -545,14 +615,14 @@ func (m fieldseekerProposedtreatmentareaMods) RandomObjectid(f *faker.Faker) Fie } // Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Method(val null.Val[enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum]) FieldseekerProposedtreatmentareaMod { +func (m fieldseekerProposedtreatmentareaMods) Method(val null.Val[string]) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Method = func() null.Val[enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum] { return val } + o.Method = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) MethodFunc(f func() null.Val[enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum]) FieldseekerProposedtreatmentareaMod { +func (m fieldseekerProposedtreatmentareaMods) MethodFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { o.Method = f }) @@ -570,12 +640,12 @@ func (m fieldseekerProposedtreatmentareaMods) UnsetMethod() FieldseekerProposedt // The generated value is sometimes null func (m fieldseekerProposedtreatmentareaMods) RandomMethod(f *faker.Faker) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Method = func() null.Val[enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum] { + o.Method = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -586,12 +656,12 @@ func (m fieldseekerProposedtreatmentareaMods) RandomMethod(f *faker.Faker) Field // The generated value is never null func (m fieldseekerProposedtreatmentareaMods) RandomMethodNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Method = func() null.Val[enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum] { + o.Method = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -704,14 +774,14 @@ func (m fieldseekerProposedtreatmentareaMods) RandomZoneNotNull(f *faker.Faker) } // Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Reviewed(val null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum]) FieldseekerProposedtreatmentareaMod { +func (m fieldseekerProposedtreatmentareaMods) Reviewed(val null.Val[int16]) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] { return val } + o.Reviewed = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) ReviewedFunc(f func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum]) FieldseekerProposedtreatmentareaMod { +func (m fieldseekerProposedtreatmentareaMods) ReviewedFunc(f func() null.Val[int16]) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { o.Reviewed = f }) @@ -729,12 +799,12 @@ func (m fieldseekerProposedtreatmentareaMods) UnsetReviewed() FieldseekerPropose // The generated value is sometimes null func (m fieldseekerProposedtreatmentareaMods) RandomReviewed(f *faker.Faker) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] { + o.Reviewed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerProposedtreatmentareaNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -745,12 +815,12 @@ func (m fieldseekerProposedtreatmentareaMods) RandomReviewed(f *faker.Faker) Fie // The generated value is never null func (m fieldseekerProposedtreatmentareaMods) RandomReviewedNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] { + o.Reviewed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerProposedtreatmentareaNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1022,14 +1092,14 @@ func (m fieldseekerProposedtreatmentareaMods) RandomCompletedbyNotNull(f *faker. } // Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Completed(val null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum]) FieldseekerProposedtreatmentareaMod { +func (m fieldseekerProposedtreatmentareaMods) Completed(val null.Val[int16]) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Completed = func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] { return val } + o.Completed = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) CompletedFunc(f func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum]) FieldseekerProposedtreatmentareaMod { +func (m fieldseekerProposedtreatmentareaMods) CompletedFunc(f func() null.Val[int16]) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { o.Completed = f }) @@ -1047,12 +1117,12 @@ func (m fieldseekerProposedtreatmentareaMods) UnsetCompleted() FieldseekerPropos // The generated value is sometimes null func (m fieldseekerProposedtreatmentareaMods) RandomCompleted(f *faker.Faker) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Completed = func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] { + o.Completed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerProposedtreatmentareaNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1063,26 +1133,26 @@ func (m fieldseekerProposedtreatmentareaMods) RandomCompleted(f *faker.Faker) Fi // The generated value is never null func (m fieldseekerProposedtreatmentareaMods) RandomCompletedNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Completed = func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] { + o.Completed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerProposedtreatmentareaNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Issprayroute(val null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum]) FieldseekerProposedtreatmentareaMod { +func (m fieldseekerProposedtreatmentareaMods) Issprayroute(val null.Val[int16]) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Issprayroute = func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] { return val } + o.Issprayroute = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) IssprayrouteFunc(f func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum]) FieldseekerProposedtreatmentareaMod { +func (m fieldseekerProposedtreatmentareaMods) IssprayrouteFunc(f func() null.Val[int16]) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { o.Issprayroute = f }) @@ -1100,12 +1170,12 @@ func (m fieldseekerProposedtreatmentareaMods) UnsetIssprayroute() FieldseekerPro // The generated value is sometimes null func (m fieldseekerProposedtreatmentareaMods) RandomIssprayroute(f *faker.Faker) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Issprayroute = func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] { + o.Issprayroute = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerProposedtreatmentareaNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1116,12 +1186,12 @@ func (m fieldseekerProposedtreatmentareaMods) RandomIssprayroute(f *faker.Faker) // The generated value is never null func (m fieldseekerProposedtreatmentareaMods) RandomIssprayrouteNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Issprayroute = func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] { + o.Issprayroute = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerProposedtreatmentareaNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1287,14 +1357,14 @@ func (m fieldseekerProposedtreatmentareaMods) RandomGlobalidNotNull(f *faker.Fak } // Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Exported(val null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum]) FieldseekerProposedtreatmentareaMod { +func (m fieldseekerProposedtreatmentareaMods) Exported(val null.Val[int16]) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Exported = func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] { return val } + o.Exported = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) ExportedFunc(f func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum]) FieldseekerProposedtreatmentareaMod { +func (m fieldseekerProposedtreatmentareaMods) ExportedFunc(f func() null.Val[int16]) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { o.Exported = f }) @@ -1312,12 +1382,12 @@ func (m fieldseekerProposedtreatmentareaMods) UnsetExported() FieldseekerPropose // The generated value is sometimes null func (m fieldseekerProposedtreatmentareaMods) RandomExported(f *faker.Faker) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Exported = func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] { + o.Exported = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerProposedtreatmentareaNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1328,12 +1398,12 @@ func (m fieldseekerProposedtreatmentareaMods) RandomExported(f *faker.Faker) Fie // The generated value is never null func (m fieldseekerProposedtreatmentareaMods) RandomExportedNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Exported = func() null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] { + o.Exported = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerProposedtreatmentareaNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1764,14 +1834,14 @@ func (m fieldseekerProposedtreatmentareaMods) RandomLasttreatqtyunitNotNull(f *f } // Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Priority(val null.Val[enums.FieldseekerProposedtreatmentareaLocationpriorityEnum]) FieldseekerProposedtreatmentareaMod { +func (m fieldseekerProposedtreatmentareaMods) Priority(val null.Val[string]) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Priority = func() null.Val[enums.FieldseekerProposedtreatmentareaLocationpriorityEnum] { return val } + o.Priority = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) PriorityFunc(f func() null.Val[enums.FieldseekerProposedtreatmentareaLocationpriorityEnum]) FieldseekerProposedtreatmentareaMod { +func (m fieldseekerProposedtreatmentareaMods) PriorityFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { o.Priority = f }) @@ -1789,12 +1859,12 @@ func (m fieldseekerProposedtreatmentareaMods) UnsetPriority() FieldseekerPropose // The generated value is sometimes null func (m fieldseekerProposedtreatmentareaMods) RandomPriority(f *faker.Faker) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Priority = func() null.Val[enums.FieldseekerProposedtreatmentareaLocationpriorityEnum] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerProposedtreatmentareaLocationpriorityEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1805,12 +1875,12 @@ func (m fieldseekerProposedtreatmentareaMods) RandomPriority(f *faker.Faker) Fie // The generated value is never null func (m fieldseekerProposedtreatmentareaMods) RandomPriorityNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Priority = func() null.Val[enums.FieldseekerProposedtreatmentareaLocationpriorityEnum] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerProposedtreatmentareaLocationpriorityEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -2240,6 +2310,90 @@ func (m fieldseekerProposedtreatmentareaMods) RandomShapeLengthNotNull(f *faker. }) } +// Set the model columns to this value +func (m fieldseekerProposedtreatmentareaMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerProposedtreatmentareaMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerProposedtreatmentareaMods) UnsetGeometry() FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerProposedtreatmentareaMods) RandomGeometry(f *faker.Faker) FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerProposedtreatmentareaMods) Geospatial(val null.Val[string]) FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerProposedtreatmentareaMods) GeospatialFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerProposedtreatmentareaMods) UnsetGeospatial() FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerProposedtreatmentareaMods) RandomGeospatial(f *faker.Faker) FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerProposedtreatmentareaMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + o.Geospatial = 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 fieldseekerProposedtreatmentareaMods) Version(val int32) FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { @@ -2271,11 +2425,77 @@ func (m fieldseekerProposedtreatmentareaMods) RandomVersion(f *faker.Faker) Fiel }) } +// Set the model columns to this value +func (m fieldseekerProposedtreatmentareaMods) OrganizationID(val int32) FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerProposedtreatmentareaMods) OrganizationIDFunc(f func() int32) FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerProposedtreatmentareaMods) UnsetOrganizationID() FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + 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 fieldseekerProposedtreatmentareaMods) RandomOrganizationID(f *faker.Faker) FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerProposedtreatmentareaMods) WithParentsCascading() FieldseekerProposedtreatmentareaMod { return FieldseekerProposedtreatmentareaModFunc(func(ctx context.Context, o *FieldseekerProposedtreatmentareaTemplate) { if isDone, _ := fieldseekerProposedtreatmentareaWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerProposedtreatmentareaWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerProposedtreatmentareaMods) WithOrganization(rel *OrganizationTemplate) FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(ctx context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + o.r.Organization = &fieldseekerProposedtreatmentareaROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerProposedtreatmentareaMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(ctx context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerProposedtreatmentareaMods) WithExistingOrganization(em *models.Organization) FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(ctx context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + o.r.Organization = &fieldseekerProposedtreatmentareaROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerProposedtreatmentareaMods) WithoutOrganization() FieldseekerProposedtreatmentareaMod { + return FieldseekerProposedtreatmentareaModFunc(func(ctx context.Context, o *FieldseekerProposedtreatmentareaTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.qamosquitoinspection.bob.go b/db/factory/fieldseeker.qamosquitoinspection.bob.go index 8e6afd61..7bce9279 100644 --- a/db/factory/fieldseeker.qamosquitoinspection.bob.go +++ b/db/factory/fieldseeker.qamosquitoinspection.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerQamosquitoinspectionMod interface { @@ -41,7 +42,7 @@ func (mods FieldseekerQamosquitoinspectionModSlice) Apply(ctx context.Context, n type FieldseekerQamosquitoinspectionTemplate struct { Objectid func() int64 Posdips func() null.Val[int16] - Actiontaken func() null.Val[enums.FieldseekerQamosquitoinspectionMosquitoactionEnum] + Actiontaken func() null.Val[string] Comments func() null.Val[string] Avetemp func() null.Val[float64] Windspeed func() null.Val[float64] @@ -50,7 +51,7 @@ type FieldseekerQamosquitoinspectionTemplate struct { Startdatetime func() null.Val[time.Time] Enddatetime func() null.Val[time.Time] Winddir func() null.Val[string] - Reviewed func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] + Reviewed func() null.Val[int16] Reviewedby func() null.Val[string] Revieweddate func() null.Val[time.Time] Locationname func() null.Val[string] @@ -61,34 +62,34 @@ type FieldseekerQamosquitoinspectionTemplate struct { Negdips func() null.Val[int16] Totalacres func() null.Val[float64] Acresbreeding func() null.Val[float64] - Fish func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] - Sitetype func() null.Val[enums.FieldseekerQamosquitoinspectionQasitetypeEnum] - Breedingpotential func() null.Val[enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum] - Movingwater func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] - Nowaterever func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] - Mosquitohabitat func() null.Val[enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum] + Fish func() null.Val[int16] + Sitetype func() null.Val[string] + Breedingpotential func() null.Val[string] + Movingwater func() null.Val[int16] + Nowaterever func() null.Val[int16] + Mosquitohabitat func() null.Val[string] Habvalue1 func() null.Val[int16] Habvalue1percent func() null.Val[int16] Habvalue2 func() null.Val[int16] Habvalue2percent func() null.Val[int16] Potential func() null.Val[int16] - Larvaepresent func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] - Larvaeinsidetreatedarea func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] - Larvaeoutsidetreatedarea func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] - Larvaereason func() null.Val[enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum] - Aquaticorganisms func() null.Val[enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum] - Vegetation func() null.Val[enums.FieldseekerQamosquitoinspectionQavegetationEnum] - Sourcereduction func() null.Val[enums.FieldseekerQamosquitoinspectionQasourcereductionEnum] - Waterpresent func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] - Watermovement1 func() null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] + Larvaepresent func() null.Val[int16] + Larvaeinsidetreatedarea func() null.Val[int16] + Larvaeoutsidetreatedarea func() null.Val[int16] + Larvaereason func() null.Val[string] + Aquaticorganisms func() null.Val[string] + Vegetation func() null.Val[string] + Sourcereduction func() null.Val[string] + Waterpresent func() null.Val[int16] + Watermovement1 func() null.Val[string] Watermovement1percent func() null.Val[int16] - Watermovement2 func() null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] + Watermovement2 func() null.Val[string] Watermovement2percent func() null.Val[int16] - Soilconditions func() null.Val[enums.FieldseekerQamosquitoinspectionQasoilconditionEnum] - Waterduration func() null.Val[enums.FieldseekerQamosquitoinspectionQawaterdurationEnum] - Watersource func() null.Val[enums.FieldseekerQamosquitoinspectionQawatersourceEnum] - Waterconditions func() null.Val[enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum] - Adultactivity func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] + Soilconditions func() null.Val[string] + Waterduration func() null.Val[string] + Watersource func() null.Val[string] + Waterconditions func() null.Val[string] + Adultactivity func() null.Val[int16] Linelocid func() null.Val[uuid.UUID] Pointlocid func() null.Val[uuid.UUID] Polygonlocid func() null.Val[uuid.UUID] @@ -101,13 +102,25 @@ type FieldseekerQamosquitoinspectionTemplate struct { Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerQamosquitoinspectionR f *Factory alreadyPersisted bool } +type fieldseekerQamosquitoinspectionR struct { + Organization *fieldseekerQamosquitoinspectionROrganizationR +} + +type fieldseekerQamosquitoinspectionROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerQamosquitoinspectionTemplate func (o *FieldseekerQamosquitoinspectionTemplate) Apply(ctx context.Context, mods ...FieldseekerQamosquitoinspectionMod) { for _, mod := range mods { @@ -118,6 +131,12 @@ func (o *FieldseekerQamosquitoinspectionTemplate) Apply(ctx context.Context, mod // setModelRels creates and sets the relationships on *models.FieldseekerQamosquitoinspection // according to the relationships in the template. Nothing is inserted into the db func (t FieldseekerQamosquitoinspectionTemplate) setModelRels(o *models.FieldseekerQamosquitoinspection) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Qamosquitoinspections = append(rel.R.Qamosquitoinspections, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } } // BuildSetter returns an *models.FieldseekerQamosquitoinspectionSetter @@ -373,10 +392,22 @@ func (o FieldseekerQamosquitoinspectionTemplate) BuildSetter() *models.Fieldseek val := o.Editor() m.Editor = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -585,9 +616,18 @@ func (o FieldseekerQamosquitoinspectionTemplate) Build() *models.FieldseekerQamo if o.Editor != nil { m.Editor = o.Editor() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -608,6 +648,14 @@ func (o FieldseekerQamosquitoinspectionTemplate) BuildMany(number int) models.Fi } func ensureCreatableFieldseekerQamosquitoinspection(m *models.FieldseekerQamosquitoinspectionSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerQamosquitoinspection @@ -626,11 +674,30 @@ func (o *FieldseekerQamosquitoinspectionTemplate) Create(ctx context.Context, ex opt := o.BuildSetter() ensureCreatableFieldseekerQamosquitoinspection(opt) + if o.r.Organization == nil { + FieldseekerQamosquitoinspectionMods.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.FieldseekerQamosquitoinspections.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 } @@ -770,7 +837,10 @@ func (m fieldseekerQamosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) FieldseekerQamosquitoinspectionMods.RandomCreator(f), FieldseekerQamosquitoinspectionMods.RandomEditdate(f), FieldseekerQamosquitoinspectionMods.RandomEditor(f), + FieldseekerQamosquitoinspectionMods.RandomGeometry(f), + FieldseekerQamosquitoinspectionMods.RandomGeospatial(f), FieldseekerQamosquitoinspectionMods.RandomVersion(f), + FieldseekerQamosquitoinspectionMods.RandomOrganizationID(f), } } @@ -859,14 +929,14 @@ func (m fieldseekerQamosquitoinspectionMods) RandomPosdipsNotNull(f *faker.Faker } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Actiontaken(val null.Val[enums.FieldseekerQamosquitoinspectionMosquitoactionEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Actiontaken(val null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[enums.FieldseekerQamosquitoinspectionMosquitoactionEnum] { return val } + o.Actiontaken = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) ActiontakenFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionMosquitoactionEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) ActiontakenFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Actiontaken = f }) @@ -884,12 +954,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetActiontaken() FieldseekerQamos // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomActiontaken(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[enums.FieldseekerQamosquitoinspectionMosquitoactionEnum] { + o.Actiontaken = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionMosquitoactionEnum(f) + val := random_string(f, "250") return null.From(val) } }) @@ -900,12 +970,12 @@ func (m fieldseekerQamosquitoinspectionMods) RandomActiontaken(f *faker.Faker) F // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomActiontakenNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[enums.FieldseekerQamosquitoinspectionMosquitoactionEnum] { + o.Actiontaken = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionMosquitoactionEnum(f) + val := random_string(f, "250") return null.From(val) } }) @@ -1336,14 +1406,14 @@ func (m fieldseekerQamosquitoinspectionMods) RandomWinddirNotNull(f *faker.Faker } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Reviewed(val null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Reviewed(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { return val } + o.Reviewed = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) ReviewedFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) ReviewedFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Reviewed = f }) @@ -1361,12 +1431,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetReviewed() FieldseekerQamosqui // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomReviewed(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Reviewed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1377,12 +1447,12 @@ func (m fieldseekerQamosquitoinspectionMods) RandomReviewed(f *faker.Faker) Fiel // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomReviewedNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Reviewed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1919,14 +1989,14 @@ func (m fieldseekerQamosquitoinspectionMods) RandomAcresbreedingNotNull(f *faker } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Fish(val null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Fish(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Fish = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { return val } + o.Fish = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) FishFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) FishFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Fish = f }) @@ -1944,12 +2014,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetFish() FieldseekerQamosquitoin // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomFish(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Fish = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Fish = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1960,26 +2030,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomFish(f *faker.Faker) Fieldsee // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomFishNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Fish = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Fish = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Sitetype(val null.Val[enums.FieldseekerQamosquitoinspectionQasitetypeEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Sitetype(val null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Sitetype = func() null.Val[enums.FieldseekerQamosquitoinspectionQasitetypeEnum] { return val } + o.Sitetype = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) SitetypeFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionQasitetypeEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) SitetypeFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Sitetype = f }) @@ -1997,12 +2067,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetSitetype() FieldseekerQamosqui // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomSitetype(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Sitetype = func() null.Val[enums.FieldseekerQamosquitoinspectionQasitetypeEnum] { + o.Sitetype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQasitetypeEnum(f) + val := random_string(f, "250") return null.From(val) } }) @@ -2013,26 +2083,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomSitetype(f *faker.Faker) Fiel // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomSitetypeNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Sitetype = func() null.Val[enums.FieldseekerQamosquitoinspectionQasitetypeEnum] { + o.Sitetype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQasitetypeEnum(f) + val := random_string(f, "250") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Breedingpotential(val null.Val[enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Breedingpotential(val null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Breedingpotential = func() null.Val[enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum] { return val } + o.Breedingpotential = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) BreedingpotentialFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) BreedingpotentialFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Breedingpotential = f }) @@ -2050,12 +2120,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetBreedingpotential() Fieldseeke // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomBreedingpotential(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Breedingpotential = func() null.Val[enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum] { + o.Breedingpotential = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQabreedingpotentialEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -2066,26 +2136,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomBreedingpotential(f *faker.Fa // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomBreedingpotentialNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Breedingpotential = func() null.Val[enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum] { + o.Breedingpotential = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQabreedingpotentialEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Movingwater(val null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Movingwater(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Movingwater = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { return val } + o.Movingwater = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) MovingwaterFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) MovingwaterFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Movingwater = f }) @@ -2103,12 +2173,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetMovingwater() FieldseekerQamos // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomMovingwater(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Movingwater = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Movingwater = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -2119,26 +2189,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomMovingwater(f *faker.Faker) F // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomMovingwaterNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Movingwater = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Movingwater = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Nowaterever(val null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Nowaterever(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Nowaterever = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { return val } + o.Nowaterever = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) NowatereverFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) NowatereverFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Nowaterever = f }) @@ -2156,12 +2226,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetNowaterever() FieldseekerQamos // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomNowaterever(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Nowaterever = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Nowaterever = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -2172,26 +2242,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomNowaterever(f *faker.Faker) F // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomNowatereverNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Nowaterever = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Nowaterever = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Mosquitohabitat(val null.Val[enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Mosquitohabitat(val null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Mosquitohabitat = func() null.Val[enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum] { return val } + o.Mosquitohabitat = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) MosquitohabitatFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) MosquitohabitatFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Mosquitohabitat = f }) @@ -2209,12 +2279,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetMosquitohabitat() FieldseekerQ // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomMosquitohabitat(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Mosquitohabitat = func() null.Val[enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum] { + o.Mosquitohabitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQamosquitohabitatEnum(f) + val := random_string(f, "250") return null.From(val) } }) @@ -2225,12 +2295,12 @@ func (m fieldseekerQamosquitoinspectionMods) RandomMosquitohabitat(f *faker.Fake // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomMosquitohabitatNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Mosquitohabitat = func() null.Val[enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum] { + o.Mosquitohabitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQamosquitohabitatEnum(f) + val := random_string(f, "250") return null.From(val) } }) @@ -2502,14 +2572,14 @@ func (m fieldseekerQamosquitoinspectionMods) RandomPotentialNotNull(f *faker.Fak } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Larvaepresent(val null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Larvaepresent(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { return val } + o.Larvaepresent = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) LarvaepresentFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) LarvaepresentFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Larvaepresent = f }) @@ -2527,12 +2597,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetLarvaepresent() FieldseekerQam // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomLarvaepresent(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Larvaepresent = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -2543,26 +2613,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomLarvaepresent(f *faker.Faker) // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomLarvaepresentNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Larvaepresent = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Larvaeinsidetreatedarea(val null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Larvaeinsidetreatedarea(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaeinsidetreatedarea = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { return val } + o.Larvaeinsidetreatedarea = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) LarvaeinsidetreatedareaFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) LarvaeinsidetreatedareaFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Larvaeinsidetreatedarea = f }) @@ -2580,12 +2650,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetLarvaeinsidetreatedarea() Fiel // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomLarvaeinsidetreatedarea(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaeinsidetreatedarea = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Larvaeinsidetreatedarea = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -2596,26 +2666,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomLarvaeinsidetreatedarea(f *fa // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomLarvaeinsidetreatedareaNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaeinsidetreatedarea = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Larvaeinsidetreatedarea = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Larvaeoutsidetreatedarea(val null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Larvaeoutsidetreatedarea(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaeoutsidetreatedarea = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { return val } + o.Larvaeoutsidetreatedarea = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) LarvaeoutsidetreatedareaFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) LarvaeoutsidetreatedareaFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Larvaeoutsidetreatedarea = f }) @@ -2633,12 +2703,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetLarvaeoutsidetreatedarea() Fie // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomLarvaeoutsidetreatedarea(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaeoutsidetreatedarea = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Larvaeoutsidetreatedarea = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -2649,26 +2719,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomLarvaeoutsidetreatedarea(f *f // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomLarvaeoutsidetreatedareaNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaeoutsidetreatedarea = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Larvaeoutsidetreatedarea = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Larvaereason(val null.Val[enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Larvaereason(val null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaereason = func() null.Val[enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum] { return val } + o.Larvaereason = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) LarvaereasonFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) LarvaereasonFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Larvaereason = f }) @@ -2686,12 +2756,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetLarvaereason() FieldseekerQamo // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomLarvaereason(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaereason = func() null.Val[enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum] { + o.Larvaereason = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQalarvaereasonEnum(f) + val := random_string(f, "250") return null.From(val) } }) @@ -2702,26 +2772,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomLarvaereason(f *faker.Faker) // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomLarvaereasonNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaereason = func() null.Val[enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum] { + o.Larvaereason = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQalarvaereasonEnum(f) + val := random_string(f, "250") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Aquaticorganisms(val null.Val[enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Aquaticorganisms(val null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Aquaticorganisms = func() null.Val[enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum] { return val } + o.Aquaticorganisms = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) AquaticorganismsFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) AquaticorganismsFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Aquaticorganisms = f }) @@ -2739,12 +2809,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetAquaticorganisms() Fieldseeker // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomAquaticorganisms(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Aquaticorganisms = func() null.Val[enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum] { + o.Aquaticorganisms = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQaaquaticorganismsEnum(f) + val := random_string(f, "500") return null.From(val) } }) @@ -2755,26 +2825,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomAquaticorganisms(f *faker.Fak // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomAquaticorganismsNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Aquaticorganisms = func() null.Val[enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum] { + o.Aquaticorganisms = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQaaquaticorganismsEnum(f) + val := random_string(f, "500") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Vegetation(val null.Val[enums.FieldseekerQamosquitoinspectionQavegetationEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Vegetation(val null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Vegetation = func() null.Val[enums.FieldseekerQamosquitoinspectionQavegetationEnum] { return val } + o.Vegetation = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) VegetationFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionQavegetationEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) VegetationFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Vegetation = f }) @@ -2792,12 +2862,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetVegetation() FieldseekerQamosq // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomVegetation(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Vegetation = func() null.Val[enums.FieldseekerQamosquitoinspectionQavegetationEnum] { + o.Vegetation = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQavegetationEnum(f) + val := random_string(f, "500") return null.From(val) } }) @@ -2808,26 +2878,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomVegetation(f *faker.Faker) Fi // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomVegetationNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Vegetation = func() null.Val[enums.FieldseekerQamosquitoinspectionQavegetationEnum] { + o.Vegetation = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQavegetationEnum(f) + val := random_string(f, "500") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Sourcereduction(val null.Val[enums.FieldseekerQamosquitoinspectionQasourcereductionEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Sourcereduction(val null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Sourcereduction = func() null.Val[enums.FieldseekerQamosquitoinspectionQasourcereductionEnum] { return val } + o.Sourcereduction = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) SourcereductionFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionQasourcereductionEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) SourcereductionFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Sourcereduction = f }) @@ -2845,12 +2915,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetSourcereduction() FieldseekerQ // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomSourcereduction(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Sourcereduction = func() null.Val[enums.FieldseekerQamosquitoinspectionQasourcereductionEnum] { + o.Sourcereduction = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQasourcereductionEnum(f) + val := random_string(f, "250") return null.From(val) } }) @@ -2861,26 +2931,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomSourcereduction(f *faker.Fake // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomSourcereductionNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Sourcereduction = func() null.Val[enums.FieldseekerQamosquitoinspectionQasourcereductionEnum] { + o.Sourcereduction = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQasourcereductionEnum(f) + val := random_string(f, "250") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Waterpresent(val null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Waterpresent(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterpresent = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { return val } + o.Waterpresent = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) WaterpresentFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) WaterpresentFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Waterpresent = f }) @@ -2898,12 +2968,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetWaterpresent() FieldseekerQamo // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomWaterpresent(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterpresent = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Waterpresent = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -2914,26 +2984,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomWaterpresent(f *faker.Faker) // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomWaterpresentNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterpresent = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Waterpresent = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Watermovement1(val null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Watermovement1(val null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement1 = func() null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] { return val } + o.Watermovement1 = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) Watermovement1Func(f func() null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Watermovement1Func(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Watermovement1 = f }) @@ -2951,12 +3021,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetWatermovement1() FieldseekerQa // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomWatermovement1(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement1 = func() null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] { + o.Watermovement1 = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQawatermovementEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -2967,12 +3037,12 @@ func (m fieldseekerQamosquitoinspectionMods) RandomWatermovement1(f *faker.Faker // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomWatermovement1NotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement1 = func() null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] { + o.Watermovement1 = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQawatermovementEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -3032,14 +3102,14 @@ func (m fieldseekerQamosquitoinspectionMods) RandomWatermovement1percentNotNull( } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Watermovement2(val null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Watermovement2(val null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement2 = func() null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] { return val } + o.Watermovement2 = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) Watermovement2Func(f func() null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Watermovement2Func(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Watermovement2 = f }) @@ -3057,12 +3127,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetWatermovement2() FieldseekerQa // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomWatermovement2(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement2 = func() null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] { + o.Watermovement2 = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQawatermovementEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -3073,12 +3143,12 @@ func (m fieldseekerQamosquitoinspectionMods) RandomWatermovement2(f *faker.Faker // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomWatermovement2NotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement2 = func() null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] { + o.Watermovement2 = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQawatermovementEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -3138,14 +3208,14 @@ func (m fieldseekerQamosquitoinspectionMods) RandomWatermovement2percentNotNull( } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Soilconditions(val null.Val[enums.FieldseekerQamosquitoinspectionQasoilconditionEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Soilconditions(val null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Soilconditions = func() null.Val[enums.FieldseekerQamosquitoinspectionQasoilconditionEnum] { return val } + o.Soilconditions = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) SoilconditionsFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionQasoilconditionEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) SoilconditionsFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Soilconditions = f }) @@ -3163,12 +3233,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetSoilconditions() FieldseekerQa // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomSoilconditions(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Soilconditions = func() null.Val[enums.FieldseekerQamosquitoinspectionQasoilconditionEnum] { + o.Soilconditions = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQasoilconditionEnum(f) + val := random_string(f, "250") return null.From(val) } }) @@ -3179,26 +3249,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomSoilconditions(f *faker.Faker // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomSoilconditionsNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Soilconditions = func() null.Val[enums.FieldseekerQamosquitoinspectionQasoilconditionEnum] { + o.Soilconditions = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQasoilconditionEnum(f) + val := random_string(f, "250") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Waterduration(val null.Val[enums.FieldseekerQamosquitoinspectionQawaterdurationEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Waterduration(val null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterduration = func() null.Val[enums.FieldseekerQamosquitoinspectionQawaterdurationEnum] { return val } + o.Waterduration = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) WaterdurationFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionQawaterdurationEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) WaterdurationFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Waterduration = f }) @@ -3216,12 +3286,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetWaterduration() FieldseekerQam // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomWaterduration(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterduration = func() null.Val[enums.FieldseekerQamosquitoinspectionQawaterdurationEnum] { + o.Waterduration = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQawaterdurationEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -3232,26 +3302,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomWaterduration(f *faker.Faker) // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomWaterdurationNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterduration = func() null.Val[enums.FieldseekerQamosquitoinspectionQawaterdurationEnum] { + o.Waterduration = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQawaterdurationEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Watersource(val null.Val[enums.FieldseekerQamosquitoinspectionQawatersourceEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Watersource(val null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watersource = func() null.Val[enums.FieldseekerQamosquitoinspectionQawatersourceEnum] { return val } + o.Watersource = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) WatersourceFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionQawatersourceEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) WatersourceFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Watersource = f }) @@ -3269,12 +3339,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetWatersource() FieldseekerQamos // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomWatersource(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watersource = func() null.Val[enums.FieldseekerQamosquitoinspectionQawatersourceEnum] { + o.Watersource = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQawatersourceEnum(f) + val := random_string(f, "250") return null.From(val) } }) @@ -3285,26 +3355,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomWatersource(f *faker.Faker) F // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomWatersourceNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watersource = func() null.Val[enums.FieldseekerQamosquitoinspectionQawatersourceEnum] { + o.Watersource = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQawatersourceEnum(f) + val := random_string(f, "250") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Waterconditions(val null.Val[enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Waterconditions(val null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterconditions = func() null.Val[enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum] { return val } + o.Waterconditions = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) WaterconditionsFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) WaterconditionsFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Waterconditions = f }) @@ -3322,12 +3392,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetWaterconditions() FieldseekerQ // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomWaterconditions(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterconditions = func() null.Val[enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum] { + o.Waterconditions = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQawaterconditionsEnum(f) + val := random_string(f, "250") return null.From(val) } }) @@ -3338,26 +3408,26 @@ func (m fieldseekerQamosquitoinspectionMods) RandomWaterconditions(f *faker.Fake // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomWaterconditionsNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterconditions = func() null.Val[enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum] { + o.Waterconditions = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionQawaterconditionsEnum(f) + val := random_string(f, "250") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Adultactivity(val null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) Adultactivity(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Adultactivity = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { return val } + o.Adultactivity = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) AdultactivityFunc(f func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum]) FieldseekerQamosquitoinspectionMod { +func (m fieldseekerQamosquitoinspectionMods) AdultactivityFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { o.Adultactivity = f }) @@ -3375,12 +3445,12 @@ func (m fieldseekerQamosquitoinspectionMods) UnsetAdultactivity() FieldseekerQam // The generated value is sometimes null func (m fieldseekerQamosquitoinspectionMods) RandomAdultactivity(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Adultactivity = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Adultactivity = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -3391,12 +3461,12 @@ func (m fieldseekerQamosquitoinspectionMods) RandomAdultactivity(f *faker.Faker) // The generated value is never null func (m fieldseekerQamosquitoinspectionMods) RandomAdultactivityNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Adultactivity = func() null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] { + o.Adultactivity = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerQamosquitoinspectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -4038,6 +4108,90 @@ func (m fieldseekerQamosquitoinspectionMods) RandomEditorNotNull(f *faker.Faker) }) } +// Set the model columns to this value +func (m fieldseekerQamosquitoinspectionMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerQamosquitoinspectionMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerQamosquitoinspectionMods) UnsetGeometry() FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerQamosquitoinspectionMods) RandomGeometry(f *faker.Faker) FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerQamosquitoinspectionMods) Geospatial(val null.Val[string]) FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerQamosquitoinspectionMods) GeospatialFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerQamosquitoinspectionMods) UnsetGeospatial() FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerQamosquitoinspectionMods) RandomGeospatial(f *faker.Faker) FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerQamosquitoinspectionMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + o.Geospatial = 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 fieldseekerQamosquitoinspectionMods) Version(val int32) FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { @@ -4069,11 +4223,77 @@ func (m fieldseekerQamosquitoinspectionMods) RandomVersion(f *faker.Faker) Field }) } +// Set the model columns to this value +func (m fieldseekerQamosquitoinspectionMods) OrganizationID(val int32) FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerQamosquitoinspectionMods) OrganizationIDFunc(f func() int32) FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerQamosquitoinspectionMods) UnsetOrganizationID() FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + 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 fieldseekerQamosquitoinspectionMods) RandomOrganizationID(f *faker.Faker) FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerQamosquitoinspectionMods) WithParentsCascading() FieldseekerQamosquitoinspectionMod { return FieldseekerQamosquitoinspectionModFunc(func(ctx context.Context, o *FieldseekerQamosquitoinspectionTemplate) { if isDone, _ := fieldseekerQamosquitoinspectionWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerQamosquitoinspectionWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerQamosquitoinspectionMods) WithOrganization(rel *OrganizationTemplate) FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(ctx context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + o.r.Organization = &fieldseekerQamosquitoinspectionROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerQamosquitoinspectionMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(ctx context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerQamosquitoinspectionMods) WithExistingOrganization(em *models.Organization) FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(ctx context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + o.r.Organization = &fieldseekerQamosquitoinspectionROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerQamosquitoinspectionMods) WithoutOrganization() FieldseekerQamosquitoinspectionMod { + return FieldseekerQamosquitoinspectionModFunc(func(ctx context.Context, o *FieldseekerQamosquitoinspectionTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.rodentlocation.bob.go b/db/factory/fieldseeker.rodentlocation.bob.go index e5218a2d..adad0c6f 100644 --- a/db/factory/fieldseeker.rodentlocation.bob.go +++ b/db/factory/fieldseeker.rodentlocation.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerRodentlocationMod interface { @@ -43,14 +44,14 @@ type FieldseekerRodentlocationTemplate struct { Locationname func() null.Val[string] Zone func() null.Val[string] Zone2 func() null.Val[string] - Habitat func() null.Val[enums.FieldseekerRodentlocationRodentlocationhabitatEnum] - Priority func() null.Val[enums.FieldseekerRodentlocationLocationpriority1Enum] - Usetype func() null.Val[enums.FieldseekerRodentlocationLocationusetype1Enum] - Active func() null.Val[enums.FieldseekerRodentlocationNotinuitF1Enum] + Habitat func() null.Val[string] + Priority func() null.Val[string] + Usetype func() null.Val[string] + Active func() null.Val[int16] Description func() null.Val[string] Accessdesc func() null.Val[string] Comments func() null.Val[string] - Symbology func() null.Val[enums.FieldseekerRodentlocationRodentlocationSymbologyEnum] + Symbology func() null.Val[string] Externalid func() null.Val[string] Nextactiondatescheduled func() null.Val[time.Time] Locationnumber func() null.Val[int32] @@ -69,13 +70,25 @@ type FieldseekerRodentlocationTemplate struct { Editdate func() null.Val[time.Time] Editor func() null.Val[string] Jurisdiction func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerRodentlocationR f *Factory alreadyPersisted bool } +type fieldseekerRodentlocationR struct { + Organization *fieldseekerRodentlocationROrganizationR +} + +type fieldseekerRodentlocationROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerRodentlocationTemplate func (o *FieldseekerRodentlocationTemplate) Apply(ctx context.Context, mods ...FieldseekerRodentlocationMod) { for _, mod := range mods { @@ -85,7 +98,14 @@ func (o *FieldseekerRodentlocationTemplate) Apply(ctx context.Context, mods ...F // setModelRels creates and sets the relationships on *models.FieldseekerRodentlocation // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerRodentlocationTemplate) setModelRels(o *models.FieldseekerRodentlocation) {} +func (t FieldseekerRodentlocationTemplate) setModelRels(o *models.FieldseekerRodentlocation) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Rodentlocations = append(rel.R.Rodentlocations, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerRodentlocationSetter // this does nothing with the relationship templates @@ -212,10 +232,22 @@ func (o FieldseekerRodentlocationTemplate) BuildSetter() *models.FieldseekerRode val := o.Jurisdiction() m.Jurisdiction = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -328,9 +360,18 @@ func (o FieldseekerRodentlocationTemplate) Build() *models.FieldseekerRodentloca if o.Jurisdiction != nil { m.Jurisdiction = o.Jurisdiction() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -351,6 +392,14 @@ func (o FieldseekerRodentlocationTemplate) BuildMany(number int) models.Fieldsee } func ensureCreatableFieldseekerRodentlocation(m *models.FieldseekerRodentlocationSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerRodentlocation @@ -369,11 +418,30 @@ func (o *FieldseekerRodentlocationTemplate) Create(ctx context.Context, exec bob opt := o.BuildSetter() ensureCreatableFieldseekerRodentlocation(opt) + if o.r.Organization == nil { + FieldseekerRodentlocationMods.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.FieldseekerRodentlocations.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 } @@ -481,7 +549,10 @@ func (m fieldseekerRodentlocationMods) RandomizeAllColumns(f *faker.Faker) Field FieldseekerRodentlocationMods.RandomEditdate(f), FieldseekerRodentlocationMods.RandomEditor(f), FieldseekerRodentlocationMods.RandomJurisdiction(f), + FieldseekerRodentlocationMods.RandomGeometry(f), + FieldseekerRodentlocationMods.RandomGeospatial(f), FieldseekerRodentlocationMods.RandomVersion(f), + FieldseekerRodentlocationMods.RandomOrganizationID(f), } } @@ -676,14 +747,14 @@ func (m fieldseekerRodentlocationMods) RandomZone2NotNull(f *faker.Faker) Fields } // Set the model columns to this value -func (m fieldseekerRodentlocationMods) Habitat(val null.Val[enums.FieldseekerRodentlocationRodentlocationhabitatEnum]) FieldseekerRodentlocationMod { +func (m fieldseekerRodentlocationMods) Habitat(val null.Val[string]) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerRodentlocationRodentlocationhabitatEnum] { return val } + o.Habitat = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerRodentlocationMods) HabitatFunc(f func() null.Val[enums.FieldseekerRodentlocationRodentlocationhabitatEnum]) FieldseekerRodentlocationMod { +func (m fieldseekerRodentlocationMods) HabitatFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { o.Habitat = f }) @@ -701,12 +772,12 @@ func (m fieldseekerRodentlocationMods) UnsetHabitat() FieldseekerRodentlocationM // The generated value is sometimes null func (m fieldseekerRodentlocationMods) RandomHabitat(f *faker.Faker) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerRodentlocationRodentlocationhabitatEnum] { + o.Habitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerRodentlocationRodentlocationhabitatEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -717,26 +788,26 @@ func (m fieldseekerRodentlocationMods) RandomHabitat(f *faker.Faker) Fieldseeker // The generated value is never null func (m fieldseekerRodentlocationMods) RandomHabitatNotNull(f *faker.Faker) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerRodentlocationRodentlocationhabitatEnum] { + o.Habitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerRodentlocationRodentlocationhabitatEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerRodentlocationMods) Priority(val null.Val[enums.FieldseekerRodentlocationLocationpriority1Enum]) FieldseekerRodentlocationMod { +func (m fieldseekerRodentlocationMods) Priority(val null.Val[string]) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerRodentlocationLocationpriority1Enum] { return val } + o.Priority = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerRodentlocationMods) PriorityFunc(f func() null.Val[enums.FieldseekerRodentlocationLocationpriority1Enum]) FieldseekerRodentlocationMod { +func (m fieldseekerRodentlocationMods) PriorityFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { o.Priority = f }) @@ -754,12 +825,12 @@ func (m fieldseekerRodentlocationMods) UnsetPriority() FieldseekerRodentlocation // The generated value is sometimes null func (m fieldseekerRodentlocationMods) RandomPriority(f *faker.Faker) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerRodentlocationLocationpriority1Enum] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerRodentlocationLocationpriority1Enum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -770,26 +841,26 @@ func (m fieldseekerRodentlocationMods) RandomPriority(f *faker.Faker) Fieldseeke // The generated value is never null func (m fieldseekerRodentlocationMods) RandomPriorityNotNull(f *faker.Faker) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerRodentlocationLocationpriority1Enum] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerRodentlocationLocationpriority1Enum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerRodentlocationMods) Usetype(val null.Val[enums.FieldseekerRodentlocationLocationusetype1Enum]) FieldseekerRodentlocationMod { +func (m fieldseekerRodentlocationMods) Usetype(val null.Val[string]) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerRodentlocationLocationusetype1Enum] { return val } + o.Usetype = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerRodentlocationMods) UsetypeFunc(f func() null.Val[enums.FieldseekerRodentlocationLocationusetype1Enum]) FieldseekerRodentlocationMod { +func (m fieldseekerRodentlocationMods) UsetypeFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { o.Usetype = f }) @@ -807,12 +878,12 @@ func (m fieldseekerRodentlocationMods) UnsetUsetype() FieldseekerRodentlocationM // The generated value is sometimes null func (m fieldseekerRodentlocationMods) RandomUsetype(f *faker.Faker) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerRodentlocationLocationusetype1Enum] { + o.Usetype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerRodentlocationLocationusetype1Enum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -823,26 +894,26 @@ func (m fieldseekerRodentlocationMods) RandomUsetype(f *faker.Faker) Fieldseeker // The generated value is never null func (m fieldseekerRodentlocationMods) RandomUsetypeNotNull(f *faker.Faker) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerRodentlocationLocationusetype1Enum] { + o.Usetype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerRodentlocationLocationusetype1Enum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerRodentlocationMods) Active(val null.Val[enums.FieldseekerRodentlocationNotinuitF1Enum]) FieldseekerRodentlocationMod { +func (m fieldseekerRodentlocationMods) Active(val null.Val[int16]) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerRodentlocationNotinuitF1Enum] { return val } + o.Active = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerRodentlocationMods) ActiveFunc(f func() null.Val[enums.FieldseekerRodentlocationNotinuitF1Enum]) FieldseekerRodentlocationMod { +func (m fieldseekerRodentlocationMods) ActiveFunc(f func() null.Val[int16]) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { o.Active = f }) @@ -860,12 +931,12 @@ func (m fieldseekerRodentlocationMods) UnsetActive() FieldseekerRodentlocationMo // The generated value is sometimes null func (m fieldseekerRodentlocationMods) RandomActive(f *faker.Faker) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerRodentlocationNotinuitF1Enum] { + o.Active = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerRodentlocationNotinuitF1Enum(f) + val := random_int16(f) return null.From(val) } }) @@ -876,12 +947,12 @@ func (m fieldseekerRodentlocationMods) RandomActive(f *faker.Faker) FieldseekerR // The generated value is never null func (m fieldseekerRodentlocationMods) RandomActiveNotNull(f *faker.Faker) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerRodentlocationNotinuitF1Enum] { + o.Active = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerRodentlocationNotinuitF1Enum(f) + val := random_int16(f) return null.From(val) } }) @@ -1047,14 +1118,14 @@ func (m fieldseekerRodentlocationMods) RandomCommentsNotNull(f *faker.Faker) Fie } // Set the model columns to this value -func (m fieldseekerRodentlocationMods) Symbology(val null.Val[enums.FieldseekerRodentlocationRodentlocationSymbologyEnum]) FieldseekerRodentlocationMod { +func (m fieldseekerRodentlocationMods) Symbology(val null.Val[string]) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Symbology = func() null.Val[enums.FieldseekerRodentlocationRodentlocationSymbologyEnum] { return val } + o.Symbology = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerRodentlocationMods) SymbologyFunc(f func() null.Val[enums.FieldseekerRodentlocationRodentlocationSymbologyEnum]) FieldseekerRodentlocationMod { +func (m fieldseekerRodentlocationMods) SymbologyFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { o.Symbology = f }) @@ -1072,12 +1143,12 @@ func (m fieldseekerRodentlocationMods) UnsetSymbology() FieldseekerRodentlocatio // The generated value is sometimes null func (m fieldseekerRodentlocationMods) RandomSymbology(f *faker.Faker) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Symbology = func() null.Val[enums.FieldseekerRodentlocationRodentlocationSymbologyEnum] { + o.Symbology = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerRodentlocationRodentlocationSymbologyEnum(f) + val := random_string(f, "10") return null.From(val) } }) @@ -1088,12 +1159,12 @@ func (m fieldseekerRodentlocationMods) RandomSymbology(f *faker.Faker) Fieldseek // The generated value is never null func (m fieldseekerRodentlocationMods) RandomSymbologyNotNull(f *faker.Faker) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Symbology = func() null.Val[enums.FieldseekerRodentlocationRodentlocationSymbologyEnum] { + o.Symbology = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerRodentlocationRodentlocationSymbologyEnum(f) + val := random_string(f, "10") return null.From(val) } }) @@ -2053,6 +2124,90 @@ func (m fieldseekerRodentlocationMods) RandomJurisdictionNotNull(f *faker.Faker) }) } +// Set the model columns to this value +func (m fieldseekerRodentlocationMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerRodentlocationMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerRodentlocationMods) UnsetGeometry() FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerRodentlocationMods) RandomGeometry(f *faker.Faker) FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerRodentlocationMods) Geospatial(val null.Val[string]) FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerRodentlocationMods) GeospatialFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerRodentlocationMods) UnsetGeospatial() FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerRodentlocationMods) RandomGeospatial(f *faker.Faker) FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerRodentlocationMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { + o.Geospatial = 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 fieldseekerRodentlocationMods) Version(val int32) FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { @@ -2084,11 +2239,77 @@ func (m fieldseekerRodentlocationMods) RandomVersion(f *faker.Faker) Fieldseeker }) } +// Set the model columns to this value +func (m fieldseekerRodentlocationMods) OrganizationID(val int32) FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerRodentlocationMods) OrganizationIDFunc(f func() int32) FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerRodentlocationMods) UnsetOrganizationID() FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { + 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 fieldseekerRodentlocationMods) RandomOrganizationID(f *faker.Faker) FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerRodentlocationMods) WithParentsCascading() FieldseekerRodentlocationMod { return FieldseekerRodentlocationModFunc(func(ctx context.Context, o *FieldseekerRodentlocationTemplate) { if isDone, _ := fieldseekerRodentlocationWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerRodentlocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerRodentlocationMods) WithOrganization(rel *OrganizationTemplate) FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(ctx context.Context, o *FieldseekerRodentlocationTemplate) { + o.r.Organization = &fieldseekerRodentlocationROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerRodentlocationMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(ctx context.Context, o *FieldseekerRodentlocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerRodentlocationMods) WithExistingOrganization(em *models.Organization) FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(ctx context.Context, o *FieldseekerRodentlocationTemplate) { + o.r.Organization = &fieldseekerRodentlocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerRodentlocationMods) WithoutOrganization() FieldseekerRodentlocationMod { + return FieldseekerRodentlocationModFunc(func(ctx context.Context, o *FieldseekerRodentlocationTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.samplecollection.bob.go b/db/factory/fieldseeker.samplecollection.bob.go index 2c8fcfeb..726c84c9 100644 --- a/db/factory/fieldseeker.samplecollection.bob.go +++ b/db/factory/fieldseeker.samplecollection.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerSamplecollectionMod interface { @@ -43,27 +44,27 @@ type FieldseekerSamplecollectionTemplate struct { LocID func() null.Val[uuid.UUID] Startdatetime func() null.Val[time.Time] Enddatetime func() null.Val[time.Time] - Sitecond func() null.Val[enums.FieldseekerSamplecollectionMosquitositeconditionEnum] + Sitecond func() null.Val[string] Sampleid func() null.Val[string] Survtech func() null.Val[string] Datesent func() null.Val[time.Time] Datetested func() null.Val[time.Time] Testtech func() null.Val[string] Comments func() null.Val[string] - Processed func() null.Val[enums.FieldseekerSamplecollectionNotinuitFEnum] - Sampletype func() null.Val[enums.FieldseekerSamplecollectionMosquitosampletypeEnum] - Samplecond func() null.Val[enums.FieldseekerSamplecollectionMosquitosampleconditionEnum] - Species func() null.Val[enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum] - Sex func() null.Val[enums.FieldseekerSamplecollectionNotinuisexEnum] + Processed func() null.Val[int16] + Sampletype func() null.Val[string] + Samplecond func() null.Val[string] + Species func() null.Val[string] + Sex func() null.Val[string] Avetemp func() null.Val[float64] Windspeed func() null.Val[float64] - Winddir func() null.Val[enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum] + Winddir func() null.Val[string] Raingauge func() null.Val[float64] - Activity func() null.Val[enums.FieldseekerSamplecollectionMosquitoactivityEnum] - Testmethod func() null.Val[enums.FieldseekerSamplecollectionMosquitotestmethodEnum] - Diseasetested func() null.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum] - Diseasepos func() null.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum] - Reviewed func() null.Val[enums.FieldseekerSamplecollectionNotinuitFEnum] + Activity func() null.Val[string] + Testmethod func() null.Val[string] + Diseasetested func() null.Val[string] + Diseasepos func() null.Val[string] + Reviewed func() null.Val[int16] Reviewedby func() null.Val[string] Revieweddate func() null.Val[time.Time] Locationname func() null.Val[string] @@ -75,7 +76,7 @@ type FieldseekerSamplecollectionTemplate struct { CreatedDate func() null.Val[time.Time] LastEditedUser func() null.Val[string] LastEditedDate func() null.Val[time.Time] - Lab func() null.Val[enums.FieldseekerSamplecollectionMosquitolabnameEnum] + Lab func() null.Val[string] Fieldtech func() null.Val[string] Flockid func() null.Val[uuid.UUID] Samplecount func() null.Val[int16] @@ -85,13 +86,25 @@ type FieldseekerSamplecollectionTemplate struct { Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerSamplecollectionR f *Factory alreadyPersisted bool } +type fieldseekerSamplecollectionR struct { + Organization *fieldseekerSamplecollectionROrganizationR +} + +type fieldseekerSamplecollectionROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerSamplecollectionTemplate func (o *FieldseekerSamplecollectionTemplate) Apply(ctx context.Context, mods ...FieldseekerSamplecollectionMod) { for _, mod := range mods { @@ -101,7 +114,14 @@ func (o *FieldseekerSamplecollectionTemplate) Apply(ctx context.Context, mods .. // setModelRels creates and sets the relationships on *models.FieldseekerSamplecollection // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerSamplecollectionTemplate) setModelRels(o *models.FieldseekerSamplecollection) {} +func (t FieldseekerSamplecollectionTemplate) setModelRels(o *models.FieldseekerSamplecollection) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Samplecollections = append(rel.R.Samplecollections, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerSamplecollectionSetter // this does nothing with the relationship templates @@ -292,10 +312,22 @@ func (o FieldseekerSamplecollectionTemplate) BuildSetter() *models.FieldseekerSa val := o.Editor() m.Editor = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -456,9 +488,18 @@ func (o FieldseekerSamplecollectionTemplate) Build() *models.FieldseekerSampleco if o.Editor != nil { m.Editor = o.Editor() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -479,6 +520,14 @@ func (o FieldseekerSamplecollectionTemplate) BuildMany(number int) models.Fields } func ensureCreatableFieldseekerSamplecollection(m *models.FieldseekerSamplecollectionSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerSamplecollection @@ -497,11 +546,30 @@ func (o *FieldseekerSamplecollectionTemplate) Create(ctx context.Context, exec b opt := o.BuildSetter() ensureCreatableFieldseekerSamplecollection(opt) + if o.r.Organization == nil { + FieldseekerSamplecollectionMods.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.FieldseekerSamplecollections.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 } @@ -625,7 +693,10 @@ func (m fieldseekerSamplecollectionMods) RandomizeAllColumns(f *faker.Faker) Fie FieldseekerSamplecollectionMods.RandomCreator(f), FieldseekerSamplecollectionMods.RandomEditdate(f), FieldseekerSamplecollectionMods.RandomEditor(f), + FieldseekerSamplecollectionMods.RandomGeometry(f), + FieldseekerSamplecollectionMods.RandomGeospatial(f), FieldseekerSamplecollectionMods.RandomVersion(f), + FieldseekerSamplecollectionMods.RandomOrganizationID(f), } } @@ -820,14 +891,14 @@ func (m fieldseekerSamplecollectionMods) RandomEnddatetimeNotNull(f *faker.Faker } // Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Sitecond(val null.Val[enums.FieldseekerSamplecollectionMosquitositeconditionEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) Sitecond(val null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sitecond = func() null.Val[enums.FieldseekerSamplecollectionMosquitositeconditionEnum] { return val } + o.Sitecond = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplecollectionMods) SitecondFunc(f func() null.Val[enums.FieldseekerSamplecollectionMosquitositeconditionEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) SitecondFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { o.Sitecond = f }) @@ -845,12 +916,12 @@ func (m fieldseekerSamplecollectionMods) UnsetSitecond() FieldseekerSamplecollec // The generated value is sometimes null func (m fieldseekerSamplecollectionMods) RandomSitecond(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sitecond = func() null.Val[enums.FieldseekerSamplecollectionMosquitositeconditionEnum] { + o.Sitecond = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitositeconditionEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -861,12 +932,12 @@ func (m fieldseekerSamplecollectionMods) RandomSitecond(f *faker.Faker) Fieldsee // The generated value is never null func (m fieldseekerSamplecollectionMods) RandomSitecondNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sitecond = func() null.Val[enums.FieldseekerSamplecollectionMosquitositeconditionEnum] { + o.Sitecond = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitositeconditionEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1191,14 +1262,14 @@ func (m fieldseekerSamplecollectionMods) RandomCommentsNotNull(f *faker.Faker) F } // Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Processed(val null.Val[enums.FieldseekerSamplecollectionNotinuitFEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) Processed(val null.Val[int16]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Processed = func() null.Val[enums.FieldseekerSamplecollectionNotinuitFEnum] { return val } + o.Processed = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplecollectionMods) ProcessedFunc(f func() null.Val[enums.FieldseekerSamplecollectionNotinuitFEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) ProcessedFunc(f func() null.Val[int16]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { o.Processed = f }) @@ -1216,12 +1287,12 @@ func (m fieldseekerSamplecollectionMods) UnsetProcessed() FieldseekerSamplecolle // The generated value is sometimes null func (m fieldseekerSamplecollectionMods) RandomProcessed(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Processed = func() null.Val[enums.FieldseekerSamplecollectionNotinuitFEnum] { + o.Processed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1232,26 +1303,26 @@ func (m fieldseekerSamplecollectionMods) RandomProcessed(f *faker.Faker) Fieldse // The generated value is never null func (m fieldseekerSamplecollectionMods) RandomProcessedNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Processed = func() null.Val[enums.FieldseekerSamplecollectionNotinuitFEnum] { + o.Processed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Sampletype(val null.Val[enums.FieldseekerSamplecollectionMosquitosampletypeEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) Sampletype(val null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sampletype = func() null.Val[enums.FieldseekerSamplecollectionMosquitosampletypeEnum] { return val } + o.Sampletype = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplecollectionMods) SampletypeFunc(f func() null.Val[enums.FieldseekerSamplecollectionMosquitosampletypeEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) SampletypeFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { o.Sampletype = f }) @@ -1269,12 +1340,12 @@ func (m fieldseekerSamplecollectionMods) UnsetSampletype() FieldseekerSamplecoll // The generated value is sometimes null func (m fieldseekerSamplecollectionMods) RandomSampletype(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sampletype = func() null.Val[enums.FieldseekerSamplecollectionMosquitosampletypeEnum] { + o.Sampletype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitosampletypeEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1285,26 +1356,26 @@ func (m fieldseekerSamplecollectionMods) RandomSampletype(f *faker.Faker) Fields // The generated value is never null func (m fieldseekerSamplecollectionMods) RandomSampletypeNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sampletype = func() null.Val[enums.FieldseekerSamplecollectionMosquitosampletypeEnum] { + o.Sampletype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitosampletypeEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Samplecond(val null.Val[enums.FieldseekerSamplecollectionMosquitosampleconditionEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) Samplecond(val null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Samplecond = func() null.Val[enums.FieldseekerSamplecollectionMosquitosampleconditionEnum] { return val } + o.Samplecond = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplecollectionMods) SamplecondFunc(f func() null.Val[enums.FieldseekerSamplecollectionMosquitosampleconditionEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) SamplecondFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { o.Samplecond = f }) @@ -1322,12 +1393,12 @@ func (m fieldseekerSamplecollectionMods) UnsetSamplecond() FieldseekerSamplecoll // The generated value is sometimes null func (m fieldseekerSamplecollectionMods) RandomSamplecond(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Samplecond = func() null.Val[enums.FieldseekerSamplecollectionMosquitosampleconditionEnum] { + o.Samplecond = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitosampleconditionEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1338,26 +1409,26 @@ func (m fieldseekerSamplecollectionMods) RandomSamplecond(f *faker.Faker) Fields // The generated value is never null func (m fieldseekerSamplecollectionMods) RandomSamplecondNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Samplecond = func() null.Val[enums.FieldseekerSamplecollectionMosquitosampleconditionEnum] { + o.Samplecond = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitosampleconditionEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Species(val null.Val[enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) Species(val null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Species = func() null.Val[enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum] { return val } + o.Species = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplecollectionMods) SpeciesFunc(f func() null.Val[enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) SpeciesFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { o.Species = f }) @@ -1375,12 +1446,12 @@ func (m fieldseekerSamplecollectionMods) UnsetSpecies() FieldseekerSamplecollect // The generated value is sometimes null func (m fieldseekerSamplecollectionMods) RandomSpecies(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Species = func() null.Val[enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum] { + o.Species = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitosamplespeciesEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1391,26 +1462,26 @@ func (m fieldseekerSamplecollectionMods) RandomSpecies(f *faker.Faker) Fieldseek // The generated value is never null func (m fieldseekerSamplecollectionMods) RandomSpeciesNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Species = func() null.Val[enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum] { + o.Species = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitosamplespeciesEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Sex(val null.Val[enums.FieldseekerSamplecollectionNotinuisexEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) Sex(val null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sex = func() null.Val[enums.FieldseekerSamplecollectionNotinuisexEnum] { return val } + o.Sex = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplecollectionMods) SexFunc(f func() null.Val[enums.FieldseekerSamplecollectionNotinuisexEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) SexFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { o.Sex = f }) @@ -1428,12 +1499,12 @@ func (m fieldseekerSamplecollectionMods) UnsetSex() FieldseekerSamplecollectionM // The generated value is sometimes null func (m fieldseekerSamplecollectionMods) RandomSex(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sex = func() null.Val[enums.FieldseekerSamplecollectionNotinuisexEnum] { + o.Sex = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionNotinuisexEnum(f) + val := random_string(f, "1") return null.From(val) } }) @@ -1444,12 +1515,12 @@ func (m fieldseekerSamplecollectionMods) RandomSex(f *faker.Faker) FieldseekerSa // The generated value is never null func (m fieldseekerSamplecollectionMods) RandomSexNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sex = func() null.Val[enums.FieldseekerSamplecollectionNotinuisexEnum] { + o.Sex = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionNotinuisexEnum(f) + val := random_string(f, "1") return null.From(val) } }) @@ -1562,14 +1633,14 @@ func (m fieldseekerSamplecollectionMods) RandomWindspeedNotNull(f *faker.Faker) } // Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Winddir(val null.Val[enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) Winddir(val null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Winddir = func() null.Val[enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum] { return val } + o.Winddir = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplecollectionMods) WinddirFunc(f func() null.Val[enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) WinddirFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { o.Winddir = f }) @@ -1587,12 +1658,12 @@ func (m fieldseekerSamplecollectionMods) UnsetWinddir() FieldseekerSamplecollect // The generated value is sometimes null func (m fieldseekerSamplecollectionMods) RandomWinddir(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Winddir = func() null.Val[enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum] { + o.Winddir = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionNotinuiwinddirectionEnum(f) + val := random_string(f, "3") return null.From(val) } }) @@ -1603,12 +1674,12 @@ func (m fieldseekerSamplecollectionMods) RandomWinddir(f *faker.Faker) Fieldseek // The generated value is never null func (m fieldseekerSamplecollectionMods) RandomWinddirNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Winddir = func() null.Val[enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum] { + o.Winddir = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionNotinuiwinddirectionEnum(f) + val := random_string(f, "3") return null.From(val) } }) @@ -1668,14 +1739,14 @@ func (m fieldseekerSamplecollectionMods) RandomRaingaugeNotNull(f *faker.Faker) } // Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Activity(val null.Val[enums.FieldseekerSamplecollectionMosquitoactivityEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) Activity(val null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Activity = func() null.Val[enums.FieldseekerSamplecollectionMosquitoactivityEnum] { return val } + o.Activity = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplecollectionMods) ActivityFunc(f func() null.Val[enums.FieldseekerSamplecollectionMosquitoactivityEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) ActivityFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { o.Activity = f }) @@ -1693,12 +1764,12 @@ func (m fieldseekerSamplecollectionMods) UnsetActivity() FieldseekerSamplecollec // The generated value is sometimes null func (m fieldseekerSamplecollectionMods) RandomActivity(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Activity = func() null.Val[enums.FieldseekerSamplecollectionMosquitoactivityEnum] { + o.Activity = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitoactivityEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1709,26 +1780,26 @@ func (m fieldseekerSamplecollectionMods) RandomActivity(f *faker.Faker) Fieldsee // The generated value is never null func (m fieldseekerSamplecollectionMods) RandomActivityNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Activity = func() null.Val[enums.FieldseekerSamplecollectionMosquitoactivityEnum] { + o.Activity = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitoactivityEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Testmethod(val null.Val[enums.FieldseekerSamplecollectionMosquitotestmethodEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) Testmethod(val null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Testmethod = func() null.Val[enums.FieldseekerSamplecollectionMosquitotestmethodEnum] { return val } + o.Testmethod = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplecollectionMods) TestmethodFunc(f func() null.Val[enums.FieldseekerSamplecollectionMosquitotestmethodEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) TestmethodFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { o.Testmethod = f }) @@ -1746,12 +1817,12 @@ func (m fieldseekerSamplecollectionMods) UnsetTestmethod() FieldseekerSamplecoll // The generated value is sometimes null func (m fieldseekerSamplecollectionMods) RandomTestmethod(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Testmethod = func() null.Val[enums.FieldseekerSamplecollectionMosquitotestmethodEnum] { + o.Testmethod = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitotestmethodEnum(f) + val := random_string(f, "100") return null.From(val) } }) @@ -1762,26 +1833,26 @@ func (m fieldseekerSamplecollectionMods) RandomTestmethod(f *faker.Faker) Fields // The generated value is never null func (m fieldseekerSamplecollectionMods) RandomTestmethodNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Testmethod = func() null.Val[enums.FieldseekerSamplecollectionMosquitotestmethodEnum] { + o.Testmethod = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitotestmethodEnum(f) + val := random_string(f, "100") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Diseasetested(val null.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) Diseasetested(val null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Diseasetested = func() null.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum] { return val } + o.Diseasetested = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplecollectionMods) DiseasetestedFunc(f func() null.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) DiseasetestedFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { o.Diseasetested = f }) @@ -1799,12 +1870,12 @@ func (m fieldseekerSamplecollectionMods) UnsetDiseasetested() FieldseekerSamplec // The generated value is sometimes null func (m fieldseekerSamplecollectionMods) RandomDiseasetested(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Diseasetested = func() null.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum] { + o.Diseasetested = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitodiseaseEnum(f) + val := random_string(f, "100") return null.From(val) } }) @@ -1815,26 +1886,26 @@ func (m fieldseekerSamplecollectionMods) RandomDiseasetested(f *faker.Faker) Fie // The generated value is never null func (m fieldseekerSamplecollectionMods) RandomDiseasetestedNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Diseasetested = func() null.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum] { + o.Diseasetested = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitodiseaseEnum(f) + val := random_string(f, "100") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Diseasepos(val null.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) Diseasepos(val null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Diseasepos = func() null.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum] { return val } + o.Diseasepos = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplecollectionMods) DiseaseposFunc(f func() null.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) DiseaseposFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { o.Diseasepos = f }) @@ -1852,12 +1923,12 @@ func (m fieldseekerSamplecollectionMods) UnsetDiseasepos() FieldseekerSamplecoll // The generated value is sometimes null func (m fieldseekerSamplecollectionMods) RandomDiseasepos(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Diseasepos = func() null.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum] { + o.Diseasepos = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitodiseaseEnum(f) + val := random_string(f, "100") return null.From(val) } }) @@ -1868,26 +1939,26 @@ func (m fieldseekerSamplecollectionMods) RandomDiseasepos(f *faker.Faker) Fields // The generated value is never null func (m fieldseekerSamplecollectionMods) RandomDiseaseposNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Diseasepos = func() null.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum] { + o.Diseasepos = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitodiseaseEnum(f) + val := random_string(f, "100") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Reviewed(val null.Val[enums.FieldseekerSamplecollectionNotinuitFEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) Reviewed(val null.Val[int16]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerSamplecollectionNotinuitFEnum] { return val } + o.Reviewed = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplecollectionMods) ReviewedFunc(f func() null.Val[enums.FieldseekerSamplecollectionNotinuitFEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) ReviewedFunc(f func() null.Val[int16]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { o.Reviewed = f }) @@ -1905,12 +1976,12 @@ func (m fieldseekerSamplecollectionMods) UnsetReviewed() FieldseekerSamplecollec // The generated value is sometimes null func (m fieldseekerSamplecollectionMods) RandomReviewed(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerSamplecollectionNotinuitFEnum] { + o.Reviewed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1921,12 +1992,12 @@ func (m fieldseekerSamplecollectionMods) RandomReviewed(f *faker.Faker) Fieldsee // The generated value is never null func (m fieldseekerSamplecollectionMods) RandomReviewedNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerSamplecollectionNotinuitFEnum] { + o.Reviewed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -2516,14 +2587,14 @@ func (m fieldseekerSamplecollectionMods) RandomLastEditedDateNotNull(f *faker.Fa } // Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Lab(val null.Val[enums.FieldseekerSamplecollectionMosquitolabnameEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) Lab(val null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Lab = func() null.Val[enums.FieldseekerSamplecollectionMosquitolabnameEnum] { return val } + o.Lab = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplecollectionMods) LabFunc(f func() null.Val[enums.FieldseekerSamplecollectionMosquitolabnameEnum]) FieldseekerSamplecollectionMod { +func (m fieldseekerSamplecollectionMods) LabFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { o.Lab = f }) @@ -2541,12 +2612,12 @@ func (m fieldseekerSamplecollectionMods) UnsetLab() FieldseekerSamplecollectionM // The generated value is sometimes null func (m fieldseekerSamplecollectionMods) RandomLab(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Lab = func() null.Val[enums.FieldseekerSamplecollectionMosquitolabnameEnum] { + o.Lab = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitolabnameEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -2557,12 +2628,12 @@ func (m fieldseekerSamplecollectionMods) RandomLab(f *faker.Faker) FieldseekerSa // The generated value is never null func (m fieldseekerSamplecollectionMods) RandomLabNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Lab = func() null.Val[enums.FieldseekerSamplecollectionMosquitolabnameEnum] { + o.Lab = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplecollectionMosquitolabnameEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -3045,6 +3116,90 @@ func (m fieldseekerSamplecollectionMods) RandomEditorNotNull(f *faker.Faker) Fie }) } +// Set the model columns to this value +func (m fieldseekerSamplecollectionMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerSamplecollectionMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerSamplecollectionMods) UnsetGeometry() FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerSamplecollectionMods) RandomGeometry(f *faker.Faker) FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerSamplecollectionMods) Geospatial(val null.Val[string]) FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerSamplecollectionMods) GeospatialFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerSamplecollectionMods) UnsetGeospatial() FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerSamplecollectionMods) RandomGeospatial(f *faker.Faker) FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerSamplecollectionMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { + o.Geospatial = 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 fieldseekerSamplecollectionMods) Version(val int32) FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { @@ -3076,11 +3231,77 @@ func (m fieldseekerSamplecollectionMods) RandomVersion(f *faker.Faker) Fieldseek }) } +// Set the model columns to this value +func (m fieldseekerSamplecollectionMods) OrganizationID(val int32) FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerSamplecollectionMods) OrganizationIDFunc(f func() int32) FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerSamplecollectionMods) UnsetOrganizationID() FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { + 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 fieldseekerSamplecollectionMods) RandomOrganizationID(f *faker.Faker) FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerSamplecollectionMods) WithParentsCascading() FieldseekerSamplecollectionMod { return FieldseekerSamplecollectionModFunc(func(ctx context.Context, o *FieldseekerSamplecollectionTemplate) { if isDone, _ := fieldseekerSamplecollectionWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerSamplecollectionWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerSamplecollectionMods) WithOrganization(rel *OrganizationTemplate) FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(ctx context.Context, o *FieldseekerSamplecollectionTemplate) { + o.r.Organization = &fieldseekerSamplecollectionROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerSamplecollectionMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(ctx context.Context, o *FieldseekerSamplecollectionTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerSamplecollectionMods) WithExistingOrganization(em *models.Organization) FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(ctx context.Context, o *FieldseekerSamplecollectionTemplate) { + o.r.Organization = &fieldseekerSamplecollectionROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerSamplecollectionMods) WithoutOrganization() FieldseekerSamplecollectionMod { + return FieldseekerSamplecollectionModFunc(func(ctx context.Context, o *FieldseekerSamplecollectionTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.samplelocation.bob.go b/db/factory/fieldseeker.samplelocation.bob.go index 85a8b725..7e97b9c3 100644 --- a/db/factory/fieldseeker.samplelocation.bob.go +++ b/db/factory/fieldseeker.samplelocation.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerSamplelocationMod interface { @@ -42,10 +43,10 @@ type FieldseekerSamplelocationTemplate struct { Objectid func() int64 Name func() null.Val[string] Zone func() null.Val[string] - Habitat func() null.Val[enums.FieldseekerSamplelocationLocationhabitattypeEnum] - Priority func() null.Val[enums.FieldseekerSamplelocationLocationpriorityEnum] - Usetype func() null.Val[enums.FieldseekerSamplelocationSamplelocationusetypeEnum] - Active func() null.Val[enums.FieldseekerSamplelocationNotinuitFEnum] + Habitat func() null.Val[string] + Priority func() null.Val[string] + Usetype func() null.Val[string] + Active func() null.Val[int16] Description func() null.Val[string] Accessdesc func() null.Val[string] Comments func() null.Val[string] @@ -63,13 +64,25 @@ type FieldseekerSamplelocationTemplate struct { Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerSamplelocationR f *Factory alreadyPersisted bool } +type fieldseekerSamplelocationR struct { + Organization *fieldseekerSamplelocationROrganizationR +} + +type fieldseekerSamplelocationROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerSamplelocationTemplate func (o *FieldseekerSamplelocationTemplate) Apply(ctx context.Context, mods ...FieldseekerSamplelocationMod) { for _, mod := range mods { @@ -79,7 +92,14 @@ func (o *FieldseekerSamplelocationTemplate) Apply(ctx context.Context, mods ...F // setModelRels creates and sets the relationships on *models.FieldseekerSamplelocation // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerSamplelocationTemplate) setModelRels(o *models.FieldseekerSamplelocation) {} +func (t FieldseekerSamplelocationTemplate) setModelRels(o *models.FieldseekerSamplelocation) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Samplelocations = append(rel.R.Samplelocations, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerSamplelocationSetter // this does nothing with the relationship templates @@ -182,10 +202,22 @@ func (o FieldseekerSamplelocationTemplate) BuildSetter() *models.FieldseekerSamp val := o.Editor() m.Editor = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -280,9 +312,18 @@ func (o FieldseekerSamplelocationTemplate) Build() *models.FieldseekerSampleloca if o.Editor != nil { m.Editor = o.Editor() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -303,6 +344,14 @@ func (o FieldseekerSamplelocationTemplate) BuildMany(number int) models.Fieldsee } func ensureCreatableFieldseekerSamplelocation(m *models.FieldseekerSamplelocationSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerSamplelocation @@ -321,11 +370,30 @@ func (o *FieldseekerSamplelocationTemplate) Create(ctx context.Context, exec bob opt := o.BuildSetter() ensureCreatableFieldseekerSamplelocation(opt) + if o.r.Organization == nil { + FieldseekerSamplelocationMods.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.FieldseekerSamplelocations.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 } @@ -427,7 +495,10 @@ func (m fieldseekerSamplelocationMods) RandomizeAllColumns(f *faker.Faker) Field FieldseekerSamplelocationMods.RandomCreator(f), FieldseekerSamplelocationMods.RandomEditdate(f), FieldseekerSamplelocationMods.RandomEditor(f), + FieldseekerSamplelocationMods.RandomGeometry(f), + FieldseekerSamplelocationMods.RandomGeospatial(f), FieldseekerSamplelocationMods.RandomVersion(f), + FieldseekerSamplelocationMods.RandomOrganizationID(f), } } @@ -569,14 +640,14 @@ func (m fieldseekerSamplelocationMods) RandomZoneNotNull(f *faker.Faker) Fieldse } // Set the model columns to this value -func (m fieldseekerSamplelocationMods) Habitat(val null.Val[enums.FieldseekerSamplelocationLocationhabitattypeEnum]) FieldseekerSamplelocationMod { +func (m fieldseekerSamplelocationMods) Habitat(val null.Val[string]) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerSamplelocationLocationhabitattypeEnum] { return val } + o.Habitat = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplelocationMods) HabitatFunc(f func() null.Val[enums.FieldseekerSamplelocationLocationhabitattypeEnum]) FieldseekerSamplelocationMod { +func (m fieldseekerSamplelocationMods) HabitatFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { o.Habitat = f }) @@ -594,12 +665,12 @@ func (m fieldseekerSamplelocationMods) UnsetHabitat() FieldseekerSamplelocationM // The generated value is sometimes null func (m fieldseekerSamplelocationMods) RandomHabitat(f *faker.Faker) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerSamplelocationLocationhabitattypeEnum] { + o.Habitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplelocationLocationhabitattypeEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -610,26 +681,26 @@ func (m fieldseekerSamplelocationMods) RandomHabitat(f *faker.Faker) Fieldseeker // The generated value is never null func (m fieldseekerSamplelocationMods) RandomHabitatNotNull(f *faker.Faker) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerSamplelocationLocationhabitattypeEnum] { + o.Habitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplelocationLocationhabitattypeEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerSamplelocationMods) Priority(val null.Val[enums.FieldseekerSamplelocationLocationpriorityEnum]) FieldseekerSamplelocationMod { +func (m fieldseekerSamplelocationMods) Priority(val null.Val[string]) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerSamplelocationLocationpriorityEnum] { return val } + o.Priority = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplelocationMods) PriorityFunc(f func() null.Val[enums.FieldseekerSamplelocationLocationpriorityEnum]) FieldseekerSamplelocationMod { +func (m fieldseekerSamplelocationMods) PriorityFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { o.Priority = f }) @@ -647,12 +718,12 @@ func (m fieldseekerSamplelocationMods) UnsetPriority() FieldseekerSamplelocation // The generated value is sometimes null func (m fieldseekerSamplelocationMods) RandomPriority(f *faker.Faker) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerSamplelocationLocationpriorityEnum] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplelocationLocationpriorityEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -663,26 +734,26 @@ func (m fieldseekerSamplelocationMods) RandomPriority(f *faker.Faker) Fieldseeke // The generated value is never null func (m fieldseekerSamplelocationMods) RandomPriorityNotNull(f *faker.Faker) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerSamplelocationLocationpriorityEnum] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplelocationLocationpriorityEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerSamplelocationMods) Usetype(val null.Val[enums.FieldseekerSamplelocationSamplelocationusetypeEnum]) FieldseekerSamplelocationMod { +func (m fieldseekerSamplelocationMods) Usetype(val null.Val[string]) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerSamplelocationSamplelocationusetypeEnum] { return val } + o.Usetype = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplelocationMods) UsetypeFunc(f func() null.Val[enums.FieldseekerSamplelocationSamplelocationusetypeEnum]) FieldseekerSamplelocationMod { +func (m fieldseekerSamplelocationMods) UsetypeFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { o.Usetype = f }) @@ -700,12 +771,12 @@ func (m fieldseekerSamplelocationMods) UnsetUsetype() FieldseekerSamplelocationM // The generated value is sometimes null func (m fieldseekerSamplelocationMods) RandomUsetype(f *faker.Faker) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerSamplelocationSamplelocationusetypeEnum] { + o.Usetype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplelocationSamplelocationusetypeEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -716,26 +787,26 @@ func (m fieldseekerSamplelocationMods) RandomUsetype(f *faker.Faker) Fieldseeker // The generated value is never null func (m fieldseekerSamplelocationMods) RandomUsetypeNotNull(f *faker.Faker) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerSamplelocationSamplelocationusetypeEnum] { + o.Usetype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplelocationSamplelocationusetypeEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerSamplelocationMods) Active(val null.Val[enums.FieldseekerSamplelocationNotinuitFEnum]) FieldseekerSamplelocationMod { +func (m fieldseekerSamplelocationMods) Active(val null.Val[int16]) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerSamplelocationNotinuitFEnum] { return val } + o.Active = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerSamplelocationMods) ActiveFunc(f func() null.Val[enums.FieldseekerSamplelocationNotinuitFEnum]) FieldseekerSamplelocationMod { +func (m fieldseekerSamplelocationMods) ActiveFunc(f func() null.Val[int16]) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { o.Active = f }) @@ -753,12 +824,12 @@ func (m fieldseekerSamplelocationMods) UnsetActive() FieldseekerSamplelocationMo // The generated value is sometimes null func (m fieldseekerSamplelocationMods) RandomActive(f *faker.Faker) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerSamplelocationNotinuitFEnum] { + o.Active = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplelocationNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -769,12 +840,12 @@ func (m fieldseekerSamplelocationMods) RandomActive(f *faker.Faker) FieldseekerS // The generated value is never null func (m fieldseekerSamplelocationMods) RandomActiveNotNull(f *faker.Faker) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerSamplelocationNotinuitFEnum] { + o.Active = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSamplelocationNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1681,6 +1752,90 @@ func (m fieldseekerSamplelocationMods) RandomEditorNotNull(f *faker.Faker) Field }) } +// Set the model columns to this value +func (m fieldseekerSamplelocationMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerSamplelocationMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerSamplelocationMods) UnsetGeometry() FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerSamplelocationMods) RandomGeometry(f *faker.Faker) FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerSamplelocationMods) Geospatial(val null.Val[string]) FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerSamplelocationMods) GeospatialFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerSamplelocationMods) UnsetGeospatial() FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerSamplelocationMods) RandomGeospatial(f *faker.Faker) FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerSamplelocationMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { + o.Geospatial = 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 fieldseekerSamplelocationMods) Version(val int32) FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { @@ -1712,11 +1867,77 @@ func (m fieldseekerSamplelocationMods) RandomVersion(f *faker.Faker) Fieldseeker }) } +// Set the model columns to this value +func (m fieldseekerSamplelocationMods) OrganizationID(val int32) FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerSamplelocationMods) OrganizationIDFunc(f func() int32) FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerSamplelocationMods) UnsetOrganizationID() FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { + 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 fieldseekerSamplelocationMods) RandomOrganizationID(f *faker.Faker) FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerSamplelocationMods) WithParentsCascading() FieldseekerSamplelocationMod { return FieldseekerSamplelocationModFunc(func(ctx context.Context, o *FieldseekerSamplelocationTemplate) { if isDone, _ := fieldseekerSamplelocationWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerSamplelocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerSamplelocationMods) WithOrganization(rel *OrganizationTemplate) FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(ctx context.Context, o *FieldseekerSamplelocationTemplate) { + o.r.Organization = &fieldseekerSamplelocationROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerSamplelocationMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(ctx context.Context, o *FieldseekerSamplelocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerSamplelocationMods) WithExistingOrganization(em *models.Organization) FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(ctx context.Context, o *FieldseekerSamplelocationTemplate) { + o.r.Organization = &fieldseekerSamplelocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerSamplelocationMods) WithoutOrganization() FieldseekerSamplelocationMod { + return FieldseekerSamplelocationModFunc(func(ctx context.Context, o *FieldseekerSamplelocationTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.servicerequest.bob.go b/db/factory/fieldseeker.servicerequest.bob.go index 77089555..5c85b053 100644 --- a/db/factory/fieldseeker.servicerequest.bob.go +++ b/db/factory/fieldseeker.servicerequest.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerServicerequestMod interface { @@ -41,13 +42,13 @@ func (mods FieldseekerServicerequestModSlice) Apply(ctx context.Context, n *Fiel type FieldseekerServicerequestTemplate struct { Objectid func() int64 Recdatetime func() null.Val[time.Time] - Source func() null.Val[enums.FieldseekerServicerequestServicerequestsourceEnum] + Source func() null.Val[string] Entrytech func() null.Val[string] - Priority func() null.Val[enums.FieldseekerServicerequestServicerequestpriorityEnum] - Supervisor func() null.Val[enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808] - Assignedtech func() null.Val[enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8] - Status func() null.Val[enums.FieldseekerServicerequestServicerequeststatusEnum] - Clranon func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] + Priority func() null.Val[string] + Supervisor func() null.Val[string] + Assignedtech func() null.Val[string] + Status func() null.Val[string] + Clranon func() null.Val[int16] Clrfname func() null.Val[string] Clrphone1 func() null.Val[string] Clrphone2 func() null.Val[string] @@ -56,21 +57,21 @@ type FieldseekerServicerequestTemplate struct { Clraddr1 func() null.Val[string] Clraddr2 func() null.Val[string] Clrcity func() null.Val[string] - Clrstate func() null.Val[enums.FieldseekerServicerequestServicerequestregionEnum] + Clrstate func() null.Val[string] Clrzip func() null.Val[string] Clrother func() null.Val[string] - Clrcontpref func() null.Val[enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum] + Clrcontpref func() null.Val[string] Reqcompany func() null.Val[string] Reqaddr1 func() null.Val[string] Reqaddr2 func() null.Val[string] Reqcity func() null.Val[string] - Reqstate func() null.Val[enums.FieldseekerServicerequestServicerequestregionEnum] + Reqstate func() null.Val[string] Reqzip func() null.Val[string] Reqcrossst func() null.Val[string] Reqsubdiv func() null.Val[string] Reqmapgrid func() null.Val[string] - Reqpermission func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] - Reqtarget func() null.Val[enums.FieldseekerServicerequestServicerequesttargetEnum] + Reqpermission func() null.Val[int16] + Reqtarget func() null.Val[string] Reqdescr func() null.Val[string] Reqnotesfortech func() null.Val[string] Reqnotesforcust func() null.Val[string] @@ -79,19 +80,19 @@ type FieldseekerServicerequestTemplate struct { Datetimeclosed func() null.Val[time.Time] Techclosed func() null.Val[string] SRNumber func() null.Val[int32] - Reviewed func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] + Reviewed func() null.Val[int16] Reviewedby func() null.Val[string] Revieweddate func() null.Val[time.Time] - Accepted func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] + Accepted func() null.Val[int16] Accepteddate func() null.Val[time.Time] Rejectedby func() null.Val[string] Rejecteddate func() null.Val[time.Time] - Rejectedreason func() null.Val[enums.FieldseekerServicerequestServicerequestrejectedreasonEnum] + Rejectedreason func() null.Val[string] Duedate func() null.Val[time.Time] Acceptedby func() null.Val[string] Comments func() null.Val[string] Estcompletedate func() null.Val[time.Time] - Nextaction func() null.Val[enums.FieldseekerServicerequestServicerequestnextactionEnum] + Nextaction func() null.Val[string] Recordstatus func() null.Val[int16] Globalid func() null.Val[uuid.UUID] CreatedUser func() null.Val[string] @@ -112,26 +113,38 @@ type FieldseekerServicerequestTemplate struct { Notifieddate func() null.Val[time.Time] Scheduled func() null.Val[int16] Scheduleddate func() null.Val[time.Time] - Dog func() null.Val[enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31] - SchedulePeriod func() null.Val[enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab] + Dog func() null.Val[int32] + SchedulePeriod func() null.Val[string] ScheduleNotes func() null.Val[string] - Spanish func() null.Val[enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC] + Spanish func() null.Val[int32] Creationdate func() null.Val[time.Time] Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] - Issuesreported func() null.Val[enums.FieldseekerServicerequestServicerequestissuesEnum] + Issuesreported func() null.Val[string] Jurisdiction func() null.Val[string] Notificationtimestamp func() null.Val[string] Zone func() null.Val[string] Zone2 func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerServicerequestR f *Factory alreadyPersisted bool } +type fieldseekerServicerequestR struct { + Organization *fieldseekerServicerequestROrganizationR +} + +type fieldseekerServicerequestROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerServicerequestTemplate func (o *FieldseekerServicerequestTemplate) Apply(ctx context.Context, mods ...FieldseekerServicerequestMod) { for _, mod := range mods { @@ -141,7 +154,14 @@ func (o *FieldseekerServicerequestTemplate) Apply(ctx context.Context, mods ...F // setModelRels creates and sets the relationships on *models.FieldseekerServicerequest // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerServicerequestTemplate) setModelRels(o *models.FieldseekerServicerequest) {} +func (t FieldseekerServicerequestTemplate) setModelRels(o *models.FieldseekerServicerequest) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Servicerequests = append(rel.R.Servicerequests, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerServicerequestSetter // this does nothing with the relationship templates @@ -492,10 +512,22 @@ func (o FieldseekerServicerequestTemplate) BuildSetter() *models.FieldseekerServ val := o.Zone2() m.Zone2 = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -776,9 +808,18 @@ func (o FieldseekerServicerequestTemplate) Build() *models.FieldseekerServicereq if o.Zone2 != nil { m.Zone2 = o.Zone2() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -799,6 +840,14 @@ func (o FieldseekerServicerequestTemplate) BuildMany(number int) models.Fieldsee } func ensureCreatableFieldseekerServicerequest(m *models.FieldseekerServicerequestSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerServicerequest @@ -817,11 +866,30 @@ func (o *FieldseekerServicerequestTemplate) Create(ctx context.Context, exec bob opt := o.BuildSetter() ensureCreatableFieldseekerServicerequest(opt) + if o.r.Organization == nil { + FieldseekerServicerequestMods.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.FieldseekerServicerequests.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 } @@ -985,7 +1053,10 @@ func (m fieldseekerServicerequestMods) RandomizeAllColumns(f *faker.Faker) Field FieldseekerServicerequestMods.RandomNotificationtimestamp(f), FieldseekerServicerequestMods.RandomZone(f), FieldseekerServicerequestMods.RandomZone2(f), + FieldseekerServicerequestMods.RandomGeometry(f), + FieldseekerServicerequestMods.RandomGeospatial(f), FieldseekerServicerequestMods.RandomVersion(f), + FieldseekerServicerequestMods.RandomOrganizationID(f), } } @@ -1074,14 +1145,14 @@ func (m fieldseekerServicerequestMods) RandomRecdatetimeNotNull(f *faker.Faker) } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Source(val null.Val[enums.FieldseekerServicerequestServicerequestsourceEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Source(val null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Source = func() null.Val[enums.FieldseekerServicerequestServicerequestsourceEnum] { return val } + o.Source = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) SourceFunc(f func() null.Val[enums.FieldseekerServicerequestServicerequestsourceEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) SourceFunc(f func() null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Source = f }) @@ -1099,12 +1170,12 @@ func (m fieldseekerServicerequestMods) UnsetSource() FieldseekerServicerequestMo // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomSource(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Source = func() null.Val[enums.FieldseekerServicerequestServicerequestsourceEnum] { + o.Source = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestsourceEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1115,12 +1186,12 @@ func (m fieldseekerServicerequestMods) RandomSource(f *faker.Faker) FieldseekerS // The generated value is never null func (m fieldseekerServicerequestMods) RandomSourceNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Source = func() null.Val[enums.FieldseekerServicerequestServicerequestsourceEnum] { + o.Source = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestsourceEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1180,14 +1251,14 @@ func (m fieldseekerServicerequestMods) RandomEntrytechNotNull(f *faker.Faker) Fi } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Priority(val null.Val[enums.FieldseekerServicerequestServicerequestpriorityEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Priority(val null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Priority = func() null.Val[enums.FieldseekerServicerequestServicerequestpriorityEnum] { return val } + o.Priority = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) PriorityFunc(f func() null.Val[enums.FieldseekerServicerequestServicerequestpriorityEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) PriorityFunc(f func() null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Priority = f }) @@ -1205,12 +1276,12 @@ func (m fieldseekerServicerequestMods) UnsetPriority() FieldseekerServicerequest // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomPriority(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Priority = func() null.Val[enums.FieldseekerServicerequestServicerequestpriorityEnum] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestpriorityEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1221,28 +1292,26 @@ func (m fieldseekerServicerequestMods) RandomPriority(f *faker.Faker) Fieldseeke // The generated value is never null func (m fieldseekerServicerequestMods) RandomPriorityNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Priority = func() null.Val[enums.FieldseekerServicerequestServicerequestpriorityEnum] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestpriorityEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Supervisor(val null.Val[enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Supervisor(val null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Supervisor = func() null.Val[enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808] { - return val - } + o.Supervisor = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) SupervisorFunc(f func() null.Val[enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) SupervisorFunc(f func() null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Supervisor = f }) @@ -1260,12 +1329,12 @@ func (m fieldseekerServicerequestMods) UnsetSupervisor() FieldseekerServicereque // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomSupervisor(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Supervisor = func() null.Val[enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808] { + o.Supervisor = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1276,28 +1345,26 @@ func (m fieldseekerServicerequestMods) RandomSupervisor(f *faker.Faker) Fieldsee // The generated value is never null func (m fieldseekerServicerequestMods) RandomSupervisorNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Supervisor = func() null.Val[enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808] { + o.Supervisor = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Assignedtech(val null.Val[enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Assignedtech(val null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Assignedtech = func() null.Val[enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8] { - return val - } + o.Assignedtech = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) AssignedtechFunc(f func() null.Val[enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) AssignedtechFunc(f func() null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Assignedtech = f }) @@ -1315,12 +1382,12 @@ func (m fieldseekerServicerequestMods) UnsetAssignedtech() FieldseekerServicereq // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomAssignedtech(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Assignedtech = func() null.Val[enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8] { + o.Assignedtech = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1331,26 +1398,26 @@ func (m fieldseekerServicerequestMods) RandomAssignedtech(f *faker.Faker) Fields // The generated value is never null func (m fieldseekerServicerequestMods) RandomAssignedtechNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Assignedtech = func() null.Val[enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8] { + o.Assignedtech = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Status(val null.Val[enums.FieldseekerServicerequestServicerequeststatusEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Status(val null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Status = func() null.Val[enums.FieldseekerServicerequestServicerequeststatusEnum] { return val } + o.Status = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) StatusFunc(f func() null.Val[enums.FieldseekerServicerequestServicerequeststatusEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) StatusFunc(f func() null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Status = f }) @@ -1368,12 +1435,12 @@ func (m fieldseekerServicerequestMods) UnsetStatus() FieldseekerServicerequestMo // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomStatus(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Status = func() null.Val[enums.FieldseekerServicerequestServicerequeststatusEnum] { + o.Status = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequeststatusEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1384,26 +1451,26 @@ func (m fieldseekerServicerequestMods) RandomStatus(f *faker.Faker) FieldseekerS // The generated value is never null func (m fieldseekerServicerequestMods) RandomStatusNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Status = func() null.Val[enums.FieldseekerServicerequestServicerequeststatusEnum] { + o.Status = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequeststatusEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Clranon(val null.Val[enums.FieldseekerServicerequestNotinuitFEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Clranon(val null.Val[int16]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clranon = func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] { return val } + o.Clranon = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) ClranonFunc(f func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) ClranonFunc(f func() null.Val[int16]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Clranon = f }) @@ -1421,12 +1488,12 @@ func (m fieldseekerServicerequestMods) UnsetClranon() FieldseekerServicerequestM // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomClranon(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clranon = func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] { + o.Clranon = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1437,12 +1504,12 @@ func (m fieldseekerServicerequestMods) RandomClranon(f *faker.Faker) Fieldseeker // The generated value is never null func (m fieldseekerServicerequestMods) RandomClranonNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clranon = func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] { + o.Clranon = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1873,14 +1940,14 @@ func (m fieldseekerServicerequestMods) RandomClrcityNotNull(f *faker.Faker) Fiel } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Clrstate(val null.Val[enums.FieldseekerServicerequestServicerequestregionEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Clrstate(val null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrstate = func() null.Val[enums.FieldseekerServicerequestServicerequestregionEnum] { return val } + o.Clrstate = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) ClrstateFunc(f func() null.Val[enums.FieldseekerServicerequestServicerequestregionEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) ClrstateFunc(f func() null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Clrstate = f }) @@ -1898,12 +1965,12 @@ func (m fieldseekerServicerequestMods) UnsetClrstate() FieldseekerServicerequest // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomClrstate(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrstate = func() null.Val[enums.FieldseekerServicerequestServicerequestregionEnum] { + o.Clrstate = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestregionEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1914,12 +1981,12 @@ func (m fieldseekerServicerequestMods) RandomClrstate(f *faker.Faker) Fieldseeke // The generated value is never null func (m fieldseekerServicerequestMods) RandomClrstateNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrstate = func() null.Val[enums.FieldseekerServicerequestServicerequestregionEnum] { + o.Clrstate = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestregionEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -2032,14 +2099,14 @@ func (m fieldseekerServicerequestMods) RandomClrotherNotNull(f *faker.Faker) Fie } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Clrcontpref(val null.Val[enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Clrcontpref(val null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrcontpref = func() null.Val[enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum] { return val } + o.Clrcontpref = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) ClrcontprefFunc(f func() null.Val[enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) ClrcontprefFunc(f func() null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Clrcontpref = f }) @@ -2057,12 +2124,12 @@ func (m fieldseekerServicerequestMods) UnsetClrcontpref() FieldseekerServicerequ // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomClrcontpref(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrcontpref = func() null.Val[enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum] { + o.Clrcontpref = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestcontactpreferencesEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -2073,12 +2140,12 @@ func (m fieldseekerServicerequestMods) RandomClrcontpref(f *faker.Faker) Fieldse // The generated value is never null func (m fieldseekerServicerequestMods) RandomClrcontprefNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrcontpref = func() null.Val[enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum] { + o.Clrcontpref = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestcontactpreferencesEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -2297,14 +2364,14 @@ func (m fieldseekerServicerequestMods) RandomReqcityNotNull(f *faker.Faker) Fiel } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqstate(val null.Val[enums.FieldseekerServicerequestServicerequestregionEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Reqstate(val null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqstate = func() null.Val[enums.FieldseekerServicerequestServicerequestregionEnum] { return val } + o.Reqstate = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) ReqstateFunc(f func() null.Val[enums.FieldseekerServicerequestServicerequestregionEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) ReqstateFunc(f func() null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Reqstate = f }) @@ -2322,12 +2389,12 @@ func (m fieldseekerServicerequestMods) UnsetReqstate() FieldseekerServicerequest // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomReqstate(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqstate = func() null.Val[enums.FieldseekerServicerequestServicerequestregionEnum] { + o.Reqstate = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestregionEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -2338,12 +2405,12 @@ func (m fieldseekerServicerequestMods) RandomReqstate(f *faker.Faker) Fieldseeke // The generated value is never null func (m fieldseekerServicerequestMods) RandomReqstateNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqstate = func() null.Val[enums.FieldseekerServicerequestServicerequestregionEnum] { + o.Reqstate = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestregionEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -2562,14 +2629,14 @@ func (m fieldseekerServicerequestMods) RandomReqmapgridNotNull(f *faker.Faker) F } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqpermission(val null.Val[enums.FieldseekerServicerequestNotinuitFEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Reqpermission(val null.Val[int16]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqpermission = func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] { return val } + o.Reqpermission = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) ReqpermissionFunc(f func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) ReqpermissionFunc(f func() null.Val[int16]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Reqpermission = f }) @@ -2587,12 +2654,12 @@ func (m fieldseekerServicerequestMods) UnsetReqpermission() FieldseekerServicere // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomReqpermission(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqpermission = func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] { + o.Reqpermission = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -2603,26 +2670,26 @@ func (m fieldseekerServicerequestMods) RandomReqpermission(f *faker.Faker) Field // The generated value is never null func (m fieldseekerServicerequestMods) RandomReqpermissionNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqpermission = func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] { + o.Reqpermission = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqtarget(val null.Val[enums.FieldseekerServicerequestServicerequesttargetEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Reqtarget(val null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqtarget = func() null.Val[enums.FieldseekerServicerequestServicerequesttargetEnum] { return val } + o.Reqtarget = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) ReqtargetFunc(f func() null.Val[enums.FieldseekerServicerequestServicerequesttargetEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) ReqtargetFunc(f func() null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Reqtarget = f }) @@ -2640,12 +2707,12 @@ func (m fieldseekerServicerequestMods) UnsetReqtarget() FieldseekerServicereques // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomReqtarget(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqtarget = func() null.Val[enums.FieldseekerServicerequestServicerequesttargetEnum] { + o.Reqtarget = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequesttargetEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -2656,12 +2723,12 @@ func (m fieldseekerServicerequestMods) RandomReqtarget(f *faker.Faker) Fieldseek // The generated value is never null func (m fieldseekerServicerequestMods) RandomReqtargetNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqtarget = func() null.Val[enums.FieldseekerServicerequestServicerequesttargetEnum] { + o.Reqtarget = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequesttargetEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -3092,14 +3159,14 @@ func (m fieldseekerServicerequestMods) RandomSRNumberNotNull(f *faker.Faker) Fie } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Reviewed(val null.Val[enums.FieldseekerServicerequestNotinuitFEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Reviewed(val null.Val[int16]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] { return val } + o.Reviewed = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) ReviewedFunc(f func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) ReviewedFunc(f func() null.Val[int16]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Reviewed = f }) @@ -3117,12 +3184,12 @@ func (m fieldseekerServicerequestMods) UnsetReviewed() FieldseekerServicerequest // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomReviewed(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] { + o.Reviewed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -3133,12 +3200,12 @@ func (m fieldseekerServicerequestMods) RandomReviewed(f *faker.Faker) Fieldseeke // The generated value is never null func (m fieldseekerServicerequestMods) RandomReviewedNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] { + o.Reviewed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -3251,14 +3318,14 @@ func (m fieldseekerServicerequestMods) RandomRevieweddateNotNull(f *faker.Faker) } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Accepted(val null.Val[enums.FieldseekerServicerequestNotinuitFEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Accepted(val null.Val[int16]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Accepted = func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] { return val } + o.Accepted = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) AcceptedFunc(f func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) AcceptedFunc(f func() null.Val[int16]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Accepted = f }) @@ -3276,12 +3343,12 @@ func (m fieldseekerServicerequestMods) UnsetAccepted() FieldseekerServicerequest // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomAccepted(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Accepted = func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] { + o.Accepted = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -3292,12 +3359,12 @@ func (m fieldseekerServicerequestMods) RandomAccepted(f *faker.Faker) Fieldseeke // The generated value is never null func (m fieldseekerServicerequestMods) RandomAcceptedNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Accepted = func() null.Val[enums.FieldseekerServicerequestNotinuitFEnum] { + o.Accepted = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -3463,14 +3530,14 @@ func (m fieldseekerServicerequestMods) RandomRejecteddateNotNull(f *faker.Faker) } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Rejectedreason(val null.Val[enums.FieldseekerServicerequestServicerequestrejectedreasonEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Rejectedreason(val null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Rejectedreason = func() null.Val[enums.FieldseekerServicerequestServicerequestrejectedreasonEnum] { return val } + o.Rejectedreason = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) RejectedreasonFunc(f func() null.Val[enums.FieldseekerServicerequestServicerequestrejectedreasonEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) RejectedreasonFunc(f func() null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Rejectedreason = f }) @@ -3488,12 +3555,12 @@ func (m fieldseekerServicerequestMods) UnsetRejectedreason() FieldseekerServicer // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomRejectedreason(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Rejectedreason = func() null.Val[enums.FieldseekerServicerequestServicerequestrejectedreasonEnum] { + o.Rejectedreason = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestrejectedreasonEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -3504,12 +3571,12 @@ func (m fieldseekerServicerequestMods) RandomRejectedreason(f *faker.Faker) Fiel // The generated value is never null func (m fieldseekerServicerequestMods) RandomRejectedreasonNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Rejectedreason = func() null.Val[enums.FieldseekerServicerequestServicerequestrejectedreasonEnum] { + o.Rejectedreason = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestrejectedreasonEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -3728,14 +3795,14 @@ func (m fieldseekerServicerequestMods) RandomEstcompletedateNotNull(f *faker.Fak } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Nextaction(val null.Val[enums.FieldseekerServicerequestServicerequestnextactionEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Nextaction(val null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Nextaction = func() null.Val[enums.FieldseekerServicerequestServicerequestnextactionEnum] { return val } + o.Nextaction = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) NextactionFunc(f func() null.Val[enums.FieldseekerServicerequestServicerequestnextactionEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) NextactionFunc(f func() null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Nextaction = f }) @@ -3753,12 +3820,12 @@ func (m fieldseekerServicerequestMods) UnsetNextaction() FieldseekerServicereque // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomNextaction(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Nextaction = func() null.Val[enums.FieldseekerServicerequestServicerequestnextactionEnum] { + o.Nextaction = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestnextactionEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -3769,12 +3836,12 @@ func (m fieldseekerServicerequestMods) RandomNextaction(f *faker.Faker) Fieldsee // The generated value is never null func (m fieldseekerServicerequestMods) RandomNextactionNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Nextaction = func() null.Val[enums.FieldseekerServicerequestServicerequestnextactionEnum] { + o.Nextaction = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestnextactionEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -4841,14 +4908,14 @@ func (m fieldseekerServicerequestMods) RandomScheduleddateNotNull(f *faker.Faker } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Dog(val null.Val[enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Dog(val null.Val[int32]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Dog = func() null.Val[enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31] { return val } + o.Dog = func() null.Val[int32] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) DogFunc(f func() null.Val[enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) DogFunc(f func() null.Val[int32]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Dog = f }) @@ -4866,12 +4933,12 @@ func (m fieldseekerServicerequestMods) UnsetDog() FieldseekerServicerequestMod { // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomDog(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Dog = func() null.Val[enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31] { + o.Dog = func() null.Val[int32] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31(f) + val := random_int32(f) return null.From(val) } }) @@ -4882,28 +4949,26 @@ func (m fieldseekerServicerequestMods) RandomDog(f *faker.Faker) FieldseekerServ // The generated value is never null func (m fieldseekerServicerequestMods) RandomDogNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Dog = func() null.Val[enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31] { + o.Dog = func() null.Val[int32] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31(f) + val := random_int32(f) return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerServicerequestMods) SchedulePeriod(val null.Val[enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) SchedulePeriod(val null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.SchedulePeriod = func() null.Val[enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab] { - return val - } + o.SchedulePeriod = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) SchedulePeriodFunc(f func() null.Val[enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) SchedulePeriodFunc(f func() null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.SchedulePeriod = f }) @@ -4921,12 +4986,12 @@ func (m fieldseekerServicerequestMods) UnsetSchedulePeriod() FieldseekerServicer // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomSchedulePeriod(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.SchedulePeriod = func() null.Val[enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab] { + o.SchedulePeriod = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab(f) + val := random_string(f, "20") return null.From(val) } }) @@ -4937,12 +5002,12 @@ func (m fieldseekerServicerequestMods) RandomSchedulePeriod(f *faker.Faker) Fiel // The generated value is never null func (m fieldseekerServicerequestMods) RandomSchedulePeriodNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.SchedulePeriod = func() null.Val[enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab] { + o.SchedulePeriod = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab(f) + val := random_string(f, "20") return null.From(val) } }) @@ -5002,14 +5067,14 @@ func (m fieldseekerServicerequestMods) RandomScheduleNotesNotNull(f *faker.Faker } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Spanish(val null.Val[enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Spanish(val null.Val[int32]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Spanish = func() null.Val[enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC] { return val } + o.Spanish = func() null.Val[int32] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) SpanishFunc(f func() null.Val[enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) SpanishFunc(f func() null.Val[int32]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Spanish = f }) @@ -5027,12 +5092,12 @@ func (m fieldseekerServicerequestMods) UnsetSpanish() FieldseekerServicerequestM // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomSpanish(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Spanish = func() null.Val[enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC] { + o.Spanish = func() null.Val[int32] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC(f) + val := random_int32(f) return null.From(val) } }) @@ -5043,12 +5108,12 @@ func (m fieldseekerServicerequestMods) RandomSpanish(f *faker.Faker) Fieldseeker // The generated value is never null func (m fieldseekerServicerequestMods) RandomSpanishNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Spanish = func() null.Val[enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC] { + o.Spanish = func() null.Val[int32] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC(f) + val := random_int32(f) return null.From(val) } }) @@ -5267,14 +5332,14 @@ func (m fieldseekerServicerequestMods) RandomEditorNotNull(f *faker.Faker) Field } // Set the model columns to this value -func (m fieldseekerServicerequestMods) Issuesreported(val null.Val[enums.FieldseekerServicerequestServicerequestissuesEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) Issuesreported(val null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Issuesreported = func() null.Val[enums.FieldseekerServicerequestServicerequestissuesEnum] { return val } + o.Issuesreported = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerServicerequestMods) IssuesreportedFunc(f func() null.Val[enums.FieldseekerServicerequestServicerequestissuesEnum]) FieldseekerServicerequestMod { +func (m fieldseekerServicerequestMods) IssuesreportedFunc(f func() null.Val[string]) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { o.Issuesreported = f }) @@ -5292,12 +5357,12 @@ func (m fieldseekerServicerequestMods) UnsetIssuesreported() FieldseekerServicer // The generated value is sometimes null func (m fieldseekerServicerequestMods) RandomIssuesreported(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Issuesreported = func() null.Val[enums.FieldseekerServicerequestServicerequestissuesEnum] { + o.Issuesreported = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestissuesEnum(f) + val := random_string(f, "250") return null.From(val) } }) @@ -5308,12 +5373,12 @@ func (m fieldseekerServicerequestMods) RandomIssuesreported(f *faker.Faker) Fiel // The generated value is never null func (m fieldseekerServicerequestMods) RandomIssuesreportedNotNull(f *faker.Faker) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Issuesreported = func() null.Val[enums.FieldseekerServicerequestServicerequestissuesEnum] { + o.Issuesreported = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerServicerequestServicerequestissuesEnum(f) + val := random_string(f, "250") return null.From(val) } }) @@ -5531,6 +5596,90 @@ func (m fieldseekerServicerequestMods) RandomZone2NotNull(f *faker.Faker) Fields }) } +// Set the model columns to this value +func (m fieldseekerServicerequestMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerServicerequestMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerServicerequestMods) UnsetGeometry() FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerServicerequestMods) RandomGeometry(f *faker.Faker) FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerServicerequestMods) Geospatial(val null.Val[string]) FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerServicerequestMods) GeospatialFunc(f func() null.Val[string]) FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerServicerequestMods) UnsetGeospatial() FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerServicerequestMods) RandomGeospatial(f *faker.Faker) FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerServicerequestMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { + o.Geospatial = 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 fieldseekerServicerequestMods) Version(val int32) FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { @@ -5562,11 +5711,77 @@ func (m fieldseekerServicerequestMods) RandomVersion(f *faker.Faker) Fieldseeker }) } +// Set the model columns to this value +func (m fieldseekerServicerequestMods) OrganizationID(val int32) FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerServicerequestMods) OrganizationIDFunc(f func() int32) FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerServicerequestMods) UnsetOrganizationID() FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { + 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 fieldseekerServicerequestMods) RandomOrganizationID(f *faker.Faker) FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerServicerequestMods) WithParentsCascading() FieldseekerServicerequestMod { return FieldseekerServicerequestModFunc(func(ctx context.Context, o *FieldseekerServicerequestTemplate) { if isDone, _ := fieldseekerServicerequestWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerServicerequestWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerServicerequestMods) WithOrganization(rel *OrganizationTemplate) FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(ctx context.Context, o *FieldseekerServicerequestTemplate) { + o.r.Organization = &fieldseekerServicerequestROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerServicerequestMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(ctx context.Context, o *FieldseekerServicerequestTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerServicerequestMods) WithExistingOrganization(em *models.Organization) FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(ctx context.Context, o *FieldseekerServicerequestTemplate) { + o.r.Organization = &fieldseekerServicerequestROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerServicerequestMods) WithoutOrganization() FieldseekerServicerequestMod { + return FieldseekerServicerequestModFunc(func(ctx context.Context, o *FieldseekerServicerequestTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.speciesabundance.bob.go b/db/factory/fieldseeker.speciesabundance.bob.go index d072413d..f8194218 100644 --- a/db/factory/fieldseeker.speciesabundance.bob.go +++ b/db/factory/fieldseeker.speciesabundance.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerSpeciesabundanceMod interface { @@ -48,7 +49,7 @@ type FieldseekerSpeciesabundanceTemplate struct { Gravidfem func() null.Val[int16] Larvae func() null.Val[int16] Poolstogen func() null.Val[int16] - Processed func() null.Val[enums.FieldseekerSpeciesabundanceNotinuitFEnum] + Processed func() null.Val[int16] Globalid func() null.Val[uuid.UUID] CreatedUser func() null.Val[string] CreatedDate func() null.Val[time.Time] @@ -68,13 +69,25 @@ type FieldseekerSpeciesabundanceTemplate struct { R8score func() null.Val[float64] H3R7 func() null.Val[string] H3R8 func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerSpeciesabundanceR f *Factory alreadyPersisted bool } +type fieldseekerSpeciesabundanceR struct { + Organization *fieldseekerSpeciesabundanceROrganizationR +} + +type fieldseekerSpeciesabundanceROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerSpeciesabundanceTemplate func (o *FieldseekerSpeciesabundanceTemplate) Apply(ctx context.Context, mods ...FieldseekerSpeciesabundanceMod) { for _, mod := range mods { @@ -84,7 +97,14 @@ func (o *FieldseekerSpeciesabundanceTemplate) Apply(ctx context.Context, mods .. // setModelRels creates and sets the relationships on *models.FieldseekerSpeciesabundance // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerSpeciesabundanceTemplate) setModelRels(o *models.FieldseekerSpeciesabundance) {} +func (t FieldseekerSpeciesabundanceTemplate) setModelRels(o *models.FieldseekerSpeciesabundance) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Speciesabundances = append(rel.R.Speciesabundances, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerSpeciesabundanceSetter // this does nothing with the relationship templates @@ -207,10 +227,22 @@ func (o FieldseekerSpeciesabundanceTemplate) BuildSetter() *models.FieldseekerSp val := o.H3R8() m.H3R8 = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -320,9 +352,18 @@ func (o FieldseekerSpeciesabundanceTemplate) Build() *models.FieldseekerSpeciesa if o.H3R8 != nil { m.H3R8 = o.H3R8() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -343,6 +384,14 @@ func (o FieldseekerSpeciesabundanceTemplate) BuildMany(number int) models.Fields } func ensureCreatableFieldseekerSpeciesabundance(m *models.FieldseekerSpeciesabundanceSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerSpeciesabundance @@ -361,11 +410,30 @@ func (o *FieldseekerSpeciesabundanceTemplate) Create(ctx context.Context, exec b opt := o.BuildSetter() ensureCreatableFieldseekerSpeciesabundance(opt) + if o.r.Organization == nil { + FieldseekerSpeciesabundanceMods.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.FieldseekerSpeciesabundances.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 } @@ -472,7 +540,10 @@ func (m fieldseekerSpeciesabundanceMods) RandomizeAllColumns(f *faker.Faker) Fie FieldseekerSpeciesabundanceMods.RandomR8score(f), FieldseekerSpeciesabundanceMods.RandomH3R7(f), FieldseekerSpeciesabundanceMods.RandomH3R8(f), + FieldseekerSpeciesabundanceMods.RandomGeometry(f), + FieldseekerSpeciesabundanceMods.RandomGeospatial(f), FieldseekerSpeciesabundanceMods.RandomVersion(f), + FieldseekerSpeciesabundanceMods.RandomOrganizationID(f), } } @@ -932,14 +1003,14 @@ func (m fieldseekerSpeciesabundanceMods) RandomPoolstogenNotNull(f *faker.Faker) } // Set the model columns to this value -func (m fieldseekerSpeciesabundanceMods) Processed(val null.Val[enums.FieldseekerSpeciesabundanceNotinuitFEnum]) FieldseekerSpeciesabundanceMod { +func (m fieldseekerSpeciesabundanceMods) Processed(val null.Val[int16]) FieldseekerSpeciesabundanceMod { return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Processed = func() null.Val[enums.FieldseekerSpeciesabundanceNotinuitFEnum] { return val } + o.Processed = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) ProcessedFunc(f func() null.Val[enums.FieldseekerSpeciesabundanceNotinuitFEnum]) FieldseekerSpeciesabundanceMod { +func (m fieldseekerSpeciesabundanceMods) ProcessedFunc(f func() null.Val[int16]) FieldseekerSpeciesabundanceMod { return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { o.Processed = f }) @@ -957,12 +1028,12 @@ func (m fieldseekerSpeciesabundanceMods) UnsetProcessed() FieldseekerSpeciesabun // The generated value is sometimes null func (m fieldseekerSpeciesabundanceMods) RandomProcessed(f *faker.Faker) FieldseekerSpeciesabundanceMod { return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Processed = func() null.Val[enums.FieldseekerSpeciesabundanceNotinuitFEnum] { + o.Processed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSpeciesabundanceNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -973,12 +1044,12 @@ func (m fieldseekerSpeciesabundanceMods) RandomProcessed(f *faker.Faker) Fieldse // The generated value is never null func (m fieldseekerSpeciesabundanceMods) RandomProcessedNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Processed = func() null.Val[enums.FieldseekerSpeciesabundanceNotinuitFEnum] { + o.Processed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerSpeciesabundanceNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1991,6 +2062,90 @@ func (m fieldseekerSpeciesabundanceMods) RandomH3R8NotNull(f *faker.Faker) Field }) } +// Set the model columns to this value +func (m fieldseekerSpeciesabundanceMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerSpeciesabundanceMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerSpeciesabundanceMods) UnsetGeometry() FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerSpeciesabundanceMods) RandomGeometry(f *faker.Faker) FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerSpeciesabundanceMods) Geospatial(val null.Val[string]) FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerSpeciesabundanceMods) GeospatialFunc(f func() null.Val[string]) FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerSpeciesabundanceMods) UnsetGeospatial() FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerSpeciesabundanceMods) RandomGeospatial(f *faker.Faker) FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerSpeciesabundanceMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { + o.Geospatial = 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 fieldseekerSpeciesabundanceMods) Version(val int32) FieldseekerSpeciesabundanceMod { return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { @@ -2022,11 +2177,77 @@ func (m fieldseekerSpeciesabundanceMods) RandomVersion(f *faker.Faker) Fieldseek }) } +// Set the model columns to this value +func (m fieldseekerSpeciesabundanceMods) OrganizationID(val int32) FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerSpeciesabundanceMods) OrganizationIDFunc(f func() int32) FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerSpeciesabundanceMods) UnsetOrganizationID() FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { + 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 fieldseekerSpeciesabundanceMods) RandomOrganizationID(f *faker.Faker) FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerSpeciesabundanceMods) WithParentsCascading() FieldseekerSpeciesabundanceMod { return FieldseekerSpeciesabundanceModFunc(func(ctx context.Context, o *FieldseekerSpeciesabundanceTemplate) { if isDone, _ := fieldseekerSpeciesabundanceWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerSpeciesabundanceWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerSpeciesabundanceMods) WithOrganization(rel *OrganizationTemplate) FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(ctx context.Context, o *FieldseekerSpeciesabundanceTemplate) { + o.r.Organization = &fieldseekerSpeciesabundanceROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerSpeciesabundanceMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(ctx context.Context, o *FieldseekerSpeciesabundanceTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerSpeciesabundanceMods) WithExistingOrganization(em *models.Organization) FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(ctx context.Context, o *FieldseekerSpeciesabundanceTemplate) { + o.r.Organization = &fieldseekerSpeciesabundanceROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerSpeciesabundanceMods) WithoutOrganization() FieldseekerSpeciesabundanceMod { + return FieldseekerSpeciesabundanceModFunc(func(ctx context.Context, o *FieldseekerSpeciesabundanceTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.stormdrain.bob.go b/db/factory/fieldseeker.stormdrain.bob.go index 3c8640e3..4d313ec0 100644 --- a/db/factory/fieldseeker.stormdrain.bob.go +++ b/db/factory/fieldseeker.stormdrain.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerStormdrainMod interface { @@ -43,7 +44,7 @@ type FieldseekerStormdrainTemplate struct { Nexttreatmentdate func() null.Val[time.Time] Lasttreatdate func() null.Val[time.Time] Lastaction func() null.Val[string] - Symbology func() null.Val[enums.FieldseekerStormdrainStormdrainsymbologyEnum] + Symbology func() null.Val[string] Globalid func() null.Val[uuid.UUID] CreatedUser func() null.Val[string] CreatedDate func() null.Val[time.Time] @@ -58,13 +59,25 @@ type FieldseekerStormdrainTemplate struct { Editor func() null.Val[string] Type func() null.Val[string] Jurisdiction func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerStormdrainR f *Factory alreadyPersisted bool } +type fieldseekerStormdrainR struct { + Organization *fieldseekerStormdrainROrganizationR +} + +type fieldseekerStormdrainROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerStormdrainTemplate func (o *FieldseekerStormdrainTemplate) Apply(ctx context.Context, mods ...FieldseekerStormdrainMod) { for _, mod := range mods { @@ -74,7 +87,14 @@ func (o *FieldseekerStormdrainTemplate) Apply(ctx context.Context, mods ...Field // setModelRels creates and sets the relationships on *models.FieldseekerStormdrain // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerStormdrainTemplate) setModelRels(o *models.FieldseekerStormdrain) {} +func (t FieldseekerStormdrainTemplate) setModelRels(o *models.FieldseekerStormdrain) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Stormdrains = append(rel.R.Stormdrains, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerStormdrainSetter // this does nothing with the relationship templates @@ -157,10 +177,22 @@ func (o FieldseekerStormdrainTemplate) BuildSetter() *models.FieldseekerStormdra val := o.Jurisdiction() m.Jurisdiction = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -240,9 +272,18 @@ func (o FieldseekerStormdrainTemplate) Build() *models.FieldseekerStormdrain { if o.Jurisdiction != nil { m.Jurisdiction = o.Jurisdiction() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -263,6 +304,14 @@ func (o FieldseekerStormdrainTemplate) BuildMany(number int) models.FieldseekerS } func ensureCreatableFieldseekerStormdrain(m *models.FieldseekerStormdrainSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerStormdrain @@ -281,11 +330,30 @@ func (o *FieldseekerStormdrainTemplate) Create(ctx context.Context, exec bob.Exe opt := o.BuildSetter() ensureCreatableFieldseekerStormdrain(opt) + if o.r.Organization == nil { + FieldseekerStormdrainMods.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.FieldseekerStormdrains.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 } @@ -382,7 +450,10 @@ func (m fieldseekerStormdrainMods) RandomizeAllColumns(f *faker.Faker) Fieldseek FieldseekerStormdrainMods.RandomEditor(f), FieldseekerStormdrainMods.RandomType(f), FieldseekerStormdrainMods.RandomJurisdiction(f), + FieldseekerStormdrainMods.RandomGeometry(f), + FieldseekerStormdrainMods.RandomGeospatial(f), FieldseekerStormdrainMods.RandomVersion(f), + FieldseekerStormdrainMods.RandomOrganizationID(f), } } @@ -577,14 +648,14 @@ func (m fieldseekerStormdrainMods) RandomLastactionNotNull(f *faker.Faker) Field } // Set the model columns to this value -func (m fieldseekerStormdrainMods) Symbology(val null.Val[enums.FieldseekerStormdrainStormdrainsymbologyEnum]) FieldseekerStormdrainMod { +func (m fieldseekerStormdrainMods) Symbology(val null.Val[string]) FieldseekerStormdrainMod { return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Symbology = func() null.Val[enums.FieldseekerStormdrainStormdrainsymbologyEnum] { return val } + o.Symbology = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerStormdrainMods) SymbologyFunc(f func() null.Val[enums.FieldseekerStormdrainStormdrainsymbologyEnum]) FieldseekerStormdrainMod { +func (m fieldseekerStormdrainMods) SymbologyFunc(f func() null.Val[string]) FieldseekerStormdrainMod { return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { o.Symbology = f }) @@ -602,12 +673,12 @@ func (m fieldseekerStormdrainMods) UnsetSymbology() FieldseekerStormdrainMod { // The generated value is sometimes null func (m fieldseekerStormdrainMods) RandomSymbology(f *faker.Faker) FieldseekerStormdrainMod { return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Symbology = func() null.Val[enums.FieldseekerStormdrainStormdrainsymbologyEnum] { + o.Symbology = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerStormdrainStormdrainsymbologyEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -618,12 +689,12 @@ func (m fieldseekerStormdrainMods) RandomSymbology(f *faker.Faker) FieldseekerSt // The generated value is never null func (m fieldseekerStormdrainMods) RandomSymbologyNotNull(f *faker.Faker) FieldseekerStormdrainMod { return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Symbology = func() null.Val[enums.FieldseekerStormdrainStormdrainsymbologyEnum] { + o.Symbology = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerStormdrainStormdrainsymbologyEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1371,6 +1442,90 @@ func (m fieldseekerStormdrainMods) RandomJurisdictionNotNull(f *faker.Faker) Fie }) } +// Set the model columns to this value +func (m fieldseekerStormdrainMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerStormdrainMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerStormdrainMods) UnsetGeometry() FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerStormdrainMods) RandomGeometry(f *faker.Faker) FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerStormdrainMods) Geospatial(val null.Val[string]) FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerStormdrainMods) GeospatialFunc(f func() null.Val[string]) FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerStormdrainMods) UnsetGeospatial() FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerStormdrainMods) RandomGeospatial(f *faker.Faker) FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerStormdrainMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { + o.Geospatial = 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 fieldseekerStormdrainMods) Version(val int32) FieldseekerStormdrainMod { return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { @@ -1402,11 +1557,77 @@ func (m fieldseekerStormdrainMods) RandomVersion(f *faker.Faker) FieldseekerStor }) } +// Set the model columns to this value +func (m fieldseekerStormdrainMods) OrganizationID(val int32) FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerStormdrainMods) OrganizationIDFunc(f func() int32) FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerStormdrainMods) UnsetOrganizationID() FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { + 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 fieldseekerStormdrainMods) RandomOrganizationID(f *faker.Faker) FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerStormdrainMods) WithParentsCascading() FieldseekerStormdrainMod { return FieldseekerStormdrainModFunc(func(ctx context.Context, o *FieldseekerStormdrainTemplate) { if isDone, _ := fieldseekerStormdrainWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerStormdrainWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerStormdrainMods) WithOrganization(rel *OrganizationTemplate) FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(ctx context.Context, o *FieldseekerStormdrainTemplate) { + o.r.Organization = &fieldseekerStormdrainROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerStormdrainMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(ctx context.Context, o *FieldseekerStormdrainTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerStormdrainMods) WithExistingOrganization(em *models.Organization) FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(ctx context.Context, o *FieldseekerStormdrainTemplate) { + o.r.Organization = &fieldseekerStormdrainROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerStormdrainMods) WithoutOrganization() FieldseekerStormdrainMod { + return FieldseekerStormdrainModFunc(func(ctx context.Context, o *FieldseekerStormdrainTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.timecard.bob.go b/db/factory/fieldseeker.timecard.bob.go index 44427144..993c48c0 100644 --- a/db/factory/fieldseeker.timecard.bob.go +++ b/db/factory/fieldseeker.timecard.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerTimecardMod interface { @@ -40,12 +41,12 @@ func (mods FieldseekerTimecardModSlice) Apply(ctx context.Context, n *Fieldseeke // all columns are optional and should be set by mods type FieldseekerTimecardTemplate struct { Objectid func() int64 - Activity func() null.Val[enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu] + Activity func() null.Val[string] Startdatetime func() null.Val[time.Time] Enddatetime func() null.Val[time.Time] Comments func() null.Val[string] Externalid func() null.Val[string] - Equiptype func() null.Val[enums.FieldseekerTimecardTimecardequipmenttypeEnum] + Equiptype func() null.Val[string] Locationname func() null.Val[string] Zone func() null.Val[string] Zone2 func() null.Val[string] @@ -67,13 +68,25 @@ type FieldseekerTimecardTemplate struct { Editdate func() null.Val[time.Time] Editor func() null.Val[string] Rodentlocid func() null.Val[uuid.UUID] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerTimecardR f *Factory alreadyPersisted bool } +type fieldseekerTimecardR struct { + Organization *fieldseekerTimecardROrganizationR +} + +type fieldseekerTimecardROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerTimecardTemplate func (o *FieldseekerTimecardTemplate) Apply(ctx context.Context, mods ...FieldseekerTimecardMod) { for _, mod := range mods { @@ -83,7 +96,14 @@ func (o *FieldseekerTimecardTemplate) Apply(ctx context.Context, mods ...Fieldse // setModelRels creates and sets the relationships on *models.FieldseekerTimecard // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerTimecardTemplate) setModelRels(o *models.FieldseekerTimecard) {} +func (t FieldseekerTimecardTemplate) setModelRels(o *models.FieldseekerTimecard) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Timecards = append(rel.R.Timecards, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerTimecardSetter // this does nothing with the relationship templates @@ -202,10 +222,22 @@ func (o FieldseekerTimecardTemplate) BuildSetter() *models.FieldseekerTimecardSe val := o.Rodentlocid() m.Rodentlocid = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -312,9 +344,18 @@ func (o FieldseekerTimecardTemplate) Build() *models.FieldseekerTimecard { if o.Rodentlocid != nil { m.Rodentlocid = o.Rodentlocid() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -335,6 +376,14 @@ func (o FieldseekerTimecardTemplate) BuildMany(number int) models.FieldseekerTim } func ensureCreatableFieldseekerTimecard(m *models.FieldseekerTimecardSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerTimecard @@ -353,11 +402,30 @@ func (o *FieldseekerTimecardTemplate) Create(ctx context.Context, exec bob.Execu opt := o.BuildSetter() ensureCreatableFieldseekerTimecard(opt) + if o.r.Organization == nil { + FieldseekerTimecardMods.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.FieldseekerTimecards.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 } @@ -463,7 +531,10 @@ func (m fieldseekerTimecardMods) RandomizeAllColumns(f *faker.Faker) Fieldseeker FieldseekerTimecardMods.RandomEditdate(f), FieldseekerTimecardMods.RandomEditor(f), FieldseekerTimecardMods.RandomRodentlocid(f), + FieldseekerTimecardMods.RandomGeometry(f), + FieldseekerTimecardMods.RandomGeospatial(f), FieldseekerTimecardMods.RandomVersion(f), + FieldseekerTimecardMods.RandomOrganizationID(f), } } @@ -499,16 +570,14 @@ func (m fieldseekerTimecardMods) RandomObjectid(f *faker.Faker) FieldseekerTimec } // Set the model columns to this value -func (m fieldseekerTimecardMods) Activity(val null.Val[enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu]) FieldseekerTimecardMod { +func (m fieldseekerTimecardMods) Activity(val null.Val[string]) FieldseekerTimecardMod { return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Activity = func() null.Val[enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu] { - return val - } + o.Activity = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTimecardMods) ActivityFunc(f func() null.Val[enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu]) FieldseekerTimecardMod { +func (m fieldseekerTimecardMods) ActivityFunc(f func() null.Val[string]) FieldseekerTimecardMod { return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { o.Activity = f }) @@ -526,12 +595,12 @@ func (m fieldseekerTimecardMods) UnsetActivity() FieldseekerTimecardMod { // The generated value is sometimes null func (m fieldseekerTimecardMods) RandomActivity(f *faker.Faker) FieldseekerTimecardMod { return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Activity = func() null.Val[enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu] { + o.Activity = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu(f) + val := random_string(f, "25") return null.From(val) } }) @@ -542,12 +611,12 @@ func (m fieldseekerTimecardMods) RandomActivity(f *faker.Faker) FieldseekerTimec // The generated value is never null func (m fieldseekerTimecardMods) RandomActivityNotNull(f *faker.Faker) FieldseekerTimecardMod { return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Activity = func() null.Val[enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu] { + o.Activity = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu(f) + val := random_string(f, "25") return null.From(val) } }) @@ -766,14 +835,14 @@ func (m fieldseekerTimecardMods) RandomExternalidNotNull(f *faker.Faker) Fieldse } // Set the model columns to this value -func (m fieldseekerTimecardMods) Equiptype(val null.Val[enums.FieldseekerTimecardTimecardequipmenttypeEnum]) FieldseekerTimecardMod { +func (m fieldseekerTimecardMods) Equiptype(val null.Val[string]) FieldseekerTimecardMod { return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Equiptype = func() null.Val[enums.FieldseekerTimecardTimecardequipmenttypeEnum] { return val } + o.Equiptype = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTimecardMods) EquiptypeFunc(f func() null.Val[enums.FieldseekerTimecardTimecardequipmenttypeEnum]) FieldseekerTimecardMod { +func (m fieldseekerTimecardMods) EquiptypeFunc(f func() null.Val[string]) FieldseekerTimecardMod { return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { o.Equiptype = f }) @@ -791,12 +860,12 @@ func (m fieldseekerTimecardMods) UnsetEquiptype() FieldseekerTimecardMod { // The generated value is sometimes null func (m fieldseekerTimecardMods) RandomEquiptype(f *faker.Faker) FieldseekerTimecardMod { return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Equiptype = func() null.Val[enums.FieldseekerTimecardTimecardequipmenttypeEnum] { + o.Equiptype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTimecardTimecardequipmenttypeEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -807,12 +876,12 @@ func (m fieldseekerTimecardMods) RandomEquiptype(f *faker.Faker) FieldseekerTime // The generated value is never null func (m fieldseekerTimecardMods) RandomEquiptypeNotNull(f *faker.Faker) FieldseekerTimecardMod { return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Equiptype = func() null.Val[enums.FieldseekerTimecardTimecardequipmenttypeEnum] { + o.Equiptype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTimecardTimecardequipmenttypeEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1931,6 +2000,90 @@ func (m fieldseekerTimecardMods) RandomRodentlocidNotNull(f *faker.Faker) Fields }) } +// Set the model columns to this value +func (m fieldseekerTimecardMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerTimecardMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerTimecardMods) UnsetGeometry() FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerTimecardMods) RandomGeometry(f *faker.Faker) FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerTimecardMods) Geospatial(val null.Val[string]) FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerTimecardMods) GeospatialFunc(f func() null.Val[string]) FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerTimecardMods) UnsetGeospatial() FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerTimecardMods) RandomGeospatial(f *faker.Faker) FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerTimecardMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { + o.Geospatial = 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 fieldseekerTimecardMods) Version(val int32) FieldseekerTimecardMod { return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { @@ -1962,11 +2115,77 @@ func (m fieldseekerTimecardMods) RandomVersion(f *faker.Faker) FieldseekerTimeca }) } +// Set the model columns to this value +func (m fieldseekerTimecardMods) OrganizationID(val int32) FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerTimecardMods) OrganizationIDFunc(f func() int32) FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerTimecardMods) UnsetOrganizationID() FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { + 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 fieldseekerTimecardMods) RandomOrganizationID(f *faker.Faker) FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerTimecardMods) WithParentsCascading() FieldseekerTimecardMod { return FieldseekerTimecardModFunc(func(ctx context.Context, o *FieldseekerTimecardTemplate) { if isDone, _ := fieldseekerTimecardWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerTimecardWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerTimecardMods) WithOrganization(rel *OrganizationTemplate) FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(ctx context.Context, o *FieldseekerTimecardTemplate) { + o.r.Organization = &fieldseekerTimecardROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerTimecardMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(ctx context.Context, o *FieldseekerTimecardTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerTimecardMods) WithExistingOrganization(em *models.Organization) FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(ctx context.Context, o *FieldseekerTimecardTemplate) { + o.r.Organization = &fieldseekerTimecardROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerTimecardMods) WithoutOrganization() FieldseekerTimecardMod { + return FieldseekerTimecardModFunc(func(ctx context.Context, o *FieldseekerTimecardTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.trapdata.bob.go b/db/factory/fieldseeker.trapdata.bob.go index 6d94b410..1bb0abd4 100644 --- a/db/factory/fieldseeker.trapdata.bob.go +++ b/db/factory/fieldseeker.trapdata.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerTrapdatumMod interface { @@ -40,21 +41,21 @@ func (mods FieldseekerTrapdatumModSlice) Apply(ctx context.Context, n *Fieldseek // all columns are optional and should be set by mods type FieldseekerTrapdatumTemplate struct { Objectid func() int64 - Traptype func() null.Val[enums.FieldseekerTrapdataMosquitotraptypeEnum] - Trapactivitytype func() null.Val[enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum] + Traptype func() null.Val[string] + Trapactivitytype func() null.Val[string] Startdatetime func() null.Val[time.Time] Enddatetime func() null.Val[time.Time] Comments func() null.Val[string] Idbytech func() null.Val[string] Sortbytech func() null.Val[string] - Processed func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum] - Sitecond func() null.Val[enums.FieldseekerTrapdataMosquitositeconditionEnum] + Processed func() null.Val[int16] + Sitecond func() null.Val[string] Locationname func() null.Val[string] Recordstatus func() null.Val[int16] - Reviewed func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum] + Reviewed func() null.Val[int16] Reviewedby func() null.Val[string] Revieweddate func() null.Val[time.Time] - Trapcondition func() null.Val[enums.FieldseekerTrapdataMosquitotrapconditionEnum] + Trapcondition func() null.Val[string] Trapnights func() null.Val[int16] Zone func() null.Val[string] Zone2 func() null.Val[string] @@ -68,7 +69,7 @@ type FieldseekerTrapdatumTemplate struct { Gatewaysync func() null.Val[int16] LocID func() null.Val[uuid.UUID] Voltage func() null.Val[float64] - Winddir func() null.Val[enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166] + Winddir func() null.Val[string] Windspeed func() null.Val[float64] Avetemp func() null.Val[float64] Raingauge func() null.Val[float64] @@ -80,14 +81,26 @@ type FieldseekerTrapdatumTemplate struct { Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] - Lure func() null.Val[enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu] + Lure func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerTrapdatumR f *Factory alreadyPersisted bool } +type fieldseekerTrapdatumR struct { + Organization *fieldseekerTrapdatumROrganizationR +} + +type fieldseekerTrapdatumROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerTrapdatumTemplate func (o *FieldseekerTrapdatumTemplate) Apply(ctx context.Context, mods ...FieldseekerTrapdatumMod) { for _, mod := range mods { @@ -97,7 +110,14 @@ func (o *FieldseekerTrapdatumTemplate) Apply(ctx context.Context, mods ...Fields // setModelRels creates and sets the relationships on *models.FieldseekerTrapdatum // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerTrapdatumTemplate) setModelRels(o *models.FieldseekerTrapdatum) {} +func (t FieldseekerTrapdatumTemplate) setModelRels(o *models.FieldseekerTrapdatum) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Trapdata = append(rel.R.Trapdata, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerTrapdatumSetter // this does nothing with the relationship templates @@ -272,10 +292,22 @@ func (o FieldseekerTrapdatumTemplate) BuildSetter() *models.FieldseekerTrapdatum val := o.Lure() m.Lure = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -424,9 +456,18 @@ func (o FieldseekerTrapdatumTemplate) Build() *models.FieldseekerTrapdatum { if o.Lure != nil { m.Lure = o.Lure() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -447,6 +488,14 @@ func (o FieldseekerTrapdatumTemplate) BuildMany(number int) models.FieldseekerTr } func ensureCreatableFieldseekerTrapdatum(m *models.FieldseekerTrapdatumSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerTrapdatum @@ -465,11 +514,30 @@ func (o *FieldseekerTrapdatumTemplate) Create(ctx context.Context, exec bob.Exec opt := o.BuildSetter() ensureCreatableFieldseekerTrapdatum(opt) + if o.r.Organization == nil { + FieldseekerTrapdatumMods.WithNewOrganization().Apply(ctx, o) + } + + var rel0 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel0 = o.r.Organization.o.Build() + } else { + rel0, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel0.ID) + m, err := models.FieldseekerTrapdata.Insert(opt).One(ctx, exec) if err != nil { return nil, err } + m.R.Organization = rel0 + if err := o.insertOptRels(ctx, exec, m); err != nil { return nil, err } @@ -589,7 +657,10 @@ func (m fieldseekerTrapdatumMods) RandomizeAllColumns(f *faker.Faker) Fieldseeke FieldseekerTrapdatumMods.RandomEditdate(f), FieldseekerTrapdatumMods.RandomEditor(f), FieldseekerTrapdatumMods.RandomLure(f), + FieldseekerTrapdatumMods.RandomGeometry(f), + FieldseekerTrapdatumMods.RandomGeospatial(f), FieldseekerTrapdatumMods.RandomVersion(f), + FieldseekerTrapdatumMods.RandomOrganizationID(f), } } @@ -625,14 +696,14 @@ func (m fieldseekerTrapdatumMods) RandomObjectid(f *faker.Faker) FieldseekerTrap } // Set the model columns to this value -func (m fieldseekerTrapdatumMods) Traptype(val null.Val[enums.FieldseekerTrapdataMosquitotraptypeEnum]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) Traptype(val null.Val[string]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Traptype = func() null.Val[enums.FieldseekerTrapdataMosquitotraptypeEnum] { return val } + o.Traptype = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTrapdatumMods) TraptypeFunc(f func() null.Val[enums.FieldseekerTrapdataMosquitotraptypeEnum]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) TraptypeFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { o.Traptype = f }) @@ -650,12 +721,12 @@ func (m fieldseekerTrapdatumMods) UnsetTraptype() FieldseekerTrapdatumMod { // The generated value is sometimes null func (m fieldseekerTrapdatumMods) RandomTraptype(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Traptype = func() null.Val[enums.FieldseekerTrapdataMosquitotraptypeEnum] { + o.Traptype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataMosquitotraptypeEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -666,26 +737,26 @@ func (m fieldseekerTrapdatumMods) RandomTraptype(f *faker.Faker) FieldseekerTrap // The generated value is never null func (m fieldseekerTrapdatumMods) RandomTraptypeNotNull(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Traptype = func() null.Val[enums.FieldseekerTrapdataMosquitotraptypeEnum] { + o.Traptype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataMosquitotraptypeEnum(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerTrapdatumMods) Trapactivitytype(val null.Val[enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) Trapactivitytype(val null.Val[string]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapactivitytype = func() null.Val[enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum] { return val } + o.Trapactivitytype = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTrapdatumMods) TrapactivitytypeFunc(f func() null.Val[enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) TrapactivitytypeFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { o.Trapactivitytype = f }) @@ -703,12 +774,12 @@ func (m fieldseekerTrapdatumMods) UnsetTrapactivitytype() FieldseekerTrapdatumMo // The generated value is sometimes null func (m fieldseekerTrapdatumMods) RandomTrapactivitytype(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapactivitytype = func() null.Val[enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum] { + o.Trapactivitytype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataNotinuitrapactivitytypeEnum(f) + val := random_string(f, "1") return null.From(val) } }) @@ -719,12 +790,12 @@ func (m fieldseekerTrapdatumMods) RandomTrapactivitytype(f *faker.Faker) Fieldse // The generated value is never null func (m fieldseekerTrapdatumMods) RandomTrapactivitytypeNotNull(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapactivitytype = func() null.Val[enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum] { + o.Trapactivitytype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataNotinuitrapactivitytypeEnum(f) + val := random_string(f, "1") return null.From(val) } }) @@ -996,14 +1067,14 @@ func (m fieldseekerTrapdatumMods) RandomSortbytechNotNull(f *faker.Faker) Fields } // Set the model columns to this value -func (m fieldseekerTrapdatumMods) Processed(val null.Val[enums.FieldseekerTrapdataNotinuitFEnum]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) Processed(val null.Val[int16]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Processed = func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum] { return val } + o.Processed = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerTrapdatumMods) ProcessedFunc(f func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) ProcessedFunc(f func() null.Val[int16]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { o.Processed = f }) @@ -1021,12 +1092,12 @@ func (m fieldseekerTrapdatumMods) UnsetProcessed() FieldseekerTrapdatumMod { // The generated value is sometimes null func (m fieldseekerTrapdatumMods) RandomProcessed(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Processed = func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum] { + o.Processed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1037,26 +1108,26 @@ func (m fieldseekerTrapdatumMods) RandomProcessed(f *faker.Faker) FieldseekerTra // The generated value is never null func (m fieldseekerTrapdatumMods) RandomProcessedNotNull(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Processed = func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum] { + o.Processed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerTrapdatumMods) Sitecond(val null.Val[enums.FieldseekerTrapdataMosquitositeconditionEnum]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) Sitecond(val null.Val[string]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Sitecond = func() null.Val[enums.FieldseekerTrapdataMosquitositeconditionEnum] { return val } + o.Sitecond = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTrapdatumMods) SitecondFunc(f func() null.Val[enums.FieldseekerTrapdataMosquitositeconditionEnum]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) SitecondFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { o.Sitecond = f }) @@ -1074,12 +1145,12 @@ func (m fieldseekerTrapdatumMods) UnsetSitecond() FieldseekerTrapdatumMod { // The generated value is sometimes null func (m fieldseekerTrapdatumMods) RandomSitecond(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Sitecond = func() null.Val[enums.FieldseekerTrapdataMosquitositeconditionEnum] { + o.Sitecond = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataMosquitositeconditionEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1090,12 +1161,12 @@ func (m fieldseekerTrapdatumMods) RandomSitecond(f *faker.Faker) FieldseekerTrap // The generated value is never null func (m fieldseekerTrapdatumMods) RandomSitecondNotNull(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Sitecond = func() null.Val[enums.FieldseekerTrapdataMosquitositeconditionEnum] { + o.Sitecond = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataMosquitositeconditionEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1208,14 +1279,14 @@ func (m fieldseekerTrapdatumMods) RandomRecordstatusNotNull(f *faker.Faker) Fiel } // Set the model columns to this value -func (m fieldseekerTrapdatumMods) Reviewed(val null.Val[enums.FieldseekerTrapdataNotinuitFEnum]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) Reviewed(val null.Val[int16]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum] { return val } + o.Reviewed = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerTrapdatumMods) ReviewedFunc(f func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) ReviewedFunc(f func() null.Val[int16]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { o.Reviewed = f }) @@ -1233,12 +1304,12 @@ func (m fieldseekerTrapdatumMods) UnsetReviewed() FieldseekerTrapdatumMod { // The generated value is sometimes null func (m fieldseekerTrapdatumMods) RandomReviewed(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum] { + o.Reviewed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1249,12 +1320,12 @@ func (m fieldseekerTrapdatumMods) RandomReviewed(f *faker.Faker) FieldseekerTrap // The generated value is never null func (m fieldseekerTrapdatumMods) RandomReviewedNotNull(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerTrapdataNotinuitFEnum] { + o.Reviewed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1367,14 +1438,14 @@ func (m fieldseekerTrapdatumMods) RandomRevieweddateNotNull(f *faker.Faker) Fiel } // Set the model columns to this value -func (m fieldseekerTrapdatumMods) Trapcondition(val null.Val[enums.FieldseekerTrapdataMosquitotrapconditionEnum]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) Trapcondition(val null.Val[string]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapcondition = func() null.Val[enums.FieldseekerTrapdataMosquitotrapconditionEnum] { return val } + o.Trapcondition = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTrapdatumMods) TrapconditionFunc(f func() null.Val[enums.FieldseekerTrapdataMosquitotrapconditionEnum]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) TrapconditionFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { o.Trapcondition = f }) @@ -1392,12 +1463,12 @@ func (m fieldseekerTrapdatumMods) UnsetTrapcondition() FieldseekerTrapdatumMod { // The generated value is sometimes null func (m fieldseekerTrapdatumMods) RandomTrapcondition(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapcondition = func() null.Val[enums.FieldseekerTrapdataMosquitotrapconditionEnum] { + o.Trapcondition = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataMosquitotrapconditionEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1408,12 +1479,12 @@ func (m fieldseekerTrapdatumMods) RandomTrapcondition(f *faker.Faker) Fieldseeke // The generated value is never null func (m fieldseekerTrapdatumMods) RandomTrapconditionNotNull(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapcondition = func() null.Val[enums.FieldseekerTrapdataMosquitotrapconditionEnum] { + o.Trapcondition = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataMosquitotrapconditionEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -2109,14 +2180,14 @@ func (m fieldseekerTrapdatumMods) RandomVoltageNotNull(f *faker.Faker) Fieldseek } // Set the model columns to this value -func (m fieldseekerTrapdatumMods) Winddir(val null.Val[enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) Winddir(val null.Val[string]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Winddir = func() null.Val[enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166] { return val } + o.Winddir = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTrapdatumMods) WinddirFunc(f func() null.Val[enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) WinddirFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { o.Winddir = f }) @@ -2134,12 +2205,12 @@ func (m fieldseekerTrapdatumMods) UnsetWinddir() FieldseekerTrapdatumMod { // The generated value is sometimes null func (m fieldseekerTrapdatumMods) RandomWinddir(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Winddir = func() null.Val[enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166] { + o.Winddir = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166(f) + val := random_string(f, "3") return null.From(val) } }) @@ -2150,12 +2221,12 @@ func (m fieldseekerTrapdatumMods) RandomWinddir(f *faker.Faker) FieldseekerTrapd // The generated value is never null func (m fieldseekerTrapdatumMods) RandomWinddirNotNull(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Winddir = func() null.Val[enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166] { + o.Winddir = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166(f) + val := random_string(f, "3") return null.From(val) } }) @@ -2745,14 +2816,14 @@ func (m fieldseekerTrapdatumMods) RandomEditorNotNull(f *faker.Faker) Fieldseeke } // Set the model columns to this value -func (m fieldseekerTrapdatumMods) Lure(val null.Val[enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) Lure(val null.Val[string]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Lure = func() null.Val[enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu] { return val } + o.Lure = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTrapdatumMods) LureFunc(f func() null.Val[enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu]) FieldseekerTrapdatumMod { +func (m fieldseekerTrapdatumMods) LureFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { o.Lure = f }) @@ -2770,12 +2841,12 @@ func (m fieldseekerTrapdatumMods) UnsetLure() FieldseekerTrapdatumMod { // The generated value is sometimes null func (m fieldseekerTrapdatumMods) RandomLure(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Lure = func() null.Val[enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu] { + o.Lure = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu(f) + val := random_string(f, "256") return null.From(val) } }) @@ -2786,12 +2857,96 @@ func (m fieldseekerTrapdatumMods) RandomLure(f *faker.Faker) FieldseekerTrapdatu // The generated value is never null func (m fieldseekerTrapdatumMods) RandomLureNotNull(f *faker.Faker) FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Lure = func() null.Val[enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu] { + o.Lure = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu(f) + val := random_string(f, "256") + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerTrapdatumMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerTrapdatumMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerTrapdatumMods) UnsetGeometry() FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerTrapdatumMods) RandomGeometry(f *faker.Faker) FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerTrapdatumMods) Geospatial(val null.Val[string]) FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerTrapdatumMods) GeospatialFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerTrapdatumMods) UnsetGeospatial() FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerTrapdatumMods) RandomGeospatial(f *faker.Faker) FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerTrapdatumMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) return null.From(val) } }) @@ -2828,11 +2983,77 @@ func (m fieldseekerTrapdatumMods) RandomVersion(f *faker.Faker) FieldseekerTrapd }) } +// Set the model columns to this value +func (m fieldseekerTrapdatumMods) OrganizationID(val int32) FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerTrapdatumMods) OrganizationIDFunc(f func() int32) FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerTrapdatumMods) UnsetOrganizationID() FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { + o.OrganizationID = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerTrapdatumMods) RandomOrganizationID(f *faker.Faker) FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerTrapdatumMods) WithParentsCascading() FieldseekerTrapdatumMod { return FieldseekerTrapdatumModFunc(func(ctx context.Context, o *FieldseekerTrapdatumTemplate) { if isDone, _ := fieldseekerTrapdatumWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerTrapdatumWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerTrapdatumMods) WithOrganization(rel *OrganizationTemplate) FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(ctx context.Context, o *FieldseekerTrapdatumTemplate) { + o.r.Organization = &fieldseekerTrapdatumROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerTrapdatumMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(ctx context.Context, o *FieldseekerTrapdatumTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerTrapdatumMods) WithExistingOrganization(em *models.Organization) FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(ctx context.Context, o *FieldseekerTrapdatumTemplate) { + o.r.Organization = &fieldseekerTrapdatumROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerTrapdatumMods) WithoutOrganization() FieldseekerTrapdatumMod { + return FieldseekerTrapdatumModFunc(func(ctx context.Context, o *FieldseekerTrapdatumTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.traplocation.bob.go b/db/factory/fieldseeker.traplocation.bob.go index d7bbea66..7587ce56 100644 --- a/db/factory/fieldseeker.traplocation.bob.go +++ b/db/factory/fieldseeker.traplocation.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerTraplocationMod interface { @@ -42,12 +43,12 @@ type FieldseekerTraplocationTemplate struct { Objectid func() int64 Name func() null.Val[string] Zone func() null.Val[string] - Habitat func() null.Val[enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e] - Priority func() null.Val[enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B] - Usetype func() null.Val[enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2] - Active func() null.Val[enums.FieldseekerTraplocationNotinuitFEnum] + Habitat func() null.Val[string] + Priority func() null.Val[string] + Usetype func() null.Val[string] + Active func() null.Val[int16] Description func() null.Val[string] - Accessdesc func() null.Val[enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0] + Accessdesc func() null.Val[string] Comments func() null.Val[string] Externalid func() null.Val[string] Nextactiondatescheduled func() null.Val[time.Time] @@ -69,13 +70,25 @@ type FieldseekerTraplocationTemplate struct { Editor func() null.Val[string] H3R7 func() null.Val[string] H3R8 func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerTraplocationR f *Factory alreadyPersisted bool } +type fieldseekerTraplocationR struct { + Organization *fieldseekerTraplocationROrganizationR +} + +type fieldseekerTraplocationROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerTraplocationTemplate func (o *FieldseekerTraplocationTemplate) Apply(ctx context.Context, mods ...FieldseekerTraplocationMod) { for _, mod := range mods { @@ -85,7 +98,14 @@ func (o *FieldseekerTraplocationTemplate) Apply(ctx context.Context, mods ...Fie // setModelRels creates and sets the relationships on *models.FieldseekerTraplocation // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerTraplocationTemplate) setModelRels(o *models.FieldseekerTraplocation) {} +func (t FieldseekerTraplocationTemplate) setModelRels(o *models.FieldseekerTraplocation) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Traplocations = append(rel.R.Traplocations, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerTraplocationSetter // this does nothing with the relationship templates @@ -212,10 +232,22 @@ func (o FieldseekerTraplocationTemplate) BuildSetter() *models.FieldseekerTraplo val := o.H3R8() m.H3R8 = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -328,9 +360,18 @@ func (o FieldseekerTraplocationTemplate) Build() *models.FieldseekerTraplocation if o.H3R8 != nil { m.H3R8 = o.H3R8() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -351,6 +392,14 @@ func (o FieldseekerTraplocationTemplate) BuildMany(number int) models.Fieldseeke } func ensureCreatableFieldseekerTraplocation(m *models.FieldseekerTraplocationSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerTraplocation @@ -369,11 +418,30 @@ func (o *FieldseekerTraplocationTemplate) Create(ctx context.Context, exec bob.E opt := o.BuildSetter() ensureCreatableFieldseekerTraplocation(opt) + if o.r.Organization == nil { + FieldseekerTraplocationMods.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.FieldseekerTraplocations.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 } @@ -481,7 +549,10 @@ func (m fieldseekerTraplocationMods) RandomizeAllColumns(f *faker.Faker) Fieldse FieldseekerTraplocationMods.RandomEditor(f), FieldseekerTraplocationMods.RandomH3R7(f), FieldseekerTraplocationMods.RandomH3R8(f), + FieldseekerTraplocationMods.RandomGeometry(f), + FieldseekerTraplocationMods.RandomGeospatial(f), FieldseekerTraplocationMods.RandomVersion(f), + FieldseekerTraplocationMods.RandomOrganizationID(f), } } @@ -623,16 +694,14 @@ func (m fieldseekerTraplocationMods) RandomZoneNotNull(f *faker.Faker) Fieldseek } // Set the model columns to this value -func (m fieldseekerTraplocationMods) Habitat(val null.Val[enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e]) FieldseekerTraplocationMod { +func (m fieldseekerTraplocationMods) Habitat(val null.Val[string]) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e] { - return val - } + o.Habitat = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTraplocationMods) HabitatFunc(f func() null.Val[enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e]) FieldseekerTraplocationMod { +func (m fieldseekerTraplocationMods) HabitatFunc(f func() null.Val[string]) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { o.Habitat = f }) @@ -650,12 +719,12 @@ func (m fieldseekerTraplocationMods) UnsetHabitat() FieldseekerTraplocationMod { // The generated value is sometimes null func (m fieldseekerTraplocationMods) RandomHabitat(f *faker.Faker) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e] { + o.Habitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e(f) + val := random_string(f, "25") return null.From(val) } }) @@ -666,28 +735,26 @@ func (m fieldseekerTraplocationMods) RandomHabitat(f *faker.Faker) FieldseekerTr // The generated value is never null func (m fieldseekerTraplocationMods) RandomHabitatNotNull(f *faker.Faker) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e] { + o.Habitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerTraplocationMods) Priority(val null.Val[enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B]) FieldseekerTraplocationMod { +func (m fieldseekerTraplocationMods) Priority(val null.Val[string]) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B] { - return val - } + o.Priority = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTraplocationMods) PriorityFunc(f func() null.Val[enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B]) FieldseekerTraplocationMod { +func (m fieldseekerTraplocationMods) PriorityFunc(f func() null.Val[string]) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { o.Priority = f }) @@ -705,12 +772,12 @@ func (m fieldseekerTraplocationMods) UnsetPriority() FieldseekerTraplocationMod // The generated value is sometimes null func (m fieldseekerTraplocationMods) RandomPriority(f *faker.Faker) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B(f) + val := random_string(f, "25") return null.From(val) } }) @@ -721,28 +788,26 @@ func (m fieldseekerTraplocationMods) RandomPriority(f *faker.Faker) FieldseekerT // The generated value is never null func (m fieldseekerTraplocationMods) RandomPriorityNotNull(f *faker.Faker) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Priority = func() null.Val[enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B] { + o.Priority = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerTraplocationMods) Usetype(val null.Val[enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2]) FieldseekerTraplocationMod { +func (m fieldseekerTraplocationMods) Usetype(val null.Val[string]) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2] { - return val - } + o.Usetype = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTraplocationMods) UsetypeFunc(f func() null.Val[enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2]) FieldseekerTraplocationMod { +func (m fieldseekerTraplocationMods) UsetypeFunc(f func() null.Val[string]) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { o.Usetype = f }) @@ -760,12 +825,12 @@ func (m fieldseekerTraplocationMods) UnsetUsetype() FieldseekerTraplocationMod { // The generated value is sometimes null func (m fieldseekerTraplocationMods) RandomUsetype(f *faker.Faker) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2] { + o.Usetype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2(f) + val := random_string(f, "25") return null.From(val) } }) @@ -776,26 +841,26 @@ func (m fieldseekerTraplocationMods) RandomUsetype(f *faker.Faker) FieldseekerTr // The generated value is never null func (m fieldseekerTraplocationMods) RandomUsetypeNotNull(f *faker.Faker) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Usetype = func() null.Val[enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2] { + o.Usetype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerTraplocationMods) Active(val null.Val[enums.FieldseekerTraplocationNotinuitFEnum]) FieldseekerTraplocationMod { +func (m fieldseekerTraplocationMods) Active(val null.Val[int16]) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerTraplocationNotinuitFEnum] { return val } + o.Active = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerTraplocationMods) ActiveFunc(f func() null.Val[enums.FieldseekerTraplocationNotinuitFEnum]) FieldseekerTraplocationMod { +func (m fieldseekerTraplocationMods) ActiveFunc(f func() null.Val[int16]) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { o.Active = f }) @@ -813,12 +878,12 @@ func (m fieldseekerTraplocationMods) UnsetActive() FieldseekerTraplocationMod { // The generated value is sometimes null func (m fieldseekerTraplocationMods) RandomActive(f *faker.Faker) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerTraplocationNotinuitFEnum] { + o.Active = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTraplocationNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -829,12 +894,12 @@ func (m fieldseekerTraplocationMods) RandomActive(f *faker.Faker) FieldseekerTra // The generated value is never null func (m fieldseekerTraplocationMods) RandomActiveNotNull(f *faker.Faker) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Active = func() null.Val[enums.FieldseekerTraplocationNotinuitFEnum] { + o.Active = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTraplocationNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -894,14 +959,14 @@ func (m fieldseekerTraplocationMods) RandomDescriptionNotNull(f *faker.Faker) Fi } // Set the model columns to this value -func (m fieldseekerTraplocationMods) Accessdesc(val null.Val[enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0]) FieldseekerTraplocationMod { +func (m fieldseekerTraplocationMods) Accessdesc(val null.Val[string]) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Accessdesc = func() null.Val[enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0] { return val } + o.Accessdesc = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTraplocationMods) AccessdescFunc(f func() null.Val[enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0]) FieldseekerTraplocationMod { +func (m fieldseekerTraplocationMods) AccessdescFunc(f func() null.Val[string]) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { o.Accessdesc = f }) @@ -919,12 +984,12 @@ func (m fieldseekerTraplocationMods) UnsetAccessdesc() FieldseekerTraplocationMo // The generated value is sometimes null func (m fieldseekerTraplocationMods) RandomAccessdesc(f *faker.Faker) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Accessdesc = func() null.Val[enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0] { + o.Accessdesc = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0(f) + val := random_string(f, "250") return null.From(val) } }) @@ -935,12 +1000,12 @@ func (m fieldseekerTraplocationMods) RandomAccessdesc(f *faker.Faker) Fieldseeke // The generated value is never null func (m fieldseekerTraplocationMods) RandomAccessdescNotNull(f *faker.Faker) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Accessdesc = func() null.Val[enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0] { + o.Accessdesc = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0(f) + val := random_string(f, "250") return null.From(val) } }) @@ -2059,6 +2124,90 @@ func (m fieldseekerTraplocationMods) RandomH3R8NotNull(f *faker.Faker) Fieldseek }) } +// Set the model columns to this value +func (m fieldseekerTraplocationMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerTraplocationMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerTraplocationMods) UnsetGeometry() FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerTraplocationMods) RandomGeometry(f *faker.Faker) FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerTraplocationMods) Geospatial(val null.Val[string]) FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerTraplocationMods) GeospatialFunc(f func() null.Val[string]) FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerTraplocationMods) UnsetGeospatial() FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerTraplocationMods) RandomGeospatial(f *faker.Faker) FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerTraplocationMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { + o.Geospatial = 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 fieldseekerTraplocationMods) Version(val int32) FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { @@ -2090,11 +2239,77 @@ func (m fieldseekerTraplocationMods) RandomVersion(f *faker.Faker) FieldseekerTr }) } +// Set the model columns to this value +func (m fieldseekerTraplocationMods) OrganizationID(val int32) FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerTraplocationMods) OrganizationIDFunc(f func() int32) FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerTraplocationMods) UnsetOrganizationID() FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { + 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 fieldseekerTraplocationMods) RandomOrganizationID(f *faker.Faker) FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerTraplocationMods) WithParentsCascading() FieldseekerTraplocationMod { return FieldseekerTraplocationModFunc(func(ctx context.Context, o *FieldseekerTraplocationTemplate) { if isDone, _ := fieldseekerTraplocationWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerTraplocationWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerTraplocationMods) WithOrganization(rel *OrganizationTemplate) FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(ctx context.Context, o *FieldseekerTraplocationTemplate) { + o.r.Organization = &fieldseekerTraplocationROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerTraplocationMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(ctx context.Context, o *FieldseekerTraplocationTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerTraplocationMods) WithExistingOrganization(em *models.Organization) FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(ctx context.Context, o *FieldseekerTraplocationTemplate) { + o.r.Organization = &fieldseekerTraplocationROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerTraplocationMods) WithoutOrganization() FieldseekerTraplocationMod { + return FieldseekerTraplocationModFunc(func(ctx context.Context, o *FieldseekerTraplocationTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.treatment.bob.go b/db/factory/fieldseeker.treatment.bob.go index 830f0a80..25eba31b 100644 --- a/db/factory/fieldseeker.treatment.bob.go +++ b/db/factory/fieldseeker.treatment.bob.go @@ -1,21 +1,22 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" models "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerTreatmentMod interface { @@ -40,28 +41,28 @@ func (mods FieldseekerTreatmentModSlice) Apply(ctx context.Context, n *Fieldseek // all columns are optional and should be set by mods type FieldseekerTreatmentTemplate struct { Objectid func() int64 - Activity func() null.Val[enums.FieldseekerTreatmentMosquitoactivityEnum] + Activity func() null.Val[string] Treatarea func() null.Val[float64] - Areaunit func() null.Val[enums.FieldseekerTreatmentMosquitoproductareaunitEnum] + Areaunit func() null.Val[string] Product func() null.Val[string] Qty func() null.Val[float64] - Qtyunit func() null.Val[enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum] - Method func() null.Val[enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu] - Equiptype func() null.Val[enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f] + Qtyunit func() null.Val[string] + Method func() null.Val[string] + Equiptype func() null.Val[string] Comments func() null.Val[string] Avetemp func() null.Val[float64] Windspeed func() null.Val[float64] - Winddir func() null.Val[enums.FieldseekerTreatmentNotinuiwinddirectionEnum] + Winddir func() null.Val[string] Raingauge func() null.Val[float64] Startdatetime func() null.Val[time.Time] Enddatetime func() null.Val[time.Time] InspID func() null.Val[uuid.UUID] - Reviewed func() null.Val[enums.FieldseekerTreatmentNotinuitFEnum] + Reviewed func() null.Val[int16] Reviewedby func() null.Val[string] Revieweddate func() null.Val[time.Time] Locationname func() null.Val[string] Zone func() null.Val[string] - Warningoverride func() null.Val[enums.FieldseekerTreatmentNotinuitFEnum] + Warningoverride func() null.Val[int16] Recordstatus func() null.Val[int16] Zone2 func() null.Val[string] Treatacres func() null.Val[float64] @@ -82,24 +83,36 @@ type FieldseekerTreatmentTemplate struct { Fieldtech func() null.Val[string] Ptaid func() null.Val[uuid.UUID] Flowrate func() null.Val[float64] - Habitat func() null.Val[enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1] + Habitat func() null.Val[string] Treathectares func() null.Val[float64] Invloc func() null.Val[string] - TempSitecond func() null.Val[enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E] - Sitecond func() null.Val[enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E] + TempSitecond func() null.Val[string] + Sitecond func() null.Val[string] Totalcostprodcut func() null.Val[float64] Creationdate func() null.Val[time.Time] Creator func() null.Val[string] Editdate func() null.Val[time.Time] Editor func() null.Val[string] Targetspecies func() null.Val[string] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerTreatmentR f *Factory alreadyPersisted bool } +type fieldseekerTreatmentR struct { + Organization *fieldseekerTreatmentROrganizationR +} + +type fieldseekerTreatmentROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerTreatmentTemplate func (o *FieldseekerTreatmentTemplate) Apply(ctx context.Context, mods ...FieldseekerTreatmentMod) { for _, mod := range mods { @@ -109,7 +122,14 @@ func (o *FieldseekerTreatmentTemplate) Apply(ctx context.Context, mods ...Fields // setModelRels creates and sets the relationships on *models.FieldseekerTreatment // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerTreatmentTemplate) setModelRels(o *models.FieldseekerTreatment) {} +func (t FieldseekerTreatmentTemplate) setModelRels(o *models.FieldseekerTreatment) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Treatments = append(rel.R.Treatments, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerTreatmentSetter // this does nothing with the relationship templates @@ -332,10 +352,22 @@ func (o FieldseekerTreatmentTemplate) BuildSetter() *models.FieldseekerTreatment val := o.Targetspecies() m.Targetspecies = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -520,9 +552,18 @@ func (o FieldseekerTreatmentTemplate) Build() *models.FieldseekerTreatment { if o.Targetspecies != nil { m.Targetspecies = o.Targetspecies() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -543,6 +584,14 @@ func (o FieldseekerTreatmentTemplate) BuildMany(number int) models.FieldseekerTr } func ensureCreatableFieldseekerTreatment(m *models.FieldseekerTreatmentSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerTreatment @@ -561,11 +610,30 @@ func (o *FieldseekerTreatmentTemplate) Create(ctx context.Context, exec bob.Exec opt := o.BuildSetter() ensureCreatableFieldseekerTreatment(opt) + if o.r.Organization == nil { + FieldseekerTreatmentMods.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.FieldseekerTreatments.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 } @@ -697,7 +765,10 @@ func (m fieldseekerTreatmentMods) RandomizeAllColumns(f *faker.Faker) Fieldseeke FieldseekerTreatmentMods.RandomEditdate(f), FieldseekerTreatmentMods.RandomEditor(f), FieldseekerTreatmentMods.RandomTargetspecies(f), + FieldseekerTreatmentMods.RandomGeometry(f), + FieldseekerTreatmentMods.RandomGeospatial(f), FieldseekerTreatmentMods.RandomVersion(f), + FieldseekerTreatmentMods.RandomOrganizationID(f), } } @@ -733,14 +804,14 @@ func (m fieldseekerTreatmentMods) RandomObjectid(f *faker.Faker) FieldseekerTrea } // Set the model columns to this value -func (m fieldseekerTreatmentMods) Activity(val null.Val[enums.FieldseekerTreatmentMosquitoactivityEnum]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) Activity(val null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Activity = func() null.Val[enums.FieldseekerTreatmentMosquitoactivityEnum] { return val } + o.Activity = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTreatmentMods) ActivityFunc(f func() null.Val[enums.FieldseekerTreatmentMosquitoactivityEnum]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) ActivityFunc(f func() null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { o.Activity = f }) @@ -758,12 +829,12 @@ func (m fieldseekerTreatmentMods) UnsetActivity() FieldseekerTreatmentMod { // The generated value is sometimes null func (m fieldseekerTreatmentMods) RandomActivity(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Activity = func() null.Val[enums.FieldseekerTreatmentMosquitoactivityEnum] { + o.Activity = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentMosquitoactivityEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -774,12 +845,12 @@ func (m fieldseekerTreatmentMods) RandomActivity(f *faker.Faker) FieldseekerTrea // The generated value is never null func (m fieldseekerTreatmentMods) RandomActivityNotNull(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Activity = func() null.Val[enums.FieldseekerTreatmentMosquitoactivityEnum] { + o.Activity = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentMosquitoactivityEnum(f) + val := random_string(f, "25") return null.From(val) } }) @@ -839,14 +910,14 @@ func (m fieldseekerTreatmentMods) RandomTreatareaNotNull(f *faker.Faker) Fieldse } // Set the model columns to this value -func (m fieldseekerTreatmentMods) Areaunit(val null.Val[enums.FieldseekerTreatmentMosquitoproductareaunitEnum]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) Areaunit(val null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Areaunit = func() null.Val[enums.FieldseekerTreatmentMosquitoproductareaunitEnum] { return val } + o.Areaunit = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTreatmentMods) AreaunitFunc(f func() null.Val[enums.FieldseekerTreatmentMosquitoproductareaunitEnum]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) AreaunitFunc(f func() null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { o.Areaunit = f }) @@ -864,12 +935,12 @@ func (m fieldseekerTreatmentMods) UnsetAreaunit() FieldseekerTreatmentMod { // The generated value is sometimes null func (m fieldseekerTreatmentMods) RandomAreaunit(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Areaunit = func() null.Val[enums.FieldseekerTreatmentMosquitoproductareaunitEnum] { + o.Areaunit = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentMosquitoproductareaunitEnum(f) + val := random_string(f, "10") return null.From(val) } }) @@ -880,12 +951,12 @@ func (m fieldseekerTreatmentMods) RandomAreaunit(f *faker.Faker) FieldseekerTrea // The generated value is never null func (m fieldseekerTreatmentMods) RandomAreaunitNotNull(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Areaunit = func() null.Val[enums.FieldseekerTreatmentMosquitoproductareaunitEnum] { + o.Areaunit = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentMosquitoproductareaunitEnum(f) + val := random_string(f, "10") return null.From(val) } }) @@ -998,14 +1069,14 @@ func (m fieldseekerTreatmentMods) RandomQtyNotNull(f *faker.Faker) FieldseekerTr } // Set the model columns to this value -func (m fieldseekerTreatmentMods) Qtyunit(val null.Val[enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) Qtyunit(val null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Qtyunit = func() null.Val[enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum] { return val } + o.Qtyunit = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTreatmentMods) QtyunitFunc(f func() null.Val[enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) QtyunitFunc(f func() null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { o.Qtyunit = f }) @@ -1023,12 +1094,12 @@ func (m fieldseekerTreatmentMods) UnsetQtyunit() FieldseekerTreatmentMod { // The generated value is sometimes null func (m fieldseekerTreatmentMods) RandomQtyunit(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Qtyunit = func() null.Val[enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum] { + o.Qtyunit = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentMosquitoproductmeasureunitEnum(f) + val := random_string(f, "10") return null.From(val) } }) @@ -1039,28 +1110,26 @@ func (m fieldseekerTreatmentMods) RandomQtyunit(f *faker.Faker) FieldseekerTreat // The generated value is never null func (m fieldseekerTreatmentMods) RandomQtyunitNotNull(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Qtyunit = func() null.Val[enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum] { + o.Qtyunit = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentMosquitoproductmeasureunitEnum(f) + val := random_string(f, "10") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerTreatmentMods) Method(val null.Val[enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) Method(val null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Method = func() null.Val[enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu] { - return val - } + o.Method = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTreatmentMods) MethodFunc(f func() null.Val[enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) MethodFunc(f func() null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { o.Method = f }) @@ -1078,12 +1147,12 @@ func (m fieldseekerTreatmentMods) UnsetMethod() FieldseekerTreatmentMod { // The generated value is sometimes null func (m fieldseekerTreatmentMods) RandomMethod(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Method = func() null.Val[enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu] { + o.Method = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1094,26 +1163,26 @@ func (m fieldseekerTreatmentMods) RandomMethod(f *faker.Faker) FieldseekerTreatm // The generated value is never null func (m fieldseekerTreatmentMods) RandomMethodNotNull(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Method = func() null.Val[enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu] { + o.Method = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu(f) + val := random_string(f, "25") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerTreatmentMods) Equiptype(val null.Val[enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) Equiptype(val null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Equiptype = func() null.Val[enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f] { return val } + o.Equiptype = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTreatmentMods) EquiptypeFunc(f func() null.Val[enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) EquiptypeFunc(f func() null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { o.Equiptype = f }) @@ -1131,12 +1200,12 @@ func (m fieldseekerTreatmentMods) UnsetEquiptype() FieldseekerTreatmentMod { // The generated value is sometimes null func (m fieldseekerTreatmentMods) RandomEquiptype(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Equiptype = func() null.Val[enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f] { + o.Equiptype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1147,12 +1216,12 @@ func (m fieldseekerTreatmentMods) RandomEquiptype(f *faker.Faker) FieldseekerTre // The generated value is never null func (m fieldseekerTreatmentMods) RandomEquiptypeNotNull(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Equiptype = func() null.Val[enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f] { + o.Equiptype = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f(f) + val := random_string(f, "25") return null.From(val) } }) @@ -1318,14 +1387,14 @@ func (m fieldseekerTreatmentMods) RandomWindspeedNotNull(f *faker.Faker) Fieldse } // Set the model columns to this value -func (m fieldseekerTreatmentMods) Winddir(val null.Val[enums.FieldseekerTreatmentNotinuiwinddirectionEnum]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) Winddir(val null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Winddir = func() null.Val[enums.FieldseekerTreatmentNotinuiwinddirectionEnum] { return val } + o.Winddir = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTreatmentMods) WinddirFunc(f func() null.Val[enums.FieldseekerTreatmentNotinuiwinddirectionEnum]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) WinddirFunc(f func() null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { o.Winddir = f }) @@ -1343,12 +1412,12 @@ func (m fieldseekerTreatmentMods) UnsetWinddir() FieldseekerTreatmentMod { // The generated value is sometimes null func (m fieldseekerTreatmentMods) RandomWinddir(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Winddir = func() null.Val[enums.FieldseekerTreatmentNotinuiwinddirectionEnum] { + o.Winddir = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentNotinuiwinddirectionEnum(f) + val := random_string(f, "3") return null.From(val) } }) @@ -1359,12 +1428,12 @@ func (m fieldseekerTreatmentMods) RandomWinddir(f *faker.Faker) FieldseekerTreat // The generated value is never null func (m fieldseekerTreatmentMods) RandomWinddirNotNull(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Winddir = func() null.Val[enums.FieldseekerTreatmentNotinuiwinddirectionEnum] { + o.Winddir = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentNotinuiwinddirectionEnum(f) + val := random_string(f, "3") return null.From(val) } }) @@ -1583,14 +1652,14 @@ func (m fieldseekerTreatmentMods) RandomInspIDNotNull(f *faker.Faker) Fieldseeke } // Set the model columns to this value -func (m fieldseekerTreatmentMods) Reviewed(val null.Val[enums.FieldseekerTreatmentNotinuitFEnum]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) Reviewed(val null.Val[int16]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerTreatmentNotinuitFEnum] { return val } + o.Reviewed = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerTreatmentMods) ReviewedFunc(f func() null.Val[enums.FieldseekerTreatmentNotinuitFEnum]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) ReviewedFunc(f func() null.Val[int16]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { o.Reviewed = f }) @@ -1608,12 +1677,12 @@ func (m fieldseekerTreatmentMods) UnsetReviewed() FieldseekerTreatmentMod { // The generated value is sometimes null func (m fieldseekerTreatmentMods) RandomReviewed(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerTreatmentNotinuitFEnum] { + o.Reviewed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1624,12 +1693,12 @@ func (m fieldseekerTreatmentMods) RandomReviewed(f *faker.Faker) FieldseekerTrea // The generated value is never null func (m fieldseekerTreatmentMods) RandomReviewedNotNull(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Reviewed = func() null.Val[enums.FieldseekerTreatmentNotinuitFEnum] { + o.Reviewed = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1848,14 +1917,14 @@ func (m fieldseekerTreatmentMods) RandomZoneNotNull(f *faker.Faker) FieldseekerT } // Set the model columns to this value -func (m fieldseekerTreatmentMods) Warningoverride(val null.Val[enums.FieldseekerTreatmentNotinuitFEnum]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) Warningoverride(val null.Val[int16]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Warningoverride = func() null.Val[enums.FieldseekerTreatmentNotinuitFEnum] { return val } + o.Warningoverride = func() null.Val[int16] { return val } }) } // Set the Column from the function -func (m fieldseekerTreatmentMods) WarningoverrideFunc(f func() null.Val[enums.FieldseekerTreatmentNotinuitFEnum]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) WarningoverrideFunc(f func() null.Val[int16]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { o.Warningoverride = f }) @@ -1873,12 +1942,12 @@ func (m fieldseekerTreatmentMods) UnsetWarningoverride() FieldseekerTreatmentMod // The generated value is sometimes null func (m fieldseekerTreatmentMods) RandomWarningoverride(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Warningoverride = func() null.Val[enums.FieldseekerTreatmentNotinuitFEnum] { + o.Warningoverride = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -1889,12 +1958,12 @@ func (m fieldseekerTreatmentMods) RandomWarningoverride(f *faker.Faker) Fieldsee // The generated value is never null func (m fieldseekerTreatmentMods) RandomWarningoverrideNotNull(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Warningoverride = func() null.Val[enums.FieldseekerTreatmentNotinuitFEnum] { + o.Warningoverride = func() null.Val[int16] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentNotinuitFEnum(f) + val := random_int16(f) return null.From(val) } }) @@ -2961,14 +3030,14 @@ func (m fieldseekerTreatmentMods) RandomFlowrateNotNull(f *faker.Faker) Fieldsee } // Set the model columns to this value -func (m fieldseekerTreatmentMods) Habitat(val null.Val[enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) Habitat(val null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1] { return val } + o.Habitat = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTreatmentMods) HabitatFunc(f func() null.Val[enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) HabitatFunc(f func() null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { o.Habitat = f }) @@ -2986,12 +3055,12 @@ func (m fieldseekerTreatmentMods) UnsetHabitat() FieldseekerTreatmentMod { // The generated value is sometimes null func (m fieldseekerTreatmentMods) RandomHabitat(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1] { + o.Habitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1(f) + val := random_string(f, "250") return null.From(val) } }) @@ -3002,12 +3071,12 @@ func (m fieldseekerTreatmentMods) RandomHabitat(f *faker.Faker) FieldseekerTreat // The generated value is never null func (m fieldseekerTreatmentMods) RandomHabitatNotNull(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Habitat = func() null.Val[enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1] { + o.Habitat = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1(f) + val := random_string(f, "250") return null.From(val) } }) @@ -3120,16 +3189,14 @@ func (m fieldseekerTreatmentMods) RandomInvlocNotNull(f *faker.Faker) Fieldseeke } // Set the model columns to this value -func (m fieldseekerTreatmentMods) TempSitecond(val null.Val[enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) TempSitecond(val null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.TempSitecond = func() null.Val[enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E] { - return val - } + o.TempSitecond = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTreatmentMods) TempSitecondFunc(f func() null.Val[enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) TempSitecondFunc(f func() null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { o.TempSitecond = f }) @@ -3147,12 +3214,12 @@ func (m fieldseekerTreatmentMods) UnsetTempSitecond() FieldseekerTreatmentMod { // The generated value is sometimes null func (m fieldseekerTreatmentMods) RandomTempSitecond(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.TempSitecond = func() null.Val[enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E] { + o.TempSitecond = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E(f) + val := random_string(f, "250") return null.From(val) } }) @@ -3163,28 +3230,26 @@ func (m fieldseekerTreatmentMods) RandomTempSitecond(f *faker.Faker) Fieldseeker // The generated value is never null func (m fieldseekerTreatmentMods) RandomTempSitecondNotNull(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.TempSitecond = func() null.Val[enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E] { + o.TempSitecond = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E(f) + val := random_string(f, "250") return null.From(val) } }) } // Set the model columns to this value -func (m fieldseekerTreatmentMods) Sitecond(val null.Val[enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) Sitecond(val null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Sitecond = func() null.Val[enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E] { - return val - } + o.Sitecond = func() null.Val[string] { return val } }) } // Set the Column from the function -func (m fieldseekerTreatmentMods) SitecondFunc(f func() null.Val[enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E]) FieldseekerTreatmentMod { +func (m fieldseekerTreatmentMods) SitecondFunc(f func() null.Val[string]) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { o.Sitecond = f }) @@ -3202,12 +3267,12 @@ func (m fieldseekerTreatmentMods) UnsetSitecond() FieldseekerTreatmentMod { // The generated value is sometimes null func (m fieldseekerTreatmentMods) RandomSitecond(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Sitecond = func() null.Val[enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E] { + o.Sitecond = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E(f) + val := random_string(f, "250") return null.From(val) } }) @@ -3218,12 +3283,12 @@ func (m fieldseekerTreatmentMods) RandomSitecond(f *faker.Faker) FieldseekerTrea // The generated value is never null func (m fieldseekerTreatmentMods) RandomSitecondNotNull(f *faker.Faker) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Sitecond = func() null.Val[enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E] { + o.Sitecond = func() null.Val[string] { if f == nil { f = &defaultFaker } - val := random_enums_FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E(f) + val := random_string(f, "250") return null.From(val) } }) @@ -3547,6 +3612,90 @@ func (m fieldseekerTreatmentMods) RandomTargetspeciesNotNull(f *faker.Faker) Fie }) } +// Set the model columns to this value +func (m fieldseekerTreatmentMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerTreatmentMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerTreatmentMods) UnsetGeometry() FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerTreatmentMods) RandomGeometry(f *faker.Faker) FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerTreatmentMods) Geospatial(val null.Val[string]) FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerTreatmentMods) GeospatialFunc(f func() null.Val[string]) FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerTreatmentMods) UnsetGeospatial() FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerTreatmentMods) RandomGeospatial(f *faker.Faker) FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerTreatmentMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { + o.Geospatial = 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 fieldseekerTreatmentMods) Version(val int32) FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { @@ -3578,11 +3727,77 @@ func (m fieldseekerTreatmentMods) RandomVersion(f *faker.Faker) FieldseekerTreat }) } +// Set the model columns to this value +func (m fieldseekerTreatmentMods) OrganizationID(val int32) FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerTreatmentMods) OrganizationIDFunc(f func() int32) FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerTreatmentMods) UnsetOrganizationID() FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { + 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 fieldseekerTreatmentMods) RandomOrganizationID(f *faker.Faker) FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerTreatmentMods) WithParentsCascading() FieldseekerTreatmentMod { return FieldseekerTreatmentModFunc(func(ctx context.Context, o *FieldseekerTreatmentTemplate) { if isDone, _ := fieldseekerTreatmentWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerTreatmentWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerTreatmentMods) WithOrganization(rel *OrganizationTemplate) FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(ctx context.Context, o *FieldseekerTreatmentTemplate) { + o.r.Organization = &fieldseekerTreatmentROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerTreatmentMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(ctx context.Context, o *FieldseekerTreatmentTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerTreatmentMods) WithExistingOrganization(em *models.Organization) FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(ctx context.Context, o *FieldseekerTreatmentTemplate) { + o.r.Organization = &fieldseekerTreatmentROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerTreatmentMods) WithoutOrganization() FieldseekerTreatmentMod { + return FieldseekerTreatmentModFunc(func(ctx context.Context, o *FieldseekerTreatmentTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.treatmentarea.bob.go b/db/factory/fieldseeker.treatmentarea.bob.go index b2ae78f3..e635cb31 100644 --- a/db/factory/fieldseeker.treatmentarea.bob.go +++ b/db/factory/fieldseeker.treatmentarea.bob.go @@ -1,10 +1,11 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" @@ -12,9 +13,10 @@ import ( "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerTreatmentareaMod interface { @@ -56,13 +58,25 @@ type FieldseekerTreatmentareaTemplate struct { Editor func() null.Val[string] ShapeArea func() null.Val[float64] ShapeLength func() null.Val[float64] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerTreatmentareaR f *Factory alreadyPersisted bool } +type fieldseekerTreatmentareaR struct { + Organization *fieldseekerTreatmentareaROrganizationR +} + +type fieldseekerTreatmentareaROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerTreatmentareaTemplate func (o *FieldseekerTreatmentareaTemplate) Apply(ctx context.Context, mods ...FieldseekerTreatmentareaMod) { for _, mod := range mods { @@ -72,7 +86,14 @@ func (o *FieldseekerTreatmentareaTemplate) Apply(ctx context.Context, mods ...Fi // setModelRels creates and sets the relationships on *models.FieldseekerTreatmentarea // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerTreatmentareaTemplate) setModelRels(o *models.FieldseekerTreatmentarea) {} +func (t FieldseekerTreatmentareaTemplate) setModelRels(o *models.FieldseekerTreatmentarea) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Treatmentareas = append(rel.R.Treatmentareas, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerTreatmentareaSetter // this does nothing with the relationship templates @@ -151,10 +172,22 @@ func (o FieldseekerTreatmentareaTemplate) BuildSetter() *models.FieldseekerTreat val := o.ShapeLength() m.ShapeLength = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -231,9 +264,18 @@ func (o FieldseekerTreatmentareaTemplate) Build() *models.FieldseekerTreatmentar if o.ShapeLength != nil { m.ShapeLength = o.ShapeLength() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -254,6 +296,14 @@ func (o FieldseekerTreatmentareaTemplate) BuildMany(number int) models.Fieldseek } func ensureCreatableFieldseekerTreatmentarea(m *models.FieldseekerTreatmentareaSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerTreatmentarea @@ -272,11 +322,30 @@ func (o *FieldseekerTreatmentareaTemplate) Create(ctx context.Context, exec bob. opt := o.BuildSetter() ensureCreatableFieldseekerTreatmentarea(opt) + if o.r.Organization == nil { + FieldseekerTreatmentareaMods.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.FieldseekerTreatmentareas.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 } @@ -372,7 +441,10 @@ func (m fieldseekerTreatmentareaMods) RandomizeAllColumns(f *faker.Faker) Fields FieldseekerTreatmentareaMods.RandomEditor(f), FieldseekerTreatmentareaMods.RandomShapeArea(f), FieldseekerTreatmentareaMods.RandomShapeLength(f), + FieldseekerTreatmentareaMods.RandomGeometry(f), + FieldseekerTreatmentareaMods.RandomGeospatial(f), FieldseekerTreatmentareaMods.RandomVersion(f), + FieldseekerTreatmentareaMods.RandomOrganizationID(f), } } @@ -1308,6 +1380,90 @@ func (m fieldseekerTreatmentareaMods) RandomShapeLengthNotNull(f *faker.Faker) F }) } +// Set the model columns to this value +func (m fieldseekerTreatmentareaMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerTreatmentareaMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerTreatmentareaMods) UnsetGeometry() FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerTreatmentareaMods) RandomGeometry(f *faker.Faker) FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerTreatmentareaMods) Geospatial(val null.Val[string]) FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerTreatmentareaMods) GeospatialFunc(f func() null.Val[string]) FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerTreatmentareaMods) UnsetGeospatial() FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerTreatmentareaMods) RandomGeospatial(f *faker.Faker) FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerTreatmentareaMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { + o.Geospatial = 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 fieldseekerTreatmentareaMods) Version(val int32) FieldseekerTreatmentareaMod { return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { @@ -1339,11 +1495,77 @@ func (m fieldseekerTreatmentareaMods) RandomVersion(f *faker.Faker) FieldseekerT }) } +// Set the model columns to this value +func (m fieldseekerTreatmentareaMods) OrganizationID(val int32) FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerTreatmentareaMods) OrganizationIDFunc(f func() int32) FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerTreatmentareaMods) UnsetOrganizationID() FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { + 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 fieldseekerTreatmentareaMods) RandomOrganizationID(f *faker.Faker) FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerTreatmentareaMods) WithParentsCascading() FieldseekerTreatmentareaMod { return FieldseekerTreatmentareaModFunc(func(ctx context.Context, o *FieldseekerTreatmentareaTemplate) { if isDone, _ := fieldseekerTreatmentareaWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerTreatmentareaWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerTreatmentareaMods) WithOrganization(rel *OrganizationTemplate) FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(ctx context.Context, o *FieldseekerTreatmentareaTemplate) { + o.r.Organization = &fieldseekerTreatmentareaROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerTreatmentareaMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(ctx context.Context, o *FieldseekerTreatmentareaTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerTreatmentareaMods) WithExistingOrganization(em *models.Organization) FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(ctx context.Context, o *FieldseekerTreatmentareaTemplate) { + o.r.Organization = &fieldseekerTreatmentareaROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerTreatmentareaMods) WithoutOrganization() FieldseekerTreatmentareaMod { + return FieldseekerTreatmentareaModFunc(func(ctx context.Context, o *FieldseekerTreatmentareaTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.zones.bob.go b/db/factory/fieldseeker.zones.bob.go index eccd682d..fad1a4f0 100644 --- a/db/factory/fieldseeker.zones.bob.go +++ b/db/factory/fieldseeker.zones.bob.go @@ -1,10 +1,11 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" @@ -12,9 +13,10 @@ import ( "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerZoneMod interface { @@ -52,13 +54,25 @@ type FieldseekerZoneTemplate struct { Editor func() null.Val[string] ShapeArea func() null.Val[float64] ShapeLength func() null.Val[float64] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerZoneR f *Factory alreadyPersisted bool } +type fieldseekerZoneR struct { + Organization *fieldseekerZoneROrganizationR +} + +type fieldseekerZoneROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerZoneTemplate func (o *FieldseekerZoneTemplate) Apply(ctx context.Context, mods ...FieldseekerZoneMod) { for _, mod := range mods { @@ -68,7 +82,14 @@ func (o *FieldseekerZoneTemplate) Apply(ctx context.Context, mods ...Fieldseeker // setModelRels creates and sets the relationships on *models.FieldseekerZone // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerZoneTemplate) setModelRels(o *models.FieldseekerZone) {} +func (t FieldseekerZoneTemplate) setModelRels(o *models.FieldseekerZone) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Zones = append(rel.R.Zones, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerZoneSetter // this does nothing with the relationship templates @@ -131,10 +152,22 @@ func (o FieldseekerZoneTemplate) BuildSetter() *models.FieldseekerZoneSetter { val := o.ShapeLength() m.ShapeLength = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -199,9 +232,18 @@ func (o FieldseekerZoneTemplate) Build() *models.FieldseekerZone { if o.ShapeLength != nil { m.ShapeLength = o.ShapeLength() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -222,6 +264,14 @@ func (o FieldseekerZoneTemplate) BuildMany(number int) models.FieldseekerZoneSli } func ensureCreatableFieldseekerZone(m *models.FieldseekerZoneSetter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerZone @@ -240,11 +290,30 @@ func (o *FieldseekerZoneTemplate) Create(ctx context.Context, exec bob.Executor) opt := o.BuildSetter() ensureCreatableFieldseekerZone(opt) + if o.r.Organization == nil { + FieldseekerZoneMods.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.FieldseekerZones.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 } @@ -336,7 +405,10 @@ func (m fieldseekerZoneMods) RandomizeAllColumns(f *faker.Faker) FieldseekerZone FieldseekerZoneMods.RandomEditor(f), FieldseekerZoneMods.RandomShapeArea(f), FieldseekerZoneMods.RandomShapeLength(f), + FieldseekerZoneMods.RandomGeometry(f), + FieldseekerZoneMods.RandomGeospatial(f), FieldseekerZoneMods.RandomVersion(f), + FieldseekerZoneMods.RandomOrganizationID(f), } } @@ -1060,6 +1132,90 @@ func (m fieldseekerZoneMods) RandomShapeLengthNotNull(f *faker.Faker) Fieldseeke }) } +// Set the model columns to this value +func (m fieldseekerZoneMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerZoneMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerZoneMods) UnsetGeometry() FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerZoneMods) RandomGeometry(f *faker.Faker) FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerZoneMods) Geospatial(val null.Val[string]) FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerZoneMods) GeospatialFunc(f func() null.Val[string]) FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerZoneMods) UnsetGeospatial() FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerZoneMods) RandomGeospatial(f *faker.Faker) FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerZoneMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { + o.Geospatial = 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 fieldseekerZoneMods) Version(val int32) FieldseekerZoneMod { return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { @@ -1091,11 +1247,77 @@ func (m fieldseekerZoneMods) RandomVersion(f *faker.Faker) FieldseekerZoneMod { }) } +// Set the model columns to this value +func (m fieldseekerZoneMods) OrganizationID(val int32) FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerZoneMods) OrganizationIDFunc(f func() int32) FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerZoneMods) UnsetOrganizationID() FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { + 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 fieldseekerZoneMods) RandomOrganizationID(f *faker.Faker) FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerZoneMods) WithParentsCascading() FieldseekerZoneMod { return FieldseekerZoneModFunc(func(ctx context.Context, o *FieldseekerZoneTemplate) { if isDone, _ := fieldseekerZoneWithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerZoneWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerZoneMods) WithOrganization(rel *OrganizationTemplate) FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(ctx context.Context, o *FieldseekerZoneTemplate) { + o.r.Organization = &fieldseekerZoneROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerZoneMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(ctx context.Context, o *FieldseekerZoneTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerZoneMods) WithExistingOrganization(em *models.Organization) FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(ctx context.Context, o *FieldseekerZoneTemplate) { + o.r.Organization = &fieldseekerZoneROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerZoneMods) WithoutOrganization() FieldseekerZoneMod { + return FieldseekerZoneModFunc(func(ctx context.Context, o *FieldseekerZoneTemplate) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker.zones2.bob.go b/db/factory/fieldseeker.zones2.bob.go index ca848ce2..e59f427c 100644 --- a/db/factory/fieldseeker.zones2.bob.go +++ b/db/factory/fieldseeker.zones2.bob.go @@ -1,10 +1,11 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory import ( "context" + "encoding/json" "testing" "time" @@ -12,9 +13,10 @@ import ( "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) type FieldseekerZones2Mod interface { @@ -51,13 +53,25 @@ type FieldseekerZones2Template struct { Editor func() null.Val[string] ShapeArea func() null.Val[float64] ShapeLength func() null.Val[float64] + Geometry func() types.JSON[json.RawMessage] + Geospatial func() null.Val[string] Version func() int32 + OrganizationID func() int32 + r fieldseekerZones2R f *Factory alreadyPersisted bool } +type fieldseekerZones2R struct { + Organization *fieldseekerZones2ROrganizationR +} + +type fieldseekerZones2ROrganizationR struct { + o *OrganizationTemplate +} + // Apply mods to the FieldseekerZones2Template func (o *FieldseekerZones2Template) Apply(ctx context.Context, mods ...FieldseekerZones2Mod) { for _, mod := range mods { @@ -67,7 +81,14 @@ func (o *FieldseekerZones2Template) Apply(ctx context.Context, mods ...Fieldseek // setModelRels creates and sets the relationships on *models.FieldseekerZones2 // according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerZones2Template) setModelRels(o *models.FieldseekerZones2) {} +func (t FieldseekerZones2Template) setModelRels(o *models.FieldseekerZones2) { + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.Zones2s = append(rel.R.Zones2s, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } +} // BuildSetter returns an *models.FieldseekerZones2Setter // this does nothing with the relationship templates @@ -126,10 +147,22 @@ func (o FieldseekerZones2Template) BuildSetter() *models.FieldseekerZones2Setter val := o.ShapeLength() m.ShapeLength = omitnull.FromNull(val) } + if o.Geometry != nil { + val := o.Geometry() + m.Geometry = omit.From(val) + } + if o.Geospatial != nil { + val := o.Geospatial() + m.Geospatial = omitnull.FromNull(val) + } if o.Version != nil { val := o.Version() m.Version = omit.From(val) } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } return m } @@ -191,9 +224,18 @@ func (o FieldseekerZones2Template) Build() *models.FieldseekerZones2 { if o.ShapeLength != nil { m.ShapeLength = o.ShapeLength() } + if o.Geometry != nil { + m.Geometry = o.Geometry() + } + if o.Geospatial != nil { + m.Geospatial = o.Geospatial() + } if o.Version != nil { m.Version = o.Version() } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } o.setModelRels(m) @@ -214,6 +256,14 @@ func (o FieldseekerZones2Template) BuildMany(number int) models.FieldseekerZones } func ensureCreatableFieldseekerZones2(m *models.FieldseekerZones2Setter) { + if !(m.Geometry.IsValue()) { + val := random_types_JSON_json_RawMessage_(nil) + m.Geometry = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.FieldseekerZones2 @@ -232,11 +282,30 @@ func (o *FieldseekerZones2Template) Create(ctx context.Context, exec bob.Executo opt := o.BuildSetter() ensureCreatableFieldseekerZones2(opt) + if o.r.Organization == nil { + FieldseekerZones2Mods.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.FieldseekerZones2s.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 } @@ -327,7 +396,10 @@ func (m fieldseekerZones2Mods) RandomizeAllColumns(f *faker.Faker) FieldseekerZo FieldseekerZones2Mods.RandomEditor(f), FieldseekerZones2Mods.RandomShapeArea(f), FieldseekerZones2Mods.RandomShapeLength(f), + FieldseekerZones2Mods.RandomGeometry(f), + FieldseekerZones2Mods.RandomGeospatial(f), FieldseekerZones2Mods.RandomVersion(f), + FieldseekerZones2Mods.RandomOrganizationID(f), } } @@ -998,6 +1070,90 @@ func (m fieldseekerZones2Mods) RandomShapeLengthNotNull(f *faker.Faker) Fieldsee }) } +// Set the model columns to this value +func (m fieldseekerZones2Mods) Geometry(val types.JSON[json.RawMessage]) FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { + o.Geometry = func() types.JSON[json.RawMessage] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerZones2Mods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { + o.Geometry = f + }) +} + +// Clear any values for the column +func (m fieldseekerZones2Mods) UnsetGeometry() FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { + o.Geometry = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m fieldseekerZones2Mods) RandomGeometry(f *faker.Faker) FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { + o.Geometry = func() types.JSON[json.RawMessage] { + return random_types_JSON_json_RawMessage_(f) + } + }) +} + +// Set the model columns to this value +func (m fieldseekerZones2Mods) Geospatial(val null.Val[string]) FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { + o.Geospatial = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerZones2Mods) GeospatialFunc(f func() null.Val[string]) FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { + o.Geospatial = f + }) +} + +// Clear any values for the column +func (m fieldseekerZones2Mods) UnsetGeospatial() FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { + o.Geospatial = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is sometimes null +func (m fieldseekerZones2Mods) RandomGeospatial(f *faker.Faker) FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { + o.Geospatial = func() null.Val[string] { + if f == nil { + f = &defaultFaker + } + + val := random_string(f) + return null.From(val) + } + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +// The generated value is never null +func (m fieldseekerZones2Mods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { + o.Geospatial = 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 fieldseekerZones2Mods) Version(val int32) FieldseekerZones2Mod { return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { @@ -1029,11 +1185,77 @@ func (m fieldseekerZones2Mods) RandomVersion(f *faker.Faker) FieldseekerZones2Mo }) } +// Set the model columns to this value +func (m fieldseekerZones2Mods) OrganizationID(val int32) FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m fieldseekerZones2Mods) OrganizationIDFunc(f func() int32) FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m fieldseekerZones2Mods) UnsetOrganizationID() FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { + 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 fieldseekerZones2Mods) RandomOrganizationID(f *faker.Faker) FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + func (m fieldseekerZones2Mods) WithParentsCascading() FieldseekerZones2Mod { return FieldseekerZones2ModFunc(func(ctx context.Context, o *FieldseekerZones2Template) { if isDone, _ := fieldseekerZones2WithParentsCascadingCtx.Value(ctx); isDone { return } ctx = fieldseekerZones2WithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m fieldseekerZones2Mods) WithOrganization(rel *OrganizationTemplate) FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(ctx context.Context, o *FieldseekerZones2Template) { + o.r.Organization = &fieldseekerZones2ROrganizationR{ + o: rel, + } + }) +} + +func (m fieldseekerZones2Mods) WithNewOrganization(mods ...OrganizationMod) FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(ctx context.Context, o *FieldseekerZones2Template) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m fieldseekerZones2Mods) WithExistingOrganization(em *models.Organization) FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(ctx context.Context, o *FieldseekerZones2Template) { + o.r.Organization = &fieldseekerZones2ROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m fieldseekerZones2Mods) WithoutOrganization() FieldseekerZones2Mod { + return FieldseekerZones2ModFunc(func(ctx context.Context, o *FieldseekerZones2Template) { + o.r.Organization = nil }) } diff --git a/db/factory/fieldseeker_sync.bob.go b/db/factory/fieldseeker_sync.bob.go index 7e567ea9..58c19f35 100644 --- a/db/factory/fieldseeker_sync.bob.go +++ b/db/factory/fieldseeker_sync.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory diff --git a/db/factory/fs_containerrelate.bob.go b/db/factory/fs_containerrelate.bob.go deleted file mode 100644 index e3dcbabc..00000000 --- a/db/factory/fs_containerrelate.bob.go +++ /dev/null @@ -1,1324 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSContainerrelateMod interface { - Apply(context.Context, *FSContainerrelateTemplate) -} - -type FSContainerrelateModFunc func(context.Context, *FSContainerrelateTemplate) - -func (f FSContainerrelateModFunc) Apply(ctx context.Context, n *FSContainerrelateTemplate) { - f(ctx, n) -} - -type FSContainerrelateModSlice []FSContainerrelateMod - -func (mods FSContainerrelateModSlice) Apply(ctx context.Context, n *FSContainerrelateTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSContainerrelateTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSContainerrelateTemplate struct { - OrganizationID func() int32 - Containertype func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() string - Inspsampleid func() null.Val[string] - Mosquitoinspid func() null.Val[string] - Objectid func() int32 - Treatmentid func() null.Val[string] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Updated func() time.Time - - r fsContainerrelateR - f *Factory - - alreadyPersisted bool -} - -type fsContainerrelateR struct { - Organization *fsContainerrelateROrganizationR -} - -type fsContainerrelateROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSContainerrelateTemplate -func (o *FSContainerrelateTemplate) Apply(ctx context.Context, mods ...FSContainerrelateMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSContainerrelate -// according to the relationships in the template. Nothing is inserted into the db -func (t FSContainerrelateTemplate) setModelRels(o *models.FSContainerrelate) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSContainerrelates = append(rel.R.FSContainerrelates, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSContainerrelateSetter -// this does nothing with the relationship templates -func (o FSContainerrelateTemplate) BuildSetter() *models.FSContainerrelateSetter { - m := &models.FSContainerrelateSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Containertype != nil { - val := o.Containertype() - m.Containertype = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Inspsampleid != nil { - val := o.Inspsampleid() - m.Inspsampleid = omitnull.FromNull(val) - } - if o.Mosquitoinspid != nil { - val := o.Mosquitoinspid() - m.Mosquitoinspid = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Treatmentid != nil { - val := o.Treatmentid() - m.Treatmentid = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSContainerrelateSetter -// this does nothing with the relationship templates -func (o FSContainerrelateTemplate) BuildManySetter(number int) []*models.FSContainerrelateSetter { - m := make([]*models.FSContainerrelateSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSContainerrelate -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSContainerrelateTemplate.Create -func (o FSContainerrelateTemplate) Build() *models.FSContainerrelate { - m := &models.FSContainerrelate{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Containertype != nil { - m.Containertype = o.Containertype() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Inspsampleid != nil { - m.Inspsampleid = o.Inspsampleid() - } - if o.Mosquitoinspid != nil { - m.Mosquitoinspid = o.Mosquitoinspid() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Treatmentid != nil { - m.Treatmentid = o.Treatmentid() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSContainerrelateSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSContainerrelateTemplate.CreateMany -func (o FSContainerrelateTemplate) BuildMany(number int) models.FSContainerrelateSlice { - m := make(models.FSContainerrelateSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSContainerrelate(m *models.FSContainerrelateSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSContainerrelate -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSContainerrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSContainerrelate) error { - var err error - - return err -} - -// Create builds a fsContainerrelate and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSContainerrelateTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSContainerrelate, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSContainerrelate(opt) - - if o.r.Organization == nil { - FSContainerrelateMods.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.FSContainerrelates.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 fsContainerrelate and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSContainerrelateTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSContainerrelate { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsContainerrelate 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 *FSContainerrelateTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSContainerrelate { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsContainerrelates and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSContainerrelateTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSContainerrelateSlice, error) { - var err error - m := make(models.FSContainerrelateSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsContainerrelates and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSContainerrelateTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSContainerrelateSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsContainerrelates 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 FSContainerrelateTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSContainerrelateSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSContainerrelate has methods that act as mods for the FSContainerrelateTemplate -var FSContainerrelateMods fsContainerrelateMods - -type fsContainerrelateMods struct{} - -func (m fsContainerrelateMods) RandomizeAllColumns(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModSlice{ - FSContainerrelateMods.RandomOrganizationID(f), - FSContainerrelateMods.RandomContainertype(f), - FSContainerrelateMods.RandomCreationdate(f), - FSContainerrelateMods.RandomCreator(f), - FSContainerrelateMods.RandomEditdate(f), - FSContainerrelateMods.RandomEditor(f), - FSContainerrelateMods.RandomGlobalid(f), - FSContainerrelateMods.RandomInspsampleid(f), - FSContainerrelateMods.RandomMosquitoinspid(f), - FSContainerrelateMods.RandomObjectid(f), - FSContainerrelateMods.RandomTreatmentid(f), - FSContainerrelateMods.RandomCreatedDate(f), - FSContainerrelateMods.RandomCreatedUser(f), - FSContainerrelateMods.RandomGeometryX(f), - FSContainerrelateMods.RandomGeometryY(f), - FSContainerrelateMods.RandomLastEditedDate(f), - FSContainerrelateMods.RandomLastEditedUser(f), - FSContainerrelateMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsContainerrelateMods) OrganizationID(val int32) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) OrganizationIDFunc(f func() int32) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetOrganizationID() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - 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 fsContainerrelateMods) RandomOrganizationID(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsContainerrelateMods) Containertype(val null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Containertype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) ContainertypeFunc(f func() null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Containertype = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetContainertype() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Containertype = 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 fsContainerrelateMods) RandomContainertype(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Containertype = 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) RandomContainertypeNotNull(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Containertype = 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 fsContainerrelateMods) Creationdate(val null.Val[int64]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) CreationdateFunc(f func() null.Val[int64]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetCreationdate() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Creationdate = 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 fsContainerrelateMods) RandomCreationdate(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsContainerrelateMods) Creator(val null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) CreatorFunc(f func() null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetCreator() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Creator = 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 fsContainerrelateMods) RandomCreator(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Creator = 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 fsContainerrelateMods) Editdate(val null.Val[int64]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) EditdateFunc(f func() null.Val[int64]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetEditdate() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Editdate = 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 fsContainerrelateMods) RandomEditdate(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsContainerrelateMods) Editor(val null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) EditorFunc(f func() null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetEditor() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Editor = 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 fsContainerrelateMods) RandomEditor(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Editor = 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 fsContainerrelateMods) Globalid(val string) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) GlobalidFunc(f func() string) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetGlobalid() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsContainerrelateMods) RandomGlobalid(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsContainerrelateMods) Inspsampleid(val null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Inspsampleid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) InspsampleidFunc(f func() null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Inspsampleid = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetInspsampleid() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Inspsampleid = 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 fsContainerrelateMods) RandomInspsampleid(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Inspsampleid = 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) RandomInspsampleidNotNull(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Inspsampleid = 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 fsContainerrelateMods) Mosquitoinspid(val null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Mosquitoinspid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) MosquitoinspidFunc(f func() null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Mosquitoinspid = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetMosquitoinspid() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Mosquitoinspid = 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 fsContainerrelateMods) RandomMosquitoinspid(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Mosquitoinspid = 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) RandomMosquitoinspidNotNull(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Mosquitoinspid = 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 fsContainerrelateMods) Objectid(val int32) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) ObjectidFunc(f func() int32) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetObjectid() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsContainerrelateMods) RandomObjectid(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsContainerrelateMods) Treatmentid(val null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Treatmentid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) TreatmentidFunc(f func() null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Treatmentid = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetTreatmentid() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Treatmentid = 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 fsContainerrelateMods) RandomTreatmentid(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Treatmentid = 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) RandomTreatmentidNotNull(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Treatmentid = 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 fsContainerrelateMods) CreatedDate(val null.Val[int64]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) CreatedDateFunc(f func() null.Val[int64]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetCreatedDate() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.CreatedDate = 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 fsContainerrelateMods) RandomCreatedDate(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsContainerrelateMods) CreatedUser(val null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) CreatedUserFunc(f func() null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetCreatedUser() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.CreatedUser = 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 fsContainerrelateMods) RandomCreatedUser(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.CreatedUser = 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 fsContainerrelateMods) GeometryX(val null.Val[float64]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) GeometryXFunc(f func() null.Val[float64]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetGeometryX() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.GeometryX = 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 fsContainerrelateMods) RandomGeometryX(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - 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 fsContainerrelateMods) RandomGeometryXNotNull(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.GeometryX = 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 fsContainerrelateMods) GeometryY(val null.Val[float64]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) GeometryYFunc(f func() null.Val[float64]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetGeometryY() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.GeometryY = 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 fsContainerrelateMods) RandomGeometryY(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - 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 fsContainerrelateMods) RandomGeometryYNotNull(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.GeometryY = 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 fsContainerrelateMods) LastEditedDate(val null.Val[int64]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) LastEditedDateFunc(f func() null.Val[int64]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetLastEditedDate() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.LastEditedDate = 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 fsContainerrelateMods) RandomLastEditedDate(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsContainerrelateMods) LastEditedUser(val null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) LastEditedUserFunc(f func() null.Val[string]) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetLastEditedUser() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.LastEditedUser = 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 fsContainerrelateMods) RandomLastEditedUser(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.LastEditedUser = 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 fsContainerrelateMods) Updated(val time.Time) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsContainerrelateMods) UpdatedFunc(f func() time.Time) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsContainerrelateMods) UnsetUpdated() FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsContainerrelateMods) RandomUpdated(f *faker.Faker) FSContainerrelateMod { - return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsContainerrelateMods) WithParentsCascading() FSContainerrelateMod { - return FSContainerrelateModFunc(func(ctx context.Context, o *FSContainerrelateTemplate) { - if isDone, _ := fsContainerrelateWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsContainerrelateWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsContainerrelateMods) WithOrganization(rel *OrganizationTemplate) FSContainerrelateMod { - return FSContainerrelateModFunc(func(ctx context.Context, o *FSContainerrelateTemplate) { - o.r.Organization = &fsContainerrelateROrganizationR{ - o: rel, - } - }) -} - -func (m fsContainerrelateMods) WithNewOrganization(mods ...OrganizationMod) FSContainerrelateMod { - return FSContainerrelateModFunc(func(ctx context.Context, o *FSContainerrelateTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsContainerrelateMods) WithExistingOrganization(em *models.Organization) FSContainerrelateMod { - return FSContainerrelateModFunc(func(ctx context.Context, o *FSContainerrelateTemplate) { - o.r.Organization = &fsContainerrelateROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsContainerrelateMods) WithoutOrganization() FSContainerrelateMod { - return FSContainerrelateModFunc(func(ctx context.Context, o *FSContainerrelateTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_fieldscoutinglog.bob.go b/db/factory/fs_fieldscoutinglog.bob.go deleted file mode 100644 index 10eed1f8..00000000 --- a/db/factory/fs_fieldscoutinglog.bob.go +++ /dev/null @@ -1,1138 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSFieldscoutinglogMod interface { - Apply(context.Context, *FSFieldscoutinglogTemplate) -} - -type FSFieldscoutinglogModFunc func(context.Context, *FSFieldscoutinglogTemplate) - -func (f FSFieldscoutinglogModFunc) Apply(ctx context.Context, n *FSFieldscoutinglogTemplate) { - f(ctx, n) -} - -type FSFieldscoutinglogModSlice []FSFieldscoutinglogMod - -func (mods FSFieldscoutinglogModSlice) Apply(ctx context.Context, n *FSFieldscoutinglogTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSFieldscoutinglogTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSFieldscoutinglogTemplate struct { - OrganizationID func() int32 - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() string - Objectid func() int32 - Status func() null.Val[int16] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Updated func() time.Time - - r fsFieldscoutinglogR - f *Factory - - alreadyPersisted bool -} - -type fsFieldscoutinglogR struct { - Organization *fsFieldscoutinglogROrganizationR -} - -type fsFieldscoutinglogROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSFieldscoutinglogTemplate -func (o *FSFieldscoutinglogTemplate) Apply(ctx context.Context, mods ...FSFieldscoutinglogMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSFieldscoutinglog -// according to the relationships in the template. Nothing is inserted into the db -func (t FSFieldscoutinglogTemplate) setModelRels(o *models.FSFieldscoutinglog) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSFieldscoutinglogs = append(rel.R.FSFieldscoutinglogs, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSFieldscoutinglogSetter -// this does nothing with the relationship templates -func (o FSFieldscoutinglogTemplate) BuildSetter() *models.FSFieldscoutinglogSetter { - m := &models.FSFieldscoutinglogSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Status != nil { - val := o.Status() - m.Status = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSFieldscoutinglogSetter -// this does nothing with the relationship templates -func (o FSFieldscoutinglogTemplate) BuildManySetter(number int) []*models.FSFieldscoutinglogSetter { - m := make([]*models.FSFieldscoutinglogSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSFieldscoutinglog -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSFieldscoutinglogTemplate.Create -func (o FSFieldscoutinglogTemplate) Build() *models.FSFieldscoutinglog { - m := &models.FSFieldscoutinglog{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Status != nil { - m.Status = o.Status() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSFieldscoutinglogSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSFieldscoutinglogTemplate.CreateMany -func (o FSFieldscoutinglogTemplate) BuildMany(number int) models.FSFieldscoutinglogSlice { - m := make(models.FSFieldscoutinglogSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSFieldscoutinglog(m *models.FSFieldscoutinglogSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSFieldscoutinglog -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSFieldscoutinglogTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSFieldscoutinglog) error { - var err error - - return err -} - -// Create builds a fsFieldscoutinglog and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSFieldscoutinglogTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSFieldscoutinglog, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSFieldscoutinglog(opt) - - if o.r.Organization == nil { - FSFieldscoutinglogMods.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.FSFieldscoutinglogs.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 fsFieldscoutinglog and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSFieldscoutinglogTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSFieldscoutinglog { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsFieldscoutinglog 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 *FSFieldscoutinglogTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSFieldscoutinglog { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsFieldscoutinglogs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSFieldscoutinglogTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSFieldscoutinglogSlice, error) { - var err error - m := make(models.FSFieldscoutinglogSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsFieldscoutinglogs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSFieldscoutinglogTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSFieldscoutinglogSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsFieldscoutinglogs 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 FSFieldscoutinglogTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSFieldscoutinglogSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSFieldscoutinglog has methods that act as mods for the FSFieldscoutinglogTemplate -var FSFieldscoutinglogMods fsFieldscoutinglogMods - -type fsFieldscoutinglogMods struct{} - -func (m fsFieldscoutinglogMods) RandomizeAllColumns(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModSlice{ - FSFieldscoutinglogMods.RandomOrganizationID(f), - FSFieldscoutinglogMods.RandomCreationdate(f), - FSFieldscoutinglogMods.RandomCreator(f), - FSFieldscoutinglogMods.RandomEditdate(f), - FSFieldscoutinglogMods.RandomEditor(f), - FSFieldscoutinglogMods.RandomGlobalid(f), - FSFieldscoutinglogMods.RandomObjectid(f), - FSFieldscoutinglogMods.RandomStatus(f), - FSFieldscoutinglogMods.RandomCreatedDate(f), - FSFieldscoutinglogMods.RandomCreatedUser(f), - FSFieldscoutinglogMods.RandomGeometryX(f), - FSFieldscoutinglogMods.RandomGeometryY(f), - FSFieldscoutinglogMods.RandomLastEditedDate(f), - FSFieldscoutinglogMods.RandomLastEditedUser(f), - FSFieldscoutinglogMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsFieldscoutinglogMods) OrganizationID(val int32) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsFieldscoutinglogMods) OrganizationIDFunc(f func() int32) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsFieldscoutinglogMods) UnsetOrganizationID() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - 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 fsFieldscoutinglogMods) RandomOrganizationID(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsFieldscoutinglogMods) Creationdate(val null.Val[int64]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsFieldscoutinglogMods) CreationdateFunc(f func() null.Val[int64]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsFieldscoutinglogMods) UnsetCreationdate() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Creationdate = 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 fsFieldscoutinglogMods) RandomCreationdate(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsFieldscoutinglogMods) Creator(val null.Val[string]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsFieldscoutinglogMods) CreatorFunc(f func() null.Val[string]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsFieldscoutinglogMods) UnsetCreator() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Creator = 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 fsFieldscoutinglogMods) RandomCreator(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Creator = 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 fsFieldscoutinglogMods) Editdate(val null.Val[int64]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsFieldscoutinglogMods) EditdateFunc(f func() null.Val[int64]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsFieldscoutinglogMods) UnsetEditdate() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Editdate = 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 fsFieldscoutinglogMods) RandomEditdate(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsFieldscoutinglogMods) Editor(val null.Val[string]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsFieldscoutinglogMods) EditorFunc(f func() null.Val[string]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsFieldscoutinglogMods) UnsetEditor() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Editor = 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 fsFieldscoutinglogMods) RandomEditor(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Editor = 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 fsFieldscoutinglogMods) Globalid(val string) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsFieldscoutinglogMods) GlobalidFunc(f func() string) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsFieldscoutinglogMods) UnsetGlobalid() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsFieldscoutinglogMods) RandomGlobalid(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsFieldscoutinglogMods) Objectid(val int32) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsFieldscoutinglogMods) ObjectidFunc(f func() int32) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsFieldscoutinglogMods) UnsetObjectid() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsFieldscoutinglogMods) RandomObjectid(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsFieldscoutinglogMods) Status(val null.Val[int16]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Status = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsFieldscoutinglogMods) StatusFunc(f func() null.Val[int16]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Status = f - }) -} - -// Clear any values for the column -func (m fsFieldscoutinglogMods) UnsetStatus() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Status = 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 fsFieldscoutinglogMods) RandomStatus(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Status = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomStatusNotNull(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Status = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsFieldscoutinglogMods) CreatedDate(val null.Val[int64]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsFieldscoutinglogMods) CreatedDateFunc(f func() null.Val[int64]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsFieldscoutinglogMods) UnsetCreatedDate() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.CreatedDate = 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 fsFieldscoutinglogMods) RandomCreatedDate(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsFieldscoutinglogMods) CreatedUser(val null.Val[string]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsFieldscoutinglogMods) CreatedUserFunc(f func() null.Val[string]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsFieldscoutinglogMods) UnsetCreatedUser() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.CreatedUser = 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 fsFieldscoutinglogMods) RandomCreatedUser(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.CreatedUser = 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 fsFieldscoutinglogMods) GeometryX(val null.Val[float64]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsFieldscoutinglogMods) GeometryXFunc(f func() null.Val[float64]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsFieldscoutinglogMods) UnsetGeometryX() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.GeometryX = 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 fsFieldscoutinglogMods) RandomGeometryX(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - 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 fsFieldscoutinglogMods) RandomGeometryXNotNull(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.GeometryX = 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 fsFieldscoutinglogMods) GeometryY(val null.Val[float64]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsFieldscoutinglogMods) GeometryYFunc(f func() null.Val[float64]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsFieldscoutinglogMods) UnsetGeometryY() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.GeometryY = 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 fsFieldscoutinglogMods) RandomGeometryY(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - 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 fsFieldscoutinglogMods) RandomGeometryYNotNull(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.GeometryY = 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 fsFieldscoutinglogMods) LastEditedDate(val null.Val[int64]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsFieldscoutinglogMods) LastEditedDateFunc(f func() null.Val[int64]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsFieldscoutinglogMods) UnsetLastEditedDate() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.LastEditedDate = 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 fsFieldscoutinglogMods) RandomLastEditedDate(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsFieldscoutinglogMods) LastEditedUser(val null.Val[string]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsFieldscoutinglogMods) LastEditedUserFunc(f func() null.Val[string]) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsFieldscoutinglogMods) UnsetLastEditedUser() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.LastEditedUser = 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 fsFieldscoutinglogMods) RandomLastEditedUser(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.LastEditedUser = 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 fsFieldscoutinglogMods) Updated(val time.Time) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsFieldscoutinglogMods) UpdatedFunc(f func() time.Time) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsFieldscoutinglogMods) UnsetUpdated() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsFieldscoutinglogMods) RandomUpdated(f *faker.Faker) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsFieldscoutinglogMods) WithParentsCascading() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(ctx context.Context, o *FSFieldscoutinglogTemplate) { - if isDone, _ := fsFieldscoutinglogWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsFieldscoutinglogWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsFieldscoutinglogMods) WithOrganization(rel *OrganizationTemplate) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(ctx context.Context, o *FSFieldscoutinglogTemplate) { - o.r.Organization = &fsFieldscoutinglogROrganizationR{ - o: rel, - } - }) -} - -func (m fsFieldscoutinglogMods) WithNewOrganization(mods ...OrganizationMod) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(ctx context.Context, o *FSFieldscoutinglogTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsFieldscoutinglogMods) WithExistingOrganization(em *models.Organization) FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(ctx context.Context, o *FSFieldscoutinglogTemplate) { - o.r.Organization = &fsFieldscoutinglogROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsFieldscoutinglogMods) WithoutOrganization() FSFieldscoutinglogMod { - return FSFieldscoutinglogModFunc(func(ctx context.Context, o *FSFieldscoutinglogTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_habitatrelate.bob.go b/db/factory/fs_habitatrelate.bob.go deleted file mode 100644 index 15c39b13..00000000 --- a/db/factory/fs_habitatrelate.bob.go +++ /dev/null @@ -1,1200 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSHabitatrelateMod interface { - Apply(context.Context, *FSHabitatrelateTemplate) -} - -type FSHabitatrelateModFunc func(context.Context, *FSHabitatrelateTemplate) - -func (f FSHabitatrelateModFunc) Apply(ctx context.Context, n *FSHabitatrelateTemplate) { - f(ctx, n) -} - -type FSHabitatrelateModSlice []FSHabitatrelateMod - -func (mods FSHabitatrelateModSlice) Apply(ctx context.Context, n *FSHabitatrelateTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSHabitatrelateTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSHabitatrelateTemplate struct { - OrganizationID func() int32 - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - ForeignID func() null.Val[string] - Globalid func() string - Habitattype func() null.Val[string] - Objectid func() int32 - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Updated func() time.Time - - r fsHabitatrelateR - f *Factory - - alreadyPersisted bool -} - -type fsHabitatrelateR struct { - Organization *fsHabitatrelateROrganizationR -} - -type fsHabitatrelateROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSHabitatrelateTemplate -func (o *FSHabitatrelateTemplate) Apply(ctx context.Context, mods ...FSHabitatrelateMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSHabitatrelate -// according to the relationships in the template. Nothing is inserted into the db -func (t FSHabitatrelateTemplate) setModelRels(o *models.FSHabitatrelate) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSHabitatrelates = append(rel.R.FSHabitatrelates, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSHabitatrelateSetter -// this does nothing with the relationship templates -func (o FSHabitatrelateTemplate) BuildSetter() *models.FSHabitatrelateSetter { - m := &models.FSHabitatrelateSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.ForeignID != nil { - val := o.ForeignID() - m.ForeignID = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Habitattype != nil { - val := o.Habitattype() - m.Habitattype = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSHabitatrelateSetter -// this does nothing with the relationship templates -func (o FSHabitatrelateTemplate) BuildManySetter(number int) []*models.FSHabitatrelateSetter { - m := make([]*models.FSHabitatrelateSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSHabitatrelate -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSHabitatrelateTemplate.Create -func (o FSHabitatrelateTemplate) Build() *models.FSHabitatrelate { - m := &models.FSHabitatrelate{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.ForeignID != nil { - m.ForeignID = o.ForeignID() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitattype != nil { - m.Habitattype = o.Habitattype() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSHabitatrelateSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSHabitatrelateTemplate.CreateMany -func (o FSHabitatrelateTemplate) BuildMany(number int) models.FSHabitatrelateSlice { - m := make(models.FSHabitatrelateSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSHabitatrelate(m *models.FSHabitatrelateSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSHabitatrelate -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSHabitatrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSHabitatrelate) error { - var err error - - return err -} - -// Create builds a fsHabitatrelate and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSHabitatrelateTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSHabitatrelate, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSHabitatrelate(opt) - - if o.r.Organization == nil { - FSHabitatrelateMods.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.FSHabitatrelates.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 fsHabitatrelate and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSHabitatrelateTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSHabitatrelate { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsHabitatrelate 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 *FSHabitatrelateTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSHabitatrelate { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsHabitatrelates and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSHabitatrelateTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSHabitatrelateSlice, error) { - var err error - m := make(models.FSHabitatrelateSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsHabitatrelates and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSHabitatrelateTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSHabitatrelateSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsHabitatrelates 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 FSHabitatrelateTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSHabitatrelateSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSHabitatrelate has methods that act as mods for the FSHabitatrelateTemplate -var FSHabitatrelateMods fsHabitatrelateMods - -type fsHabitatrelateMods struct{} - -func (m fsHabitatrelateMods) RandomizeAllColumns(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModSlice{ - FSHabitatrelateMods.RandomOrganizationID(f), - FSHabitatrelateMods.RandomCreationdate(f), - FSHabitatrelateMods.RandomCreator(f), - FSHabitatrelateMods.RandomEditdate(f), - FSHabitatrelateMods.RandomEditor(f), - FSHabitatrelateMods.RandomForeignID(f), - FSHabitatrelateMods.RandomGlobalid(f), - FSHabitatrelateMods.RandomHabitattype(f), - FSHabitatrelateMods.RandomObjectid(f), - FSHabitatrelateMods.RandomCreatedDate(f), - FSHabitatrelateMods.RandomCreatedUser(f), - FSHabitatrelateMods.RandomGeometryX(f), - FSHabitatrelateMods.RandomGeometryY(f), - FSHabitatrelateMods.RandomLastEditedDate(f), - FSHabitatrelateMods.RandomLastEditedUser(f), - FSHabitatrelateMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsHabitatrelateMods) OrganizationID(val int32) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) OrganizationIDFunc(f func() int32) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetOrganizationID() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - 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 fsHabitatrelateMods) RandomOrganizationID(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsHabitatrelateMods) Creationdate(val null.Val[int64]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) CreationdateFunc(f func() null.Val[int64]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetCreationdate() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Creationdate = 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 fsHabitatrelateMods) RandomCreationdate(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsHabitatrelateMods) Creator(val null.Val[string]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) CreatorFunc(f func() null.Val[string]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetCreator() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Creator = 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 fsHabitatrelateMods) RandomCreator(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Creator = 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 fsHabitatrelateMods) Editdate(val null.Val[int64]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) EditdateFunc(f func() null.Val[int64]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetEditdate() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Editdate = 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 fsHabitatrelateMods) RandomEditdate(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsHabitatrelateMods) Editor(val null.Val[string]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) EditorFunc(f func() null.Val[string]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetEditor() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Editor = 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 fsHabitatrelateMods) RandomEditor(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Editor = 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 fsHabitatrelateMods) ForeignID(val null.Val[string]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.ForeignID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) ForeignIDFunc(f func() null.Val[string]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.ForeignID = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetForeignID() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.ForeignID = 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 fsHabitatrelateMods) RandomForeignID(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.ForeignID = 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) RandomForeignIDNotNull(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.ForeignID = 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 fsHabitatrelateMods) Globalid(val string) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) GlobalidFunc(f func() string) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetGlobalid() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsHabitatrelateMods) RandomGlobalid(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsHabitatrelateMods) Habitattype(val null.Val[string]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Habitattype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) HabitattypeFunc(f func() null.Val[string]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Habitattype = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetHabitattype() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Habitattype = 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 fsHabitatrelateMods) RandomHabitattype(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Habitattype = 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) RandomHabitattypeNotNull(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Habitattype = 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 fsHabitatrelateMods) Objectid(val int32) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) ObjectidFunc(f func() int32) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetObjectid() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsHabitatrelateMods) RandomObjectid(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsHabitatrelateMods) CreatedDate(val null.Val[int64]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) CreatedDateFunc(f func() null.Val[int64]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetCreatedDate() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.CreatedDate = 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 fsHabitatrelateMods) RandomCreatedDate(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsHabitatrelateMods) CreatedUser(val null.Val[string]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) CreatedUserFunc(f func() null.Val[string]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetCreatedUser() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.CreatedUser = 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 fsHabitatrelateMods) RandomCreatedUser(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.CreatedUser = 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 fsHabitatrelateMods) GeometryX(val null.Val[float64]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) GeometryXFunc(f func() null.Val[float64]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetGeometryX() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.GeometryX = 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 fsHabitatrelateMods) RandomGeometryX(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - 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 fsHabitatrelateMods) RandomGeometryXNotNull(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.GeometryX = 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 fsHabitatrelateMods) GeometryY(val null.Val[float64]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) GeometryYFunc(f func() null.Val[float64]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetGeometryY() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.GeometryY = 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 fsHabitatrelateMods) RandomGeometryY(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - 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 fsHabitatrelateMods) RandomGeometryYNotNull(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.GeometryY = 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 fsHabitatrelateMods) LastEditedDate(val null.Val[int64]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) LastEditedDateFunc(f func() null.Val[int64]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetLastEditedDate() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.LastEditedDate = 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 fsHabitatrelateMods) RandomLastEditedDate(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsHabitatrelateMods) LastEditedUser(val null.Val[string]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) LastEditedUserFunc(f func() null.Val[string]) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetLastEditedUser() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.LastEditedUser = 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 fsHabitatrelateMods) RandomLastEditedUser(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.LastEditedUser = 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 fsHabitatrelateMods) Updated(val time.Time) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsHabitatrelateMods) UpdatedFunc(f func() time.Time) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsHabitatrelateMods) UnsetUpdated() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsHabitatrelateMods) RandomUpdated(f *faker.Faker) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsHabitatrelateMods) WithParentsCascading() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(ctx context.Context, o *FSHabitatrelateTemplate) { - if isDone, _ := fsHabitatrelateWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsHabitatrelateWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsHabitatrelateMods) WithOrganization(rel *OrganizationTemplate) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(ctx context.Context, o *FSHabitatrelateTemplate) { - o.r.Organization = &fsHabitatrelateROrganizationR{ - o: rel, - } - }) -} - -func (m fsHabitatrelateMods) WithNewOrganization(mods ...OrganizationMod) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(ctx context.Context, o *FSHabitatrelateTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsHabitatrelateMods) WithExistingOrganization(em *models.Organization) FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(ctx context.Context, o *FSHabitatrelateTemplate) { - o.r.Organization = &fsHabitatrelateROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsHabitatrelateMods) WithoutOrganization() FSHabitatrelateMod { - return FSHabitatrelateModFunc(func(ctx context.Context, o *FSHabitatrelateTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_inspectionsample.bob.go b/db/factory/fs_inspectionsample.bob.go deleted file mode 100644 index 997258fe..00000000 --- a/db/factory/fs_inspectionsample.bob.go +++ /dev/null @@ -1,1324 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSInspectionsampleMod interface { - Apply(context.Context, *FSInspectionsampleTemplate) -} - -type FSInspectionsampleModFunc func(context.Context, *FSInspectionsampleTemplate) - -func (f FSInspectionsampleModFunc) Apply(ctx context.Context, n *FSInspectionsampleTemplate) { - f(ctx, n) -} - -type FSInspectionsampleModSlice []FSInspectionsampleMod - -func (mods FSInspectionsampleModSlice) Apply(ctx context.Context, n *FSInspectionsampleTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSInspectionsampleTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSInspectionsampleTemplate struct { - OrganizationID func() int32 - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() string - Idbytech func() null.Val[string] - InspID func() null.Val[string] - Objectid func() int32 - Processed func() null.Val[int16] - Sampleid func() null.Val[string] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Updated func() time.Time - - r fsInspectionsampleR - f *Factory - - alreadyPersisted bool -} - -type fsInspectionsampleR struct { - Organization *fsInspectionsampleROrganizationR -} - -type fsInspectionsampleROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSInspectionsampleTemplate -func (o *FSInspectionsampleTemplate) Apply(ctx context.Context, mods ...FSInspectionsampleMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSInspectionsample -// according to the relationships in the template. Nothing is inserted into the db -func (t FSInspectionsampleTemplate) setModelRels(o *models.FSInspectionsample) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSInspectionsamples = append(rel.R.FSInspectionsamples, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSInspectionsampleSetter -// this does nothing with the relationship templates -func (o FSInspectionsampleTemplate) BuildSetter() *models.FSInspectionsampleSetter { - m := &models.FSInspectionsampleSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Idbytech != nil { - val := o.Idbytech() - m.Idbytech = omitnull.FromNull(val) - } - if o.InspID != nil { - val := o.InspID() - m.InspID = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.Sampleid != nil { - val := o.Sampleid() - m.Sampleid = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSInspectionsampleSetter -// this does nothing with the relationship templates -func (o FSInspectionsampleTemplate) BuildManySetter(number int) []*models.FSInspectionsampleSetter { - m := make([]*models.FSInspectionsampleSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSInspectionsample -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSInspectionsampleTemplate.Create -func (o FSInspectionsampleTemplate) Build() *models.FSInspectionsample { - m := &models.FSInspectionsample{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Idbytech != nil { - m.Idbytech = o.Idbytech() - } - if o.InspID != nil { - m.InspID = o.InspID() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.Sampleid != nil { - m.Sampleid = o.Sampleid() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSInspectionsampleSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSInspectionsampleTemplate.CreateMany -func (o FSInspectionsampleTemplate) BuildMany(number int) models.FSInspectionsampleSlice { - m := make(models.FSInspectionsampleSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSInspectionsample(m *models.FSInspectionsampleSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSInspectionsample -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSInspectionsampleTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSInspectionsample) error { - var err error - - return err -} - -// Create builds a fsInspectionsample and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSInspectionsampleTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSInspectionsample, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSInspectionsample(opt) - - if o.r.Organization == nil { - FSInspectionsampleMods.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.FSInspectionsamples.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 fsInspectionsample and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSInspectionsampleTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSInspectionsample { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsInspectionsample 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 *FSInspectionsampleTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSInspectionsample { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsInspectionsamples and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSInspectionsampleTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSInspectionsampleSlice, error) { - var err error - m := make(models.FSInspectionsampleSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsInspectionsamples and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSInspectionsampleTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSInspectionsampleSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsInspectionsamples 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 FSInspectionsampleTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSInspectionsampleSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSInspectionsample has methods that act as mods for the FSInspectionsampleTemplate -var FSInspectionsampleMods fsInspectionsampleMods - -type fsInspectionsampleMods struct{} - -func (m fsInspectionsampleMods) RandomizeAllColumns(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModSlice{ - FSInspectionsampleMods.RandomOrganizationID(f), - FSInspectionsampleMods.RandomCreationdate(f), - FSInspectionsampleMods.RandomCreator(f), - FSInspectionsampleMods.RandomEditdate(f), - FSInspectionsampleMods.RandomEditor(f), - FSInspectionsampleMods.RandomGlobalid(f), - FSInspectionsampleMods.RandomIdbytech(f), - FSInspectionsampleMods.RandomInspID(f), - FSInspectionsampleMods.RandomObjectid(f), - FSInspectionsampleMods.RandomProcessed(f), - FSInspectionsampleMods.RandomSampleid(f), - FSInspectionsampleMods.RandomCreatedDate(f), - FSInspectionsampleMods.RandomCreatedUser(f), - FSInspectionsampleMods.RandomGeometryX(f), - FSInspectionsampleMods.RandomGeometryY(f), - FSInspectionsampleMods.RandomLastEditedDate(f), - FSInspectionsampleMods.RandomLastEditedUser(f), - FSInspectionsampleMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsInspectionsampleMods) OrganizationID(val int32) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) OrganizationIDFunc(f func() int32) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetOrganizationID() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - 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 fsInspectionsampleMods) RandomOrganizationID(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampleMods) Creationdate(val null.Val[int64]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) CreationdateFunc(f func() null.Val[int64]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetCreationdate() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Creationdate = 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 fsInspectionsampleMods) RandomCreationdate(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampleMods) Creator(val null.Val[string]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) CreatorFunc(f func() null.Val[string]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetCreator() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Creator = 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 fsInspectionsampleMods) RandomCreator(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Creator = 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 fsInspectionsampleMods) Editdate(val null.Val[int64]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) EditdateFunc(f func() null.Val[int64]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetEditdate() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Editdate = 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 fsInspectionsampleMods) RandomEditdate(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampleMods) Editor(val null.Val[string]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) EditorFunc(f func() null.Val[string]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetEditor() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Editor = 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 fsInspectionsampleMods) RandomEditor(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Editor = 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 fsInspectionsampleMods) Globalid(val string) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) GlobalidFunc(f func() string) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetGlobalid() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsInspectionsampleMods) RandomGlobalid(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampleMods) Idbytech(val null.Val[string]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Idbytech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) IdbytechFunc(f func() null.Val[string]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Idbytech = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetIdbytech() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Idbytech = 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 fsInspectionsampleMods) RandomIdbytech(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Idbytech = 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) RandomIdbytechNotNull(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Idbytech = 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 fsInspectionsampleMods) InspID(val null.Val[string]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.InspID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) InspIDFunc(f func() null.Val[string]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.InspID = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetInspID() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.InspID = 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 fsInspectionsampleMods) RandomInspID(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.InspID = 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) RandomInspIDNotNull(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.InspID = 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 fsInspectionsampleMods) Objectid(val int32) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) ObjectidFunc(f func() int32) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetObjectid() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsInspectionsampleMods) RandomObjectid(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampleMods) Processed(val null.Val[int16]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) ProcessedFunc(f func() null.Val[int16]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetProcessed() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Processed = 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 fsInspectionsampleMods) RandomProcessed(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampleMods) Sampleid(val null.Val[string]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Sampleid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) SampleidFunc(f func() null.Val[string]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Sampleid = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetSampleid() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Sampleid = 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 fsInspectionsampleMods) RandomSampleid(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Sampleid = 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) RandomSampleidNotNull(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Sampleid = 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 fsInspectionsampleMods) CreatedDate(val null.Val[int64]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) CreatedDateFunc(f func() null.Val[int64]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetCreatedDate() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.CreatedDate = 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 fsInspectionsampleMods) RandomCreatedDate(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampleMods) CreatedUser(val null.Val[string]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) CreatedUserFunc(f func() null.Val[string]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetCreatedUser() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.CreatedUser = 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 fsInspectionsampleMods) RandomCreatedUser(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.CreatedUser = 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 fsInspectionsampleMods) GeometryX(val null.Val[float64]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) GeometryXFunc(f func() null.Val[float64]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetGeometryX() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.GeometryX = 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 fsInspectionsampleMods) RandomGeometryX(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - 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 fsInspectionsampleMods) RandomGeometryXNotNull(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.GeometryX = 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 fsInspectionsampleMods) GeometryY(val null.Val[float64]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) GeometryYFunc(f func() null.Val[float64]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetGeometryY() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.GeometryY = 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 fsInspectionsampleMods) RandomGeometryY(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - 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 fsInspectionsampleMods) RandomGeometryYNotNull(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.GeometryY = 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 fsInspectionsampleMods) LastEditedDate(val null.Val[int64]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) LastEditedDateFunc(f func() null.Val[int64]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetLastEditedDate() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.LastEditedDate = 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 fsInspectionsampleMods) RandomLastEditedDate(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampleMods) LastEditedUser(val null.Val[string]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) LastEditedUserFunc(f func() null.Val[string]) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetLastEditedUser() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.LastEditedUser = 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 fsInspectionsampleMods) RandomLastEditedUser(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.LastEditedUser = 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 fsInspectionsampleMods) Updated(val time.Time) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampleMods) UpdatedFunc(f func() time.Time) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampleMods) UnsetUpdated() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsInspectionsampleMods) RandomUpdated(f *faker.Faker) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsInspectionsampleMods) WithParentsCascading() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(ctx context.Context, o *FSInspectionsampleTemplate) { - if isDone, _ := fsInspectionsampleWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsInspectionsampleWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsInspectionsampleMods) WithOrganization(rel *OrganizationTemplate) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(ctx context.Context, o *FSInspectionsampleTemplate) { - o.r.Organization = &fsInspectionsampleROrganizationR{ - o: rel, - } - }) -} - -func (m fsInspectionsampleMods) WithNewOrganization(mods ...OrganizationMod) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(ctx context.Context, o *FSInspectionsampleTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsInspectionsampleMods) WithExistingOrganization(em *models.Organization) FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(ctx context.Context, o *FSInspectionsampleTemplate) { - o.r.Organization = &fsInspectionsampleROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsInspectionsampleMods) WithoutOrganization() FSInspectionsampleMod { - return FSInspectionsampleModFunc(func(ctx context.Context, o *FSInspectionsampleTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_inspectionsampledetail.bob.go b/db/factory/fs_inspectionsampledetail.bob.go deleted file mode 100644 index 4d035fc5..00000000 --- a/db/factory/fs_inspectionsampledetail.bob.go +++ /dev/null @@ -1,2006 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSInspectionsampledetailMod interface { - Apply(context.Context, *FSInspectionsampledetailTemplate) -} - -type FSInspectionsampledetailModFunc func(context.Context, *FSInspectionsampledetailTemplate) - -func (f FSInspectionsampledetailModFunc) Apply(ctx context.Context, n *FSInspectionsampledetailTemplate) { - f(ctx, n) -} - -type FSInspectionsampledetailModSlice []FSInspectionsampledetailMod - -func (mods FSInspectionsampledetailModSlice) Apply(ctx context.Context, n *FSInspectionsampledetailTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSInspectionsampledetailTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSInspectionsampledetailTemplate struct { - OrganizationID func() int32 - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fadultact func() null.Val[string] - Fdomstage func() null.Val[string] - Feggcount func() null.Val[int16] - Fieldspecies func() null.Val[string] - Flarvcount func() null.Val[int16] - Flstages func() null.Val[string] - Fpupcount func() null.Val[int16] - Globalid func() string - InspsampleID func() null.Val[string] - Labspecies func() null.Val[string] - Ldomstage func() null.Val[string] - Leggcount func() null.Val[int16] - Llarvcount func() null.Val[int16] - Lpupcount func() null.Val[int16] - Objectid func() int32 - Processed func() null.Val[int16] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Updated func() time.Time - - r fsInspectionsampledetailR - f *Factory - - alreadyPersisted bool -} - -type fsInspectionsampledetailR struct { - Organization *fsInspectionsampledetailROrganizationR -} - -type fsInspectionsampledetailROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSInspectionsampledetailTemplate -func (o *FSInspectionsampledetailTemplate) Apply(ctx context.Context, mods ...FSInspectionsampledetailMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSInspectionsampledetail -// according to the relationships in the template. Nothing is inserted into the db -func (t FSInspectionsampledetailTemplate) setModelRels(o *models.FSInspectionsampledetail) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSInspectionsampledetails = append(rel.R.FSInspectionsampledetails, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSInspectionsampledetailSetter -// this does nothing with the relationship templates -func (o FSInspectionsampledetailTemplate) BuildSetter() *models.FSInspectionsampledetailSetter { - m := &models.FSInspectionsampledetailSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fadultact != nil { - val := o.Fadultact() - m.Fadultact = omitnull.FromNull(val) - } - if o.Fdomstage != nil { - val := o.Fdomstage() - m.Fdomstage = omitnull.FromNull(val) - } - if o.Feggcount != nil { - val := o.Feggcount() - m.Feggcount = omitnull.FromNull(val) - } - if o.Fieldspecies != nil { - val := o.Fieldspecies() - m.Fieldspecies = omitnull.FromNull(val) - } - if o.Flarvcount != nil { - val := o.Flarvcount() - m.Flarvcount = omitnull.FromNull(val) - } - if o.Flstages != nil { - val := o.Flstages() - m.Flstages = omitnull.FromNull(val) - } - if o.Fpupcount != nil { - val := o.Fpupcount() - m.Fpupcount = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.InspsampleID != nil { - val := o.InspsampleID() - m.InspsampleID = omitnull.FromNull(val) - } - if o.Labspecies != nil { - val := o.Labspecies() - m.Labspecies = omitnull.FromNull(val) - } - if o.Ldomstage != nil { - val := o.Ldomstage() - m.Ldomstage = omitnull.FromNull(val) - } - if o.Leggcount != nil { - val := o.Leggcount() - m.Leggcount = omitnull.FromNull(val) - } - if o.Llarvcount != nil { - val := o.Llarvcount() - m.Llarvcount = omitnull.FromNull(val) - } - if o.Lpupcount != nil { - val := o.Lpupcount() - m.Lpupcount = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSInspectionsampledetailSetter -// this does nothing with the relationship templates -func (o FSInspectionsampledetailTemplate) BuildManySetter(number int) []*models.FSInspectionsampledetailSetter { - m := make([]*models.FSInspectionsampledetailSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSInspectionsampledetail -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSInspectionsampledetailTemplate.Create -func (o FSInspectionsampledetailTemplate) Build() *models.FSInspectionsampledetail { - m := &models.FSInspectionsampledetail{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fadultact != nil { - m.Fadultact = o.Fadultact() - } - if o.Fdomstage != nil { - m.Fdomstage = o.Fdomstage() - } - if o.Feggcount != nil { - m.Feggcount = o.Feggcount() - } - if o.Fieldspecies != nil { - m.Fieldspecies = o.Fieldspecies() - } - if o.Flarvcount != nil { - m.Flarvcount = o.Flarvcount() - } - if o.Flstages != nil { - m.Flstages = o.Flstages() - } - if o.Fpupcount != nil { - m.Fpupcount = o.Fpupcount() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.InspsampleID != nil { - m.InspsampleID = o.InspsampleID() - } - if o.Labspecies != nil { - m.Labspecies = o.Labspecies() - } - if o.Ldomstage != nil { - m.Ldomstage = o.Ldomstage() - } - if o.Leggcount != nil { - m.Leggcount = o.Leggcount() - } - if o.Llarvcount != nil { - m.Llarvcount = o.Llarvcount() - } - if o.Lpupcount != nil { - m.Lpupcount = o.Lpupcount() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSInspectionsampledetailSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSInspectionsampledetailTemplate.CreateMany -func (o FSInspectionsampledetailTemplate) BuildMany(number int) models.FSInspectionsampledetailSlice { - m := make(models.FSInspectionsampledetailSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSInspectionsampledetail(m *models.FSInspectionsampledetailSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSInspectionsampledetail -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSInspectionsampledetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSInspectionsampledetail) error { - var err error - - return err -} - -// Create builds a fsInspectionsampledetail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSInspectionsampledetailTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSInspectionsampledetail, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSInspectionsampledetail(opt) - - if o.r.Organization == nil { - FSInspectionsampledetailMods.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.FSInspectionsampledetails.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 fsInspectionsampledetail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSInspectionsampledetailTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSInspectionsampledetail { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsInspectionsampledetail 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 *FSInspectionsampledetailTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSInspectionsampledetail { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsInspectionsampledetails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSInspectionsampledetailTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSInspectionsampledetailSlice, error) { - var err error - m := make(models.FSInspectionsampledetailSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsInspectionsampledetails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSInspectionsampledetailTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSInspectionsampledetailSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsInspectionsampledetails 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 FSInspectionsampledetailTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSInspectionsampledetailSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSInspectionsampledetail has methods that act as mods for the FSInspectionsampledetailTemplate -var FSInspectionsampledetailMods fsInspectionsampledetailMods - -type fsInspectionsampledetailMods struct{} - -func (m fsInspectionsampledetailMods) RandomizeAllColumns(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModSlice{ - FSInspectionsampledetailMods.RandomOrganizationID(f), - FSInspectionsampledetailMods.RandomComments(f), - FSInspectionsampledetailMods.RandomCreationdate(f), - FSInspectionsampledetailMods.RandomCreator(f), - FSInspectionsampledetailMods.RandomEditdate(f), - FSInspectionsampledetailMods.RandomEditor(f), - FSInspectionsampledetailMods.RandomFadultact(f), - FSInspectionsampledetailMods.RandomFdomstage(f), - FSInspectionsampledetailMods.RandomFeggcount(f), - FSInspectionsampledetailMods.RandomFieldspecies(f), - FSInspectionsampledetailMods.RandomFlarvcount(f), - FSInspectionsampledetailMods.RandomFlstages(f), - FSInspectionsampledetailMods.RandomFpupcount(f), - FSInspectionsampledetailMods.RandomGlobalid(f), - FSInspectionsampledetailMods.RandomInspsampleID(f), - FSInspectionsampledetailMods.RandomLabspecies(f), - FSInspectionsampledetailMods.RandomLdomstage(f), - FSInspectionsampledetailMods.RandomLeggcount(f), - FSInspectionsampledetailMods.RandomLlarvcount(f), - FSInspectionsampledetailMods.RandomLpupcount(f), - FSInspectionsampledetailMods.RandomObjectid(f), - FSInspectionsampledetailMods.RandomProcessed(f), - FSInspectionsampledetailMods.RandomCreatedDate(f), - FSInspectionsampledetailMods.RandomCreatedUser(f), - FSInspectionsampledetailMods.RandomGeometryX(f), - FSInspectionsampledetailMods.RandomGeometryY(f), - FSInspectionsampledetailMods.RandomLastEditedDate(f), - FSInspectionsampledetailMods.RandomLastEditedUser(f), - FSInspectionsampledetailMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsInspectionsampledetailMods) OrganizationID(val int32) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) OrganizationIDFunc(f func() int32) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetOrganizationID() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - 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 fsInspectionsampledetailMods) RandomOrganizationID(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampledetailMods) Comments(val null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) CommentsFunc(f func() null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetComments() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Comments = 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 fsInspectionsampledetailMods) RandomComments(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Comments = 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 fsInspectionsampledetailMods) Creationdate(val null.Val[int64]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) CreationdateFunc(f func() null.Val[int64]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetCreationdate() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Creationdate = 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 fsInspectionsampledetailMods) RandomCreationdate(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampledetailMods) Creator(val null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) CreatorFunc(f func() null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetCreator() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Creator = 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 fsInspectionsampledetailMods) RandomCreator(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Creator = 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 fsInspectionsampledetailMods) Editdate(val null.Val[int64]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) EditdateFunc(f func() null.Val[int64]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetEditdate() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Editdate = 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 fsInspectionsampledetailMods) RandomEditdate(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampledetailMods) Editor(val null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) EditorFunc(f func() null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetEditor() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Editor = 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 fsInspectionsampledetailMods) RandomEditor(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Editor = 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 fsInspectionsampledetailMods) Fadultact(val null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fadultact = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) FadultactFunc(f func() null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fadultact = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetFadultact() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fadultact = 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 fsInspectionsampledetailMods) RandomFadultact(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fadultact = 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) RandomFadultactNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fadultact = 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 fsInspectionsampledetailMods) Fdomstage(val null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fdomstage = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) FdomstageFunc(f func() null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fdomstage = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetFdomstage() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fdomstage = 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 fsInspectionsampledetailMods) RandomFdomstage(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fdomstage = 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) RandomFdomstageNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fdomstage = 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 fsInspectionsampledetailMods) Feggcount(val null.Val[int16]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Feggcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) FeggcountFunc(f func() null.Val[int16]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Feggcount = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetFeggcount() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Feggcount = 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 fsInspectionsampledetailMods) RandomFeggcount(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Feggcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomFeggcountNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Feggcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampledetailMods) Fieldspecies(val null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fieldspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) FieldspeciesFunc(f func() null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fieldspecies = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetFieldspecies() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fieldspecies = 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 fsInspectionsampledetailMods) RandomFieldspecies(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fieldspecies = 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) RandomFieldspeciesNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fieldspecies = 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 fsInspectionsampledetailMods) Flarvcount(val null.Val[int16]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Flarvcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) FlarvcountFunc(f func() null.Val[int16]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Flarvcount = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetFlarvcount() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Flarvcount = 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 fsInspectionsampledetailMods) RandomFlarvcount(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Flarvcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomFlarvcountNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Flarvcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampledetailMods) Flstages(val null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Flstages = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) FlstagesFunc(f func() null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Flstages = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetFlstages() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Flstages = 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 fsInspectionsampledetailMods) RandomFlstages(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Flstages = 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) RandomFlstagesNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Flstages = 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 fsInspectionsampledetailMods) Fpupcount(val null.Val[int16]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fpupcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) FpupcountFunc(f func() null.Val[int16]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fpupcount = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetFpupcount() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fpupcount = 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 fsInspectionsampledetailMods) RandomFpupcount(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fpupcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomFpupcountNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Fpupcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampledetailMods) Globalid(val string) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) GlobalidFunc(f func() string) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetGlobalid() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsInspectionsampledetailMods) RandomGlobalid(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampledetailMods) InspsampleID(val null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.InspsampleID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) InspsampleIDFunc(f func() null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.InspsampleID = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetInspsampleID() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.InspsampleID = 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 fsInspectionsampledetailMods) RandomInspsampleID(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.InspsampleID = 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) RandomInspsampleIDNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.InspsampleID = 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 fsInspectionsampledetailMods) Labspecies(val null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Labspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) LabspeciesFunc(f func() null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Labspecies = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetLabspecies() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Labspecies = 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 fsInspectionsampledetailMods) RandomLabspecies(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Labspecies = 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) RandomLabspeciesNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Labspecies = 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 fsInspectionsampledetailMods) Ldomstage(val null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Ldomstage = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) LdomstageFunc(f func() null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Ldomstage = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetLdomstage() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Ldomstage = 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 fsInspectionsampledetailMods) RandomLdomstage(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Ldomstage = 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) RandomLdomstageNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Ldomstage = 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 fsInspectionsampledetailMods) Leggcount(val null.Val[int16]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Leggcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) LeggcountFunc(f func() null.Val[int16]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Leggcount = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetLeggcount() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Leggcount = 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 fsInspectionsampledetailMods) RandomLeggcount(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Leggcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomLeggcountNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Leggcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampledetailMods) Llarvcount(val null.Val[int16]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Llarvcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) LlarvcountFunc(f func() null.Val[int16]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Llarvcount = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetLlarvcount() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Llarvcount = 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 fsInspectionsampledetailMods) RandomLlarvcount(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Llarvcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomLlarvcountNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Llarvcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampledetailMods) Lpupcount(val null.Val[int16]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Lpupcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) LpupcountFunc(f func() null.Val[int16]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Lpupcount = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetLpupcount() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Lpupcount = 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 fsInspectionsampledetailMods) RandomLpupcount(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Lpupcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomLpupcountNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Lpupcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampledetailMods) Objectid(val int32) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) ObjectidFunc(f func() int32) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetObjectid() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsInspectionsampledetailMods) RandomObjectid(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampledetailMods) Processed(val null.Val[int16]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) ProcessedFunc(f func() null.Val[int16]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetProcessed() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Processed = 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 fsInspectionsampledetailMods) RandomProcessed(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampledetailMods) CreatedDate(val null.Val[int64]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) CreatedDateFunc(f func() null.Val[int64]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetCreatedDate() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.CreatedDate = 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 fsInspectionsampledetailMods) RandomCreatedDate(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampledetailMods) CreatedUser(val null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) CreatedUserFunc(f func() null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetCreatedUser() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.CreatedUser = 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 fsInspectionsampledetailMods) RandomCreatedUser(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.CreatedUser = 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 fsInspectionsampledetailMods) GeometryX(val null.Val[float64]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) GeometryXFunc(f func() null.Val[float64]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetGeometryX() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.GeometryX = 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 fsInspectionsampledetailMods) RandomGeometryX(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - 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 fsInspectionsampledetailMods) RandomGeometryXNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.GeometryX = 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 fsInspectionsampledetailMods) GeometryY(val null.Val[float64]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) GeometryYFunc(f func() null.Val[float64]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetGeometryY() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.GeometryY = 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 fsInspectionsampledetailMods) RandomGeometryY(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - 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 fsInspectionsampledetailMods) RandomGeometryYNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.GeometryY = 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 fsInspectionsampledetailMods) LastEditedDate(val null.Val[int64]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) LastEditedDateFunc(f func() null.Val[int64]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetLastEditedDate() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.LastEditedDate = 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 fsInspectionsampledetailMods) RandomLastEditedDate(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsInspectionsampledetailMods) LastEditedUser(val null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) LastEditedUserFunc(f func() null.Val[string]) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetLastEditedUser() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.LastEditedUser = 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 fsInspectionsampledetailMods) RandomLastEditedUser(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.LastEditedUser = 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 fsInspectionsampledetailMods) Updated(val time.Time) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsInspectionsampledetailMods) UpdatedFunc(f func() time.Time) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsInspectionsampledetailMods) UnsetUpdated() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsInspectionsampledetailMods) RandomUpdated(f *faker.Faker) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsInspectionsampledetailMods) WithParentsCascading() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(ctx context.Context, o *FSInspectionsampledetailTemplate) { - if isDone, _ := fsInspectionsampledetailWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsInspectionsampledetailWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsInspectionsampledetailMods) WithOrganization(rel *OrganizationTemplate) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(ctx context.Context, o *FSInspectionsampledetailTemplate) { - o.r.Organization = &fsInspectionsampledetailROrganizationR{ - o: rel, - } - }) -} - -func (m fsInspectionsampledetailMods) WithNewOrganization(mods ...OrganizationMod) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(ctx context.Context, o *FSInspectionsampledetailTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsInspectionsampledetailMods) WithExistingOrganization(em *models.Organization) FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(ctx context.Context, o *FSInspectionsampledetailTemplate) { - o.r.Organization = &fsInspectionsampledetailROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsInspectionsampledetailMods) WithoutOrganization() FSInspectionsampledetailMod { - return FSInspectionsampledetailModFunc(func(ctx context.Context, o *FSInspectionsampledetailTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_linelocation.bob.go b/db/factory/fs_linelocation.bob.go deleted file mode 100644 index 07162ea8..00000000 --- a/db/factory/fs_linelocation.bob.go +++ /dev/null @@ -1,3432 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSLinelocationMod interface { - Apply(context.Context, *FSLinelocationTemplate) -} - -type FSLinelocationModFunc func(context.Context, *FSLinelocationTemplate) - -func (f FSLinelocationModFunc) Apply(ctx context.Context, n *FSLinelocationTemplate) { - f(ctx, n) -} - -type FSLinelocationModSlice []FSLinelocationMod - -func (mods FSLinelocationModSlice) Apply(ctx context.Context, n *FSLinelocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSLinelocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSLinelocationTemplate struct { - OrganizationID func() int32 - Accessdesc func() null.Val[string] - Acres func() null.Val[float64] - Active func() null.Val[int16] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Description func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() string - Habitat func() null.Val[string] - Hectares func() null.Val[float64] - Jurisdiction func() null.Val[string] - Larvinspectinterval func() null.Val[int16] - Lastinspectactiontaken func() null.Val[string] - Lastinspectactivity func() null.Val[string] - Lastinspectavglarvae func() null.Val[float64] - Lastinspectavgpupae func() null.Val[float64] - Lastinspectbreeding func() null.Val[string] - Lastinspectconditions func() null.Val[string] - Lastinspectdate func() null.Val[int64] - Lastinspectfieldspecies func() null.Val[string] - Lastinspectlstages func() null.Val[string] - Lasttreatactivity func() null.Val[string] - Lasttreatdate func() null.Val[int64] - Lasttreatproduct func() null.Val[string] - Lasttreatqty func() null.Val[float64] - Lasttreatqtyunit func() null.Val[string] - LengthFT func() null.Val[float64] - LengthMeters func() null.Val[float64] - Locationnumber func() null.Val[int64] - Name func() null.Val[string] - Nextactiondatescheduled func() null.Val[int64] - Objectid func() int32 - Priority func() null.Val[string] - Symbology func() null.Val[string] - ShapeLength func() null.Val[float64] - Usetype func() null.Val[string] - Waterorigin func() null.Val[string] - WidthFT func() null.Val[float64] - WidthMeters func() null.Val[float64] - Zone func() null.Val[string] - 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] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Updated func() time.Time - - r fsLinelocationR - f *Factory - - alreadyPersisted bool -} - -type fsLinelocationR struct { - Organization *fsLinelocationROrganizationR -} - -type fsLinelocationROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSLinelocationTemplate -func (o *FSLinelocationTemplate) Apply(ctx context.Context, mods ...FSLinelocationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSLinelocation -// according to the relationships in the template. Nothing is inserted into the db -func (t FSLinelocationTemplate) setModelRels(o *models.FSLinelocation) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSLinelocations = append(rel.R.FSLinelocations, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSLinelocationSetter -// this does nothing with the relationship templates -func (o FSLinelocationTemplate) BuildSetter() *models.FSLinelocationSetter { - m := &models.FSLinelocationSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Acres != nil { - val := o.Acres() - m.Acres = omitnull.FromNull(val) - } - if o.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(val) - } - if o.Hectares != nil { - val := o.Hectares() - m.Hectares = omitnull.FromNull(val) - } - if o.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.Larvinspectinterval != nil { - val := o.Larvinspectinterval() - m.Larvinspectinterval = omitnull.FromNull(val) - } - if o.Lastinspectactiontaken != nil { - val := o.Lastinspectactiontaken() - m.Lastinspectactiontaken = omitnull.FromNull(val) - } - if o.Lastinspectactivity != nil { - val := o.Lastinspectactivity() - m.Lastinspectactivity = omitnull.FromNull(val) - } - if o.Lastinspectavglarvae != nil { - val := o.Lastinspectavglarvae() - m.Lastinspectavglarvae = omitnull.FromNull(val) - } - if o.Lastinspectavgpupae != nil { - val := o.Lastinspectavgpupae() - m.Lastinspectavgpupae = omitnull.FromNull(val) - } - if o.Lastinspectbreeding != nil { - val := o.Lastinspectbreeding() - m.Lastinspectbreeding = omitnull.FromNull(val) - } - if o.Lastinspectconditions != nil { - val := o.Lastinspectconditions() - m.Lastinspectconditions = omitnull.FromNull(val) - } - if o.Lastinspectdate != nil { - val := o.Lastinspectdate() - m.Lastinspectdate = omitnull.FromNull(val) - } - if o.Lastinspectfieldspecies != nil { - val := o.Lastinspectfieldspecies() - m.Lastinspectfieldspecies = omitnull.FromNull(val) - } - if o.Lastinspectlstages != nil { - val := o.Lastinspectlstages() - m.Lastinspectlstages = omitnull.FromNull(val) - } - if o.Lasttreatactivity != nil { - val := o.Lasttreatactivity() - m.Lasttreatactivity = omitnull.FromNull(val) - } - if o.Lasttreatdate != nil { - val := o.Lasttreatdate() - m.Lasttreatdate = omitnull.FromNull(val) - } - if o.Lasttreatproduct != nil { - val := o.Lasttreatproduct() - m.Lasttreatproduct = omitnull.FromNull(val) - } - if o.Lasttreatqty != nil { - val := o.Lasttreatqty() - m.Lasttreatqty = omitnull.FromNull(val) - } - if o.Lasttreatqtyunit != nil { - val := o.Lasttreatqtyunit() - m.Lasttreatqtyunit = omitnull.FromNull(val) - } - if o.LengthFT != nil { - val := o.LengthFT() - m.LengthFT = omitnull.FromNull(val) - } - if o.LengthMeters != nil { - val := o.LengthMeters() - m.LengthMeters = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Symbology != nil { - val := o.Symbology() - m.Symbology = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - val := o.ShapeLength() - m.ShapeLength = omitnull.FromNull(val) - } - if o.Usetype != nil { - val := o.Usetype() - m.Usetype = omitnull.FromNull(val) - } - if o.Waterorigin != nil { - val := o.Waterorigin() - m.Waterorigin = omitnull.FromNull(val) - } - if o.WidthFT != nil { - val := o.WidthFT() - m.WidthFT = omitnull.FromNull(val) - } - if o.WidthMeters != nil { - val := o.WidthMeters() - m.WidthMeters = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSLinelocationSetter -// this does nothing with the relationship templates -func (o FSLinelocationTemplate) BuildManySetter(number int) []*models.FSLinelocationSetter { - m := make([]*models.FSLinelocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSLinelocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSLinelocationTemplate.Create -func (o FSLinelocationTemplate) Build() *models.FSLinelocation { - m := &models.FSLinelocation{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Acres != nil { - m.Acres = o.Acres() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Hectares != nil { - m.Hectares = o.Hectares() - } - if o.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Larvinspectinterval != nil { - m.Larvinspectinterval = o.Larvinspectinterval() - } - if o.Lastinspectactiontaken != nil { - m.Lastinspectactiontaken = o.Lastinspectactiontaken() - } - if o.Lastinspectactivity != nil { - m.Lastinspectactivity = o.Lastinspectactivity() - } - if o.Lastinspectavglarvae != nil { - m.Lastinspectavglarvae = o.Lastinspectavglarvae() - } - if o.Lastinspectavgpupae != nil { - m.Lastinspectavgpupae = o.Lastinspectavgpupae() - } - if o.Lastinspectbreeding != nil { - m.Lastinspectbreeding = o.Lastinspectbreeding() - } - if o.Lastinspectconditions != nil { - m.Lastinspectconditions = o.Lastinspectconditions() - } - if o.Lastinspectdate != nil { - m.Lastinspectdate = o.Lastinspectdate() - } - if o.Lastinspectfieldspecies != nil { - m.Lastinspectfieldspecies = o.Lastinspectfieldspecies() - } - if o.Lastinspectlstages != nil { - m.Lastinspectlstages = o.Lastinspectlstages() - } - if o.Lasttreatactivity != nil { - m.Lasttreatactivity = o.Lasttreatactivity() - } - if o.Lasttreatdate != nil { - m.Lasttreatdate = o.Lasttreatdate() - } - if o.Lasttreatproduct != nil { - m.Lasttreatproduct = o.Lasttreatproduct() - } - if o.Lasttreatqty != nil { - m.Lasttreatqty = o.Lasttreatqty() - } - if o.Lasttreatqtyunit != nil { - m.Lasttreatqtyunit = o.Lasttreatqtyunit() - } - if o.LengthFT != nil { - m.LengthFT = o.LengthFT() - } - if o.LengthMeters != nil { - m.LengthMeters = o.LengthMeters() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Symbology != nil { - m.Symbology = o.Symbology() - } - if o.ShapeLength != nil { - m.ShapeLength = o.ShapeLength() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Waterorigin != nil { - m.Waterorigin = o.Waterorigin() - } - if o.WidthFT != nil { - m.WidthFT = o.WidthFT() - } - if o.WidthMeters != nil { - m.WidthMeters = o.WidthMeters() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSLinelocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSLinelocationTemplate.CreateMany -func (o FSLinelocationTemplate) BuildMany(number int) models.FSLinelocationSlice { - m := make(models.FSLinelocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSLinelocation(m *models.FSLinelocationSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSLinelocation -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSLinelocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSLinelocation) error { - var err error - - return err -} - -// Create builds a fsLinelocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSLinelocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSLinelocation, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSLinelocation(opt) - - if o.r.Organization == nil { - FSLinelocationMods.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.FSLinelocations.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 fsLinelocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSLinelocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSLinelocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsLinelocation 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 *FSLinelocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSLinelocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsLinelocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSLinelocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSLinelocationSlice, error) { - var err error - m := make(models.FSLinelocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsLinelocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSLinelocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSLinelocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsLinelocations 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 FSLinelocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSLinelocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSLinelocation has methods that act as mods for the FSLinelocationTemplate -var FSLinelocationMods fsLinelocationMods - -type fsLinelocationMods struct{} - -func (m fsLinelocationMods) RandomizeAllColumns(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModSlice{ - FSLinelocationMods.RandomOrganizationID(f), - FSLinelocationMods.RandomAccessdesc(f), - FSLinelocationMods.RandomAcres(f), - FSLinelocationMods.RandomActive(f), - FSLinelocationMods.RandomComments(f), - FSLinelocationMods.RandomCreationdate(f), - FSLinelocationMods.RandomCreator(f), - FSLinelocationMods.RandomDescription(f), - FSLinelocationMods.RandomExternalid(f), - FSLinelocationMods.RandomEditdate(f), - FSLinelocationMods.RandomEditor(f), - FSLinelocationMods.RandomGlobalid(f), - FSLinelocationMods.RandomHabitat(f), - FSLinelocationMods.RandomHectares(f), - FSLinelocationMods.RandomJurisdiction(f), - FSLinelocationMods.RandomLarvinspectinterval(f), - FSLinelocationMods.RandomLastinspectactiontaken(f), - FSLinelocationMods.RandomLastinspectactivity(f), - FSLinelocationMods.RandomLastinspectavglarvae(f), - FSLinelocationMods.RandomLastinspectavgpupae(f), - FSLinelocationMods.RandomLastinspectbreeding(f), - FSLinelocationMods.RandomLastinspectconditions(f), - FSLinelocationMods.RandomLastinspectdate(f), - FSLinelocationMods.RandomLastinspectfieldspecies(f), - FSLinelocationMods.RandomLastinspectlstages(f), - FSLinelocationMods.RandomLasttreatactivity(f), - FSLinelocationMods.RandomLasttreatdate(f), - FSLinelocationMods.RandomLasttreatproduct(f), - FSLinelocationMods.RandomLasttreatqty(f), - FSLinelocationMods.RandomLasttreatqtyunit(f), - FSLinelocationMods.RandomLengthFT(f), - FSLinelocationMods.RandomLengthMeters(f), - FSLinelocationMods.RandomLocationnumber(f), - FSLinelocationMods.RandomName(f), - FSLinelocationMods.RandomNextactiondatescheduled(f), - FSLinelocationMods.RandomObjectid(f), - FSLinelocationMods.RandomPriority(f), - FSLinelocationMods.RandomSymbology(f), - FSLinelocationMods.RandomShapeLength(f), - FSLinelocationMods.RandomUsetype(f), - FSLinelocationMods.RandomWaterorigin(f), - FSLinelocationMods.RandomWidthFT(f), - FSLinelocationMods.RandomWidthMeters(f), - FSLinelocationMods.RandomZone(f), - FSLinelocationMods.RandomZone2(f), - FSLinelocationMods.RandomCreatedDate(f), - FSLinelocationMods.RandomCreatedUser(f), - FSLinelocationMods.RandomGeometryX(f), - FSLinelocationMods.RandomGeometryY(f), - FSLinelocationMods.RandomLastEditedDate(f), - FSLinelocationMods.RandomLastEditedUser(f), - FSLinelocationMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsLinelocationMods) OrganizationID(val int32) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) OrganizationIDFunc(f func() int32) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetOrganizationID() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - 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 fsLinelocationMods) RandomOrganizationID(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsLinelocationMods) Accessdesc(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) AccessdescFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetAccessdesc() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Accessdesc = 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 fsLinelocationMods) RandomAccessdesc(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Accessdesc = 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) RandomAccessdescNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Accessdesc = 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 fsLinelocationMods) Acres(val null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Acres = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) AcresFunc(f func() null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Acres = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetAcres() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Acres = 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 fsLinelocationMods) RandomAcres(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Acres = 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 fsLinelocationMods) RandomAcresNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Acres = 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 fsLinelocationMods) Active(val null.Val[int16]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) ActiveFunc(f func() null.Val[int16]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetActive() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Active = 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 fsLinelocationMods) RandomActive(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomActiveNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsLinelocationMods) Comments(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) CommentsFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetComments() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Comments = 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 fsLinelocationMods) RandomComments(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Comments = 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 fsLinelocationMods) Creationdate(val null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) CreationdateFunc(f func() null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetCreationdate() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Creationdate = 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 fsLinelocationMods) RandomCreationdate(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsLinelocationMods) Creator(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) CreatorFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetCreator() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Creator = 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 fsLinelocationMods) RandomCreator(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Creator = 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 fsLinelocationMods) Description(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) DescriptionFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetDescription() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Description = 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 fsLinelocationMods) RandomDescription(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Description = 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) RandomDescriptionNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Description = 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 fsLinelocationMods) Externalid(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) ExternalidFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetExternalid() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Externalid = 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 fsLinelocationMods) RandomExternalid(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Externalid = 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) RandomExternalidNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Externalid = 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 fsLinelocationMods) Editdate(val null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) EditdateFunc(f func() null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetEditdate() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Editdate = 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 fsLinelocationMods) RandomEditdate(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsLinelocationMods) Editor(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) EditorFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetEditor() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Editor = 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 fsLinelocationMods) RandomEditor(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Editor = 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 fsLinelocationMods) Globalid(val string) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) GlobalidFunc(f func() string) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetGlobalid() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsLinelocationMods) RandomGlobalid(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsLinelocationMods) Habitat(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) HabitatFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetHabitat() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Habitat = 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 fsLinelocationMods) RandomHabitat(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Habitat = 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) RandomHabitatNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Habitat = 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 fsLinelocationMods) Hectares(val null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Hectares = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) HectaresFunc(f func() null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Hectares = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetHectares() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Hectares = 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 fsLinelocationMods) RandomHectares(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Hectares = 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 fsLinelocationMods) RandomHectaresNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Hectares = 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 fsLinelocationMods) Jurisdiction(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) JurisdictionFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetJurisdiction() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Jurisdiction = 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 fsLinelocationMods) RandomJurisdiction(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Jurisdiction = 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) RandomJurisdictionNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Jurisdiction = 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 fsLinelocationMods) Larvinspectinterval(val null.Val[int16]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LarvinspectintervalFunc(f func() null.Val[int16]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Larvinspectinterval = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLarvinspectinterval() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Larvinspectinterval = 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 fsLinelocationMods) RandomLarvinspectinterval(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomLarvinspectintervalNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsLinelocationMods) Lastinspectactiontaken(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectactiontaken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LastinspectactiontakenFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectactiontaken = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLastinspectactiontaken() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectactiontaken = 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 fsLinelocationMods) RandomLastinspectactiontaken(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectactiontaken = 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) RandomLastinspectactiontakenNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectactiontaken = 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 fsLinelocationMods) Lastinspectactivity(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LastinspectactivityFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectactivity = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLastinspectactivity() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectactivity = 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 fsLinelocationMods) RandomLastinspectactivity(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectactivity = 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) RandomLastinspectactivityNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectactivity = 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 fsLinelocationMods) Lastinspectavglarvae(val null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectavglarvae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LastinspectavglarvaeFunc(f func() null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectavglarvae = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLastinspectavglarvae() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectavglarvae = 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 fsLinelocationMods) RandomLastinspectavglarvae(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectavglarvae = 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 fsLinelocationMods) RandomLastinspectavglarvaeNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectavglarvae = 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 fsLinelocationMods) Lastinspectavgpupae(val null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectavgpupae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LastinspectavgpupaeFunc(f func() null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectavgpupae = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLastinspectavgpupae() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectavgpupae = 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 fsLinelocationMods) RandomLastinspectavgpupae(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectavgpupae = 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 fsLinelocationMods) RandomLastinspectavgpupaeNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectavgpupae = 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 fsLinelocationMods) Lastinspectbreeding(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectbreeding = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LastinspectbreedingFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectbreeding = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLastinspectbreeding() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectbreeding = 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 fsLinelocationMods) RandomLastinspectbreeding(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectbreeding = 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) RandomLastinspectbreedingNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectbreeding = 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 fsLinelocationMods) Lastinspectconditions(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LastinspectconditionsFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectconditions = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLastinspectconditions() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectconditions = 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 fsLinelocationMods) RandomLastinspectconditions(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectconditions = 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) RandomLastinspectconditionsNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectconditions = 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 fsLinelocationMods) Lastinspectdate(val null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LastinspectdateFunc(f func() null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectdate = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLastinspectdate() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectdate = 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 fsLinelocationMods) RandomLastinspectdate(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastinspectdateNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsLinelocationMods) Lastinspectfieldspecies(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectfieldspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LastinspectfieldspeciesFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectfieldspecies = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLastinspectfieldspecies() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectfieldspecies = 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 fsLinelocationMods) RandomLastinspectfieldspecies(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectfieldspecies = 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) RandomLastinspectfieldspeciesNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectfieldspecies = 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 fsLinelocationMods) Lastinspectlstages(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectlstages = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LastinspectlstagesFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectlstages = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLastinspectlstages() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectlstages = 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 fsLinelocationMods) RandomLastinspectlstages(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectlstages = 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) RandomLastinspectlstagesNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lastinspectlstages = 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 fsLinelocationMods) Lasttreatactivity(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LasttreatactivityFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatactivity = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLasttreatactivity() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatactivity = 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 fsLinelocationMods) RandomLasttreatactivity(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatactivity = 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) RandomLasttreatactivityNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatactivity = 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 fsLinelocationMods) Lasttreatdate(val null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LasttreatdateFunc(f func() null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatdate = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLasttreatdate() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatdate = 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 fsLinelocationMods) RandomLasttreatdate(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLasttreatdateNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsLinelocationMods) Lasttreatproduct(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatproduct = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LasttreatproductFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatproduct = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLasttreatproduct() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatproduct = 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 fsLinelocationMods) RandomLasttreatproduct(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatproduct = 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) RandomLasttreatproductNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatproduct = 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 fsLinelocationMods) Lasttreatqty(val null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatqty = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LasttreatqtyFunc(f func() null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatqty = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLasttreatqty() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatqty = 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 fsLinelocationMods) RandomLasttreatqty(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatqty = 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 fsLinelocationMods) RandomLasttreatqtyNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatqty = 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 fsLinelocationMods) Lasttreatqtyunit(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LasttreatqtyunitFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatqtyunit = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLasttreatqtyunit() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatqtyunit = 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 fsLinelocationMods) RandomLasttreatqtyunit(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatqtyunit = 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) RandomLasttreatqtyunitNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Lasttreatqtyunit = 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 fsLinelocationMods) LengthFT(val null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LengthFT = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LengthFTFunc(f func() null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LengthFT = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLengthFT() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LengthFT = 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 fsLinelocationMods) RandomLengthFT(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LengthFT = 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 fsLinelocationMods) RandomLengthFTNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LengthFT = 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 fsLinelocationMods) LengthMeters(val null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LengthMeters = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LengthMetersFunc(f func() null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LengthMeters = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLengthMeters() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LengthMeters = 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 fsLinelocationMods) RandomLengthMeters(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LengthMeters = 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 fsLinelocationMods) RandomLengthMetersNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LengthMeters = 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 fsLinelocationMods) Locationnumber(val null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Locationnumber = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LocationnumberFunc(f func() null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLocationnumber() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Locationnumber = 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 fsLinelocationMods) RandomLocationnumber(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsLinelocationMods) Name(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) NameFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetName() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Name = 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 fsLinelocationMods) RandomName(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Name = 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) RandomNameNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Name = 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 fsLinelocationMods) Nextactiondatescheduled(val null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetNextactiondatescheduled() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Nextactiondatescheduled = 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 fsLinelocationMods) RandomNextactiondatescheduled(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsLinelocationMods) Objectid(val int32) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) ObjectidFunc(f func() int32) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetObjectid() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsLinelocationMods) RandomObjectid(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsLinelocationMods) Priority(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) PriorityFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetPriority() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Priority = 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 fsLinelocationMods) RandomPriority(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Priority = 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) RandomPriorityNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Priority = 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 fsLinelocationMods) Symbology(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Symbology = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) SymbologyFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Symbology = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetSymbology() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Symbology = 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 fsLinelocationMods) RandomSymbology(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Symbology = 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) RandomSymbologyNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Symbology = 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 fsLinelocationMods) ShapeLength(val null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) ShapeLengthFunc(f func() null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetShapeLength() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.ShapeLength = 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 fsLinelocationMods) RandomShapeLength(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.ShapeLength = 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 fsLinelocationMods) RandomShapeLengthNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.ShapeLength = 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 fsLinelocationMods) Usetype(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) UsetypeFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetUsetype() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Usetype = 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 fsLinelocationMods) RandomUsetype(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Usetype = 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) RandomUsetypeNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Usetype = 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 fsLinelocationMods) Waterorigin(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Waterorigin = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) WateroriginFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Waterorigin = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetWaterorigin() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Waterorigin = 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 fsLinelocationMods) RandomWaterorigin(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Waterorigin = 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) RandomWateroriginNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Waterorigin = 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 fsLinelocationMods) WidthFT(val null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.WidthFT = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) WidthFTFunc(f func() null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.WidthFT = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetWidthFT() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.WidthFT = 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 fsLinelocationMods) RandomWidthFT(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.WidthFT = 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 fsLinelocationMods) RandomWidthFTNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.WidthFT = 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 fsLinelocationMods) WidthMeters(val null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.WidthMeters = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) WidthMetersFunc(f func() null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.WidthMeters = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetWidthMeters() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.WidthMeters = 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 fsLinelocationMods) RandomWidthMeters(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.WidthMeters = 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 fsLinelocationMods) RandomWidthMetersNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.WidthMeters = 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 fsLinelocationMods) Zone(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) ZoneFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetZone() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Zone = 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 fsLinelocationMods) RandomZone(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Zone = 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) RandomZoneNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Zone = 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 fsLinelocationMods) Zone2(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) Zone2Func(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetZone2() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Zone2 = 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 fsLinelocationMods) RandomZone2(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Zone2 = 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) RandomZone2NotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Zone2 = 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 fsLinelocationMods) CreatedDate(val null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) CreatedDateFunc(f func() null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetCreatedDate() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.CreatedDate = 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 fsLinelocationMods) RandomCreatedDate(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsLinelocationMods) CreatedUser(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) CreatedUserFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetCreatedUser() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.CreatedUser = 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 fsLinelocationMods) RandomCreatedUser(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.CreatedUser = 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 fsLinelocationMods) GeometryX(val null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) GeometryXFunc(f func() null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetGeometryX() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.GeometryX = 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 fsLinelocationMods) RandomGeometryX(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - 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 fsLinelocationMods) RandomGeometryXNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.GeometryX = 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 fsLinelocationMods) GeometryY(val null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) GeometryYFunc(f func() null.Val[float64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetGeometryY() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.GeometryY = 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 fsLinelocationMods) RandomGeometryY(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - 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 fsLinelocationMods) RandomGeometryYNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.GeometryY = 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 fsLinelocationMods) LastEditedDate(val null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LastEditedDateFunc(f func() null.Val[int64]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLastEditedDate() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LastEditedDate = 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 fsLinelocationMods) RandomLastEditedDate(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsLinelocationMods) LastEditedUser(val null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) LastEditedUserFunc(f func() null.Val[string]) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetLastEditedUser() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LastEditedUser = 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 fsLinelocationMods) RandomLastEditedUser(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.LastEditedUser = 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 fsLinelocationMods) Updated(val time.Time) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsLinelocationMods) UpdatedFunc(f func() time.Time) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsLinelocationMods) UnsetUpdated() FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsLinelocationMods) RandomUpdated(f *faker.Faker) FSLinelocationMod { - return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsLinelocationMods) WithParentsCascading() FSLinelocationMod { - return FSLinelocationModFunc(func(ctx context.Context, o *FSLinelocationTemplate) { - if isDone, _ := fsLinelocationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsLinelocationWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsLinelocationMods) WithOrganization(rel *OrganizationTemplate) FSLinelocationMod { - return FSLinelocationModFunc(func(ctx context.Context, o *FSLinelocationTemplate) { - o.r.Organization = &fsLinelocationROrganizationR{ - o: rel, - } - }) -} - -func (m fsLinelocationMods) WithNewOrganization(mods ...OrganizationMod) FSLinelocationMod { - return FSLinelocationModFunc(func(ctx context.Context, o *FSLinelocationTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsLinelocationMods) WithExistingOrganization(em *models.Organization) FSLinelocationMod { - return FSLinelocationModFunc(func(ctx context.Context, o *FSLinelocationTemplate) { - o.r.Organization = &fsLinelocationROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsLinelocationMods) WithoutOrganization() FSLinelocationMod { - return FSLinelocationModFunc(func(ctx context.Context, o *FSLinelocationTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_locationtracking.bob.go b/db/factory/fs_locationtracking.bob.go deleted file mode 100644 index c7fd4eeb..00000000 --- a/db/factory/fs_locationtracking.bob.go +++ /dev/null @@ -1,1200 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSLocationtrackingMod interface { - Apply(context.Context, *FSLocationtrackingTemplate) -} - -type FSLocationtrackingModFunc func(context.Context, *FSLocationtrackingTemplate) - -func (f FSLocationtrackingModFunc) Apply(ctx context.Context, n *FSLocationtrackingTemplate) { - f(ctx, n) -} - -type FSLocationtrackingModSlice []FSLocationtrackingMod - -func (mods FSLocationtrackingModSlice) Apply(ctx context.Context, n *FSLocationtrackingTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSLocationtrackingTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSLocationtrackingTemplate struct { - OrganizationID func() int32 - Accuracy func() null.Val[float64] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fieldtech func() null.Val[string] - Globalid func() string - Objectid func() int32 - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Updated func() time.Time - - r fsLocationtrackingR - f *Factory - - alreadyPersisted bool -} - -type fsLocationtrackingR struct { - Organization *fsLocationtrackingROrganizationR -} - -type fsLocationtrackingROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSLocationtrackingTemplate -func (o *FSLocationtrackingTemplate) Apply(ctx context.Context, mods ...FSLocationtrackingMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSLocationtracking -// according to the relationships in the template. Nothing is inserted into the db -func (t FSLocationtrackingTemplate) setModelRels(o *models.FSLocationtracking) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSLocationtrackings = append(rel.R.FSLocationtrackings, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSLocationtrackingSetter -// this does nothing with the relationship templates -func (o FSLocationtrackingTemplate) BuildSetter() *models.FSLocationtrackingSetter { - m := &models.FSLocationtrackingSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accuracy != nil { - val := o.Accuracy() - m.Accuracy = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSLocationtrackingSetter -// this does nothing with the relationship templates -func (o FSLocationtrackingTemplate) BuildManySetter(number int) []*models.FSLocationtrackingSetter { - m := make([]*models.FSLocationtrackingSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSLocationtracking -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSLocationtrackingTemplate.Create -func (o FSLocationtrackingTemplate) Build() *models.FSLocationtracking { - m := &models.FSLocationtracking{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accuracy != nil { - m.Accuracy = o.Accuracy() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSLocationtrackingSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSLocationtrackingTemplate.CreateMany -func (o FSLocationtrackingTemplate) BuildMany(number int) models.FSLocationtrackingSlice { - m := make(models.FSLocationtrackingSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSLocationtracking(m *models.FSLocationtrackingSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSLocationtracking -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSLocationtrackingTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSLocationtracking) error { - var err error - - return err -} - -// Create builds a fsLocationtracking and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSLocationtrackingTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSLocationtracking, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSLocationtracking(opt) - - if o.r.Organization == nil { - FSLocationtrackingMods.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.FSLocationtrackings.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 fsLocationtracking and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSLocationtrackingTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSLocationtracking { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsLocationtracking 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 *FSLocationtrackingTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSLocationtracking { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsLocationtrackings and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSLocationtrackingTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSLocationtrackingSlice, error) { - var err error - m := make(models.FSLocationtrackingSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsLocationtrackings and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSLocationtrackingTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSLocationtrackingSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsLocationtrackings 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 FSLocationtrackingTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSLocationtrackingSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSLocationtracking has methods that act as mods for the FSLocationtrackingTemplate -var FSLocationtrackingMods fsLocationtrackingMods - -type fsLocationtrackingMods struct{} - -func (m fsLocationtrackingMods) RandomizeAllColumns(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModSlice{ - FSLocationtrackingMods.RandomOrganizationID(f), - FSLocationtrackingMods.RandomAccuracy(f), - FSLocationtrackingMods.RandomCreationdate(f), - FSLocationtrackingMods.RandomCreator(f), - FSLocationtrackingMods.RandomEditdate(f), - FSLocationtrackingMods.RandomEditor(f), - FSLocationtrackingMods.RandomFieldtech(f), - FSLocationtrackingMods.RandomGlobalid(f), - FSLocationtrackingMods.RandomObjectid(f), - FSLocationtrackingMods.RandomCreatedDate(f), - FSLocationtrackingMods.RandomCreatedUser(f), - FSLocationtrackingMods.RandomGeometryX(f), - FSLocationtrackingMods.RandomGeometryY(f), - FSLocationtrackingMods.RandomLastEditedDate(f), - FSLocationtrackingMods.RandomLastEditedUser(f), - FSLocationtrackingMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsLocationtrackingMods) OrganizationID(val int32) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) OrganizationIDFunc(f func() int32) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetOrganizationID() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - 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 fsLocationtrackingMods) RandomOrganizationID(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsLocationtrackingMods) Accuracy(val null.Val[float64]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Accuracy = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) AccuracyFunc(f func() null.Val[float64]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Accuracy = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetAccuracy() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Accuracy = 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 fsLocationtrackingMods) RandomAccuracy(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Accuracy = 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 fsLocationtrackingMods) RandomAccuracyNotNull(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Accuracy = 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 fsLocationtrackingMods) Creationdate(val null.Val[int64]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) CreationdateFunc(f func() null.Val[int64]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetCreationdate() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Creationdate = 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 fsLocationtrackingMods) RandomCreationdate(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsLocationtrackingMods) Creator(val null.Val[string]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) CreatorFunc(f func() null.Val[string]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetCreator() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Creator = 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 fsLocationtrackingMods) RandomCreator(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Creator = 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 fsLocationtrackingMods) Editdate(val null.Val[int64]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) EditdateFunc(f func() null.Val[int64]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetEditdate() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Editdate = 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 fsLocationtrackingMods) RandomEditdate(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsLocationtrackingMods) Editor(val null.Val[string]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) EditorFunc(f func() null.Val[string]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetEditor() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Editor = 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 fsLocationtrackingMods) RandomEditor(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Editor = 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 fsLocationtrackingMods) Fieldtech(val null.Val[string]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) FieldtechFunc(f func() null.Val[string]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetFieldtech() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Fieldtech = 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 fsLocationtrackingMods) RandomFieldtech(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Fieldtech = 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) RandomFieldtechNotNull(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Fieldtech = 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 fsLocationtrackingMods) Globalid(val string) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) GlobalidFunc(f func() string) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetGlobalid() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsLocationtrackingMods) RandomGlobalid(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsLocationtrackingMods) Objectid(val int32) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) ObjectidFunc(f func() int32) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetObjectid() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsLocationtrackingMods) RandomObjectid(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsLocationtrackingMods) CreatedDate(val null.Val[int64]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) CreatedDateFunc(f func() null.Val[int64]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetCreatedDate() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.CreatedDate = 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 fsLocationtrackingMods) RandomCreatedDate(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsLocationtrackingMods) CreatedUser(val null.Val[string]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) CreatedUserFunc(f func() null.Val[string]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetCreatedUser() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.CreatedUser = 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 fsLocationtrackingMods) RandomCreatedUser(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.CreatedUser = 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 fsLocationtrackingMods) GeometryX(val null.Val[float64]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) GeometryXFunc(f func() null.Val[float64]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetGeometryX() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.GeometryX = 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 fsLocationtrackingMods) RandomGeometryX(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - 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 fsLocationtrackingMods) RandomGeometryXNotNull(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.GeometryX = 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 fsLocationtrackingMods) GeometryY(val null.Val[float64]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) GeometryYFunc(f func() null.Val[float64]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetGeometryY() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.GeometryY = 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 fsLocationtrackingMods) RandomGeometryY(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - 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 fsLocationtrackingMods) RandomGeometryYNotNull(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.GeometryY = 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 fsLocationtrackingMods) LastEditedDate(val null.Val[int64]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) LastEditedDateFunc(f func() null.Val[int64]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetLastEditedDate() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.LastEditedDate = 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 fsLocationtrackingMods) RandomLastEditedDate(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsLocationtrackingMods) LastEditedUser(val null.Val[string]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) LastEditedUserFunc(f func() null.Val[string]) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetLastEditedUser() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.LastEditedUser = 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 fsLocationtrackingMods) RandomLastEditedUser(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.LastEditedUser = 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 fsLocationtrackingMods) Updated(val time.Time) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsLocationtrackingMods) UpdatedFunc(f func() time.Time) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsLocationtrackingMods) UnsetUpdated() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsLocationtrackingMods) RandomUpdated(f *faker.Faker) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsLocationtrackingMods) WithParentsCascading() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(ctx context.Context, o *FSLocationtrackingTemplate) { - if isDone, _ := fsLocationtrackingWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsLocationtrackingWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsLocationtrackingMods) WithOrganization(rel *OrganizationTemplate) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(ctx context.Context, o *FSLocationtrackingTemplate) { - o.r.Organization = &fsLocationtrackingROrganizationR{ - o: rel, - } - }) -} - -func (m fsLocationtrackingMods) WithNewOrganization(mods ...OrganizationMod) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(ctx context.Context, o *FSLocationtrackingTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsLocationtrackingMods) WithExistingOrganization(em *models.Organization) FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(ctx context.Context, o *FSLocationtrackingTemplate) { - o.r.Organization = &fsLocationtrackingROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsLocationtrackingMods) WithoutOrganization() FSLocationtrackingMod { - return FSLocationtrackingModFunc(func(ctx context.Context, o *FSLocationtrackingTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_mosquitoinspection.bob.go b/db/factory/fs_mosquitoinspection.bob.go deleted file mode 100644 index 01edd168..00000000 --- a/db/factory/fs_mosquitoinspection.bob.go +++ /dev/null @@ -1,4052 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSMosquitoinspectionMod interface { - Apply(context.Context, *FSMosquitoinspectionTemplate) -} - -type FSMosquitoinspectionModFunc func(context.Context, *FSMosquitoinspectionTemplate) - -func (f FSMosquitoinspectionModFunc) Apply(ctx context.Context, n *FSMosquitoinspectionTemplate) { - f(ctx, n) -} - -type FSMosquitoinspectionModSlice []FSMosquitoinspectionMod - -func (mods FSMosquitoinspectionModSlice) Apply(ctx context.Context, n *FSMosquitoinspectionTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSMosquitoinspectionTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSMosquitoinspectionTemplate struct { - OrganizationID func() int32 - Actiontaken func() null.Val[string] - Activity func() null.Val[string] - Adultact func() null.Val[string] - Avetemp func() null.Val[float64] - Avglarvae func() null.Val[float64] - Avgpupae func() null.Val[float64] - Breeding func() null.Val[string] - Cbcount func() null.Val[int16] - Comments func() null.Val[string] - Containercount func() null.Val[int16] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Domstage func() null.Val[string] - Eggs func() null.Val[int16] - Enddatetime func() null.Val[int64] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fieldspecies func() null.Val[string] - Fieldtech func() null.Val[string] - Globalid func() string - Jurisdiction func() null.Val[string] - Larvaepresent func() null.Val[int16] - Linelocid func() null.Val[string] - Locationname func() null.Val[string] - Lstages func() null.Val[string] - Numdips func() null.Val[int16] - Objectid func() int32 - Personalcontact func() null.Val[int16] - Pointlocid func() null.Val[string] - Polygonlocid func() null.Val[string] - Posdips func() null.Val[int16] - Positivecontainercount func() null.Val[int16] - Pupaepresent func() null.Val[int16] - Raingauge func() null.Val[float64] - Recordstatus func() null.Val[int16] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[int64] - Sdid func() null.Val[string] - Sitecond func() null.Val[string] - Srid func() null.Val[string] - Startdatetime func() null.Val[int64] - Tirecount func() null.Val[int16] - Totlarvae func() null.Val[int16] - Totpupae func() null.Val[int16] - Visualmonitoring func() null.Val[int16] - Vmcomments func() null.Val[string] - Winddir func() null.Val[string] - Windspeed func() null.Val[float64] - Zone func() null.Val[string] - 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] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Adminaction func() null.Val[string] - Ptaid func() null.Val[string] - Updated func() time.Time - Geom func() null.Val[string] - - r fsMosquitoinspectionR - f *Factory - - alreadyPersisted bool -} - -type fsMosquitoinspectionR struct { - Organization *fsMosquitoinspectionROrganizationR -} - -type fsMosquitoinspectionROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSMosquitoinspectionTemplate -func (o *FSMosquitoinspectionTemplate) Apply(ctx context.Context, mods ...FSMosquitoinspectionMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSMosquitoinspection -// according to the relationships in the template. Nothing is inserted into the db -func (t FSMosquitoinspectionTemplate) setModelRels(o *models.FSMosquitoinspection) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSMosquitoinspections = append(rel.R.FSMosquitoinspections, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSMosquitoinspectionSetter -// this does nothing with the relationship templates -func (o FSMosquitoinspectionTemplate) BuildSetter() *models.FSMosquitoinspectionSetter { - m := &models.FSMosquitoinspectionSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Actiontaken != nil { - val := o.Actiontaken() - m.Actiontaken = omitnull.FromNull(val) - } - if o.Activity != nil { - val := o.Activity() - m.Activity = omitnull.FromNull(val) - } - if o.Adultact != nil { - val := o.Adultact() - m.Adultact = omitnull.FromNull(val) - } - if o.Avetemp != nil { - val := o.Avetemp() - m.Avetemp = omitnull.FromNull(val) - } - if o.Avglarvae != nil { - val := o.Avglarvae() - m.Avglarvae = omitnull.FromNull(val) - } - if o.Avgpupae != nil { - val := o.Avgpupae() - m.Avgpupae = omitnull.FromNull(val) - } - if o.Breeding != nil { - val := o.Breeding() - m.Breeding = omitnull.FromNull(val) - } - if o.Cbcount != nil { - val := o.Cbcount() - m.Cbcount = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Containercount != nil { - val := o.Containercount() - m.Containercount = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Domstage != nil { - val := o.Domstage() - m.Domstage = omitnull.FromNull(val) - } - if o.Eggs != nil { - val := o.Eggs() - m.Eggs = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fieldspecies != nil { - val := o.Fieldspecies() - m.Fieldspecies = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.Larvaepresent != nil { - val := o.Larvaepresent() - m.Larvaepresent = omitnull.FromNull(val) - } - if o.Linelocid != nil { - val := o.Linelocid() - m.Linelocid = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.Lstages != nil { - val := o.Lstages() - m.Lstages = omitnull.FromNull(val) - } - if o.Numdips != nil { - val := o.Numdips() - m.Numdips = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Personalcontact != nil { - val := o.Personalcontact() - m.Personalcontact = omitnull.FromNull(val) - } - if o.Pointlocid != nil { - val := o.Pointlocid() - m.Pointlocid = omitnull.FromNull(val) - } - if o.Polygonlocid != nil { - val := o.Polygonlocid() - m.Polygonlocid = omitnull.FromNull(val) - } - if o.Posdips != nil { - val := o.Posdips() - m.Posdips = omitnull.FromNull(val) - } - if o.Positivecontainercount != nil { - val := o.Positivecontainercount() - m.Positivecontainercount = omitnull.FromNull(val) - } - if o.Pupaepresent != nil { - val := o.Pupaepresent() - m.Pupaepresent = omitnull.FromNull(val) - } - if o.Raingauge != nil { - val := o.Raingauge() - m.Raingauge = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Reviewed != nil { - val := o.Reviewed() - m.Reviewed = omitnull.FromNull(val) - } - if o.Reviewedby != nil { - val := o.Reviewedby() - m.Reviewedby = omitnull.FromNull(val) - } - if o.Revieweddate != nil { - val := o.Revieweddate() - m.Revieweddate = omitnull.FromNull(val) - } - if o.Sdid != nil { - val := o.Sdid() - m.Sdid = omitnull.FromNull(val) - } - if o.Sitecond != nil { - val := o.Sitecond() - m.Sitecond = omitnull.FromNull(val) - } - if o.Srid != nil { - val := o.Srid() - m.Srid = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Tirecount != nil { - val := o.Tirecount() - m.Tirecount = omitnull.FromNull(val) - } - if o.Totlarvae != nil { - val := o.Totlarvae() - m.Totlarvae = omitnull.FromNull(val) - } - if o.Totpupae != nil { - val := o.Totpupae() - m.Totpupae = omitnull.FromNull(val) - } - if o.Visualmonitoring != nil { - val := o.Visualmonitoring() - m.Visualmonitoring = omitnull.FromNull(val) - } - if o.Vmcomments != nil { - val := o.Vmcomments() - m.Vmcomments = omitnull.FromNull(val) - } - if o.Winddir != nil { - val := o.Winddir() - m.Winddir = omitnull.FromNull(val) - } - if o.Windspeed != nil { - val := o.Windspeed() - m.Windspeed = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Adminaction != nil { - val := o.Adminaction() - m.Adminaction = omitnull.FromNull(val) - } - if o.Ptaid != nil { - val := o.Ptaid() - m.Ptaid = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - if o.Geom != nil { - val := o.Geom() - m.Geom = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSMosquitoinspectionSetter -// this does nothing with the relationship templates -func (o FSMosquitoinspectionTemplate) BuildManySetter(number int) []*models.FSMosquitoinspectionSetter { - m := make([]*models.FSMosquitoinspectionSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSMosquitoinspection -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSMosquitoinspectionTemplate.Create -func (o FSMosquitoinspectionTemplate) Build() *models.FSMosquitoinspection { - m := &models.FSMosquitoinspection{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Actiontaken != nil { - m.Actiontaken = o.Actiontaken() - } - if o.Activity != nil { - m.Activity = o.Activity() - } - if o.Adultact != nil { - m.Adultact = o.Adultact() - } - if o.Avetemp != nil { - m.Avetemp = o.Avetemp() - } - if o.Avglarvae != nil { - m.Avglarvae = o.Avglarvae() - } - if o.Avgpupae != nil { - m.Avgpupae = o.Avgpupae() - } - if o.Breeding != nil { - m.Breeding = o.Breeding() - } - if o.Cbcount != nil { - m.Cbcount = o.Cbcount() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Containercount != nil { - m.Containercount = o.Containercount() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Domstage != nil { - m.Domstage = o.Domstage() - } - if o.Eggs != nil { - m.Eggs = o.Eggs() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fieldspecies != nil { - m.Fieldspecies = o.Fieldspecies() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Larvaepresent != nil { - m.Larvaepresent = o.Larvaepresent() - } - if o.Linelocid != nil { - m.Linelocid = o.Linelocid() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.Lstages != nil { - m.Lstages = o.Lstages() - } - if o.Numdips != nil { - m.Numdips = o.Numdips() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Personalcontact != nil { - m.Personalcontact = o.Personalcontact() - } - if o.Pointlocid != nil { - m.Pointlocid = o.Pointlocid() - } - if o.Polygonlocid != nil { - m.Polygonlocid = o.Polygonlocid() - } - if o.Posdips != nil { - m.Posdips = o.Posdips() - } - if o.Positivecontainercount != nil { - m.Positivecontainercount = o.Positivecontainercount() - } - if o.Pupaepresent != nil { - m.Pupaepresent = o.Pupaepresent() - } - if o.Raingauge != nil { - m.Raingauge = o.Raingauge() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Reviewed != nil { - m.Reviewed = o.Reviewed() - } - if o.Reviewedby != nil { - m.Reviewedby = o.Reviewedby() - } - if o.Revieweddate != nil { - m.Revieweddate = o.Revieweddate() - } - if o.Sdid != nil { - m.Sdid = o.Sdid() - } - if o.Sitecond != nil { - m.Sitecond = o.Sitecond() - } - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Tirecount != nil { - m.Tirecount = o.Tirecount() - } - if o.Totlarvae != nil { - m.Totlarvae = o.Totlarvae() - } - if o.Totpupae != nil { - m.Totpupae = o.Totpupae() - } - if o.Visualmonitoring != nil { - m.Visualmonitoring = o.Visualmonitoring() - } - if o.Vmcomments != nil { - m.Vmcomments = o.Vmcomments() - } - if o.Winddir != nil { - m.Winddir = o.Winddir() - } - if o.Windspeed != nil { - m.Windspeed = o.Windspeed() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Adminaction != nil { - m.Adminaction = o.Adminaction() - } - if o.Ptaid != nil { - m.Ptaid = o.Ptaid() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - if o.Geom != nil { - m.Geom = o.Geom() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSMosquitoinspectionSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSMosquitoinspectionTemplate.CreateMany -func (o FSMosquitoinspectionTemplate) BuildMany(number int) models.FSMosquitoinspectionSlice { - m := make(models.FSMosquitoinspectionSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSMosquitoinspection(m *models.FSMosquitoinspectionSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSMosquitoinspection -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSMosquitoinspectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSMosquitoinspection) error { - var err error - - return err -} - -// Create builds a fsMosquitoinspection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSMosquitoinspectionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSMosquitoinspection, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSMosquitoinspection(opt) - - if o.r.Organization == nil { - FSMosquitoinspectionMods.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.FSMosquitoinspections.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 fsMosquitoinspection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSMosquitoinspectionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSMosquitoinspection { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsMosquitoinspection 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 *FSMosquitoinspectionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSMosquitoinspection { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsMosquitoinspections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSMosquitoinspectionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSMosquitoinspectionSlice, error) { - var err error - m := make(models.FSMosquitoinspectionSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsMosquitoinspections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSMosquitoinspectionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSMosquitoinspectionSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsMosquitoinspections 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 FSMosquitoinspectionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSMosquitoinspectionSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSMosquitoinspection has methods that act as mods for the FSMosquitoinspectionTemplate -var FSMosquitoinspectionMods fsMosquitoinspectionMods - -type fsMosquitoinspectionMods struct{} - -func (m fsMosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModSlice{ - FSMosquitoinspectionMods.RandomOrganizationID(f), - FSMosquitoinspectionMods.RandomActiontaken(f), - FSMosquitoinspectionMods.RandomActivity(f), - FSMosquitoinspectionMods.RandomAdultact(f), - FSMosquitoinspectionMods.RandomAvetemp(f), - FSMosquitoinspectionMods.RandomAvglarvae(f), - FSMosquitoinspectionMods.RandomAvgpupae(f), - FSMosquitoinspectionMods.RandomBreeding(f), - FSMosquitoinspectionMods.RandomCbcount(f), - FSMosquitoinspectionMods.RandomComments(f), - FSMosquitoinspectionMods.RandomContainercount(f), - FSMosquitoinspectionMods.RandomCreationdate(f), - FSMosquitoinspectionMods.RandomCreator(f), - FSMosquitoinspectionMods.RandomDomstage(f), - FSMosquitoinspectionMods.RandomEggs(f), - FSMosquitoinspectionMods.RandomEnddatetime(f), - FSMosquitoinspectionMods.RandomEditdate(f), - FSMosquitoinspectionMods.RandomEditor(f), - FSMosquitoinspectionMods.RandomFieldspecies(f), - FSMosquitoinspectionMods.RandomFieldtech(f), - FSMosquitoinspectionMods.RandomGlobalid(f), - FSMosquitoinspectionMods.RandomJurisdiction(f), - FSMosquitoinspectionMods.RandomLarvaepresent(f), - FSMosquitoinspectionMods.RandomLinelocid(f), - FSMosquitoinspectionMods.RandomLocationname(f), - FSMosquitoinspectionMods.RandomLstages(f), - FSMosquitoinspectionMods.RandomNumdips(f), - FSMosquitoinspectionMods.RandomObjectid(f), - FSMosquitoinspectionMods.RandomPersonalcontact(f), - FSMosquitoinspectionMods.RandomPointlocid(f), - FSMosquitoinspectionMods.RandomPolygonlocid(f), - FSMosquitoinspectionMods.RandomPosdips(f), - FSMosquitoinspectionMods.RandomPositivecontainercount(f), - FSMosquitoinspectionMods.RandomPupaepresent(f), - FSMosquitoinspectionMods.RandomRaingauge(f), - FSMosquitoinspectionMods.RandomRecordstatus(f), - FSMosquitoinspectionMods.RandomReviewed(f), - FSMosquitoinspectionMods.RandomReviewedby(f), - FSMosquitoinspectionMods.RandomRevieweddate(f), - FSMosquitoinspectionMods.RandomSdid(f), - FSMosquitoinspectionMods.RandomSitecond(f), - FSMosquitoinspectionMods.RandomSrid(f), - FSMosquitoinspectionMods.RandomStartdatetime(f), - FSMosquitoinspectionMods.RandomTirecount(f), - FSMosquitoinspectionMods.RandomTotlarvae(f), - FSMosquitoinspectionMods.RandomTotpupae(f), - FSMosquitoinspectionMods.RandomVisualmonitoring(f), - FSMosquitoinspectionMods.RandomVmcomments(f), - FSMosquitoinspectionMods.RandomWinddir(f), - FSMosquitoinspectionMods.RandomWindspeed(f), - FSMosquitoinspectionMods.RandomZone(f), - FSMosquitoinspectionMods.RandomZone2(f), - FSMosquitoinspectionMods.RandomCreatedDate(f), - FSMosquitoinspectionMods.RandomCreatedUser(f), - FSMosquitoinspectionMods.RandomGeometryX(f), - FSMosquitoinspectionMods.RandomGeometryY(f), - FSMosquitoinspectionMods.RandomLastEditedDate(f), - FSMosquitoinspectionMods.RandomLastEditedUser(f), - FSMosquitoinspectionMods.RandomAdminaction(f), - FSMosquitoinspectionMods.RandomPtaid(f), - FSMosquitoinspectionMods.RandomUpdated(f), - FSMosquitoinspectionMods.RandomGeom(f), - } -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) OrganizationID(val int32) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) OrganizationIDFunc(f func() int32) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetOrganizationID() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - 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 fsMosquitoinspectionMods) RandomOrganizationID(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Actiontaken(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) ActiontakenFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Actiontaken = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetActiontaken() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Actiontaken = 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 fsMosquitoinspectionMods) RandomActiontaken(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Actiontaken = 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) RandomActiontakenNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Actiontaken = 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 fsMosquitoinspectionMods) Activity(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Activity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) ActivityFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Activity = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetActivity() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Activity = 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 fsMosquitoinspectionMods) RandomActivity(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Activity = 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) RandomActivityNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Activity = 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 fsMosquitoinspectionMods) Adultact(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Adultact = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) AdultactFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Adultact = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetAdultact() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Adultact = 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 fsMosquitoinspectionMods) RandomAdultact(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Adultact = 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) RandomAdultactNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Adultact = 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 fsMosquitoinspectionMods) Avetemp(val null.Val[float64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Avetemp = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) AvetempFunc(f func() null.Val[float64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Avetemp = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetAvetemp() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Avetemp = 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 fsMosquitoinspectionMods) RandomAvetemp(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Avetemp = 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 fsMosquitoinspectionMods) RandomAvetempNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Avetemp = 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 fsMosquitoinspectionMods) Avglarvae(val null.Val[float64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Avglarvae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) AvglarvaeFunc(f func() null.Val[float64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Avglarvae = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetAvglarvae() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Avglarvae = 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 fsMosquitoinspectionMods) RandomAvglarvae(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Avglarvae = 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 fsMosquitoinspectionMods) RandomAvglarvaeNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Avglarvae = 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 fsMosquitoinspectionMods) Avgpupae(val null.Val[float64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Avgpupae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) AvgpupaeFunc(f func() null.Val[float64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Avgpupae = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetAvgpupae() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Avgpupae = 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 fsMosquitoinspectionMods) RandomAvgpupae(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Avgpupae = 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 fsMosquitoinspectionMods) RandomAvgpupaeNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Avgpupae = 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 fsMosquitoinspectionMods) Breeding(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Breeding = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) BreedingFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Breeding = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetBreeding() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Breeding = 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 fsMosquitoinspectionMods) RandomBreeding(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Breeding = 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) RandomBreedingNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Breeding = 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 fsMosquitoinspectionMods) Cbcount(val null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Cbcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) CbcountFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Cbcount = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetCbcount() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Cbcount = 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 fsMosquitoinspectionMods) RandomCbcount(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Cbcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomCbcountNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Cbcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Comments(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) CommentsFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetComments() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Comments = 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 fsMosquitoinspectionMods) RandomComments(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Comments = 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 fsMosquitoinspectionMods) Containercount(val null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Containercount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) ContainercountFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Containercount = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetContainercount() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Containercount = 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 fsMosquitoinspectionMods) RandomContainercount(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Containercount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomContainercountNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Containercount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Creationdate(val null.Val[int64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) CreationdateFunc(f func() null.Val[int64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetCreationdate() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Creationdate = 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 fsMosquitoinspectionMods) RandomCreationdate(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Creator(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) CreatorFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetCreator() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Creator = 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 fsMosquitoinspectionMods) RandomCreator(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Creator = 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 fsMosquitoinspectionMods) Domstage(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Domstage = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) DomstageFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Domstage = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetDomstage() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Domstage = 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 fsMosquitoinspectionMods) RandomDomstage(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Domstage = 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) RandomDomstageNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Domstage = 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 fsMosquitoinspectionMods) Eggs(val null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Eggs = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) EggsFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Eggs = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetEggs() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Eggs = 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 fsMosquitoinspectionMods) RandomEggs(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Eggs = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomEggsNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Eggs = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Enddatetime(val null.Val[int64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Enddatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) EnddatetimeFunc(f func() null.Val[int64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetEnddatetime() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Enddatetime = 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 fsMosquitoinspectionMods) RandomEnddatetime(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Editdate(val null.Val[int64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) EditdateFunc(f func() null.Val[int64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetEditdate() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Editdate = 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 fsMosquitoinspectionMods) RandomEditdate(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Editor(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) EditorFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetEditor() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Editor = 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 fsMosquitoinspectionMods) RandomEditor(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Editor = 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 fsMosquitoinspectionMods) Fieldspecies(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Fieldspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) FieldspeciesFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Fieldspecies = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetFieldspecies() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Fieldspecies = 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 fsMosquitoinspectionMods) RandomFieldspecies(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Fieldspecies = 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) RandomFieldspeciesNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Fieldspecies = 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 fsMosquitoinspectionMods) Fieldtech(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) FieldtechFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetFieldtech() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Fieldtech = 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 fsMosquitoinspectionMods) RandomFieldtech(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Fieldtech = 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) RandomFieldtechNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Fieldtech = 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 fsMosquitoinspectionMods) Globalid(val string) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) GlobalidFunc(f func() string) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetGlobalid() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsMosquitoinspectionMods) RandomGlobalid(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Jurisdiction(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) JurisdictionFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetJurisdiction() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Jurisdiction = 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 fsMosquitoinspectionMods) RandomJurisdiction(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Jurisdiction = 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) RandomJurisdictionNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Jurisdiction = 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 fsMosquitoinspectionMods) Larvaepresent(val null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) LarvaepresentFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Larvaepresent = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetLarvaepresent() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Larvaepresent = 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 fsMosquitoinspectionMods) RandomLarvaepresent(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomLarvaepresentNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Linelocid(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Linelocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) LinelocidFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Linelocid = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetLinelocid() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Linelocid = 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 fsMosquitoinspectionMods) RandomLinelocid(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Linelocid = 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) RandomLinelocidNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Linelocid = 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 fsMosquitoinspectionMods) Locationname(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) LocationnameFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetLocationname() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Locationname = 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 fsMosquitoinspectionMods) RandomLocationname(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Locationname = 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) RandomLocationnameNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Locationname = 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 fsMosquitoinspectionMods) Lstages(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Lstages = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) LstagesFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Lstages = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetLstages() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Lstages = 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 fsMosquitoinspectionMods) RandomLstages(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Lstages = 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) RandomLstagesNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Lstages = 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 fsMosquitoinspectionMods) Numdips(val null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Numdips = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) NumdipsFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Numdips = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetNumdips() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Numdips = 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 fsMosquitoinspectionMods) RandomNumdips(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Numdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomNumdipsNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Numdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Objectid(val int32) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) ObjectidFunc(f func() int32) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetObjectid() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsMosquitoinspectionMods) RandomObjectid(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Personalcontact(val null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Personalcontact = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) PersonalcontactFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Personalcontact = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetPersonalcontact() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Personalcontact = 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 fsMosquitoinspectionMods) RandomPersonalcontact(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Personalcontact = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomPersonalcontactNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Personalcontact = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Pointlocid(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Pointlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) PointlocidFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Pointlocid = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetPointlocid() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Pointlocid = 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 fsMosquitoinspectionMods) RandomPointlocid(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Pointlocid = 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) RandomPointlocidNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Pointlocid = 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 fsMosquitoinspectionMods) Polygonlocid(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Polygonlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) PolygonlocidFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Polygonlocid = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetPolygonlocid() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Polygonlocid = 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 fsMosquitoinspectionMods) RandomPolygonlocid(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Polygonlocid = 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) RandomPolygonlocidNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Polygonlocid = 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 fsMosquitoinspectionMods) Posdips(val null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Posdips = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) PosdipsFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Posdips = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetPosdips() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Posdips = 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 fsMosquitoinspectionMods) RandomPosdips(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Posdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomPosdipsNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Posdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Positivecontainercount(val null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Positivecontainercount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) PositivecontainercountFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Positivecontainercount = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetPositivecontainercount() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Positivecontainercount = 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 fsMosquitoinspectionMods) RandomPositivecontainercount(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Positivecontainercount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomPositivecontainercountNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Positivecontainercount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Pupaepresent(val null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Pupaepresent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) PupaepresentFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Pupaepresent = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetPupaepresent() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Pupaepresent = 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 fsMosquitoinspectionMods) RandomPupaepresent(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Pupaepresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomPupaepresentNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Pupaepresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Raingauge(val null.Val[float64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Raingauge = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) RaingaugeFunc(f func() null.Val[float64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Raingauge = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetRaingauge() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Raingauge = 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 fsMosquitoinspectionMods) RandomRaingauge(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Raingauge = 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 fsMosquitoinspectionMods) RandomRaingaugeNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Raingauge = 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 fsMosquitoinspectionMods) Recordstatus(val null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) RecordstatusFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetRecordstatus() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Recordstatus = 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 fsMosquitoinspectionMods) RandomRecordstatus(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Reviewed(val null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) ReviewedFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetReviewed() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Reviewed = 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 fsMosquitoinspectionMods) RandomReviewed(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Reviewedby(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) ReviewedbyFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetReviewedby() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Reviewedby = 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 fsMosquitoinspectionMods) RandomReviewedby(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Reviewedby = 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) RandomReviewedbyNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Reviewedby = 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 fsMosquitoinspectionMods) Revieweddate(val null.Val[int64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Revieweddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) RevieweddateFunc(f func() null.Val[int64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetRevieweddate() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Revieweddate = 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 fsMosquitoinspectionMods) RandomRevieweddate(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Sdid(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Sdid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) SdidFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Sdid = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetSdid() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Sdid = 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 fsMosquitoinspectionMods) RandomSdid(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Sdid = 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) RandomSdidNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Sdid = 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 fsMosquitoinspectionMods) Sitecond(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Sitecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) SitecondFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Sitecond = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetSitecond() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Sitecond = 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 fsMosquitoinspectionMods) RandomSitecond(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Sitecond = 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) RandomSitecondNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Sitecond = 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 fsMosquitoinspectionMods) Srid(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Srid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) SridFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetSrid() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - 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 fsMosquitoinspectionMods) RandomSrid(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Srid = 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) RandomSridNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Srid = 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 fsMosquitoinspectionMods) Startdatetime(val null.Val[int64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Startdatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) StartdatetimeFunc(f func() null.Val[int64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetStartdatetime() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Startdatetime = 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 fsMosquitoinspectionMods) RandomStartdatetime(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Tirecount(val null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Tirecount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) TirecountFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Tirecount = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetTirecount() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Tirecount = 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 fsMosquitoinspectionMods) RandomTirecount(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Tirecount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomTirecountNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Tirecount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Totlarvae(val null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Totlarvae = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) TotlarvaeFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Totlarvae = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetTotlarvae() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Totlarvae = 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 fsMosquitoinspectionMods) RandomTotlarvae(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Totlarvae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomTotlarvaeNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Totlarvae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Totpupae(val null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Totpupae = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) TotpupaeFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Totpupae = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetTotpupae() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Totpupae = 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 fsMosquitoinspectionMods) RandomTotpupae(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Totpupae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomTotpupaeNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Totpupae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Visualmonitoring(val null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Visualmonitoring = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) VisualmonitoringFunc(f func() null.Val[int16]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Visualmonitoring = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetVisualmonitoring() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Visualmonitoring = 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 fsMosquitoinspectionMods) RandomVisualmonitoring(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Visualmonitoring = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomVisualmonitoringNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Visualmonitoring = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Vmcomments(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Vmcomments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) VmcommentsFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Vmcomments = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetVmcomments() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Vmcomments = 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 fsMosquitoinspectionMods) RandomVmcomments(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Vmcomments = 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) RandomVmcommentsNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Vmcomments = 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 fsMosquitoinspectionMods) Winddir(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Winddir = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) WinddirFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Winddir = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetWinddir() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Winddir = 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 fsMosquitoinspectionMods) RandomWinddir(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Winddir = 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) RandomWinddirNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Winddir = 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 fsMosquitoinspectionMods) Windspeed(val null.Val[float64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Windspeed = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) WindspeedFunc(f func() null.Val[float64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Windspeed = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetWindspeed() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Windspeed = 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 fsMosquitoinspectionMods) RandomWindspeed(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Windspeed = 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 fsMosquitoinspectionMods) RandomWindspeedNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Windspeed = 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 fsMosquitoinspectionMods) Zone(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) ZoneFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetZone() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Zone = 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 fsMosquitoinspectionMods) RandomZone(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Zone = 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) RandomZoneNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Zone = 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 fsMosquitoinspectionMods) Zone2(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) Zone2Func(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetZone2() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Zone2 = 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 fsMosquitoinspectionMods) RandomZone2(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Zone2 = 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) RandomZone2NotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Zone2 = 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 fsMosquitoinspectionMods) CreatedDate(val null.Val[int64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) CreatedDateFunc(f func() null.Val[int64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetCreatedDate() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.CreatedDate = 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 fsMosquitoinspectionMods) RandomCreatedDate(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) CreatedUser(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) CreatedUserFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetCreatedUser() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.CreatedUser = 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 fsMosquitoinspectionMods) RandomCreatedUser(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.CreatedUser = 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 fsMosquitoinspectionMods) GeometryX(val null.Val[float64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) GeometryXFunc(f func() null.Val[float64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetGeometryX() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.GeometryX = 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 fsMosquitoinspectionMods) RandomGeometryX(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - 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 fsMosquitoinspectionMods) RandomGeometryXNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.GeometryX = 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 fsMosquitoinspectionMods) GeometryY(val null.Val[float64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) GeometryYFunc(f func() null.Val[float64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetGeometryY() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.GeometryY = 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 fsMosquitoinspectionMods) RandomGeometryY(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - 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 fsMosquitoinspectionMods) RandomGeometryYNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.GeometryY = 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 fsMosquitoinspectionMods) LastEditedDate(val null.Val[int64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) LastEditedDateFunc(f func() null.Val[int64]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetLastEditedDate() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.LastEditedDate = 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 fsMosquitoinspectionMods) RandomLastEditedDate(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) LastEditedUser(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) LastEditedUserFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetLastEditedUser() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.LastEditedUser = 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 fsMosquitoinspectionMods) RandomLastEditedUser(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.LastEditedUser = 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 fsMosquitoinspectionMods) Adminaction(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Adminaction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) AdminactionFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Adminaction = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetAdminaction() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Adminaction = 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 fsMosquitoinspectionMods) RandomAdminaction(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Adminaction = 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) RandomAdminactionNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Adminaction = 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 fsMosquitoinspectionMods) Ptaid(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Ptaid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) PtaidFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Ptaid = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetPtaid() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Ptaid = 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 fsMosquitoinspectionMods) RandomPtaid(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Ptaid = 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) RandomPtaidNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Ptaid = 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 fsMosquitoinspectionMods) Updated(val time.Time) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) UpdatedFunc(f func() time.Time) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetUpdated() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsMosquitoinspectionMods) RandomUpdated(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m fsMosquitoinspectionMods) Geom(val null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Geom = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsMosquitoinspectionMods) GeomFunc(f func() null.Val[string]) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Geom = f - }) -} - -// Clear any values for the column -func (m fsMosquitoinspectionMods) UnsetGeom() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Geom = 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 fsMosquitoinspectionMods) RandomGeom(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Geom = 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) RandomGeomNotNull(f *faker.Faker) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) { - o.Geom = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -func (m fsMosquitoinspectionMods) WithParentsCascading() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(ctx context.Context, o *FSMosquitoinspectionTemplate) { - if isDone, _ := fsMosquitoinspectionWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsMosquitoinspectionWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsMosquitoinspectionMods) WithOrganization(rel *OrganizationTemplate) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(ctx context.Context, o *FSMosquitoinspectionTemplate) { - o.r.Organization = &fsMosquitoinspectionROrganizationR{ - o: rel, - } - }) -} - -func (m fsMosquitoinspectionMods) WithNewOrganization(mods ...OrganizationMod) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(ctx context.Context, o *FSMosquitoinspectionTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsMosquitoinspectionMods) WithExistingOrganization(em *models.Organization) FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(ctx context.Context, o *FSMosquitoinspectionTemplate) { - o.r.Organization = &fsMosquitoinspectionROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsMosquitoinspectionMods) WithoutOrganization() FSMosquitoinspectionMod { - return FSMosquitoinspectionModFunc(func(ctx context.Context, o *FSMosquitoinspectionTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_pointlocation.bob.go b/db/factory/fs_pointlocation.bob.go deleted file mode 100644 index 8f9a74ea..00000000 --- a/db/factory/fs_pointlocation.bob.go +++ /dev/null @@ -1,3210 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSPointlocationMod interface { - Apply(context.Context, *FSPointlocationTemplate) -} - -type FSPointlocationModFunc func(context.Context, *FSPointlocationTemplate) - -func (f FSPointlocationModFunc) Apply(ctx context.Context, n *FSPointlocationTemplate) { - f(ctx, n) -} - -type FSPointlocationModSlice []FSPointlocationMod - -func (mods FSPointlocationModSlice) Apply(ctx context.Context, n *FSPointlocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSPointlocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSPointlocationTemplate struct { - OrganizationID func() int32 - Accessdesc func() null.Val[string] - Active func() null.Val[int16] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Description func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() string - Habitat func() null.Val[string] - Jurisdiction func() null.Val[string] - Larvinspectinterval func() null.Val[int16] - Lastinspectactiontaken func() null.Val[string] - Lastinspectactivity func() null.Val[string] - Lastinspectavglarvae func() null.Val[float64] - Lastinspectavgpupae func() null.Val[float64] - Lastinspectbreeding func() null.Val[string] - Lastinspectconditions func() null.Val[string] - Lastinspectdate func() null.Val[int64] - Lastinspectfieldspecies func() null.Val[string] - Lastinspectlstages func() null.Val[string] - Lasttreatactivity func() null.Val[string] - Lasttreatdate func() null.Val[int64] - Lasttreatproduct func() null.Val[string] - Lasttreatqty func() null.Val[float64] - Lasttreatqtyunit func() null.Val[string] - Locationnumber func() null.Val[int64] - Name func() null.Val[string] - Nextactiondatescheduled func() null.Val[int64] - Objectid func() int32 - Priority func() null.Val[string] - Stype func() null.Val[string] - Symbology func() null.Val[string] - Usetype func() null.Val[string] - Waterorigin func() null.Val[string] - X func() null.Val[float64] - Y func() null.Val[float64] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - GeometryX func() float64 - GeometryY func() float64 - Assignedtech func() null.Val[string] - DeactivateReason func() null.Val[string] - Scalarpriority func() null.Val[int64] - Sourcestatus func() null.Val[string] - Updated func() time.Time - Geom func() null.Val[string] - - r fsPointlocationR - f *Factory - - alreadyPersisted bool -} - -type fsPointlocationR struct { - Organization *fsPointlocationROrganizationR -} - -type fsPointlocationROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSPointlocationTemplate -func (o *FSPointlocationTemplate) Apply(ctx context.Context, mods ...FSPointlocationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSPointlocation -// according to the relationships in the template. Nothing is inserted into the db -func (t FSPointlocationTemplate) setModelRels(o *models.FSPointlocation) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSPointlocations = append(rel.R.FSPointlocations, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSPointlocationSetter -// this does nothing with the relationship templates -func (o FSPointlocationTemplate) BuildSetter() *models.FSPointlocationSetter { - m := &models.FSPointlocationSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(val) - } - if o.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.Larvinspectinterval != nil { - val := o.Larvinspectinterval() - m.Larvinspectinterval = omitnull.FromNull(val) - } - if o.Lastinspectactiontaken != nil { - val := o.Lastinspectactiontaken() - m.Lastinspectactiontaken = omitnull.FromNull(val) - } - if o.Lastinspectactivity != nil { - val := o.Lastinspectactivity() - m.Lastinspectactivity = omitnull.FromNull(val) - } - if o.Lastinspectavglarvae != nil { - val := o.Lastinspectavglarvae() - m.Lastinspectavglarvae = omitnull.FromNull(val) - } - if o.Lastinspectavgpupae != nil { - val := o.Lastinspectavgpupae() - m.Lastinspectavgpupae = omitnull.FromNull(val) - } - if o.Lastinspectbreeding != nil { - val := o.Lastinspectbreeding() - m.Lastinspectbreeding = omitnull.FromNull(val) - } - if o.Lastinspectconditions != nil { - val := o.Lastinspectconditions() - m.Lastinspectconditions = omitnull.FromNull(val) - } - if o.Lastinspectdate != nil { - val := o.Lastinspectdate() - m.Lastinspectdate = omitnull.FromNull(val) - } - if o.Lastinspectfieldspecies != nil { - val := o.Lastinspectfieldspecies() - m.Lastinspectfieldspecies = omitnull.FromNull(val) - } - if o.Lastinspectlstages != nil { - val := o.Lastinspectlstages() - m.Lastinspectlstages = omitnull.FromNull(val) - } - if o.Lasttreatactivity != nil { - val := o.Lasttreatactivity() - m.Lasttreatactivity = omitnull.FromNull(val) - } - if o.Lasttreatdate != nil { - val := o.Lasttreatdate() - m.Lasttreatdate = omitnull.FromNull(val) - } - if o.Lasttreatproduct != nil { - val := o.Lasttreatproduct() - m.Lasttreatproduct = omitnull.FromNull(val) - } - if o.Lasttreatqty != nil { - val := o.Lasttreatqty() - m.Lasttreatqty = omitnull.FromNull(val) - } - if o.Lasttreatqtyunit != nil { - val := o.Lasttreatqtyunit() - m.Lasttreatqtyunit = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Stype != nil { - val := o.Stype() - m.Stype = omitnull.FromNull(val) - } - if o.Symbology != nil { - val := o.Symbology() - m.Symbology = omitnull.FromNull(val) - } - if o.Usetype != nil { - val := o.Usetype() - m.Usetype = omitnull.FromNull(val) - } - if o.Waterorigin != nil { - val := o.Waterorigin() - m.Waterorigin = omitnull.FromNull(val) - } - if o.X != nil { - val := o.X() - m.X = omitnull.FromNull(val) - } - if o.Y != nil { - val := o.Y() - m.Y = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omit.From(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omit.From(val) - } - if o.Assignedtech != nil { - val := o.Assignedtech() - m.Assignedtech = omitnull.FromNull(val) - } - if o.DeactivateReason != nil { - val := o.DeactivateReason() - m.DeactivateReason = omitnull.FromNull(val) - } - if o.Scalarpriority != nil { - val := o.Scalarpriority() - m.Scalarpriority = omitnull.FromNull(val) - } - if o.Sourcestatus != nil { - val := o.Sourcestatus() - m.Sourcestatus = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - if o.Geom != nil { - val := o.Geom() - m.Geom = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSPointlocationSetter -// this does nothing with the relationship templates -func (o FSPointlocationTemplate) BuildManySetter(number int) []*models.FSPointlocationSetter { - m := make([]*models.FSPointlocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSPointlocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSPointlocationTemplate.Create -func (o FSPointlocationTemplate) Build() *models.FSPointlocation { - m := &models.FSPointlocation{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Larvinspectinterval != nil { - m.Larvinspectinterval = o.Larvinspectinterval() - } - if o.Lastinspectactiontaken != nil { - m.Lastinspectactiontaken = o.Lastinspectactiontaken() - } - if o.Lastinspectactivity != nil { - m.Lastinspectactivity = o.Lastinspectactivity() - } - if o.Lastinspectavglarvae != nil { - m.Lastinspectavglarvae = o.Lastinspectavglarvae() - } - if o.Lastinspectavgpupae != nil { - m.Lastinspectavgpupae = o.Lastinspectavgpupae() - } - if o.Lastinspectbreeding != nil { - m.Lastinspectbreeding = o.Lastinspectbreeding() - } - if o.Lastinspectconditions != nil { - m.Lastinspectconditions = o.Lastinspectconditions() - } - if o.Lastinspectdate != nil { - m.Lastinspectdate = o.Lastinspectdate() - } - if o.Lastinspectfieldspecies != nil { - m.Lastinspectfieldspecies = o.Lastinspectfieldspecies() - } - if o.Lastinspectlstages != nil { - m.Lastinspectlstages = o.Lastinspectlstages() - } - if o.Lasttreatactivity != nil { - m.Lasttreatactivity = o.Lasttreatactivity() - } - if o.Lasttreatdate != nil { - m.Lasttreatdate = o.Lasttreatdate() - } - if o.Lasttreatproduct != nil { - m.Lasttreatproduct = o.Lasttreatproduct() - } - if o.Lasttreatqty != nil { - m.Lasttreatqty = o.Lasttreatqty() - } - if o.Lasttreatqtyunit != nil { - m.Lasttreatqtyunit = o.Lasttreatqtyunit() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Stype != nil { - m.Stype = o.Stype() - } - if o.Symbology != nil { - m.Symbology = o.Symbology() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Waterorigin != nil { - m.Waterorigin = o.Waterorigin() - } - if o.X != nil { - m.X = o.X() - } - if o.Y != nil { - m.Y = o.Y() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.Assignedtech != nil { - m.Assignedtech = o.Assignedtech() - } - if o.DeactivateReason != nil { - m.DeactivateReason = o.DeactivateReason() - } - if o.Scalarpriority != nil { - m.Scalarpriority = o.Scalarpriority() - } - if o.Sourcestatus != nil { - m.Sourcestatus = o.Sourcestatus() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - if o.Geom != nil { - m.Geom = o.Geom() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSPointlocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSPointlocationTemplate.CreateMany -func (o FSPointlocationTemplate) BuildMany(number int) models.FSPointlocationSlice { - m := make(models.FSPointlocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSPointlocation(m *models.FSPointlocationSetter) { - if !(m.OrganizationID.IsValue()) { - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSPointlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSPointlocation) error { - var err error - - return err -} - -// Create builds a fsPointlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSPointlocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSPointlocation, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSPointlocation(opt) - - if o.r.Organization == nil { - FSPointlocationMods.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.FSPointlocations.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 fsPointlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSPointlocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSPointlocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsPointlocation 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 *FSPointlocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSPointlocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsPointlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSPointlocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSPointlocationSlice, error) { - var err error - m := make(models.FSPointlocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsPointlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSPointlocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSPointlocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsPointlocations 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 FSPointlocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSPointlocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSPointlocation has methods that act as mods for the FSPointlocationTemplate -var FSPointlocationMods fsPointlocationMods - -type fsPointlocationMods struct{} - -func (m fsPointlocationMods) RandomizeAllColumns(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModSlice{ - FSPointlocationMods.RandomOrganizationID(f), - FSPointlocationMods.RandomAccessdesc(f), - FSPointlocationMods.RandomActive(f), - FSPointlocationMods.RandomComments(f), - FSPointlocationMods.RandomCreationdate(f), - FSPointlocationMods.RandomCreator(f), - FSPointlocationMods.RandomDescription(f), - FSPointlocationMods.RandomExternalid(f), - FSPointlocationMods.RandomEditdate(f), - FSPointlocationMods.RandomEditor(f), - FSPointlocationMods.RandomGlobalid(f), - FSPointlocationMods.RandomHabitat(f), - FSPointlocationMods.RandomJurisdiction(f), - FSPointlocationMods.RandomLarvinspectinterval(f), - FSPointlocationMods.RandomLastinspectactiontaken(f), - FSPointlocationMods.RandomLastinspectactivity(f), - FSPointlocationMods.RandomLastinspectavglarvae(f), - FSPointlocationMods.RandomLastinspectavgpupae(f), - FSPointlocationMods.RandomLastinspectbreeding(f), - FSPointlocationMods.RandomLastinspectconditions(f), - FSPointlocationMods.RandomLastinspectdate(f), - FSPointlocationMods.RandomLastinspectfieldspecies(f), - FSPointlocationMods.RandomLastinspectlstages(f), - FSPointlocationMods.RandomLasttreatactivity(f), - FSPointlocationMods.RandomLasttreatdate(f), - FSPointlocationMods.RandomLasttreatproduct(f), - FSPointlocationMods.RandomLasttreatqty(f), - FSPointlocationMods.RandomLasttreatqtyunit(f), - FSPointlocationMods.RandomLocationnumber(f), - FSPointlocationMods.RandomName(f), - FSPointlocationMods.RandomNextactiondatescheduled(f), - FSPointlocationMods.RandomObjectid(f), - FSPointlocationMods.RandomPriority(f), - FSPointlocationMods.RandomStype(f), - FSPointlocationMods.RandomSymbology(f), - FSPointlocationMods.RandomUsetype(f), - FSPointlocationMods.RandomWaterorigin(f), - FSPointlocationMods.RandomX(f), - FSPointlocationMods.RandomY(f), - FSPointlocationMods.RandomZone(f), - FSPointlocationMods.RandomZone2(f), - FSPointlocationMods.RandomGeometryX(f), - FSPointlocationMods.RandomGeometryY(f), - FSPointlocationMods.RandomAssignedtech(f), - FSPointlocationMods.RandomDeactivateReason(f), - FSPointlocationMods.RandomScalarpriority(f), - FSPointlocationMods.RandomSourcestatus(f), - FSPointlocationMods.RandomUpdated(f), - FSPointlocationMods.RandomGeom(f), - } -} - -// Set the model columns to this value -func (m fsPointlocationMods) OrganizationID(val int32) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) OrganizationIDFunc(f func() int32) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetOrganizationID() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - 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 fsPointlocationMods) RandomOrganizationID(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsPointlocationMods) Accessdesc(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) AccessdescFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetAccessdesc() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Accessdesc = 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 fsPointlocationMods) RandomAccessdesc(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Accessdesc = 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) RandomAccessdescNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Accessdesc = 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 fsPointlocationMods) Active(val null.Val[int16]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) ActiveFunc(f func() null.Val[int16]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetActive() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Active = 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 fsPointlocationMods) RandomActive(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomActiveNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPointlocationMods) Comments(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) CommentsFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetComments() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Comments = 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 fsPointlocationMods) RandomComments(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Comments = 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 fsPointlocationMods) Creationdate(val null.Val[int64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) CreationdateFunc(f func() null.Val[int64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetCreationdate() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Creationdate = 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 fsPointlocationMods) RandomCreationdate(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPointlocationMods) Creator(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) CreatorFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetCreator() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Creator = 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 fsPointlocationMods) RandomCreator(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Creator = 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 fsPointlocationMods) Description(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) DescriptionFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetDescription() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Description = 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 fsPointlocationMods) RandomDescription(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Description = 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) RandomDescriptionNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Description = 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 fsPointlocationMods) Externalid(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) ExternalidFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetExternalid() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Externalid = 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 fsPointlocationMods) RandomExternalid(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Externalid = 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) RandomExternalidNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Externalid = 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 fsPointlocationMods) Editdate(val null.Val[int64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) EditdateFunc(f func() null.Val[int64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetEditdate() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Editdate = 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 fsPointlocationMods) RandomEditdate(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPointlocationMods) Editor(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) EditorFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetEditor() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Editor = 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 fsPointlocationMods) RandomEditor(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Editor = 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 fsPointlocationMods) Globalid(val string) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) GlobalidFunc(f func() string) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetGlobalid() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsPointlocationMods) RandomGlobalid(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsPointlocationMods) Habitat(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) HabitatFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetHabitat() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Habitat = 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 fsPointlocationMods) RandomHabitat(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Habitat = 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) RandomHabitatNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Habitat = 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 fsPointlocationMods) Jurisdiction(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) JurisdictionFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetJurisdiction() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Jurisdiction = 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 fsPointlocationMods) RandomJurisdiction(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Jurisdiction = 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) RandomJurisdictionNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Jurisdiction = 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 fsPointlocationMods) Larvinspectinterval(val null.Val[int16]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LarvinspectintervalFunc(f func() null.Val[int16]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Larvinspectinterval = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLarvinspectinterval() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Larvinspectinterval = 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 fsPointlocationMods) RandomLarvinspectinterval(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomLarvinspectintervalNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPointlocationMods) Lastinspectactiontaken(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectactiontaken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LastinspectactiontakenFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectactiontaken = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLastinspectactiontaken() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectactiontaken = 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 fsPointlocationMods) RandomLastinspectactiontaken(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectactiontaken = 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) RandomLastinspectactiontakenNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectactiontaken = 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 fsPointlocationMods) Lastinspectactivity(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LastinspectactivityFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectactivity = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLastinspectactivity() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectactivity = 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 fsPointlocationMods) RandomLastinspectactivity(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectactivity = 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) RandomLastinspectactivityNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectactivity = 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 fsPointlocationMods) Lastinspectavglarvae(val null.Val[float64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectavglarvae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LastinspectavglarvaeFunc(f func() null.Val[float64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectavglarvae = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLastinspectavglarvae() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectavglarvae = 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 fsPointlocationMods) RandomLastinspectavglarvae(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectavglarvae = 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) RandomLastinspectavglarvaeNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectavglarvae = 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 fsPointlocationMods) Lastinspectavgpupae(val null.Val[float64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectavgpupae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LastinspectavgpupaeFunc(f func() null.Val[float64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectavgpupae = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLastinspectavgpupae() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectavgpupae = 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 fsPointlocationMods) RandomLastinspectavgpupae(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectavgpupae = 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) RandomLastinspectavgpupaeNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectavgpupae = 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 fsPointlocationMods) Lastinspectbreeding(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectbreeding = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LastinspectbreedingFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectbreeding = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLastinspectbreeding() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectbreeding = 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 fsPointlocationMods) RandomLastinspectbreeding(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectbreeding = 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) RandomLastinspectbreedingNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectbreeding = 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 fsPointlocationMods) Lastinspectconditions(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LastinspectconditionsFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectconditions = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLastinspectconditions() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectconditions = 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 fsPointlocationMods) RandomLastinspectconditions(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectconditions = 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) RandomLastinspectconditionsNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectconditions = 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 fsPointlocationMods) Lastinspectdate(val null.Val[int64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LastinspectdateFunc(f func() null.Val[int64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectdate = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLastinspectdate() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectdate = 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 fsPointlocationMods) RandomLastinspectdate(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastinspectdateNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPointlocationMods) Lastinspectfieldspecies(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectfieldspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LastinspectfieldspeciesFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectfieldspecies = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLastinspectfieldspecies() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectfieldspecies = 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 fsPointlocationMods) RandomLastinspectfieldspecies(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectfieldspecies = 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) RandomLastinspectfieldspeciesNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectfieldspecies = 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 fsPointlocationMods) Lastinspectlstages(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectlstages = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LastinspectlstagesFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectlstages = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLastinspectlstages() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectlstages = 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 fsPointlocationMods) RandomLastinspectlstages(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectlstages = 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) RandomLastinspectlstagesNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lastinspectlstages = 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 fsPointlocationMods) Lasttreatactivity(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LasttreatactivityFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatactivity = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLasttreatactivity() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatactivity = 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 fsPointlocationMods) RandomLasttreatactivity(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatactivity = 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) RandomLasttreatactivityNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatactivity = 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 fsPointlocationMods) Lasttreatdate(val null.Val[int64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LasttreatdateFunc(f func() null.Val[int64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatdate = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLasttreatdate() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatdate = 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 fsPointlocationMods) RandomLasttreatdate(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLasttreatdateNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPointlocationMods) Lasttreatproduct(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatproduct = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LasttreatproductFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatproduct = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLasttreatproduct() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatproduct = 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 fsPointlocationMods) RandomLasttreatproduct(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatproduct = 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) RandomLasttreatproductNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatproduct = 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 fsPointlocationMods) Lasttreatqty(val null.Val[float64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatqty = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LasttreatqtyFunc(f func() null.Val[float64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatqty = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLasttreatqty() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatqty = 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 fsPointlocationMods) RandomLasttreatqty(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatqty = 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) RandomLasttreatqtyNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatqty = 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 fsPointlocationMods) Lasttreatqtyunit(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LasttreatqtyunitFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatqtyunit = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLasttreatqtyunit() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatqtyunit = 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 fsPointlocationMods) RandomLasttreatqtyunit(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatqtyunit = 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) RandomLasttreatqtyunitNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Lasttreatqtyunit = 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 fsPointlocationMods) Locationnumber(val null.Val[int64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) LocationnumberFunc(f func() null.Val[int64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetLocationnumber() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Locationnumber = 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 fsPointlocationMods) RandomLocationnumber(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPointlocationMods) Name(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) NameFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetName() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Name = 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 fsPointlocationMods) RandomName(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Name = 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) RandomNameNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Name = 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 fsPointlocationMods) Nextactiondatescheduled(val null.Val[int64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetNextactiondatescheduled() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Nextactiondatescheduled = 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 fsPointlocationMods) RandomNextactiondatescheduled(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPointlocationMods) Objectid(val int32) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) ObjectidFunc(f func() int32) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetObjectid() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsPointlocationMods) RandomObjectid(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsPointlocationMods) Priority(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) PriorityFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetPriority() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Priority = 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 fsPointlocationMods) RandomPriority(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Priority = 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) RandomPriorityNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Priority = 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 fsPointlocationMods) Stype(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Stype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) StypeFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Stype = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetStype() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Stype = 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 fsPointlocationMods) RandomStype(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Stype = 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) RandomStypeNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Stype = 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 fsPointlocationMods) Symbology(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Symbology = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) SymbologyFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Symbology = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetSymbology() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Symbology = 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 fsPointlocationMods) RandomSymbology(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Symbology = 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) RandomSymbologyNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Symbology = 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 fsPointlocationMods) Usetype(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) UsetypeFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetUsetype() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Usetype = 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 fsPointlocationMods) RandomUsetype(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Usetype = 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) RandomUsetypeNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Usetype = 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 fsPointlocationMods) Waterorigin(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Waterorigin = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) WateroriginFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Waterorigin = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetWaterorigin() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Waterorigin = 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 fsPointlocationMods) RandomWaterorigin(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Waterorigin = 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) RandomWateroriginNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Waterorigin = 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 fsPointlocationMods) X(val null.Val[float64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.X = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) XFunc(f func() null.Val[float64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.X = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetX() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.X = 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 fsPointlocationMods) RandomX(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.X = 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) RandomXNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.X = 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 fsPointlocationMods) Y(val null.Val[float64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Y = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) YFunc(f func() null.Val[float64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Y = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetY() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Y = 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 fsPointlocationMods) RandomY(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Y = 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) RandomYNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Y = 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 fsPointlocationMods) Zone(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) ZoneFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetZone() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Zone = 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 fsPointlocationMods) RandomZone(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Zone = 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) RandomZoneNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Zone = 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 fsPointlocationMods) Zone2(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) Zone2Func(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetZone2() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Zone2 = 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 fsPointlocationMods) RandomZone2(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Zone2 = 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) RandomZone2NotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Zone2 = 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 fsPointlocationMods) GeometryX(val float64) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.GeometryX = func() float64 { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) GeometryXFunc(f func() float64) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetGeometryX() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.GeometryX = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsPointlocationMods) RandomGeometryX(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.GeometryX = func() float64 { - return random_float64(f) - } - }) -} - -// Set the model columns to this value -func (m fsPointlocationMods) GeometryY(val float64) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.GeometryY = func() float64 { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) GeometryYFunc(f func() float64) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetGeometryY() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.GeometryY = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsPointlocationMods) RandomGeometryY(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.GeometryY = func() float64 { - return random_float64(f) - } - }) -} - -// Set the model columns to this value -func (m fsPointlocationMods) Assignedtech(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Assignedtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) AssignedtechFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Assignedtech = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetAssignedtech() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Assignedtech = 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 fsPointlocationMods) RandomAssignedtech(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Assignedtech = 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) RandomAssignedtechNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Assignedtech = 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 fsPointlocationMods) DeactivateReason(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.DeactivateReason = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) DeactivateReasonFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.DeactivateReason = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetDeactivateReason() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.DeactivateReason = 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 fsPointlocationMods) RandomDeactivateReason(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.DeactivateReason = 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) RandomDeactivateReasonNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.DeactivateReason = 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 fsPointlocationMods) Scalarpriority(val null.Val[int64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Scalarpriority = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) ScalarpriorityFunc(f func() null.Val[int64]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Scalarpriority = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetScalarpriority() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Scalarpriority = 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 fsPointlocationMods) RandomScalarpriority(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Scalarpriority = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomScalarpriorityNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Scalarpriority = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPointlocationMods) Sourcestatus(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Sourcestatus = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) SourcestatusFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Sourcestatus = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetSourcestatus() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Sourcestatus = 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 fsPointlocationMods) RandomSourcestatus(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Sourcestatus = 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) RandomSourcestatusNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Sourcestatus = 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 fsPointlocationMods) Updated(val time.Time) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) UpdatedFunc(f func() time.Time) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetUpdated() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsPointlocationMods) RandomUpdated(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m fsPointlocationMods) Geom(val null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Geom = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPointlocationMods) GeomFunc(f func() null.Val[string]) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Geom = f - }) -} - -// Clear any values for the column -func (m fsPointlocationMods) UnsetGeom() FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Geom = 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 fsPointlocationMods) RandomGeom(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Geom = 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) RandomGeomNotNull(f *faker.Faker) FSPointlocationMod { - return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) { - o.Geom = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -func (m fsPointlocationMods) WithParentsCascading() FSPointlocationMod { - return FSPointlocationModFunc(func(ctx context.Context, o *FSPointlocationTemplate) { - if isDone, _ := fsPointlocationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsPointlocationWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsPointlocationMods) WithOrganization(rel *OrganizationTemplate) FSPointlocationMod { - return FSPointlocationModFunc(func(ctx context.Context, o *FSPointlocationTemplate) { - o.r.Organization = &fsPointlocationROrganizationR{ - o: rel, - } - }) -} - -func (m fsPointlocationMods) WithNewOrganization(mods ...OrganizationMod) FSPointlocationMod { - return FSPointlocationModFunc(func(ctx context.Context, o *FSPointlocationTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsPointlocationMods) WithExistingOrganization(em *models.Organization) FSPointlocationMod { - return FSPointlocationModFunc(func(ctx context.Context, o *FSPointlocationTemplate) { - o.r.Organization = &fsPointlocationROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsPointlocationMods) WithoutOrganization() FSPointlocationMod { - return FSPointlocationModFunc(func(ctx context.Context, o *FSPointlocationTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_polygonlocation.bob.go b/db/factory/fs_polygonlocation.bob.go deleted file mode 100644 index 455e0192..00000000 --- a/db/factory/fs_polygonlocation.bob.go +++ /dev/null @@ -1,3060 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSPolygonlocationMod interface { - Apply(context.Context, *FSPolygonlocationTemplate) -} - -type FSPolygonlocationModFunc func(context.Context, *FSPolygonlocationTemplate) - -func (f FSPolygonlocationModFunc) Apply(ctx context.Context, n *FSPolygonlocationTemplate) { - f(ctx, n) -} - -type FSPolygonlocationModSlice []FSPolygonlocationMod - -func (mods FSPolygonlocationModSlice) Apply(ctx context.Context, n *FSPolygonlocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSPolygonlocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSPolygonlocationTemplate struct { - OrganizationID func() int32 - Accessdesc func() null.Val[string] - Acres func() null.Val[float64] - Active func() null.Val[int16] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Description func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Filter func() null.Val[string] - Globalid func() string - Habitat func() null.Val[string] - Hectares func() null.Val[float64] - Jurisdiction func() null.Val[string] - Larvinspectinterval func() null.Val[int16] - Lastinspectactiontaken func() null.Val[string] - Lastinspectactivity func() null.Val[string] - Lastinspectavglarvae func() null.Val[float64] - Lastinspectavgpupae func() null.Val[float64] - Lastinspectbreeding func() null.Val[string] - Lastinspectconditions func() null.Val[string] - Lastinspectdate func() null.Val[int64] - Lastinspectfieldspecies func() null.Val[string] - Lastinspectlstages func() null.Val[string] - Lasttreatactivity func() null.Val[string] - Lasttreatdate func() null.Val[int64] - Lasttreatproduct func() null.Val[string] - Lasttreatqty func() null.Val[float64] - Lasttreatqtyunit func() null.Val[string] - Locationnumber func() null.Val[int64] - Name func() null.Val[string] - Nextactiondatescheduled func() null.Val[int64] - Objectid func() int32 - Priority func() null.Val[string] - Symbology func() null.Val[string] - ShapeArea func() null.Val[float64] - ShapeLength func() null.Val[float64] - Usetype func() null.Val[string] - Waterorigin func() null.Val[string] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - Updated func() time.Time - - r fsPolygonlocationR - f *Factory - - alreadyPersisted bool -} - -type fsPolygonlocationR struct { - Organization *fsPolygonlocationROrganizationR -} - -type fsPolygonlocationROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSPolygonlocationTemplate -func (o *FSPolygonlocationTemplate) Apply(ctx context.Context, mods ...FSPolygonlocationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSPolygonlocation -// according to the relationships in the template. Nothing is inserted into the db -func (t FSPolygonlocationTemplate) setModelRels(o *models.FSPolygonlocation) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSPolygonlocations = append(rel.R.FSPolygonlocations, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSPolygonlocationSetter -// this does nothing with the relationship templates -func (o FSPolygonlocationTemplate) BuildSetter() *models.FSPolygonlocationSetter { - m := &models.FSPolygonlocationSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Acres != nil { - val := o.Acres() - m.Acres = omitnull.FromNull(val) - } - if o.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Filter != nil { - val := o.Filter() - m.Filter = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(val) - } - if o.Hectares != nil { - val := o.Hectares() - m.Hectares = omitnull.FromNull(val) - } - if o.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.Larvinspectinterval != nil { - val := o.Larvinspectinterval() - m.Larvinspectinterval = omitnull.FromNull(val) - } - if o.Lastinspectactiontaken != nil { - val := o.Lastinspectactiontaken() - m.Lastinspectactiontaken = omitnull.FromNull(val) - } - if o.Lastinspectactivity != nil { - val := o.Lastinspectactivity() - m.Lastinspectactivity = omitnull.FromNull(val) - } - if o.Lastinspectavglarvae != nil { - val := o.Lastinspectavglarvae() - m.Lastinspectavglarvae = omitnull.FromNull(val) - } - if o.Lastinspectavgpupae != nil { - val := o.Lastinspectavgpupae() - m.Lastinspectavgpupae = omitnull.FromNull(val) - } - if o.Lastinspectbreeding != nil { - val := o.Lastinspectbreeding() - m.Lastinspectbreeding = omitnull.FromNull(val) - } - if o.Lastinspectconditions != nil { - val := o.Lastinspectconditions() - m.Lastinspectconditions = omitnull.FromNull(val) - } - if o.Lastinspectdate != nil { - val := o.Lastinspectdate() - m.Lastinspectdate = omitnull.FromNull(val) - } - if o.Lastinspectfieldspecies != nil { - val := o.Lastinspectfieldspecies() - m.Lastinspectfieldspecies = omitnull.FromNull(val) - } - if o.Lastinspectlstages != nil { - val := o.Lastinspectlstages() - m.Lastinspectlstages = omitnull.FromNull(val) - } - if o.Lasttreatactivity != nil { - val := o.Lasttreatactivity() - m.Lasttreatactivity = omitnull.FromNull(val) - } - if o.Lasttreatdate != nil { - val := o.Lasttreatdate() - m.Lasttreatdate = omitnull.FromNull(val) - } - if o.Lasttreatproduct != nil { - val := o.Lasttreatproduct() - m.Lasttreatproduct = omitnull.FromNull(val) - } - if o.Lasttreatqty != nil { - val := o.Lasttreatqty() - m.Lasttreatqty = omitnull.FromNull(val) - } - if o.Lasttreatqtyunit != nil { - val := o.Lasttreatqtyunit() - m.Lasttreatqtyunit = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Symbology != nil { - val := o.Symbology() - m.Symbology = omitnull.FromNull(val) - } - if o.ShapeArea != nil { - val := o.ShapeArea() - m.ShapeArea = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - val := o.ShapeLength() - m.ShapeLength = omitnull.FromNull(val) - } - if o.Usetype != nil { - val := o.Usetype() - m.Usetype = omitnull.FromNull(val) - } - if o.Waterorigin != nil { - val := o.Waterorigin() - m.Waterorigin = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSPolygonlocationSetter -// this does nothing with the relationship templates -func (o FSPolygonlocationTemplate) BuildManySetter(number int) []*models.FSPolygonlocationSetter { - m := make([]*models.FSPolygonlocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSPolygonlocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSPolygonlocationTemplate.Create -func (o FSPolygonlocationTemplate) Build() *models.FSPolygonlocation { - m := &models.FSPolygonlocation{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Acres != nil { - m.Acres = o.Acres() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Filter != nil { - m.Filter = o.Filter() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Hectares != nil { - m.Hectares = o.Hectares() - } - if o.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Larvinspectinterval != nil { - m.Larvinspectinterval = o.Larvinspectinterval() - } - if o.Lastinspectactiontaken != nil { - m.Lastinspectactiontaken = o.Lastinspectactiontaken() - } - if o.Lastinspectactivity != nil { - m.Lastinspectactivity = o.Lastinspectactivity() - } - if o.Lastinspectavglarvae != nil { - m.Lastinspectavglarvae = o.Lastinspectavglarvae() - } - if o.Lastinspectavgpupae != nil { - m.Lastinspectavgpupae = o.Lastinspectavgpupae() - } - if o.Lastinspectbreeding != nil { - m.Lastinspectbreeding = o.Lastinspectbreeding() - } - if o.Lastinspectconditions != nil { - m.Lastinspectconditions = o.Lastinspectconditions() - } - if o.Lastinspectdate != nil { - m.Lastinspectdate = o.Lastinspectdate() - } - if o.Lastinspectfieldspecies != nil { - m.Lastinspectfieldspecies = o.Lastinspectfieldspecies() - } - if o.Lastinspectlstages != nil { - m.Lastinspectlstages = o.Lastinspectlstages() - } - if o.Lasttreatactivity != nil { - m.Lasttreatactivity = o.Lasttreatactivity() - } - if o.Lasttreatdate != nil { - m.Lasttreatdate = o.Lasttreatdate() - } - if o.Lasttreatproduct != nil { - m.Lasttreatproduct = o.Lasttreatproduct() - } - if o.Lasttreatqty != nil { - m.Lasttreatqty = o.Lasttreatqty() - } - if o.Lasttreatqtyunit != nil { - m.Lasttreatqtyunit = o.Lasttreatqtyunit() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Symbology != nil { - m.Symbology = o.Symbology() - } - if o.ShapeArea != nil { - m.ShapeArea = o.ShapeArea() - } - if o.ShapeLength != nil { - m.ShapeLength = o.ShapeLength() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Waterorigin != nil { - m.Waterorigin = o.Waterorigin() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSPolygonlocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSPolygonlocationTemplate.CreateMany -func (o FSPolygonlocationTemplate) BuildMany(number int) models.FSPolygonlocationSlice { - m := make(models.FSPolygonlocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSPolygonlocation(m *models.FSPolygonlocationSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSPolygonlocation -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSPolygonlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSPolygonlocation) error { - var err error - - return err -} - -// Create builds a fsPolygonlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSPolygonlocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSPolygonlocation, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSPolygonlocation(opt) - - if o.r.Organization == nil { - FSPolygonlocationMods.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.FSPolygonlocations.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 fsPolygonlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSPolygonlocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSPolygonlocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsPolygonlocation 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 *FSPolygonlocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSPolygonlocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsPolygonlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSPolygonlocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSPolygonlocationSlice, error) { - var err error - m := make(models.FSPolygonlocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsPolygonlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSPolygonlocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSPolygonlocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsPolygonlocations 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 FSPolygonlocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSPolygonlocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSPolygonlocation has methods that act as mods for the FSPolygonlocationTemplate -var FSPolygonlocationMods fsPolygonlocationMods - -type fsPolygonlocationMods struct{} - -func (m fsPolygonlocationMods) RandomizeAllColumns(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModSlice{ - FSPolygonlocationMods.RandomOrganizationID(f), - FSPolygonlocationMods.RandomAccessdesc(f), - FSPolygonlocationMods.RandomAcres(f), - FSPolygonlocationMods.RandomActive(f), - FSPolygonlocationMods.RandomComments(f), - FSPolygonlocationMods.RandomCreationdate(f), - FSPolygonlocationMods.RandomCreator(f), - FSPolygonlocationMods.RandomDescription(f), - FSPolygonlocationMods.RandomExternalid(f), - FSPolygonlocationMods.RandomEditdate(f), - FSPolygonlocationMods.RandomEditor(f), - FSPolygonlocationMods.RandomFilter(f), - FSPolygonlocationMods.RandomGlobalid(f), - FSPolygonlocationMods.RandomHabitat(f), - FSPolygonlocationMods.RandomHectares(f), - FSPolygonlocationMods.RandomJurisdiction(f), - FSPolygonlocationMods.RandomLarvinspectinterval(f), - FSPolygonlocationMods.RandomLastinspectactiontaken(f), - FSPolygonlocationMods.RandomLastinspectactivity(f), - FSPolygonlocationMods.RandomLastinspectavglarvae(f), - FSPolygonlocationMods.RandomLastinspectavgpupae(f), - FSPolygonlocationMods.RandomLastinspectbreeding(f), - FSPolygonlocationMods.RandomLastinspectconditions(f), - FSPolygonlocationMods.RandomLastinspectdate(f), - FSPolygonlocationMods.RandomLastinspectfieldspecies(f), - FSPolygonlocationMods.RandomLastinspectlstages(f), - FSPolygonlocationMods.RandomLasttreatactivity(f), - FSPolygonlocationMods.RandomLasttreatdate(f), - FSPolygonlocationMods.RandomLasttreatproduct(f), - FSPolygonlocationMods.RandomLasttreatqty(f), - FSPolygonlocationMods.RandomLasttreatqtyunit(f), - FSPolygonlocationMods.RandomLocationnumber(f), - FSPolygonlocationMods.RandomName(f), - FSPolygonlocationMods.RandomNextactiondatescheduled(f), - FSPolygonlocationMods.RandomObjectid(f), - FSPolygonlocationMods.RandomPriority(f), - FSPolygonlocationMods.RandomSymbology(f), - FSPolygonlocationMods.RandomShapeArea(f), - FSPolygonlocationMods.RandomShapeLength(f), - FSPolygonlocationMods.RandomUsetype(f), - FSPolygonlocationMods.RandomWaterorigin(f), - FSPolygonlocationMods.RandomZone(f), - FSPolygonlocationMods.RandomZone2(f), - FSPolygonlocationMods.RandomGeometryX(f), - FSPolygonlocationMods.RandomGeometryY(f), - FSPolygonlocationMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsPolygonlocationMods) OrganizationID(val int32) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) OrganizationIDFunc(f func() int32) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetOrganizationID() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - 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 fsPolygonlocationMods) RandomOrganizationID(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsPolygonlocationMods) Accessdesc(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) AccessdescFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetAccessdesc() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Accessdesc = 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 fsPolygonlocationMods) RandomAccessdesc(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Accessdesc = 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) RandomAccessdescNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Accessdesc = 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 fsPolygonlocationMods) Acres(val null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Acres = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) AcresFunc(f func() null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Acres = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetAcres() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Acres = 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 fsPolygonlocationMods) RandomAcres(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Acres = 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 fsPolygonlocationMods) RandomAcresNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Acres = 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 fsPolygonlocationMods) Active(val null.Val[int16]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) ActiveFunc(f func() null.Val[int16]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetActive() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Active = 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 fsPolygonlocationMods) RandomActive(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomActiveNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPolygonlocationMods) Comments(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) CommentsFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetComments() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Comments = 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 fsPolygonlocationMods) RandomComments(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Comments = 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 fsPolygonlocationMods) Creationdate(val null.Val[int64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) CreationdateFunc(f func() null.Val[int64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetCreationdate() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Creationdate = 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 fsPolygonlocationMods) RandomCreationdate(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPolygonlocationMods) Creator(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) CreatorFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetCreator() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Creator = 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 fsPolygonlocationMods) RandomCreator(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Creator = 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 fsPolygonlocationMods) Description(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) DescriptionFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetDescription() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Description = 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 fsPolygonlocationMods) RandomDescription(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Description = 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) RandomDescriptionNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Description = 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 fsPolygonlocationMods) Externalid(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) ExternalidFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetExternalid() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Externalid = 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 fsPolygonlocationMods) RandomExternalid(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Externalid = 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) RandomExternalidNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Externalid = 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 fsPolygonlocationMods) Editdate(val null.Val[int64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) EditdateFunc(f func() null.Val[int64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetEditdate() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Editdate = 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 fsPolygonlocationMods) RandomEditdate(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPolygonlocationMods) Editor(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) EditorFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetEditor() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Editor = 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 fsPolygonlocationMods) RandomEditor(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Editor = 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 fsPolygonlocationMods) Filter(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Filter = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) FilterFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Filter = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetFilter() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Filter = 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 fsPolygonlocationMods) RandomFilter(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Filter = 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) RandomFilterNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Filter = 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 fsPolygonlocationMods) Globalid(val string) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) GlobalidFunc(f func() string) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetGlobalid() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsPolygonlocationMods) RandomGlobalid(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsPolygonlocationMods) Habitat(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) HabitatFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetHabitat() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Habitat = 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 fsPolygonlocationMods) RandomHabitat(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Habitat = 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) RandomHabitatNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Habitat = 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 fsPolygonlocationMods) Hectares(val null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Hectares = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) HectaresFunc(f func() null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Hectares = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetHectares() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Hectares = 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 fsPolygonlocationMods) RandomHectares(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Hectares = 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 fsPolygonlocationMods) RandomHectaresNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Hectares = 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 fsPolygonlocationMods) Jurisdiction(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) JurisdictionFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetJurisdiction() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Jurisdiction = 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 fsPolygonlocationMods) RandomJurisdiction(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Jurisdiction = 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) RandomJurisdictionNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Jurisdiction = 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 fsPolygonlocationMods) Larvinspectinterval(val null.Val[int16]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LarvinspectintervalFunc(f func() null.Val[int16]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Larvinspectinterval = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLarvinspectinterval() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Larvinspectinterval = 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 fsPolygonlocationMods) RandomLarvinspectinterval(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomLarvinspectintervalNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPolygonlocationMods) Lastinspectactiontaken(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectactiontaken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LastinspectactiontakenFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectactiontaken = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLastinspectactiontaken() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectactiontaken = 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 fsPolygonlocationMods) RandomLastinspectactiontaken(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectactiontaken = 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) RandomLastinspectactiontakenNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectactiontaken = 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 fsPolygonlocationMods) Lastinspectactivity(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LastinspectactivityFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectactivity = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLastinspectactivity() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectactivity = 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 fsPolygonlocationMods) RandomLastinspectactivity(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectactivity = 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) RandomLastinspectactivityNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectactivity = 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 fsPolygonlocationMods) Lastinspectavglarvae(val null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectavglarvae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LastinspectavglarvaeFunc(f func() null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectavglarvae = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLastinspectavglarvae() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectavglarvae = 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 fsPolygonlocationMods) RandomLastinspectavglarvae(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectavglarvae = 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 fsPolygonlocationMods) RandomLastinspectavglarvaeNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectavglarvae = 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 fsPolygonlocationMods) Lastinspectavgpupae(val null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectavgpupae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LastinspectavgpupaeFunc(f func() null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectavgpupae = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLastinspectavgpupae() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectavgpupae = 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 fsPolygonlocationMods) RandomLastinspectavgpupae(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectavgpupae = 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 fsPolygonlocationMods) RandomLastinspectavgpupaeNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectavgpupae = 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 fsPolygonlocationMods) Lastinspectbreeding(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectbreeding = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LastinspectbreedingFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectbreeding = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLastinspectbreeding() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectbreeding = 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 fsPolygonlocationMods) RandomLastinspectbreeding(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectbreeding = 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) RandomLastinspectbreedingNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectbreeding = 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 fsPolygonlocationMods) Lastinspectconditions(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LastinspectconditionsFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectconditions = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLastinspectconditions() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectconditions = 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 fsPolygonlocationMods) RandomLastinspectconditions(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectconditions = 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) RandomLastinspectconditionsNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectconditions = 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 fsPolygonlocationMods) Lastinspectdate(val null.Val[int64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LastinspectdateFunc(f func() null.Val[int64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectdate = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLastinspectdate() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectdate = 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 fsPolygonlocationMods) RandomLastinspectdate(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastinspectdateNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPolygonlocationMods) Lastinspectfieldspecies(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectfieldspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LastinspectfieldspeciesFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectfieldspecies = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLastinspectfieldspecies() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectfieldspecies = 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 fsPolygonlocationMods) RandomLastinspectfieldspecies(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectfieldspecies = 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) RandomLastinspectfieldspeciesNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectfieldspecies = 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 fsPolygonlocationMods) Lastinspectlstages(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectlstages = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LastinspectlstagesFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectlstages = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLastinspectlstages() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectlstages = 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 fsPolygonlocationMods) RandomLastinspectlstages(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectlstages = 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) RandomLastinspectlstagesNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lastinspectlstages = 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 fsPolygonlocationMods) Lasttreatactivity(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LasttreatactivityFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatactivity = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLasttreatactivity() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatactivity = 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 fsPolygonlocationMods) RandomLasttreatactivity(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatactivity = 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) RandomLasttreatactivityNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatactivity = 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 fsPolygonlocationMods) Lasttreatdate(val null.Val[int64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LasttreatdateFunc(f func() null.Val[int64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatdate = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLasttreatdate() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatdate = 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 fsPolygonlocationMods) RandomLasttreatdate(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLasttreatdateNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPolygonlocationMods) Lasttreatproduct(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatproduct = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LasttreatproductFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatproduct = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLasttreatproduct() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatproduct = 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 fsPolygonlocationMods) RandomLasttreatproduct(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatproduct = 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) RandomLasttreatproductNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatproduct = 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 fsPolygonlocationMods) Lasttreatqty(val null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatqty = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LasttreatqtyFunc(f func() null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatqty = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLasttreatqty() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatqty = 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 fsPolygonlocationMods) RandomLasttreatqty(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatqty = 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 fsPolygonlocationMods) RandomLasttreatqtyNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatqty = 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 fsPolygonlocationMods) Lasttreatqtyunit(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LasttreatqtyunitFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatqtyunit = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLasttreatqtyunit() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatqtyunit = 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 fsPolygonlocationMods) RandomLasttreatqtyunit(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatqtyunit = 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) RandomLasttreatqtyunitNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Lasttreatqtyunit = 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 fsPolygonlocationMods) Locationnumber(val null.Val[int64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) LocationnumberFunc(f func() null.Val[int64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetLocationnumber() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Locationnumber = 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 fsPolygonlocationMods) RandomLocationnumber(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPolygonlocationMods) Name(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) NameFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetName() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Name = 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 fsPolygonlocationMods) RandomName(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Name = 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) RandomNameNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Name = 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 fsPolygonlocationMods) Nextactiondatescheduled(val null.Val[int64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetNextactiondatescheduled() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Nextactiondatescheduled = 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 fsPolygonlocationMods) RandomNextactiondatescheduled(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPolygonlocationMods) Objectid(val int32) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) ObjectidFunc(f func() int32) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetObjectid() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsPolygonlocationMods) RandomObjectid(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsPolygonlocationMods) Priority(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) PriorityFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetPriority() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Priority = 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 fsPolygonlocationMods) RandomPriority(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Priority = 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) RandomPriorityNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Priority = 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 fsPolygonlocationMods) Symbology(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Symbology = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) SymbologyFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Symbology = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetSymbology() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Symbology = 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 fsPolygonlocationMods) RandomSymbology(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Symbology = 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) RandomSymbologyNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Symbology = 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 fsPolygonlocationMods) ShapeArea(val null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.ShapeArea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) ShapeAreaFunc(f func() null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.ShapeArea = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetShapeArea() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.ShapeArea = 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 fsPolygonlocationMods) RandomShapeArea(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.ShapeArea = 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 fsPolygonlocationMods) RandomShapeAreaNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.ShapeArea = 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 fsPolygonlocationMods) ShapeLength(val null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) ShapeLengthFunc(f func() null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetShapeLength() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.ShapeLength = 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 fsPolygonlocationMods) RandomShapeLength(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.ShapeLength = 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 fsPolygonlocationMods) RandomShapeLengthNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.ShapeLength = 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 fsPolygonlocationMods) Usetype(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) UsetypeFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetUsetype() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Usetype = 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 fsPolygonlocationMods) RandomUsetype(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Usetype = 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) RandomUsetypeNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Usetype = 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 fsPolygonlocationMods) Waterorigin(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Waterorigin = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) WateroriginFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Waterorigin = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetWaterorigin() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Waterorigin = 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 fsPolygonlocationMods) RandomWaterorigin(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Waterorigin = 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) RandomWateroriginNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Waterorigin = 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 fsPolygonlocationMods) Zone(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) ZoneFunc(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetZone() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Zone = 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 fsPolygonlocationMods) RandomZone(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Zone = 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) RandomZoneNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Zone = 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 fsPolygonlocationMods) Zone2(val null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) Zone2Func(f func() null.Val[string]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetZone2() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Zone2 = 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 fsPolygonlocationMods) RandomZone2(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Zone2 = 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) RandomZone2NotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Zone2 = 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 fsPolygonlocationMods) GeometryX(val null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) GeometryXFunc(f func() null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetGeometryX() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.GeometryX = 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 fsPolygonlocationMods) RandomGeometryX(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - 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 fsPolygonlocationMods) RandomGeometryXNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.GeometryX = 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 fsPolygonlocationMods) GeometryY(val null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) GeometryYFunc(f func() null.Val[float64]) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetGeometryY() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.GeometryY = 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 fsPolygonlocationMods) RandomGeometryY(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - 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 fsPolygonlocationMods) RandomGeometryYNotNull(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.GeometryY = 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 fsPolygonlocationMods) Updated(val time.Time) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsPolygonlocationMods) UpdatedFunc(f func() time.Time) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsPolygonlocationMods) UnsetUpdated() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsPolygonlocationMods) RandomUpdated(f *faker.Faker) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsPolygonlocationMods) WithParentsCascading() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(ctx context.Context, o *FSPolygonlocationTemplate) { - if isDone, _ := fsPolygonlocationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsPolygonlocationWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsPolygonlocationMods) WithOrganization(rel *OrganizationTemplate) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(ctx context.Context, o *FSPolygonlocationTemplate) { - o.r.Organization = &fsPolygonlocationROrganizationR{ - o: rel, - } - }) -} - -func (m fsPolygonlocationMods) WithNewOrganization(mods ...OrganizationMod) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(ctx context.Context, o *FSPolygonlocationTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsPolygonlocationMods) WithExistingOrganization(em *models.Organization) FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(ctx context.Context, o *FSPolygonlocationTemplate) { - o.r.Organization = &fsPolygonlocationROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsPolygonlocationMods) WithoutOrganization() FSPolygonlocationMod { - return FSPolygonlocationModFunc(func(ctx context.Context, o *FSPolygonlocationTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_pool.bob.go b/db/factory/fs_pool.bob.go deleted file mode 100644 index c02da508..00000000 --- a/db/factory/fs_pool.bob.go +++ /dev/null @@ -1,2192 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSPoolMod interface { - Apply(context.Context, *FSPoolTemplate) -} - -type FSPoolModFunc func(context.Context, *FSPoolTemplate) - -func (f FSPoolModFunc) Apply(ctx context.Context, n *FSPoolTemplate) { - f(ctx, n) -} - -type FSPoolModSlice []FSPoolMod - -func (mods FSPoolModSlice) Apply(ctx context.Context, n *FSPoolTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSPoolTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSPoolTemplate struct { - OrganizationID func() int32 - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Datesent func() null.Val[int64] - Datetested func() null.Val[int64] - Diseasepos func() null.Val[string] - Diseasetested func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Gatewaysync func() null.Val[int16] - Globalid func() string - Lab func() null.Val[string] - LabID func() null.Val[string] - Objectid func() int32 - Poolyear func() null.Val[int16] - Processed func() null.Val[int16] - Sampleid func() null.Val[string] - Survtech func() null.Val[string] - Testmethod func() null.Val[string] - Testtech func() null.Val[string] - TrapdataID func() null.Val[string] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Vectorsurvcollectionid func() null.Val[string] - Vectorsurvpoolid func() null.Val[string] - Vectorsurvtrapdataid func() null.Val[string] - Updated func() time.Time - - r fsPoolR - f *Factory - - alreadyPersisted bool -} - -type fsPoolR struct { - Organization *fsPoolROrganizationR -} - -type fsPoolROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSPoolTemplate -func (o *FSPoolTemplate) Apply(ctx context.Context, mods ...FSPoolMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSPool -// according to the relationships in the template. Nothing is inserted into the db -func (t FSPoolTemplate) setModelRels(o *models.FSPool) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSPools = append(rel.R.FSPools, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSPoolSetter -// this does nothing with the relationship templates -func (o FSPoolTemplate) BuildSetter() *models.FSPoolSetter { - m := &models.FSPoolSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Datesent != nil { - val := o.Datesent() - m.Datesent = omitnull.FromNull(val) - } - if o.Datetested != nil { - val := o.Datetested() - m.Datetested = omitnull.FromNull(val) - } - if o.Diseasepos != nil { - val := o.Diseasepos() - m.Diseasepos = omitnull.FromNull(val) - } - if o.Diseasetested != nil { - val := o.Diseasetested() - m.Diseasetested = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Gatewaysync != nil { - val := o.Gatewaysync() - m.Gatewaysync = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Lab != nil { - val := o.Lab() - m.Lab = omitnull.FromNull(val) - } - if o.LabID != nil { - val := o.LabID() - m.LabID = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Poolyear != nil { - val := o.Poolyear() - m.Poolyear = omitnull.FromNull(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.Sampleid != nil { - val := o.Sampleid() - m.Sampleid = omitnull.FromNull(val) - } - if o.Survtech != nil { - val := o.Survtech() - m.Survtech = omitnull.FromNull(val) - } - if o.Testmethod != nil { - val := o.Testmethod() - m.Testmethod = omitnull.FromNull(val) - } - if o.Testtech != nil { - val := o.Testtech() - m.Testtech = omitnull.FromNull(val) - } - if o.TrapdataID != nil { - val := o.TrapdataID() - m.TrapdataID = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Vectorsurvcollectionid != nil { - val := o.Vectorsurvcollectionid() - m.Vectorsurvcollectionid = omitnull.FromNull(val) - } - if o.Vectorsurvpoolid != nil { - val := o.Vectorsurvpoolid() - m.Vectorsurvpoolid = omitnull.FromNull(val) - } - if o.Vectorsurvtrapdataid != nil { - val := o.Vectorsurvtrapdataid() - m.Vectorsurvtrapdataid = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSPoolSetter -// this does nothing with the relationship templates -func (o FSPoolTemplate) BuildManySetter(number int) []*models.FSPoolSetter { - m := make([]*models.FSPoolSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSPool -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSPoolTemplate.Create -func (o FSPoolTemplate) Build() *models.FSPool { - m := &models.FSPool{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Datesent != nil { - m.Datesent = o.Datesent() - } - if o.Datetested != nil { - m.Datetested = o.Datetested() - } - if o.Diseasepos != nil { - m.Diseasepos = o.Diseasepos() - } - if o.Diseasetested != nil { - m.Diseasetested = o.Diseasetested() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Gatewaysync != nil { - m.Gatewaysync = o.Gatewaysync() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Lab != nil { - m.Lab = o.Lab() - } - if o.LabID != nil { - m.LabID = o.LabID() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Poolyear != nil { - m.Poolyear = o.Poolyear() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.Sampleid != nil { - m.Sampleid = o.Sampleid() - } - if o.Survtech != nil { - m.Survtech = o.Survtech() - } - if o.Testmethod != nil { - m.Testmethod = o.Testmethod() - } - if o.Testtech != nil { - m.Testtech = o.Testtech() - } - if o.TrapdataID != nil { - m.TrapdataID = o.TrapdataID() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Vectorsurvcollectionid != nil { - m.Vectorsurvcollectionid = o.Vectorsurvcollectionid() - } - if o.Vectorsurvpoolid != nil { - m.Vectorsurvpoolid = o.Vectorsurvpoolid() - } - if o.Vectorsurvtrapdataid != nil { - m.Vectorsurvtrapdataid = o.Vectorsurvtrapdataid() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSPoolSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSPoolTemplate.CreateMany -func (o FSPoolTemplate) BuildMany(number int) models.FSPoolSlice { - m := make(models.FSPoolSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSPool(m *models.FSPoolSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSPool -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSPoolTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSPool) error { - var err error - - return err -} - -// Create builds a fsPool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSPoolTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSPool, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSPool(opt) - - if o.r.Organization == nil { - FSPoolMods.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.FSPools.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 fsPool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSPoolTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSPool { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsPool 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 *FSPoolTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSPool { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsPools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSPoolTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSPoolSlice, error) { - var err error - m := make(models.FSPoolSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsPools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSPoolTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSPoolSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsPools 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 FSPoolTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSPoolSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSPool has methods that act as mods for the FSPoolTemplate -var FSPoolMods fsPoolMods - -type fsPoolMods struct{} - -func (m fsPoolMods) RandomizeAllColumns(f *faker.Faker) FSPoolMod { - return FSPoolModSlice{ - FSPoolMods.RandomOrganizationID(f), - FSPoolMods.RandomComments(f), - FSPoolMods.RandomCreationdate(f), - FSPoolMods.RandomCreator(f), - FSPoolMods.RandomDatesent(f), - FSPoolMods.RandomDatetested(f), - FSPoolMods.RandomDiseasepos(f), - FSPoolMods.RandomDiseasetested(f), - FSPoolMods.RandomEditdate(f), - FSPoolMods.RandomEditor(f), - FSPoolMods.RandomGatewaysync(f), - FSPoolMods.RandomGlobalid(f), - FSPoolMods.RandomLab(f), - FSPoolMods.RandomLabID(f), - FSPoolMods.RandomObjectid(f), - FSPoolMods.RandomPoolyear(f), - FSPoolMods.RandomProcessed(f), - FSPoolMods.RandomSampleid(f), - FSPoolMods.RandomSurvtech(f), - FSPoolMods.RandomTestmethod(f), - FSPoolMods.RandomTesttech(f), - FSPoolMods.RandomTrapdataID(f), - FSPoolMods.RandomCreatedDate(f), - FSPoolMods.RandomCreatedUser(f), - FSPoolMods.RandomGeometryX(f), - FSPoolMods.RandomGeometryY(f), - FSPoolMods.RandomLastEditedDate(f), - FSPoolMods.RandomLastEditedUser(f), - FSPoolMods.RandomVectorsurvcollectionid(f), - FSPoolMods.RandomVectorsurvpoolid(f), - FSPoolMods.RandomVectorsurvtrapdataid(f), - FSPoolMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsPoolMods) OrganizationID(val int32) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) OrganizationIDFunc(f func() int32) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetOrganizationID() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - 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 fsPoolMods) RandomOrganizationID(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsPoolMods) Comments(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) CommentsFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetComments() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Comments = 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 fsPoolMods) RandomComments(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Comments = 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 fsPoolMods) Creationdate(val null.Val[int64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) CreationdateFunc(f func() null.Val[int64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetCreationdate() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Creationdate = 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 fsPoolMods) RandomCreationdate(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPoolMods) Creator(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) CreatorFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetCreator() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Creator = 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 fsPoolMods) RandomCreator(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Creator = 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 fsPoolMods) Datesent(val null.Val[int64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Datesent = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) DatesentFunc(f func() null.Val[int64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Datesent = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetDatesent() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Datesent = 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 fsPoolMods) RandomDatesent(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Datesent = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomDatesentNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Datesent = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPoolMods) Datetested(val null.Val[int64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Datetested = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) DatetestedFunc(f func() null.Val[int64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Datetested = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetDatetested() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Datetested = 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 fsPoolMods) RandomDatetested(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Datetested = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomDatetestedNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Datetested = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPoolMods) Diseasepos(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Diseasepos = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) DiseaseposFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Diseasepos = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetDiseasepos() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Diseasepos = 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 fsPoolMods) RandomDiseasepos(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Diseasepos = 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) RandomDiseaseposNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Diseasepos = 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 fsPoolMods) Diseasetested(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Diseasetested = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) DiseasetestedFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Diseasetested = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetDiseasetested() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Diseasetested = 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 fsPoolMods) RandomDiseasetested(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Diseasetested = 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) RandomDiseasetestedNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Diseasetested = 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 fsPoolMods) Editdate(val null.Val[int64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) EditdateFunc(f func() null.Val[int64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetEditdate() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Editdate = 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 fsPoolMods) RandomEditdate(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPoolMods) Editor(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) EditorFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetEditor() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Editor = 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 fsPoolMods) RandomEditor(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Editor = 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 fsPoolMods) Gatewaysync(val null.Val[int16]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Gatewaysync = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) GatewaysyncFunc(f func() null.Val[int16]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Gatewaysync = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetGatewaysync() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Gatewaysync = 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 fsPoolMods) RandomGatewaysync(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomGatewaysyncNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPoolMods) Globalid(val string) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) GlobalidFunc(f func() string) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetGlobalid() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsPoolMods) RandomGlobalid(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsPoolMods) Lab(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Lab = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) LabFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Lab = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetLab() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Lab = 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 fsPoolMods) RandomLab(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Lab = 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) RandomLabNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Lab = 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 fsPoolMods) LabID(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.LabID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) LabIDFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.LabID = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetLabID() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.LabID = 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 fsPoolMods) RandomLabID(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.LabID = 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) RandomLabIDNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.LabID = 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 fsPoolMods) Objectid(val int32) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) ObjectidFunc(f func() int32) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetObjectid() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsPoolMods) RandomObjectid(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsPoolMods) Poolyear(val null.Val[int16]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Poolyear = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) PoolyearFunc(f func() null.Val[int16]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Poolyear = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetPoolyear() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Poolyear = 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 fsPoolMods) RandomPoolyear(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Poolyear = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomPoolyearNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Poolyear = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPoolMods) Processed(val null.Val[int16]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) ProcessedFunc(f func() null.Val[int16]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetProcessed() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Processed = 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 fsPoolMods) RandomProcessed(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPoolMods) Sampleid(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Sampleid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) SampleidFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Sampleid = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetSampleid() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Sampleid = 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 fsPoolMods) RandomSampleid(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Sampleid = 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) RandomSampleidNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Sampleid = 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 fsPoolMods) Survtech(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Survtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) SurvtechFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Survtech = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetSurvtech() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Survtech = 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 fsPoolMods) RandomSurvtech(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Survtech = 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) RandomSurvtechNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Survtech = 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 fsPoolMods) Testmethod(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Testmethod = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) TestmethodFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Testmethod = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetTestmethod() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Testmethod = 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 fsPoolMods) RandomTestmethod(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Testmethod = 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) RandomTestmethodNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Testmethod = 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 fsPoolMods) Testtech(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Testtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) TesttechFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Testtech = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetTesttech() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Testtech = 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 fsPoolMods) RandomTesttech(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Testtech = 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) RandomTesttechNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Testtech = 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 fsPoolMods) TrapdataID(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.TrapdataID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) TrapdataIDFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.TrapdataID = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetTrapdataID() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.TrapdataID = 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 fsPoolMods) RandomTrapdataID(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.TrapdataID = 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) RandomTrapdataIDNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.TrapdataID = 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 fsPoolMods) CreatedDate(val null.Val[int64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) CreatedDateFunc(f func() null.Val[int64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetCreatedDate() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.CreatedDate = 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 fsPoolMods) RandomCreatedDate(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPoolMods) CreatedUser(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) CreatedUserFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetCreatedUser() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.CreatedUser = 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 fsPoolMods) RandomCreatedUser(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.CreatedUser = 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 fsPoolMods) GeometryX(val null.Val[float64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) GeometryXFunc(f func() null.Val[float64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetGeometryX() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.GeometryX = 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 fsPoolMods) RandomGeometryX(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - 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 fsPoolMods) RandomGeometryXNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.GeometryX = 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 fsPoolMods) GeometryY(val null.Val[float64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) GeometryYFunc(f func() null.Val[float64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetGeometryY() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.GeometryY = 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 fsPoolMods) RandomGeometryY(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - 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 fsPoolMods) RandomGeometryYNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.GeometryY = 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 fsPoolMods) LastEditedDate(val null.Val[int64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) LastEditedDateFunc(f func() null.Val[int64]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetLastEditedDate() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.LastEditedDate = 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 fsPoolMods) RandomLastEditedDate(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPoolMods) LastEditedUser(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) LastEditedUserFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetLastEditedUser() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.LastEditedUser = 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 fsPoolMods) RandomLastEditedUser(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.LastEditedUser = 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 fsPoolMods) Vectorsurvcollectionid(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Vectorsurvcollectionid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) VectorsurvcollectionidFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Vectorsurvcollectionid = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetVectorsurvcollectionid() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Vectorsurvcollectionid = 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 fsPoolMods) RandomVectorsurvcollectionid(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Vectorsurvcollectionid = 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) RandomVectorsurvcollectionidNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Vectorsurvcollectionid = 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 fsPoolMods) Vectorsurvpoolid(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Vectorsurvpoolid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) VectorsurvpoolidFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Vectorsurvpoolid = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetVectorsurvpoolid() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Vectorsurvpoolid = 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 fsPoolMods) RandomVectorsurvpoolid(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Vectorsurvpoolid = 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) RandomVectorsurvpoolidNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Vectorsurvpoolid = 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 fsPoolMods) Vectorsurvtrapdataid(val null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Vectorsurvtrapdataid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) VectorsurvtrapdataidFunc(f func() null.Val[string]) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Vectorsurvtrapdataid = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetVectorsurvtrapdataid() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Vectorsurvtrapdataid = 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 fsPoolMods) RandomVectorsurvtrapdataid(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Vectorsurvtrapdataid = 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) RandomVectorsurvtrapdataidNotNull(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Vectorsurvtrapdataid = 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 fsPoolMods) Updated(val time.Time) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsPoolMods) UpdatedFunc(f func() time.Time) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsPoolMods) UnsetUpdated() FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsPoolMods) RandomUpdated(f *faker.Faker) FSPoolMod { - return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsPoolMods) WithParentsCascading() FSPoolMod { - return FSPoolModFunc(func(ctx context.Context, o *FSPoolTemplate) { - if isDone, _ := fsPoolWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsPoolWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsPoolMods) WithOrganization(rel *OrganizationTemplate) FSPoolMod { - return FSPoolModFunc(func(ctx context.Context, o *FSPoolTemplate) { - o.r.Organization = &fsPoolROrganizationR{ - o: rel, - } - }) -} - -func (m fsPoolMods) WithNewOrganization(mods ...OrganizationMod) FSPoolMod { - return FSPoolModFunc(func(ctx context.Context, o *FSPoolTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsPoolMods) WithExistingOrganization(em *models.Organization) FSPoolMod { - return FSPoolModFunc(func(ctx context.Context, o *FSPoolTemplate) { - o.r.Organization = &fsPoolROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsPoolMods) WithoutOrganization() FSPoolMod { - return FSPoolModFunc(func(ctx context.Context, o *FSPoolTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_pooldetail.bob.go b/db/factory/fs_pooldetail.bob.go deleted file mode 100644 index cb869810..00000000 --- a/db/factory/fs_pooldetail.bob.go +++ /dev/null @@ -1,1324 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSPooldetailMod interface { - Apply(context.Context, *FSPooldetailTemplate) -} - -type FSPooldetailModFunc func(context.Context, *FSPooldetailTemplate) - -func (f FSPooldetailModFunc) Apply(ctx context.Context, n *FSPooldetailTemplate) { - f(ctx, n) -} - -type FSPooldetailModSlice []FSPooldetailMod - -func (mods FSPooldetailModSlice) Apply(ctx context.Context, n *FSPooldetailTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSPooldetailTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSPooldetailTemplate struct { - OrganizationID func() int32 - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Females func() null.Val[int16] - Globalid func() string - Objectid func() int32 - PoolID func() null.Val[string] - Species func() null.Val[string] - TrapdataID func() null.Val[string] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Updated func() time.Time - - r fsPooldetailR - f *Factory - - alreadyPersisted bool -} - -type fsPooldetailR struct { - Organization *fsPooldetailROrganizationR -} - -type fsPooldetailROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSPooldetailTemplate -func (o *FSPooldetailTemplate) Apply(ctx context.Context, mods ...FSPooldetailMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSPooldetail -// according to the relationships in the template. Nothing is inserted into the db -func (t FSPooldetailTemplate) setModelRels(o *models.FSPooldetail) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSPooldetails = append(rel.R.FSPooldetails, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSPooldetailSetter -// this does nothing with the relationship templates -func (o FSPooldetailTemplate) BuildSetter() *models.FSPooldetailSetter { - m := &models.FSPooldetailSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Females != nil { - val := o.Females() - m.Females = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.PoolID != nil { - val := o.PoolID() - m.PoolID = omitnull.FromNull(val) - } - if o.Species != nil { - val := o.Species() - m.Species = omitnull.FromNull(val) - } - if o.TrapdataID != nil { - val := o.TrapdataID() - m.TrapdataID = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSPooldetailSetter -// this does nothing with the relationship templates -func (o FSPooldetailTemplate) BuildManySetter(number int) []*models.FSPooldetailSetter { - m := make([]*models.FSPooldetailSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSPooldetail -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSPooldetailTemplate.Create -func (o FSPooldetailTemplate) Build() *models.FSPooldetail { - m := &models.FSPooldetail{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Females != nil { - m.Females = o.Females() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.PoolID != nil { - m.PoolID = o.PoolID() - } - if o.Species != nil { - m.Species = o.Species() - } - if o.TrapdataID != nil { - m.TrapdataID = o.TrapdataID() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSPooldetailSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSPooldetailTemplate.CreateMany -func (o FSPooldetailTemplate) BuildMany(number int) models.FSPooldetailSlice { - m := make(models.FSPooldetailSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSPooldetail(m *models.FSPooldetailSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSPooldetail -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSPooldetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSPooldetail) error { - var err error - - return err -} - -// Create builds a fsPooldetail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSPooldetailTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSPooldetail, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSPooldetail(opt) - - if o.r.Organization == nil { - FSPooldetailMods.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.FSPooldetails.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 fsPooldetail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSPooldetailTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSPooldetail { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsPooldetail 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 *FSPooldetailTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSPooldetail { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsPooldetails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSPooldetailTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSPooldetailSlice, error) { - var err error - m := make(models.FSPooldetailSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsPooldetails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSPooldetailTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSPooldetailSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsPooldetails 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 FSPooldetailTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSPooldetailSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSPooldetail has methods that act as mods for the FSPooldetailTemplate -var FSPooldetailMods fsPooldetailMods - -type fsPooldetailMods struct{} - -func (m fsPooldetailMods) RandomizeAllColumns(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModSlice{ - FSPooldetailMods.RandomOrganizationID(f), - FSPooldetailMods.RandomCreationdate(f), - FSPooldetailMods.RandomCreator(f), - FSPooldetailMods.RandomEditdate(f), - FSPooldetailMods.RandomEditor(f), - FSPooldetailMods.RandomFemales(f), - FSPooldetailMods.RandomGlobalid(f), - FSPooldetailMods.RandomObjectid(f), - FSPooldetailMods.RandomPoolID(f), - FSPooldetailMods.RandomSpecies(f), - FSPooldetailMods.RandomTrapdataID(f), - FSPooldetailMods.RandomCreatedDate(f), - FSPooldetailMods.RandomCreatedUser(f), - FSPooldetailMods.RandomGeometryX(f), - FSPooldetailMods.RandomGeometryY(f), - FSPooldetailMods.RandomLastEditedDate(f), - FSPooldetailMods.RandomLastEditedUser(f), - FSPooldetailMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsPooldetailMods) OrganizationID(val int32) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) OrganizationIDFunc(f func() int32) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetOrganizationID() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - 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 fsPooldetailMods) RandomOrganizationID(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsPooldetailMods) Creationdate(val null.Val[int64]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) CreationdateFunc(f func() null.Val[int64]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetCreationdate() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Creationdate = 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 fsPooldetailMods) RandomCreationdate(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPooldetailMods) Creator(val null.Val[string]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) CreatorFunc(f func() null.Val[string]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetCreator() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Creator = 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 fsPooldetailMods) RandomCreator(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Creator = 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 fsPooldetailMods) Editdate(val null.Val[int64]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) EditdateFunc(f func() null.Val[int64]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetEditdate() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Editdate = 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 fsPooldetailMods) RandomEditdate(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPooldetailMods) Editor(val null.Val[string]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) EditorFunc(f func() null.Val[string]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetEditor() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Editor = 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 fsPooldetailMods) RandomEditor(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Editor = 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 fsPooldetailMods) Females(val null.Val[int16]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Females = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) FemalesFunc(f func() null.Val[int16]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Females = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetFemales() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Females = 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 fsPooldetailMods) RandomFemales(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Females = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomFemalesNotNull(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Females = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPooldetailMods) Globalid(val string) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) GlobalidFunc(f func() string) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetGlobalid() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsPooldetailMods) RandomGlobalid(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsPooldetailMods) Objectid(val int32) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) ObjectidFunc(f func() int32) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetObjectid() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsPooldetailMods) RandomObjectid(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsPooldetailMods) PoolID(val null.Val[string]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.PoolID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) PoolIDFunc(f func() null.Val[string]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.PoolID = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetPoolID() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.PoolID = 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 fsPooldetailMods) RandomPoolID(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.PoolID = 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) RandomPoolIDNotNull(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.PoolID = 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 fsPooldetailMods) Species(val null.Val[string]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Species = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) SpeciesFunc(f func() null.Val[string]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Species = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetSpecies() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Species = 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 fsPooldetailMods) RandomSpecies(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Species = 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) RandomSpeciesNotNull(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Species = 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 fsPooldetailMods) TrapdataID(val null.Val[string]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.TrapdataID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) TrapdataIDFunc(f func() null.Val[string]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.TrapdataID = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetTrapdataID() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.TrapdataID = 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 fsPooldetailMods) RandomTrapdataID(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.TrapdataID = 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) RandomTrapdataIDNotNull(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.TrapdataID = 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 fsPooldetailMods) CreatedDate(val null.Val[int64]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) CreatedDateFunc(f func() null.Val[int64]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetCreatedDate() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.CreatedDate = 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 fsPooldetailMods) RandomCreatedDate(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPooldetailMods) CreatedUser(val null.Val[string]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) CreatedUserFunc(f func() null.Val[string]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetCreatedUser() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.CreatedUser = 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 fsPooldetailMods) RandomCreatedUser(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.CreatedUser = 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 fsPooldetailMods) GeometryX(val null.Val[float64]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) GeometryXFunc(f func() null.Val[float64]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetGeometryX() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.GeometryX = 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 fsPooldetailMods) RandomGeometryX(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - 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 fsPooldetailMods) RandomGeometryXNotNull(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.GeometryX = 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 fsPooldetailMods) GeometryY(val null.Val[float64]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) GeometryYFunc(f func() null.Val[float64]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetGeometryY() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.GeometryY = 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 fsPooldetailMods) RandomGeometryY(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - 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 fsPooldetailMods) RandomGeometryYNotNull(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.GeometryY = 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 fsPooldetailMods) LastEditedDate(val null.Val[int64]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) LastEditedDateFunc(f func() null.Val[int64]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetLastEditedDate() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.LastEditedDate = 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 fsPooldetailMods) RandomLastEditedDate(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsPooldetailMods) LastEditedUser(val null.Val[string]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) LastEditedUserFunc(f func() null.Val[string]) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetLastEditedUser() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.LastEditedUser = 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 fsPooldetailMods) RandomLastEditedUser(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.LastEditedUser = 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 fsPooldetailMods) Updated(val time.Time) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsPooldetailMods) UpdatedFunc(f func() time.Time) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsPooldetailMods) UnsetUpdated() FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsPooldetailMods) RandomUpdated(f *faker.Faker) FSPooldetailMod { - return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsPooldetailMods) WithParentsCascading() FSPooldetailMod { - return FSPooldetailModFunc(func(ctx context.Context, o *FSPooldetailTemplate) { - if isDone, _ := fsPooldetailWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsPooldetailWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsPooldetailMods) WithOrganization(rel *OrganizationTemplate) FSPooldetailMod { - return FSPooldetailModFunc(func(ctx context.Context, o *FSPooldetailTemplate) { - o.r.Organization = &fsPooldetailROrganizationR{ - o: rel, - } - }) -} - -func (m fsPooldetailMods) WithNewOrganization(mods ...OrganizationMod) FSPooldetailMod { - return FSPooldetailModFunc(func(ctx context.Context, o *FSPooldetailTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsPooldetailMods) WithExistingOrganization(em *models.Organization) FSPooldetailMod { - return FSPooldetailModFunc(func(ctx context.Context, o *FSPooldetailTemplate) { - o.r.Organization = &fsPooldetailROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsPooldetailMods) WithoutOrganization() FSPooldetailMod { - return FSPooldetailModFunc(func(ctx context.Context, o *FSPooldetailTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_proposedtreatmentarea.bob.go b/db/factory/fs_proposedtreatmentarea.bob.go deleted file mode 100644 index 6e14ff17..00000000 --- a/db/factory/fs_proposedtreatmentarea.bob.go +++ /dev/null @@ -1,2502 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSProposedtreatmentareaMod interface { - Apply(context.Context, *FSProposedtreatmentareaTemplate) -} - -type FSProposedtreatmentareaModFunc func(context.Context, *FSProposedtreatmentareaTemplate) - -func (f FSProposedtreatmentareaModFunc) Apply(ctx context.Context, n *FSProposedtreatmentareaTemplate) { - f(ctx, n) -} - -type FSProposedtreatmentareaModSlice []FSProposedtreatmentareaMod - -func (mods FSProposedtreatmentareaModSlice) Apply(ctx context.Context, n *FSProposedtreatmentareaTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSProposedtreatmentareaTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSProposedtreatmentareaTemplate struct { - OrganizationID func() int32 - Acres func() null.Val[float64] - Comments func() null.Val[string] - Completed func() null.Val[int16] - Completedby func() null.Val[string] - Completeddate func() null.Val[int64] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Duedate func() null.Val[int64] - Exported func() null.Val[int16] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() string - Hectares func() null.Val[float64] - Issprayroute func() null.Val[int16] - Lasttreatactivity func() null.Val[string] - Lasttreatdate func() null.Val[int64] - Lasttreatproduct func() null.Val[string] - Lasttreatqty func() null.Val[float64] - Lasttreatqtyunit func() null.Val[string] - Method func() null.Val[string] - Name func() null.Val[string] - Objectid func() int32 - Priority func() null.Val[string] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[int64] - ShapeArea func() null.Val[float64] - ShapeLength func() null.Val[float64] - Targetapprate func() null.Val[float64] - Targetproduct func() null.Val[string] - Targetspecies func() null.Val[string] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - Updated func() time.Time - - r fsProposedtreatmentareaR - f *Factory - - alreadyPersisted bool -} - -type fsProposedtreatmentareaR struct { - Organization *fsProposedtreatmentareaROrganizationR -} - -type fsProposedtreatmentareaROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSProposedtreatmentareaTemplate -func (o *FSProposedtreatmentareaTemplate) Apply(ctx context.Context, mods ...FSProposedtreatmentareaMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSProposedtreatmentarea -// according to the relationships in the template. Nothing is inserted into the db -func (t FSProposedtreatmentareaTemplate) setModelRels(o *models.FSProposedtreatmentarea) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSProposedtreatmentareas = append(rel.R.FSProposedtreatmentareas, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSProposedtreatmentareaSetter -// this does nothing with the relationship templates -func (o FSProposedtreatmentareaTemplate) BuildSetter() *models.FSProposedtreatmentareaSetter { - m := &models.FSProposedtreatmentareaSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Acres != nil { - val := o.Acres() - m.Acres = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Completed != nil { - val := o.Completed() - m.Completed = omitnull.FromNull(val) - } - if o.Completedby != nil { - val := o.Completedby() - m.Completedby = omitnull.FromNull(val) - } - if o.Completeddate != nil { - val := o.Completeddate() - m.Completeddate = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Duedate != nil { - val := o.Duedate() - m.Duedate = omitnull.FromNull(val) - } - if o.Exported != nil { - val := o.Exported() - m.Exported = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Hectares != nil { - val := o.Hectares() - m.Hectares = omitnull.FromNull(val) - } - if o.Issprayroute != nil { - val := o.Issprayroute() - m.Issprayroute = omitnull.FromNull(val) - } - if o.Lasttreatactivity != nil { - val := o.Lasttreatactivity() - m.Lasttreatactivity = omitnull.FromNull(val) - } - if o.Lasttreatdate != nil { - val := o.Lasttreatdate() - m.Lasttreatdate = omitnull.FromNull(val) - } - if o.Lasttreatproduct != nil { - val := o.Lasttreatproduct() - m.Lasttreatproduct = omitnull.FromNull(val) - } - if o.Lasttreatqty != nil { - val := o.Lasttreatqty() - m.Lasttreatqty = omitnull.FromNull(val) - } - if o.Lasttreatqtyunit != nil { - val := o.Lasttreatqtyunit() - m.Lasttreatqtyunit = omitnull.FromNull(val) - } - if o.Method != nil { - val := o.Method() - m.Method = omitnull.FromNull(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Reviewed != nil { - val := o.Reviewed() - m.Reviewed = omitnull.FromNull(val) - } - if o.Reviewedby != nil { - val := o.Reviewedby() - m.Reviewedby = omitnull.FromNull(val) - } - if o.Revieweddate != nil { - val := o.Revieweddate() - m.Revieweddate = omitnull.FromNull(val) - } - if o.ShapeArea != nil { - val := o.ShapeArea() - m.ShapeArea = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - val := o.ShapeLength() - m.ShapeLength = omitnull.FromNull(val) - } - if o.Targetapprate != nil { - val := o.Targetapprate() - m.Targetapprate = omitnull.FromNull(val) - } - if o.Targetproduct != nil { - val := o.Targetproduct() - m.Targetproduct = omitnull.FromNull(val) - } - if o.Targetspecies != nil { - val := o.Targetspecies() - m.Targetspecies = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSProposedtreatmentareaSetter -// this does nothing with the relationship templates -func (o FSProposedtreatmentareaTemplate) BuildManySetter(number int) []*models.FSProposedtreatmentareaSetter { - m := make([]*models.FSProposedtreatmentareaSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSProposedtreatmentarea -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSProposedtreatmentareaTemplate.Create -func (o FSProposedtreatmentareaTemplate) Build() *models.FSProposedtreatmentarea { - m := &models.FSProposedtreatmentarea{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Acres != nil { - m.Acres = o.Acres() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Completed != nil { - m.Completed = o.Completed() - } - if o.Completedby != nil { - m.Completedby = o.Completedby() - } - if o.Completeddate != nil { - m.Completeddate = o.Completeddate() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Duedate != nil { - m.Duedate = o.Duedate() - } - if o.Exported != nil { - m.Exported = o.Exported() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Hectares != nil { - m.Hectares = o.Hectares() - } - if o.Issprayroute != nil { - m.Issprayroute = o.Issprayroute() - } - if o.Lasttreatactivity != nil { - m.Lasttreatactivity = o.Lasttreatactivity() - } - if o.Lasttreatdate != nil { - m.Lasttreatdate = o.Lasttreatdate() - } - if o.Lasttreatproduct != nil { - m.Lasttreatproduct = o.Lasttreatproduct() - } - if o.Lasttreatqty != nil { - m.Lasttreatqty = o.Lasttreatqty() - } - if o.Lasttreatqtyunit != nil { - m.Lasttreatqtyunit = o.Lasttreatqtyunit() - } - if o.Method != nil { - m.Method = o.Method() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Reviewed != nil { - m.Reviewed = o.Reviewed() - } - if o.Reviewedby != nil { - m.Reviewedby = o.Reviewedby() - } - if o.Revieweddate != nil { - m.Revieweddate = o.Revieweddate() - } - if o.ShapeArea != nil { - m.ShapeArea = o.ShapeArea() - } - if o.ShapeLength != nil { - m.ShapeLength = o.ShapeLength() - } - if o.Targetapprate != nil { - m.Targetapprate = o.Targetapprate() - } - if o.Targetproduct != nil { - m.Targetproduct = o.Targetproduct() - } - if o.Targetspecies != nil { - m.Targetspecies = o.Targetspecies() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSProposedtreatmentareaSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSProposedtreatmentareaTemplate.CreateMany -func (o FSProposedtreatmentareaTemplate) BuildMany(number int) models.FSProposedtreatmentareaSlice { - m := make(models.FSProposedtreatmentareaSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSProposedtreatmentarea(m *models.FSProposedtreatmentareaSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSProposedtreatmentarea -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSProposedtreatmentareaTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSProposedtreatmentarea) error { - var err error - - return err -} - -// Create builds a fsProposedtreatmentarea and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSProposedtreatmentareaTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSProposedtreatmentarea, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSProposedtreatmentarea(opt) - - if o.r.Organization == nil { - FSProposedtreatmentareaMods.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.FSProposedtreatmentareas.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 fsProposedtreatmentarea and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSProposedtreatmentareaTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSProposedtreatmentarea { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsProposedtreatmentarea 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 *FSProposedtreatmentareaTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSProposedtreatmentarea { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsProposedtreatmentareas and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSProposedtreatmentareaTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSProposedtreatmentareaSlice, error) { - var err error - m := make(models.FSProposedtreatmentareaSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsProposedtreatmentareas and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSProposedtreatmentareaTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSProposedtreatmentareaSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsProposedtreatmentareas 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 FSProposedtreatmentareaTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSProposedtreatmentareaSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSProposedtreatmentarea has methods that act as mods for the FSProposedtreatmentareaTemplate -var FSProposedtreatmentareaMods fsProposedtreatmentareaMods - -type fsProposedtreatmentareaMods struct{} - -func (m fsProposedtreatmentareaMods) RandomizeAllColumns(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModSlice{ - FSProposedtreatmentareaMods.RandomOrganizationID(f), - FSProposedtreatmentareaMods.RandomAcres(f), - FSProposedtreatmentareaMods.RandomComments(f), - FSProposedtreatmentareaMods.RandomCompleted(f), - FSProposedtreatmentareaMods.RandomCompletedby(f), - FSProposedtreatmentareaMods.RandomCompleteddate(f), - FSProposedtreatmentareaMods.RandomCreationdate(f), - FSProposedtreatmentareaMods.RandomCreator(f), - FSProposedtreatmentareaMods.RandomDuedate(f), - FSProposedtreatmentareaMods.RandomExported(f), - FSProposedtreatmentareaMods.RandomEditdate(f), - FSProposedtreatmentareaMods.RandomEditor(f), - FSProposedtreatmentareaMods.RandomGlobalid(f), - FSProposedtreatmentareaMods.RandomHectares(f), - FSProposedtreatmentareaMods.RandomIssprayroute(f), - FSProposedtreatmentareaMods.RandomLasttreatactivity(f), - FSProposedtreatmentareaMods.RandomLasttreatdate(f), - FSProposedtreatmentareaMods.RandomLasttreatproduct(f), - FSProposedtreatmentareaMods.RandomLasttreatqty(f), - FSProposedtreatmentareaMods.RandomLasttreatqtyunit(f), - FSProposedtreatmentareaMods.RandomMethod(f), - FSProposedtreatmentareaMods.RandomName(f), - FSProposedtreatmentareaMods.RandomObjectid(f), - FSProposedtreatmentareaMods.RandomPriority(f), - FSProposedtreatmentareaMods.RandomReviewed(f), - FSProposedtreatmentareaMods.RandomReviewedby(f), - FSProposedtreatmentareaMods.RandomRevieweddate(f), - FSProposedtreatmentareaMods.RandomShapeArea(f), - FSProposedtreatmentareaMods.RandomShapeLength(f), - FSProposedtreatmentareaMods.RandomTargetapprate(f), - FSProposedtreatmentareaMods.RandomTargetproduct(f), - FSProposedtreatmentareaMods.RandomTargetspecies(f), - FSProposedtreatmentareaMods.RandomZone(f), - FSProposedtreatmentareaMods.RandomZone2(f), - FSProposedtreatmentareaMods.RandomGeometryX(f), - FSProposedtreatmentareaMods.RandomGeometryY(f), - FSProposedtreatmentareaMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsProposedtreatmentareaMods) OrganizationID(val int32) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) OrganizationIDFunc(f func() int32) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetOrganizationID() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - 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 fsProposedtreatmentareaMods) RandomOrganizationID(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsProposedtreatmentareaMods) Acres(val null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Acres = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) AcresFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Acres = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetAcres() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Acres = 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 fsProposedtreatmentareaMods) RandomAcres(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Acres = 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 fsProposedtreatmentareaMods) RandomAcresNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Acres = 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 fsProposedtreatmentareaMods) Comments(val null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) CommentsFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetComments() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Comments = 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 fsProposedtreatmentareaMods) RandomComments(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Comments = 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 fsProposedtreatmentareaMods) Completed(val null.Val[int16]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Completed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) CompletedFunc(f func() null.Val[int16]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Completed = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetCompleted() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Completed = 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 fsProposedtreatmentareaMods) RandomCompleted(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Completed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomCompletedNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Completed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsProposedtreatmentareaMods) Completedby(val null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Completedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) CompletedbyFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Completedby = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetCompletedby() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Completedby = 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 fsProposedtreatmentareaMods) RandomCompletedby(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Completedby = 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) RandomCompletedbyNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Completedby = 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 fsProposedtreatmentareaMods) Completeddate(val null.Val[int64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Completeddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) CompleteddateFunc(f func() null.Val[int64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Completeddate = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetCompleteddate() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Completeddate = 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 fsProposedtreatmentareaMods) RandomCompleteddate(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Completeddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCompleteddateNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Completeddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsProposedtreatmentareaMods) Creationdate(val null.Val[int64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) CreationdateFunc(f func() null.Val[int64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetCreationdate() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Creationdate = 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 fsProposedtreatmentareaMods) RandomCreationdate(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsProposedtreatmentareaMods) Creator(val null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) CreatorFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetCreator() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Creator = 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 fsProposedtreatmentareaMods) RandomCreator(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Creator = 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 fsProposedtreatmentareaMods) Duedate(val null.Val[int64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Duedate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) DuedateFunc(f func() null.Val[int64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Duedate = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetDuedate() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Duedate = 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 fsProposedtreatmentareaMods) RandomDuedate(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Duedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomDuedateNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Duedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsProposedtreatmentareaMods) Exported(val null.Val[int16]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Exported = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) ExportedFunc(f func() null.Val[int16]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Exported = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetExported() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Exported = 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 fsProposedtreatmentareaMods) RandomExported(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Exported = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomExportedNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Exported = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsProposedtreatmentareaMods) Editdate(val null.Val[int64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) EditdateFunc(f func() null.Val[int64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetEditdate() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Editdate = 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 fsProposedtreatmentareaMods) RandomEditdate(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsProposedtreatmentareaMods) Editor(val null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) EditorFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetEditor() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Editor = 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 fsProposedtreatmentareaMods) RandomEditor(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Editor = 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 fsProposedtreatmentareaMods) Globalid(val string) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) GlobalidFunc(f func() string) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetGlobalid() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsProposedtreatmentareaMods) RandomGlobalid(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsProposedtreatmentareaMods) Hectares(val null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Hectares = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) HectaresFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Hectares = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetHectares() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Hectares = 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 fsProposedtreatmentareaMods) RandomHectares(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Hectares = 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 fsProposedtreatmentareaMods) RandomHectaresNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Hectares = 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 fsProposedtreatmentareaMods) Issprayroute(val null.Val[int16]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Issprayroute = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) IssprayrouteFunc(f func() null.Val[int16]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Issprayroute = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetIssprayroute() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Issprayroute = 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 fsProposedtreatmentareaMods) RandomIssprayroute(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Issprayroute = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomIssprayrouteNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Issprayroute = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsProposedtreatmentareaMods) Lasttreatactivity(val null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) LasttreatactivityFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatactivity = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetLasttreatactivity() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatactivity = 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 fsProposedtreatmentareaMods) RandomLasttreatactivity(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatactivity = 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) RandomLasttreatactivityNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatactivity = 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 fsProposedtreatmentareaMods) Lasttreatdate(val null.Val[int64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) LasttreatdateFunc(f func() null.Val[int64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatdate = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetLasttreatdate() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatdate = 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 fsProposedtreatmentareaMods) RandomLasttreatdate(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLasttreatdateNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsProposedtreatmentareaMods) Lasttreatproduct(val null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatproduct = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) LasttreatproductFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatproduct = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetLasttreatproduct() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatproduct = 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 fsProposedtreatmentareaMods) RandomLasttreatproduct(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatproduct = 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) RandomLasttreatproductNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatproduct = 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 fsProposedtreatmentareaMods) Lasttreatqty(val null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatqty = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) LasttreatqtyFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatqty = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetLasttreatqty() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatqty = 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 fsProposedtreatmentareaMods) RandomLasttreatqty(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatqty = 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 fsProposedtreatmentareaMods) RandomLasttreatqtyNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatqty = 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 fsProposedtreatmentareaMods) Lasttreatqtyunit(val null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) LasttreatqtyunitFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatqtyunit = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetLasttreatqtyunit() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatqtyunit = 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 fsProposedtreatmentareaMods) RandomLasttreatqtyunit(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatqtyunit = 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) RandomLasttreatqtyunitNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Lasttreatqtyunit = 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 fsProposedtreatmentareaMods) Method(val null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Method = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) MethodFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Method = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetMethod() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Method = 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 fsProposedtreatmentareaMods) RandomMethod(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Method = 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) RandomMethodNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Method = 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 fsProposedtreatmentareaMods) Name(val null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) NameFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetName() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Name = 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 fsProposedtreatmentareaMods) RandomName(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Name = 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) RandomNameNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Name = 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 fsProposedtreatmentareaMods) Objectid(val int32) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) ObjectidFunc(f func() int32) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetObjectid() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsProposedtreatmentareaMods) RandomObjectid(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsProposedtreatmentareaMods) Priority(val null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) PriorityFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetPriority() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Priority = 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 fsProposedtreatmentareaMods) RandomPriority(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Priority = 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) RandomPriorityNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Priority = 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 fsProposedtreatmentareaMods) Reviewed(val null.Val[int16]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) ReviewedFunc(f func() null.Val[int16]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetReviewed() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Reviewed = 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 fsProposedtreatmentareaMods) RandomReviewed(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsProposedtreatmentareaMods) Reviewedby(val null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) ReviewedbyFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetReviewedby() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Reviewedby = 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 fsProposedtreatmentareaMods) RandomReviewedby(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Reviewedby = 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) RandomReviewedbyNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Reviewedby = 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 fsProposedtreatmentareaMods) Revieweddate(val null.Val[int64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Revieweddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) RevieweddateFunc(f func() null.Val[int64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetRevieweddate() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Revieweddate = 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 fsProposedtreatmentareaMods) RandomRevieweddate(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsProposedtreatmentareaMods) ShapeArea(val null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.ShapeArea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) ShapeAreaFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.ShapeArea = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetShapeArea() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.ShapeArea = 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 fsProposedtreatmentareaMods) RandomShapeArea(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.ShapeArea = 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 fsProposedtreatmentareaMods) RandomShapeAreaNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.ShapeArea = 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 fsProposedtreatmentareaMods) ShapeLength(val null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) ShapeLengthFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetShapeLength() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.ShapeLength = 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 fsProposedtreatmentareaMods) RandomShapeLength(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.ShapeLength = 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 fsProposedtreatmentareaMods) RandomShapeLengthNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.ShapeLength = 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 fsProposedtreatmentareaMods) Targetapprate(val null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Targetapprate = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) TargetapprateFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Targetapprate = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetTargetapprate() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Targetapprate = 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 fsProposedtreatmentareaMods) RandomTargetapprate(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Targetapprate = 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 fsProposedtreatmentareaMods) RandomTargetapprateNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Targetapprate = 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 fsProposedtreatmentareaMods) Targetproduct(val null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Targetproduct = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) TargetproductFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Targetproduct = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetTargetproduct() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Targetproduct = 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 fsProposedtreatmentareaMods) RandomTargetproduct(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Targetproduct = 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) RandomTargetproductNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Targetproduct = 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 fsProposedtreatmentareaMods) Targetspecies(val null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Targetspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) TargetspeciesFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Targetspecies = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetTargetspecies() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Targetspecies = 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 fsProposedtreatmentareaMods) RandomTargetspecies(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Targetspecies = 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) RandomTargetspeciesNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Targetspecies = 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 fsProposedtreatmentareaMods) Zone(val null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) ZoneFunc(f func() null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetZone() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Zone = 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 fsProposedtreatmentareaMods) RandomZone(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Zone = 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) RandomZoneNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Zone = 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 fsProposedtreatmentareaMods) Zone2(val null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) Zone2Func(f func() null.Val[string]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetZone2() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Zone2 = 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 fsProposedtreatmentareaMods) RandomZone2(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Zone2 = 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) RandomZone2NotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Zone2 = 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 fsProposedtreatmentareaMods) GeometryX(val null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) GeometryXFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetGeometryX() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.GeometryX = 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 fsProposedtreatmentareaMods) RandomGeometryX(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - 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 fsProposedtreatmentareaMods) RandomGeometryXNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.GeometryX = 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 fsProposedtreatmentareaMods) GeometryY(val null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) GeometryYFunc(f func() null.Val[float64]) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetGeometryY() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.GeometryY = 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 fsProposedtreatmentareaMods) RandomGeometryY(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - 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 fsProposedtreatmentareaMods) RandomGeometryYNotNull(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.GeometryY = 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 fsProposedtreatmentareaMods) Updated(val time.Time) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsProposedtreatmentareaMods) UpdatedFunc(f func() time.Time) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsProposedtreatmentareaMods) UnsetUpdated() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsProposedtreatmentareaMods) RandomUpdated(f *faker.Faker) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsProposedtreatmentareaMods) WithParentsCascading() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(ctx context.Context, o *FSProposedtreatmentareaTemplate) { - if isDone, _ := fsProposedtreatmentareaWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsProposedtreatmentareaWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsProposedtreatmentareaMods) WithOrganization(rel *OrganizationTemplate) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(ctx context.Context, o *FSProposedtreatmentareaTemplate) { - o.r.Organization = &fsProposedtreatmentareaROrganizationR{ - o: rel, - } - }) -} - -func (m fsProposedtreatmentareaMods) WithNewOrganization(mods ...OrganizationMod) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(ctx context.Context, o *FSProposedtreatmentareaTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsProposedtreatmentareaMods) WithExistingOrganization(em *models.Organization) FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(ctx context.Context, o *FSProposedtreatmentareaTemplate) { - o.r.Organization = &fsProposedtreatmentareaROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsProposedtreatmentareaMods) WithoutOrganization() FSProposedtreatmentareaMod { - return FSProposedtreatmentareaModFunc(func(ctx context.Context, o *FSProposedtreatmentareaTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_qamosquitoinspection.bob.go b/db/factory/fs_qamosquitoinspection.bob.go deleted file mode 100644 index caab70da..00000000 --- a/db/factory/fs_qamosquitoinspection.bob.go +++ /dev/null @@ -1,4300 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSQamosquitoinspectionMod interface { - Apply(context.Context, *FSQamosquitoinspectionTemplate) -} - -type FSQamosquitoinspectionModFunc func(context.Context, *FSQamosquitoinspectionTemplate) - -func (f FSQamosquitoinspectionModFunc) Apply(ctx context.Context, n *FSQamosquitoinspectionTemplate) { - f(ctx, n) -} - -type FSQamosquitoinspectionModSlice []FSQamosquitoinspectionMod - -func (mods FSQamosquitoinspectionModSlice) Apply(ctx context.Context, n *FSQamosquitoinspectionTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSQamosquitoinspectionTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSQamosquitoinspectionTemplate struct { - OrganizationID func() int32 - Acresbreeding func() null.Val[float64] - Actiontaken func() null.Val[string] - Adultactivity func() null.Val[int16] - Aquaticorganisms func() null.Val[string] - Avetemp func() null.Val[float64] - Breedingpotential func() null.Val[string] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Enddatetime func() null.Val[int64] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fieldtech func() null.Val[string] - Fish func() null.Val[int16] - Globalid func() string - Habvalue1 func() null.Val[int16] - Habvalue1percent func() null.Val[int16] - Habvalue2 func() null.Val[int16] - Habvalue2percent func() null.Val[int16] - Larvaeinsidetreatedarea func() null.Val[int16] - Larvaeoutsidetreatedarea func() null.Val[int16] - Larvaepresent func() null.Val[int16] - Larvaereason func() null.Val[string] - Linelocid func() null.Val[string] - Locationname func() null.Val[string] - LR func() null.Val[int16] - Mosquitohabitat func() null.Val[string] - Movingwater func() null.Val[int16] - Negdips func() null.Val[int16] - Nowaterever func() null.Val[int16] - Objectid func() int32 - Pointlocid func() null.Val[string] - Polygonlocid func() null.Val[string] - Posdips func() null.Val[int16] - Potential func() null.Val[int16] - Raingauge func() null.Val[float64] - Recordstatus func() null.Val[int16] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[int64] - Sitetype func() null.Val[string] - Soilconditions func() null.Val[string] - Sourcereduction func() null.Val[string] - Startdatetime func() null.Val[int64] - Totalacres func() null.Val[float64] - Vegetation func() null.Val[string] - Waterconditions func() null.Val[string] - Waterduration func() null.Val[string] - Watermovement1 func() null.Val[string] - Watermovement1percent func() null.Val[int16] - Watermovement2 func() null.Val[string] - Watermovement2percent func() null.Val[int16] - Waterpresent func() null.Val[int16] - Watersource func() null.Val[string] - Winddir func() null.Val[string] - Windspeed func() null.Val[float64] - Zone func() null.Val[string] - 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] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Updated func() time.Time - - r fsQamosquitoinspectionR - f *Factory - - alreadyPersisted bool -} - -type fsQamosquitoinspectionR struct { - Organization *fsQamosquitoinspectionROrganizationR -} - -type fsQamosquitoinspectionROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSQamosquitoinspectionTemplate -func (o *FSQamosquitoinspectionTemplate) Apply(ctx context.Context, mods ...FSQamosquitoinspectionMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSQamosquitoinspection -// according to the relationships in the template. Nothing is inserted into the db -func (t FSQamosquitoinspectionTemplate) setModelRels(o *models.FSQamosquitoinspection) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSQamosquitoinspections = append(rel.R.FSQamosquitoinspections, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSQamosquitoinspectionSetter -// this does nothing with the relationship templates -func (o FSQamosquitoinspectionTemplate) BuildSetter() *models.FSQamosquitoinspectionSetter { - m := &models.FSQamosquitoinspectionSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Acresbreeding != nil { - val := o.Acresbreeding() - m.Acresbreeding = omitnull.FromNull(val) - } - if o.Actiontaken != nil { - val := o.Actiontaken() - m.Actiontaken = omitnull.FromNull(val) - } - if o.Adultactivity != nil { - val := o.Adultactivity() - m.Adultactivity = omitnull.FromNull(val) - } - if o.Aquaticorganisms != nil { - val := o.Aquaticorganisms() - m.Aquaticorganisms = omitnull.FromNull(val) - } - if o.Avetemp != nil { - val := o.Avetemp() - m.Avetemp = omitnull.FromNull(val) - } - if o.Breedingpotential != nil { - val := o.Breedingpotential() - m.Breedingpotential = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Fish != nil { - val := o.Fish() - m.Fish = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Habvalue1 != nil { - val := o.Habvalue1() - m.Habvalue1 = omitnull.FromNull(val) - } - if o.Habvalue1percent != nil { - val := o.Habvalue1percent() - m.Habvalue1percent = omitnull.FromNull(val) - } - if o.Habvalue2 != nil { - val := o.Habvalue2() - m.Habvalue2 = omitnull.FromNull(val) - } - if o.Habvalue2percent != nil { - val := o.Habvalue2percent() - m.Habvalue2percent = omitnull.FromNull(val) - } - if o.Larvaeinsidetreatedarea != nil { - val := o.Larvaeinsidetreatedarea() - m.Larvaeinsidetreatedarea = omitnull.FromNull(val) - } - if o.Larvaeoutsidetreatedarea != nil { - val := o.Larvaeoutsidetreatedarea() - m.Larvaeoutsidetreatedarea = omitnull.FromNull(val) - } - if o.Larvaepresent != nil { - val := o.Larvaepresent() - m.Larvaepresent = omitnull.FromNull(val) - } - if o.Larvaereason != nil { - val := o.Larvaereason() - m.Larvaereason = omitnull.FromNull(val) - } - if o.Linelocid != nil { - val := o.Linelocid() - m.Linelocid = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.LR != nil { - val := o.LR() - m.LR = omitnull.FromNull(val) - } - if o.Mosquitohabitat != nil { - val := o.Mosquitohabitat() - m.Mosquitohabitat = omitnull.FromNull(val) - } - if o.Movingwater != nil { - val := o.Movingwater() - m.Movingwater = omitnull.FromNull(val) - } - if o.Negdips != nil { - val := o.Negdips() - m.Negdips = omitnull.FromNull(val) - } - if o.Nowaterever != nil { - val := o.Nowaterever() - m.Nowaterever = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Pointlocid != nil { - val := o.Pointlocid() - m.Pointlocid = omitnull.FromNull(val) - } - if o.Polygonlocid != nil { - val := o.Polygonlocid() - m.Polygonlocid = omitnull.FromNull(val) - } - if o.Posdips != nil { - val := o.Posdips() - m.Posdips = omitnull.FromNull(val) - } - if o.Potential != nil { - val := o.Potential() - m.Potential = omitnull.FromNull(val) - } - if o.Raingauge != nil { - val := o.Raingauge() - m.Raingauge = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Reviewed != nil { - val := o.Reviewed() - m.Reviewed = omitnull.FromNull(val) - } - if o.Reviewedby != nil { - val := o.Reviewedby() - m.Reviewedby = omitnull.FromNull(val) - } - if o.Revieweddate != nil { - val := o.Revieweddate() - m.Revieweddate = omitnull.FromNull(val) - } - if o.Sitetype != nil { - val := o.Sitetype() - m.Sitetype = omitnull.FromNull(val) - } - if o.Soilconditions != nil { - val := o.Soilconditions() - m.Soilconditions = omitnull.FromNull(val) - } - if o.Sourcereduction != nil { - val := o.Sourcereduction() - m.Sourcereduction = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Totalacres != nil { - val := o.Totalacres() - m.Totalacres = omitnull.FromNull(val) - } - if o.Vegetation != nil { - val := o.Vegetation() - m.Vegetation = omitnull.FromNull(val) - } - if o.Waterconditions != nil { - val := o.Waterconditions() - m.Waterconditions = omitnull.FromNull(val) - } - if o.Waterduration != nil { - val := o.Waterduration() - m.Waterduration = omitnull.FromNull(val) - } - if o.Watermovement1 != nil { - val := o.Watermovement1() - m.Watermovement1 = omitnull.FromNull(val) - } - if o.Watermovement1percent != nil { - val := o.Watermovement1percent() - m.Watermovement1percent = omitnull.FromNull(val) - } - if o.Watermovement2 != nil { - val := o.Watermovement2() - m.Watermovement2 = omitnull.FromNull(val) - } - if o.Watermovement2percent != nil { - val := o.Watermovement2percent() - m.Watermovement2percent = omitnull.FromNull(val) - } - if o.Waterpresent != nil { - val := o.Waterpresent() - m.Waterpresent = omitnull.FromNull(val) - } - if o.Watersource != nil { - val := o.Watersource() - m.Watersource = omitnull.FromNull(val) - } - if o.Winddir != nil { - val := o.Winddir() - m.Winddir = omitnull.FromNull(val) - } - if o.Windspeed != nil { - val := o.Windspeed() - m.Windspeed = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSQamosquitoinspectionSetter -// this does nothing with the relationship templates -func (o FSQamosquitoinspectionTemplate) BuildManySetter(number int) []*models.FSQamosquitoinspectionSetter { - m := make([]*models.FSQamosquitoinspectionSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSQamosquitoinspection -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSQamosquitoinspectionTemplate.Create -func (o FSQamosquitoinspectionTemplate) Build() *models.FSQamosquitoinspection { - m := &models.FSQamosquitoinspection{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Acresbreeding != nil { - m.Acresbreeding = o.Acresbreeding() - } - if o.Actiontaken != nil { - m.Actiontaken = o.Actiontaken() - } - if o.Adultactivity != nil { - m.Adultactivity = o.Adultactivity() - } - if o.Aquaticorganisms != nil { - m.Aquaticorganisms = o.Aquaticorganisms() - } - if o.Avetemp != nil { - m.Avetemp = o.Avetemp() - } - if o.Breedingpotential != nil { - m.Breedingpotential = o.Breedingpotential() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Fish != nil { - m.Fish = o.Fish() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habvalue1 != nil { - m.Habvalue1 = o.Habvalue1() - } - if o.Habvalue1percent != nil { - m.Habvalue1percent = o.Habvalue1percent() - } - if o.Habvalue2 != nil { - m.Habvalue2 = o.Habvalue2() - } - if o.Habvalue2percent != nil { - m.Habvalue2percent = o.Habvalue2percent() - } - if o.Larvaeinsidetreatedarea != nil { - m.Larvaeinsidetreatedarea = o.Larvaeinsidetreatedarea() - } - if o.Larvaeoutsidetreatedarea != nil { - m.Larvaeoutsidetreatedarea = o.Larvaeoutsidetreatedarea() - } - if o.Larvaepresent != nil { - m.Larvaepresent = o.Larvaepresent() - } - if o.Larvaereason != nil { - m.Larvaereason = o.Larvaereason() - } - if o.Linelocid != nil { - m.Linelocid = o.Linelocid() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.LR != nil { - m.LR = o.LR() - } - if o.Mosquitohabitat != nil { - m.Mosquitohabitat = o.Mosquitohabitat() - } - if o.Movingwater != nil { - m.Movingwater = o.Movingwater() - } - if o.Negdips != nil { - m.Negdips = o.Negdips() - } - if o.Nowaterever != nil { - m.Nowaterever = o.Nowaterever() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Pointlocid != nil { - m.Pointlocid = o.Pointlocid() - } - if o.Polygonlocid != nil { - m.Polygonlocid = o.Polygonlocid() - } - if o.Posdips != nil { - m.Posdips = o.Posdips() - } - if o.Potential != nil { - m.Potential = o.Potential() - } - if o.Raingauge != nil { - m.Raingauge = o.Raingauge() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Reviewed != nil { - m.Reviewed = o.Reviewed() - } - if o.Reviewedby != nil { - m.Reviewedby = o.Reviewedby() - } - if o.Revieweddate != nil { - m.Revieweddate = o.Revieweddate() - } - if o.Sitetype != nil { - m.Sitetype = o.Sitetype() - } - if o.Soilconditions != nil { - m.Soilconditions = o.Soilconditions() - } - if o.Sourcereduction != nil { - m.Sourcereduction = o.Sourcereduction() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Totalacres != nil { - m.Totalacres = o.Totalacres() - } - if o.Vegetation != nil { - m.Vegetation = o.Vegetation() - } - if o.Waterconditions != nil { - m.Waterconditions = o.Waterconditions() - } - if o.Waterduration != nil { - m.Waterduration = o.Waterduration() - } - if o.Watermovement1 != nil { - m.Watermovement1 = o.Watermovement1() - } - if o.Watermovement1percent != nil { - m.Watermovement1percent = o.Watermovement1percent() - } - if o.Watermovement2 != nil { - m.Watermovement2 = o.Watermovement2() - } - if o.Watermovement2percent != nil { - m.Watermovement2percent = o.Watermovement2percent() - } - if o.Waterpresent != nil { - m.Waterpresent = o.Waterpresent() - } - if o.Watersource != nil { - m.Watersource = o.Watersource() - } - if o.Winddir != nil { - m.Winddir = o.Winddir() - } - if o.Windspeed != nil { - m.Windspeed = o.Windspeed() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSQamosquitoinspectionSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSQamosquitoinspectionTemplate.CreateMany -func (o FSQamosquitoinspectionTemplate) BuildMany(number int) models.FSQamosquitoinspectionSlice { - m := make(models.FSQamosquitoinspectionSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSQamosquitoinspection(m *models.FSQamosquitoinspectionSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSQamosquitoinspection -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSQamosquitoinspectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSQamosquitoinspection) error { - var err error - - return err -} - -// Create builds a fsQamosquitoinspection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSQamosquitoinspectionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSQamosquitoinspection, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSQamosquitoinspection(opt) - - if o.r.Organization == nil { - FSQamosquitoinspectionMods.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.FSQamosquitoinspections.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 fsQamosquitoinspection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSQamosquitoinspectionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSQamosquitoinspection { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsQamosquitoinspection 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 *FSQamosquitoinspectionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSQamosquitoinspection { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsQamosquitoinspections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSQamosquitoinspectionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSQamosquitoinspectionSlice, error) { - var err error - m := make(models.FSQamosquitoinspectionSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsQamosquitoinspections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSQamosquitoinspectionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSQamosquitoinspectionSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsQamosquitoinspections 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 FSQamosquitoinspectionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSQamosquitoinspectionSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSQamosquitoinspection has methods that act as mods for the FSQamosquitoinspectionTemplate -var FSQamosquitoinspectionMods fsQamosquitoinspectionMods - -type fsQamosquitoinspectionMods struct{} - -func (m fsQamosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModSlice{ - FSQamosquitoinspectionMods.RandomOrganizationID(f), - FSQamosquitoinspectionMods.RandomAcresbreeding(f), - FSQamosquitoinspectionMods.RandomActiontaken(f), - FSQamosquitoinspectionMods.RandomAdultactivity(f), - FSQamosquitoinspectionMods.RandomAquaticorganisms(f), - FSQamosquitoinspectionMods.RandomAvetemp(f), - FSQamosquitoinspectionMods.RandomBreedingpotential(f), - FSQamosquitoinspectionMods.RandomComments(f), - FSQamosquitoinspectionMods.RandomCreationdate(f), - FSQamosquitoinspectionMods.RandomCreator(f), - FSQamosquitoinspectionMods.RandomEnddatetime(f), - FSQamosquitoinspectionMods.RandomEditdate(f), - FSQamosquitoinspectionMods.RandomEditor(f), - FSQamosquitoinspectionMods.RandomFieldtech(f), - FSQamosquitoinspectionMods.RandomFish(f), - FSQamosquitoinspectionMods.RandomGlobalid(f), - FSQamosquitoinspectionMods.RandomHabvalue1(f), - FSQamosquitoinspectionMods.RandomHabvalue1percent(f), - FSQamosquitoinspectionMods.RandomHabvalue2(f), - FSQamosquitoinspectionMods.RandomHabvalue2percent(f), - FSQamosquitoinspectionMods.RandomLarvaeinsidetreatedarea(f), - FSQamosquitoinspectionMods.RandomLarvaeoutsidetreatedarea(f), - FSQamosquitoinspectionMods.RandomLarvaepresent(f), - FSQamosquitoinspectionMods.RandomLarvaereason(f), - FSQamosquitoinspectionMods.RandomLinelocid(f), - FSQamosquitoinspectionMods.RandomLocationname(f), - FSQamosquitoinspectionMods.RandomLR(f), - FSQamosquitoinspectionMods.RandomMosquitohabitat(f), - FSQamosquitoinspectionMods.RandomMovingwater(f), - FSQamosquitoinspectionMods.RandomNegdips(f), - FSQamosquitoinspectionMods.RandomNowaterever(f), - FSQamosquitoinspectionMods.RandomObjectid(f), - FSQamosquitoinspectionMods.RandomPointlocid(f), - FSQamosquitoinspectionMods.RandomPolygonlocid(f), - FSQamosquitoinspectionMods.RandomPosdips(f), - FSQamosquitoinspectionMods.RandomPotential(f), - FSQamosquitoinspectionMods.RandomRaingauge(f), - FSQamosquitoinspectionMods.RandomRecordstatus(f), - FSQamosquitoinspectionMods.RandomReviewed(f), - FSQamosquitoinspectionMods.RandomReviewedby(f), - FSQamosquitoinspectionMods.RandomRevieweddate(f), - FSQamosquitoinspectionMods.RandomSitetype(f), - FSQamosquitoinspectionMods.RandomSoilconditions(f), - FSQamosquitoinspectionMods.RandomSourcereduction(f), - FSQamosquitoinspectionMods.RandomStartdatetime(f), - FSQamosquitoinspectionMods.RandomTotalacres(f), - FSQamosquitoinspectionMods.RandomVegetation(f), - FSQamosquitoinspectionMods.RandomWaterconditions(f), - FSQamosquitoinspectionMods.RandomWaterduration(f), - FSQamosquitoinspectionMods.RandomWatermovement1(f), - FSQamosquitoinspectionMods.RandomWatermovement1percent(f), - FSQamosquitoinspectionMods.RandomWatermovement2(f), - FSQamosquitoinspectionMods.RandomWatermovement2percent(f), - FSQamosquitoinspectionMods.RandomWaterpresent(f), - FSQamosquitoinspectionMods.RandomWatersource(f), - FSQamosquitoinspectionMods.RandomWinddir(f), - FSQamosquitoinspectionMods.RandomWindspeed(f), - FSQamosquitoinspectionMods.RandomZone(f), - FSQamosquitoinspectionMods.RandomZone2(f), - FSQamosquitoinspectionMods.RandomCreatedDate(f), - FSQamosquitoinspectionMods.RandomCreatedUser(f), - FSQamosquitoinspectionMods.RandomGeometryX(f), - FSQamosquitoinspectionMods.RandomGeometryY(f), - FSQamosquitoinspectionMods.RandomLastEditedDate(f), - FSQamosquitoinspectionMods.RandomLastEditedUser(f), - FSQamosquitoinspectionMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) OrganizationID(val int32) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) OrganizationIDFunc(f func() int32) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetOrganizationID() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - 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 fsQamosquitoinspectionMods) RandomOrganizationID(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Acresbreeding(val null.Val[float64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Acresbreeding = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) AcresbreedingFunc(f func() null.Val[float64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Acresbreeding = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetAcresbreeding() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Acresbreeding = 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 fsQamosquitoinspectionMods) RandomAcresbreeding(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Acresbreeding = 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 fsQamosquitoinspectionMods) RandomAcresbreedingNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Acresbreeding = 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 fsQamosquitoinspectionMods) Actiontaken(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) ActiontakenFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Actiontaken = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetActiontaken() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Actiontaken = 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 fsQamosquitoinspectionMods) RandomActiontaken(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Actiontaken = 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) RandomActiontakenNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Actiontaken = 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 fsQamosquitoinspectionMods) Adultactivity(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Adultactivity = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) AdultactivityFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Adultactivity = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetAdultactivity() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Adultactivity = 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 fsQamosquitoinspectionMods) RandomAdultactivity(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Adultactivity = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomAdultactivityNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Adultactivity = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Aquaticorganisms(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Aquaticorganisms = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) AquaticorganismsFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Aquaticorganisms = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetAquaticorganisms() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Aquaticorganisms = 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 fsQamosquitoinspectionMods) RandomAquaticorganisms(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Aquaticorganisms = 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) RandomAquaticorganismsNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Aquaticorganisms = 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 fsQamosquitoinspectionMods) Avetemp(val null.Val[float64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Avetemp = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) AvetempFunc(f func() null.Val[float64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Avetemp = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetAvetemp() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Avetemp = 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 fsQamosquitoinspectionMods) RandomAvetemp(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Avetemp = 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 fsQamosquitoinspectionMods) RandomAvetempNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Avetemp = 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 fsQamosquitoinspectionMods) Breedingpotential(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Breedingpotential = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) BreedingpotentialFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Breedingpotential = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetBreedingpotential() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Breedingpotential = 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 fsQamosquitoinspectionMods) RandomBreedingpotential(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Breedingpotential = 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) RandomBreedingpotentialNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Breedingpotential = 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 fsQamosquitoinspectionMods) Comments(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) CommentsFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetComments() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Comments = 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 fsQamosquitoinspectionMods) RandomComments(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Comments = 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 fsQamosquitoinspectionMods) Creationdate(val null.Val[int64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) CreationdateFunc(f func() null.Val[int64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetCreationdate() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Creationdate = 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 fsQamosquitoinspectionMods) RandomCreationdate(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Creator(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) CreatorFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetCreator() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Creator = 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 fsQamosquitoinspectionMods) RandomCreator(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Creator = 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 fsQamosquitoinspectionMods) Enddatetime(val null.Val[int64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Enddatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) EnddatetimeFunc(f func() null.Val[int64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetEnddatetime() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Enddatetime = 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 fsQamosquitoinspectionMods) RandomEnddatetime(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Editdate(val null.Val[int64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) EditdateFunc(f func() null.Val[int64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetEditdate() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Editdate = 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 fsQamosquitoinspectionMods) RandomEditdate(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Editor(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) EditorFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetEditor() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Editor = 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 fsQamosquitoinspectionMods) RandomEditor(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Editor = 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 fsQamosquitoinspectionMods) Fieldtech(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) FieldtechFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetFieldtech() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Fieldtech = 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 fsQamosquitoinspectionMods) RandomFieldtech(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Fieldtech = 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) RandomFieldtechNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Fieldtech = 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 fsQamosquitoinspectionMods) Fish(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Fish = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) FishFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Fish = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetFish() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Fish = 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 fsQamosquitoinspectionMods) RandomFish(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Fish = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomFishNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Fish = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Globalid(val string) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) GlobalidFunc(f func() string) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetGlobalid() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsQamosquitoinspectionMods) RandomGlobalid(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Habvalue1(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue1 = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) Habvalue1Func(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue1 = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetHabvalue1() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue1 = 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 fsQamosquitoinspectionMods) RandomHabvalue1(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue1 = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomHabvalue1NotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue1 = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Habvalue1percent(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue1percent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) Habvalue1percentFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue1percent = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetHabvalue1percent() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue1percent = 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 fsQamosquitoinspectionMods) RandomHabvalue1percent(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue1percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomHabvalue1percentNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue1percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Habvalue2(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue2 = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) Habvalue2Func(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue2 = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetHabvalue2() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue2 = 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 fsQamosquitoinspectionMods) RandomHabvalue2(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue2 = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomHabvalue2NotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue2 = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Habvalue2percent(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue2percent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) Habvalue2percentFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue2percent = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetHabvalue2percent() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue2percent = 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 fsQamosquitoinspectionMods) RandomHabvalue2percent(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue2percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomHabvalue2percentNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Habvalue2percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Larvaeinsidetreatedarea(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaeinsidetreatedarea = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) LarvaeinsidetreatedareaFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaeinsidetreatedarea = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetLarvaeinsidetreatedarea() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaeinsidetreatedarea = 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 fsQamosquitoinspectionMods) RandomLarvaeinsidetreatedarea(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaeinsidetreatedarea = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomLarvaeinsidetreatedareaNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaeinsidetreatedarea = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Larvaeoutsidetreatedarea(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaeoutsidetreatedarea = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) LarvaeoutsidetreatedareaFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaeoutsidetreatedarea = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetLarvaeoutsidetreatedarea() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaeoutsidetreatedarea = 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 fsQamosquitoinspectionMods) RandomLarvaeoutsidetreatedarea(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaeoutsidetreatedarea = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomLarvaeoutsidetreatedareaNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaeoutsidetreatedarea = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Larvaepresent(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) LarvaepresentFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaepresent = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetLarvaepresent() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaepresent = 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 fsQamosquitoinspectionMods) RandomLarvaepresent(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomLarvaepresentNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Larvaereason(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaereason = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) LarvaereasonFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaereason = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetLarvaereason() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaereason = 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 fsQamosquitoinspectionMods) RandomLarvaereason(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaereason = 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) RandomLarvaereasonNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Larvaereason = 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 fsQamosquitoinspectionMods) Linelocid(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Linelocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) LinelocidFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Linelocid = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetLinelocid() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Linelocid = 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 fsQamosquitoinspectionMods) RandomLinelocid(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Linelocid = 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) RandomLinelocidNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Linelocid = 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 fsQamosquitoinspectionMods) Locationname(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) LocationnameFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetLocationname() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Locationname = 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 fsQamosquitoinspectionMods) RandomLocationname(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Locationname = 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) RandomLocationnameNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Locationname = 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 fsQamosquitoinspectionMods) LR(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.LR = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) LRFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.LR = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetLR() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.LR = 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 fsQamosquitoinspectionMods) RandomLR(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.LR = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomLRNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.LR = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Mosquitohabitat(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Mosquitohabitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) MosquitohabitatFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Mosquitohabitat = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetMosquitohabitat() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Mosquitohabitat = 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 fsQamosquitoinspectionMods) RandomMosquitohabitat(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Mosquitohabitat = 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) RandomMosquitohabitatNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Mosquitohabitat = 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 fsQamosquitoinspectionMods) Movingwater(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Movingwater = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) MovingwaterFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Movingwater = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetMovingwater() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Movingwater = 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 fsQamosquitoinspectionMods) RandomMovingwater(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Movingwater = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomMovingwaterNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Movingwater = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Negdips(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Negdips = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) NegdipsFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Negdips = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetNegdips() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Negdips = 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 fsQamosquitoinspectionMods) RandomNegdips(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Negdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomNegdipsNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Negdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Nowaterever(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Nowaterever = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) NowatereverFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Nowaterever = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetNowaterever() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Nowaterever = 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 fsQamosquitoinspectionMods) RandomNowaterever(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Nowaterever = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomNowatereverNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Nowaterever = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Objectid(val int32) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) ObjectidFunc(f func() int32) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetObjectid() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsQamosquitoinspectionMods) RandomObjectid(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Pointlocid(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Pointlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) PointlocidFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Pointlocid = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetPointlocid() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Pointlocid = 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 fsQamosquitoinspectionMods) RandomPointlocid(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Pointlocid = 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) RandomPointlocidNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Pointlocid = 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 fsQamosquitoinspectionMods) Polygonlocid(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Polygonlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) PolygonlocidFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Polygonlocid = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetPolygonlocid() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Polygonlocid = 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 fsQamosquitoinspectionMods) RandomPolygonlocid(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Polygonlocid = 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) RandomPolygonlocidNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Polygonlocid = 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 fsQamosquitoinspectionMods) Posdips(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Posdips = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) PosdipsFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Posdips = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetPosdips() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Posdips = 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 fsQamosquitoinspectionMods) RandomPosdips(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Posdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomPosdipsNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Posdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Potential(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Potential = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) PotentialFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Potential = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetPotential() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Potential = 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 fsQamosquitoinspectionMods) RandomPotential(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Potential = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomPotentialNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Potential = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Raingauge(val null.Val[float64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Raingauge = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) RaingaugeFunc(f func() null.Val[float64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Raingauge = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetRaingauge() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Raingauge = 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 fsQamosquitoinspectionMods) RandomRaingauge(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Raingauge = 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 fsQamosquitoinspectionMods) RandomRaingaugeNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Raingauge = 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 fsQamosquitoinspectionMods) Recordstatus(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) RecordstatusFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetRecordstatus() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Recordstatus = 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 fsQamosquitoinspectionMods) RandomRecordstatus(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Reviewed(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) ReviewedFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetReviewed() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Reviewed = 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 fsQamosquitoinspectionMods) RandomReviewed(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Reviewedby(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) ReviewedbyFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetReviewedby() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Reviewedby = 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 fsQamosquitoinspectionMods) RandomReviewedby(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Reviewedby = 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) RandomReviewedbyNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Reviewedby = 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 fsQamosquitoinspectionMods) Revieweddate(val null.Val[int64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Revieweddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) RevieweddateFunc(f func() null.Val[int64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetRevieweddate() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Revieweddate = 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 fsQamosquitoinspectionMods) RandomRevieweddate(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Sitetype(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Sitetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) SitetypeFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Sitetype = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetSitetype() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Sitetype = 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 fsQamosquitoinspectionMods) RandomSitetype(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Sitetype = 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) RandomSitetypeNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Sitetype = 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 fsQamosquitoinspectionMods) Soilconditions(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Soilconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) SoilconditionsFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Soilconditions = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetSoilconditions() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Soilconditions = 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 fsQamosquitoinspectionMods) RandomSoilconditions(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Soilconditions = 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) RandomSoilconditionsNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Soilconditions = 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 fsQamosquitoinspectionMods) Sourcereduction(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Sourcereduction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) SourcereductionFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Sourcereduction = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetSourcereduction() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Sourcereduction = 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 fsQamosquitoinspectionMods) RandomSourcereduction(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Sourcereduction = 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) RandomSourcereductionNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Sourcereduction = 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 fsQamosquitoinspectionMods) Startdatetime(val null.Val[int64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Startdatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) StartdatetimeFunc(f func() null.Val[int64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetStartdatetime() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Startdatetime = 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 fsQamosquitoinspectionMods) RandomStartdatetime(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Totalacres(val null.Val[float64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Totalacres = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) TotalacresFunc(f func() null.Val[float64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Totalacres = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetTotalacres() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Totalacres = 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 fsQamosquitoinspectionMods) RandomTotalacres(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Totalacres = 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 fsQamosquitoinspectionMods) RandomTotalacresNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Totalacres = 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 fsQamosquitoinspectionMods) Vegetation(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Vegetation = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) VegetationFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Vegetation = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetVegetation() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Vegetation = 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 fsQamosquitoinspectionMods) RandomVegetation(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Vegetation = 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) RandomVegetationNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Vegetation = 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 fsQamosquitoinspectionMods) Waterconditions(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Waterconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) WaterconditionsFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Waterconditions = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetWaterconditions() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Waterconditions = 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 fsQamosquitoinspectionMods) RandomWaterconditions(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Waterconditions = 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) RandomWaterconditionsNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Waterconditions = 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 fsQamosquitoinspectionMods) Waterduration(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Waterduration = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) WaterdurationFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Waterduration = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetWaterduration() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Waterduration = 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 fsQamosquitoinspectionMods) RandomWaterduration(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Waterduration = 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) RandomWaterdurationNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Waterduration = 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 fsQamosquitoinspectionMods) Watermovement1(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement1 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) Watermovement1Func(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement1 = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetWatermovement1() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement1 = 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 fsQamosquitoinspectionMods) RandomWatermovement1(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement1 = 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) RandomWatermovement1NotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement1 = 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 fsQamosquitoinspectionMods) Watermovement1percent(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement1percent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) Watermovement1percentFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement1percent = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetWatermovement1percent() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement1percent = 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 fsQamosquitoinspectionMods) RandomWatermovement1percent(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement1percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomWatermovement1percentNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement1percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Watermovement2(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) Watermovement2Func(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement2 = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetWatermovement2() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement2 = 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 fsQamosquitoinspectionMods) RandomWatermovement2(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement2 = 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) RandomWatermovement2NotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement2 = 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 fsQamosquitoinspectionMods) Watermovement2percent(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement2percent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) Watermovement2percentFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement2percent = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetWatermovement2percent() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement2percent = 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 fsQamosquitoinspectionMods) RandomWatermovement2percent(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement2percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomWatermovement2percentNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watermovement2percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Waterpresent(val null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Waterpresent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) WaterpresentFunc(f func() null.Val[int16]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Waterpresent = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetWaterpresent() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Waterpresent = 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 fsQamosquitoinspectionMods) RandomWaterpresent(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Waterpresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomWaterpresentNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Waterpresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) Watersource(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watersource = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) WatersourceFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watersource = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetWatersource() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watersource = 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 fsQamosquitoinspectionMods) RandomWatersource(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watersource = 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) RandomWatersourceNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Watersource = 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 fsQamosquitoinspectionMods) Winddir(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Winddir = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) WinddirFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Winddir = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetWinddir() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Winddir = 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 fsQamosquitoinspectionMods) RandomWinddir(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Winddir = 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) RandomWinddirNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Winddir = 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 fsQamosquitoinspectionMods) Windspeed(val null.Val[float64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Windspeed = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) WindspeedFunc(f func() null.Val[float64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Windspeed = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetWindspeed() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Windspeed = 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 fsQamosquitoinspectionMods) RandomWindspeed(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Windspeed = 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 fsQamosquitoinspectionMods) RandomWindspeedNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Windspeed = 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 fsQamosquitoinspectionMods) Zone(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) ZoneFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetZone() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Zone = 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 fsQamosquitoinspectionMods) RandomZone(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Zone = 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) RandomZoneNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Zone = 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 fsQamosquitoinspectionMods) Zone2(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) Zone2Func(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetZone2() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Zone2 = 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 fsQamosquitoinspectionMods) RandomZone2(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Zone2 = 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) RandomZone2NotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Zone2 = 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 fsQamosquitoinspectionMods) CreatedDate(val null.Val[int64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) CreatedDateFunc(f func() null.Val[int64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetCreatedDate() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.CreatedDate = 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 fsQamosquitoinspectionMods) RandomCreatedDate(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) CreatedUser(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) CreatedUserFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetCreatedUser() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.CreatedUser = 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 fsQamosquitoinspectionMods) RandomCreatedUser(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.CreatedUser = 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 fsQamosquitoinspectionMods) GeometryX(val null.Val[float64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) GeometryXFunc(f func() null.Val[float64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetGeometryX() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.GeometryX = 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 fsQamosquitoinspectionMods) RandomGeometryX(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - 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 fsQamosquitoinspectionMods) RandomGeometryXNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.GeometryX = 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 fsQamosquitoinspectionMods) GeometryY(val null.Val[float64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) GeometryYFunc(f func() null.Val[float64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetGeometryY() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.GeometryY = 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 fsQamosquitoinspectionMods) RandomGeometryY(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - 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 fsQamosquitoinspectionMods) RandomGeometryYNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.GeometryY = 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 fsQamosquitoinspectionMods) LastEditedDate(val null.Val[int64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) LastEditedDateFunc(f func() null.Val[int64]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetLastEditedDate() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.LastEditedDate = 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 fsQamosquitoinspectionMods) RandomLastEditedDate(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsQamosquitoinspectionMods) LastEditedUser(val null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) LastEditedUserFunc(f func() null.Val[string]) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetLastEditedUser() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.LastEditedUser = 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 fsQamosquitoinspectionMods) RandomLastEditedUser(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.LastEditedUser = 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 fsQamosquitoinspectionMods) Updated(val time.Time) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsQamosquitoinspectionMods) UpdatedFunc(f func() time.Time) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsQamosquitoinspectionMods) UnsetUpdated() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsQamosquitoinspectionMods) RandomUpdated(f *faker.Faker) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsQamosquitoinspectionMods) WithParentsCascading() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(ctx context.Context, o *FSQamosquitoinspectionTemplate) { - if isDone, _ := fsQamosquitoinspectionWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsQamosquitoinspectionWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsQamosquitoinspectionMods) WithOrganization(rel *OrganizationTemplate) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(ctx context.Context, o *FSQamosquitoinspectionTemplate) { - o.r.Organization = &fsQamosquitoinspectionROrganizationR{ - o: rel, - } - }) -} - -func (m fsQamosquitoinspectionMods) WithNewOrganization(mods ...OrganizationMod) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(ctx context.Context, o *FSQamosquitoinspectionTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsQamosquitoinspectionMods) WithExistingOrganization(em *models.Organization) FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(ctx context.Context, o *FSQamosquitoinspectionTemplate) { - o.r.Organization = &fsQamosquitoinspectionROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsQamosquitoinspectionMods) WithoutOrganization() FSQamosquitoinspectionMod { - return FSQamosquitoinspectionModFunc(func(ctx context.Context, o *FSQamosquitoinspectionTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_rodentlocation.bob.go b/db/factory/fs_rodentlocation.bob.go deleted file mode 100644 index 735df29c..00000000 --- a/db/factory/fs_rodentlocation.bob.go +++ /dev/null @@ -1,2316 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSRodentlocationMod interface { - Apply(context.Context, *FSRodentlocationTemplate) -} - -type FSRodentlocationModFunc func(context.Context, *FSRodentlocationTemplate) - -func (f FSRodentlocationModFunc) Apply(ctx context.Context, n *FSRodentlocationTemplate) { - f(ctx, n) -} - -type FSRodentlocationModSlice []FSRodentlocationMod - -func (mods FSRodentlocationModSlice) Apply(ctx context.Context, n *FSRodentlocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSRodentlocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSRodentlocationTemplate struct { - OrganizationID func() int32 - Accessdesc func() null.Val[string] - Active func() null.Val[int16] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Description func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() string - Habitat func() null.Val[string] - Lastinspectaction func() null.Val[string] - Lastinspectconditions func() null.Val[string] - Lastinspectdate func() null.Val[int64] - Lastinspectrodentevidence func() null.Val[string] - Lastinspectspecies func() null.Val[string] - Locationname func() null.Val[string] - Locationnumber func() null.Val[int64] - Nextactiondatescheduled func() null.Val[int64] - Objectid func() int32 - Priority func() null.Val[string] - Symbology func() null.Val[string] - Usetype func() null.Val[string] - Zone func() null.Val[string] - 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] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Jurisdiction func() null.Val[string] - Updated func() time.Time - - r fsRodentlocationR - f *Factory - - alreadyPersisted bool -} - -type fsRodentlocationR struct { - Organization *fsRodentlocationROrganizationR -} - -type fsRodentlocationROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSRodentlocationTemplate -func (o *FSRodentlocationTemplate) Apply(ctx context.Context, mods ...FSRodentlocationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSRodentlocation -// according to the relationships in the template. Nothing is inserted into the db -func (t FSRodentlocationTemplate) setModelRels(o *models.FSRodentlocation) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSRodentlocations = append(rel.R.FSRodentlocations, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSRodentlocationSetter -// this does nothing with the relationship templates -func (o FSRodentlocationTemplate) BuildSetter() *models.FSRodentlocationSetter { - m := &models.FSRodentlocationSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(val) - } - if o.Lastinspectaction != nil { - val := o.Lastinspectaction() - m.Lastinspectaction = omitnull.FromNull(val) - } - if o.Lastinspectconditions != nil { - val := o.Lastinspectconditions() - m.Lastinspectconditions = omitnull.FromNull(val) - } - if o.Lastinspectdate != nil { - val := o.Lastinspectdate() - m.Lastinspectdate = omitnull.FromNull(val) - } - if o.Lastinspectrodentevidence != nil { - val := o.Lastinspectrodentevidence() - m.Lastinspectrodentevidence = omitnull.FromNull(val) - } - if o.Lastinspectspecies != nil { - val := o.Lastinspectspecies() - m.Lastinspectspecies = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Symbology != nil { - val := o.Symbology() - m.Symbology = omitnull.FromNull(val) - } - if o.Usetype != nil { - val := o.Usetype() - m.Usetype = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSRodentlocationSetter -// this does nothing with the relationship templates -func (o FSRodentlocationTemplate) BuildManySetter(number int) []*models.FSRodentlocationSetter { - m := make([]*models.FSRodentlocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSRodentlocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSRodentlocationTemplate.Create -func (o FSRodentlocationTemplate) Build() *models.FSRodentlocation { - m := &models.FSRodentlocation{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Lastinspectaction != nil { - m.Lastinspectaction = o.Lastinspectaction() - } - if o.Lastinspectconditions != nil { - m.Lastinspectconditions = o.Lastinspectconditions() - } - if o.Lastinspectdate != nil { - m.Lastinspectdate = o.Lastinspectdate() - } - if o.Lastinspectrodentevidence != nil { - m.Lastinspectrodentevidence = o.Lastinspectrodentevidence() - } - if o.Lastinspectspecies != nil { - m.Lastinspectspecies = o.Lastinspectspecies() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Symbology != nil { - m.Symbology = o.Symbology() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSRodentlocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSRodentlocationTemplate.CreateMany -func (o FSRodentlocationTemplate) BuildMany(number int) models.FSRodentlocationSlice { - m := make(models.FSRodentlocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSRodentlocation(m *models.FSRodentlocationSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSRodentlocation -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSRodentlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSRodentlocation) error { - var err error - - return err -} - -// Create builds a fsRodentlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSRodentlocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSRodentlocation, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSRodentlocation(opt) - - if o.r.Organization == nil { - FSRodentlocationMods.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.FSRodentlocations.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 fsRodentlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSRodentlocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSRodentlocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsRodentlocation 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 *FSRodentlocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSRodentlocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsRodentlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSRodentlocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSRodentlocationSlice, error) { - var err error - m := make(models.FSRodentlocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsRodentlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSRodentlocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSRodentlocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsRodentlocations 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 FSRodentlocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSRodentlocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSRodentlocation has methods that act as mods for the FSRodentlocationTemplate -var FSRodentlocationMods fsRodentlocationMods - -type fsRodentlocationMods struct{} - -func (m fsRodentlocationMods) RandomizeAllColumns(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModSlice{ - FSRodentlocationMods.RandomOrganizationID(f), - FSRodentlocationMods.RandomAccessdesc(f), - FSRodentlocationMods.RandomActive(f), - FSRodentlocationMods.RandomComments(f), - FSRodentlocationMods.RandomCreationdate(f), - FSRodentlocationMods.RandomCreator(f), - FSRodentlocationMods.RandomDescription(f), - FSRodentlocationMods.RandomExternalid(f), - FSRodentlocationMods.RandomEditdate(f), - FSRodentlocationMods.RandomEditor(f), - FSRodentlocationMods.RandomGlobalid(f), - FSRodentlocationMods.RandomHabitat(f), - FSRodentlocationMods.RandomLastinspectaction(f), - FSRodentlocationMods.RandomLastinspectconditions(f), - FSRodentlocationMods.RandomLastinspectdate(f), - FSRodentlocationMods.RandomLastinspectrodentevidence(f), - FSRodentlocationMods.RandomLastinspectspecies(f), - FSRodentlocationMods.RandomLocationname(f), - FSRodentlocationMods.RandomLocationnumber(f), - FSRodentlocationMods.RandomNextactiondatescheduled(f), - FSRodentlocationMods.RandomObjectid(f), - FSRodentlocationMods.RandomPriority(f), - FSRodentlocationMods.RandomSymbology(f), - FSRodentlocationMods.RandomUsetype(f), - FSRodentlocationMods.RandomZone(f), - FSRodentlocationMods.RandomZone2(f), - FSRodentlocationMods.RandomCreatedDate(f), - FSRodentlocationMods.RandomCreatedUser(f), - FSRodentlocationMods.RandomGeometryX(f), - FSRodentlocationMods.RandomGeometryY(f), - FSRodentlocationMods.RandomLastEditedDate(f), - FSRodentlocationMods.RandomLastEditedUser(f), - FSRodentlocationMods.RandomJurisdiction(f), - FSRodentlocationMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsRodentlocationMods) OrganizationID(val int32) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) OrganizationIDFunc(f func() int32) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetOrganizationID() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - 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 fsRodentlocationMods) RandomOrganizationID(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsRodentlocationMods) Accessdesc(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) AccessdescFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetAccessdesc() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Accessdesc = 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 fsRodentlocationMods) RandomAccessdesc(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Accessdesc = 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) RandomAccessdescNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Accessdesc = 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 fsRodentlocationMods) Active(val null.Val[int16]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) ActiveFunc(f func() null.Val[int16]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetActive() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Active = 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 fsRodentlocationMods) RandomActive(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomActiveNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsRodentlocationMods) Comments(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) CommentsFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetComments() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Comments = 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 fsRodentlocationMods) RandomComments(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Comments = 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 fsRodentlocationMods) Creationdate(val null.Val[int64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) CreationdateFunc(f func() null.Val[int64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetCreationdate() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Creationdate = 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 fsRodentlocationMods) RandomCreationdate(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsRodentlocationMods) Creator(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) CreatorFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetCreator() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Creator = 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 fsRodentlocationMods) RandomCreator(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Creator = 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 fsRodentlocationMods) Description(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) DescriptionFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetDescription() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Description = 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 fsRodentlocationMods) RandomDescription(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Description = 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) RandomDescriptionNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Description = 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 fsRodentlocationMods) Externalid(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) ExternalidFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetExternalid() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Externalid = 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 fsRodentlocationMods) RandomExternalid(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Externalid = 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) RandomExternalidNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Externalid = 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 fsRodentlocationMods) Editdate(val null.Val[int64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) EditdateFunc(f func() null.Val[int64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetEditdate() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Editdate = 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 fsRodentlocationMods) RandomEditdate(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsRodentlocationMods) Editor(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) EditorFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetEditor() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Editor = 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 fsRodentlocationMods) RandomEditor(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Editor = 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 fsRodentlocationMods) Globalid(val string) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) GlobalidFunc(f func() string) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetGlobalid() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsRodentlocationMods) RandomGlobalid(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsRodentlocationMods) Habitat(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) HabitatFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetHabitat() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Habitat = 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 fsRodentlocationMods) RandomHabitat(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Habitat = 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) RandomHabitatNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Habitat = 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 fsRodentlocationMods) Lastinspectaction(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectaction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) LastinspectactionFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectaction = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetLastinspectaction() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectaction = 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 fsRodentlocationMods) RandomLastinspectaction(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectaction = 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) RandomLastinspectactionNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectaction = 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 fsRodentlocationMods) Lastinspectconditions(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) LastinspectconditionsFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectconditions = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetLastinspectconditions() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectconditions = 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 fsRodentlocationMods) RandomLastinspectconditions(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectconditions = 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) RandomLastinspectconditionsNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectconditions = 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 fsRodentlocationMods) Lastinspectdate(val null.Val[int64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) LastinspectdateFunc(f func() null.Val[int64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectdate = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetLastinspectdate() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectdate = 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 fsRodentlocationMods) RandomLastinspectdate(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastinspectdateNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsRodentlocationMods) Lastinspectrodentevidence(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectrodentevidence = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) LastinspectrodentevidenceFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectrodentevidence = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetLastinspectrodentevidence() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectrodentevidence = 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 fsRodentlocationMods) RandomLastinspectrodentevidence(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectrodentevidence = 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) RandomLastinspectrodentevidenceNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectrodentevidence = 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 fsRodentlocationMods) Lastinspectspecies(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) LastinspectspeciesFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectspecies = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetLastinspectspecies() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectspecies = 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 fsRodentlocationMods) RandomLastinspectspecies(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectspecies = 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) RandomLastinspectspeciesNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Lastinspectspecies = 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 fsRodentlocationMods) Locationname(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) LocationnameFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetLocationname() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Locationname = 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 fsRodentlocationMods) RandomLocationname(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Locationname = 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) RandomLocationnameNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Locationname = 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 fsRodentlocationMods) Locationnumber(val null.Val[int64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) LocationnumberFunc(f func() null.Val[int64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetLocationnumber() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Locationnumber = 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 fsRodentlocationMods) RandomLocationnumber(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsRodentlocationMods) Nextactiondatescheduled(val null.Val[int64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetNextactiondatescheduled() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Nextactiondatescheduled = 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 fsRodentlocationMods) RandomNextactiondatescheduled(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsRodentlocationMods) Objectid(val int32) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) ObjectidFunc(f func() int32) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetObjectid() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsRodentlocationMods) RandomObjectid(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsRodentlocationMods) Priority(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) PriorityFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetPriority() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Priority = 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 fsRodentlocationMods) RandomPriority(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Priority = 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) RandomPriorityNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Priority = 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 fsRodentlocationMods) Symbology(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Symbology = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) SymbologyFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Symbology = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetSymbology() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Symbology = 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 fsRodentlocationMods) RandomSymbology(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Symbology = 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) RandomSymbologyNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Symbology = 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 fsRodentlocationMods) Usetype(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) UsetypeFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetUsetype() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Usetype = 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 fsRodentlocationMods) RandomUsetype(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Usetype = 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) RandomUsetypeNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Usetype = 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 fsRodentlocationMods) Zone(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) ZoneFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetZone() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Zone = 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 fsRodentlocationMods) RandomZone(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Zone = 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) RandomZoneNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Zone = 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 fsRodentlocationMods) Zone2(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) Zone2Func(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetZone2() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Zone2 = 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 fsRodentlocationMods) RandomZone2(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Zone2 = 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) RandomZone2NotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Zone2 = 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 fsRodentlocationMods) CreatedDate(val null.Val[int64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) CreatedDateFunc(f func() null.Val[int64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetCreatedDate() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.CreatedDate = 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 fsRodentlocationMods) RandomCreatedDate(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsRodentlocationMods) CreatedUser(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) CreatedUserFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetCreatedUser() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.CreatedUser = 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 fsRodentlocationMods) RandomCreatedUser(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.CreatedUser = 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 fsRodentlocationMods) GeometryX(val null.Val[float64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) GeometryXFunc(f func() null.Val[float64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetGeometryX() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.GeometryX = 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 fsRodentlocationMods) RandomGeometryX(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - 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 fsRodentlocationMods) RandomGeometryXNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.GeometryX = 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 fsRodentlocationMods) GeometryY(val null.Val[float64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) GeometryYFunc(f func() null.Val[float64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetGeometryY() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.GeometryY = 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 fsRodentlocationMods) RandomGeometryY(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - 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 fsRodentlocationMods) RandomGeometryYNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.GeometryY = 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 fsRodentlocationMods) LastEditedDate(val null.Val[int64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) LastEditedDateFunc(f func() null.Val[int64]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetLastEditedDate() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.LastEditedDate = 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 fsRodentlocationMods) RandomLastEditedDate(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsRodentlocationMods) LastEditedUser(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) LastEditedUserFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetLastEditedUser() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.LastEditedUser = 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 fsRodentlocationMods) RandomLastEditedUser(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.LastEditedUser = 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 fsRodentlocationMods) Jurisdiction(val null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) JurisdictionFunc(f func() null.Val[string]) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetJurisdiction() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Jurisdiction = 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 fsRodentlocationMods) RandomJurisdiction(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Jurisdiction = 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) RandomJurisdictionNotNull(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Jurisdiction = 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 fsRodentlocationMods) Updated(val time.Time) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsRodentlocationMods) UpdatedFunc(f func() time.Time) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsRodentlocationMods) UnsetUpdated() FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsRodentlocationMods) RandomUpdated(f *faker.Faker) FSRodentlocationMod { - return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsRodentlocationMods) WithParentsCascading() FSRodentlocationMod { - return FSRodentlocationModFunc(func(ctx context.Context, o *FSRodentlocationTemplate) { - if isDone, _ := fsRodentlocationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsRodentlocationWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsRodentlocationMods) WithOrganization(rel *OrganizationTemplate) FSRodentlocationMod { - return FSRodentlocationModFunc(func(ctx context.Context, o *FSRodentlocationTemplate) { - o.r.Organization = &fsRodentlocationROrganizationR{ - o: rel, - } - }) -} - -func (m fsRodentlocationMods) WithNewOrganization(mods ...OrganizationMod) FSRodentlocationMod { - return FSRodentlocationModFunc(func(ctx context.Context, o *FSRodentlocationTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsRodentlocationMods) WithExistingOrganization(em *models.Organization) FSRodentlocationMod { - return FSRodentlocationModFunc(func(ctx context.Context, o *FSRodentlocationTemplate) { - o.r.Organization = &fsRodentlocationROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsRodentlocationMods) WithoutOrganization() FSRodentlocationMod { - return FSRodentlocationModFunc(func(ctx context.Context, o *FSRodentlocationTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_samplecollection.bob.go b/db/factory/fs_samplecollection.bob.go deleted file mode 100644 index a4f52d96..00000000 --- a/db/factory/fs_samplecollection.bob.go +++ /dev/null @@ -1,3308 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSSamplecollectionMod interface { - Apply(context.Context, *FSSamplecollectionTemplate) -} - -type FSSamplecollectionModFunc func(context.Context, *FSSamplecollectionTemplate) - -func (f FSSamplecollectionModFunc) Apply(ctx context.Context, n *FSSamplecollectionTemplate) { - f(ctx, n) -} - -type FSSamplecollectionModSlice []FSSamplecollectionMod - -func (mods FSSamplecollectionModSlice) Apply(ctx context.Context, n *FSSamplecollectionTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSSamplecollectionTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSSamplecollectionTemplate struct { - OrganizationID func() int32 - Activity func() null.Val[string] - Avetemp func() null.Val[float64] - Chickenid func() null.Val[string] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Datesent func() null.Val[int64] - Datetested func() null.Val[int64] - Diseasepos func() null.Val[string] - Diseasetested func() null.Val[string] - Enddatetime func() null.Val[int64] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fieldtech func() null.Val[string] - Flockid func() null.Val[string] - Gatewaysync func() null.Val[int16] - Globalid func() string - Lab func() null.Val[string] - Locationname func() null.Val[string] - LocID func() null.Val[string] - Objectid func() int32 - Processed func() null.Val[int16] - Raingauge func() null.Val[float64] - Recordstatus func() null.Val[int16] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[int64] - Samplecond func() null.Val[string] - Samplecount func() null.Val[int16] - Sampleid func() null.Val[string] - Sampletype func() null.Val[string] - Sex func() null.Val[string] - Sitecond func() null.Val[string] - Species func() null.Val[string] - Startdatetime func() null.Val[int64] - Survtech func() null.Val[string] - Testmethod func() null.Val[string] - Testtech func() null.Val[string] - Winddir func() null.Val[string] - Windspeed func() null.Val[float64] - Zone func() null.Val[string] - 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] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Updated func() time.Time - - r fsSamplecollectionR - f *Factory - - alreadyPersisted bool -} - -type fsSamplecollectionR struct { - Organization *fsSamplecollectionROrganizationR -} - -type fsSamplecollectionROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSSamplecollectionTemplate -func (o *FSSamplecollectionTemplate) Apply(ctx context.Context, mods ...FSSamplecollectionMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSSamplecollection -// according to the relationships in the template. Nothing is inserted into the db -func (t FSSamplecollectionTemplate) setModelRels(o *models.FSSamplecollection) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSSamplecollections = append(rel.R.FSSamplecollections, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSSamplecollectionSetter -// this does nothing with the relationship templates -func (o FSSamplecollectionTemplate) BuildSetter() *models.FSSamplecollectionSetter { - m := &models.FSSamplecollectionSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Activity != nil { - val := o.Activity() - m.Activity = omitnull.FromNull(val) - } - if o.Avetemp != nil { - val := o.Avetemp() - m.Avetemp = omitnull.FromNull(val) - } - if o.Chickenid != nil { - val := o.Chickenid() - m.Chickenid = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Datesent != nil { - val := o.Datesent() - m.Datesent = omitnull.FromNull(val) - } - if o.Datetested != nil { - val := o.Datetested() - m.Datetested = omitnull.FromNull(val) - } - if o.Diseasepos != nil { - val := o.Diseasepos() - m.Diseasepos = omitnull.FromNull(val) - } - if o.Diseasetested != nil { - val := o.Diseasetested() - m.Diseasetested = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Flockid != nil { - val := o.Flockid() - m.Flockid = omitnull.FromNull(val) - } - if o.Gatewaysync != nil { - val := o.Gatewaysync() - m.Gatewaysync = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Lab != nil { - val := o.Lab() - m.Lab = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.LocID != nil { - val := o.LocID() - m.LocID = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.Raingauge != nil { - val := o.Raingauge() - m.Raingauge = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Reviewed != nil { - val := o.Reviewed() - m.Reviewed = omitnull.FromNull(val) - } - if o.Reviewedby != nil { - val := o.Reviewedby() - m.Reviewedby = omitnull.FromNull(val) - } - if o.Revieweddate != nil { - val := o.Revieweddate() - m.Revieweddate = omitnull.FromNull(val) - } - if o.Samplecond != nil { - val := o.Samplecond() - m.Samplecond = omitnull.FromNull(val) - } - if o.Samplecount != nil { - val := o.Samplecount() - m.Samplecount = omitnull.FromNull(val) - } - if o.Sampleid != nil { - val := o.Sampleid() - m.Sampleid = omitnull.FromNull(val) - } - if o.Sampletype != nil { - val := o.Sampletype() - m.Sampletype = omitnull.FromNull(val) - } - if o.Sex != nil { - val := o.Sex() - m.Sex = omitnull.FromNull(val) - } - if o.Sitecond != nil { - val := o.Sitecond() - m.Sitecond = omitnull.FromNull(val) - } - if o.Species != nil { - val := o.Species() - m.Species = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Survtech != nil { - val := o.Survtech() - m.Survtech = omitnull.FromNull(val) - } - if o.Testmethod != nil { - val := o.Testmethod() - m.Testmethod = omitnull.FromNull(val) - } - if o.Testtech != nil { - val := o.Testtech() - m.Testtech = omitnull.FromNull(val) - } - if o.Winddir != nil { - val := o.Winddir() - m.Winddir = omitnull.FromNull(val) - } - if o.Windspeed != nil { - val := o.Windspeed() - m.Windspeed = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSSamplecollectionSetter -// this does nothing with the relationship templates -func (o FSSamplecollectionTemplate) BuildManySetter(number int) []*models.FSSamplecollectionSetter { - m := make([]*models.FSSamplecollectionSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSSamplecollection -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSSamplecollectionTemplate.Create -func (o FSSamplecollectionTemplate) Build() *models.FSSamplecollection { - m := &models.FSSamplecollection{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Activity != nil { - m.Activity = o.Activity() - } - if o.Avetemp != nil { - m.Avetemp = o.Avetemp() - } - if o.Chickenid != nil { - m.Chickenid = o.Chickenid() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Datesent != nil { - m.Datesent = o.Datesent() - } - if o.Datetested != nil { - m.Datetested = o.Datetested() - } - if o.Diseasepos != nil { - m.Diseasepos = o.Diseasepos() - } - if o.Diseasetested != nil { - m.Diseasetested = o.Diseasetested() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Flockid != nil { - m.Flockid = o.Flockid() - } - if o.Gatewaysync != nil { - m.Gatewaysync = o.Gatewaysync() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Lab != nil { - m.Lab = o.Lab() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.LocID != nil { - m.LocID = o.LocID() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.Raingauge != nil { - m.Raingauge = o.Raingauge() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Reviewed != nil { - m.Reviewed = o.Reviewed() - } - if o.Reviewedby != nil { - m.Reviewedby = o.Reviewedby() - } - if o.Revieweddate != nil { - m.Revieweddate = o.Revieweddate() - } - if o.Samplecond != nil { - m.Samplecond = o.Samplecond() - } - if o.Samplecount != nil { - m.Samplecount = o.Samplecount() - } - if o.Sampleid != nil { - m.Sampleid = o.Sampleid() - } - if o.Sampletype != nil { - m.Sampletype = o.Sampletype() - } - if o.Sex != nil { - m.Sex = o.Sex() - } - if o.Sitecond != nil { - m.Sitecond = o.Sitecond() - } - if o.Species != nil { - m.Species = o.Species() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Survtech != nil { - m.Survtech = o.Survtech() - } - if o.Testmethod != nil { - m.Testmethod = o.Testmethod() - } - if o.Testtech != nil { - m.Testtech = o.Testtech() - } - if o.Winddir != nil { - m.Winddir = o.Winddir() - } - if o.Windspeed != nil { - m.Windspeed = o.Windspeed() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSSamplecollectionSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSSamplecollectionTemplate.CreateMany -func (o FSSamplecollectionTemplate) BuildMany(number int) models.FSSamplecollectionSlice { - m := make(models.FSSamplecollectionSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSSamplecollection(m *models.FSSamplecollectionSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSSamplecollection -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSSamplecollectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSSamplecollection) error { - var err error - - return err -} - -// Create builds a fsSamplecollection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSSamplecollectionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSSamplecollection, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSSamplecollection(opt) - - if o.r.Organization == nil { - FSSamplecollectionMods.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.FSSamplecollections.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 fsSamplecollection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSSamplecollectionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSSamplecollection { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsSamplecollection 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 *FSSamplecollectionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSSamplecollection { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsSamplecollections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSSamplecollectionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSSamplecollectionSlice, error) { - var err error - m := make(models.FSSamplecollectionSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsSamplecollections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSSamplecollectionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSSamplecollectionSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsSamplecollections 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 FSSamplecollectionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSSamplecollectionSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSSamplecollection has methods that act as mods for the FSSamplecollectionTemplate -var FSSamplecollectionMods fsSamplecollectionMods - -type fsSamplecollectionMods struct{} - -func (m fsSamplecollectionMods) RandomizeAllColumns(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModSlice{ - FSSamplecollectionMods.RandomOrganizationID(f), - FSSamplecollectionMods.RandomActivity(f), - FSSamplecollectionMods.RandomAvetemp(f), - FSSamplecollectionMods.RandomChickenid(f), - FSSamplecollectionMods.RandomComments(f), - FSSamplecollectionMods.RandomCreationdate(f), - FSSamplecollectionMods.RandomCreator(f), - FSSamplecollectionMods.RandomDatesent(f), - FSSamplecollectionMods.RandomDatetested(f), - FSSamplecollectionMods.RandomDiseasepos(f), - FSSamplecollectionMods.RandomDiseasetested(f), - FSSamplecollectionMods.RandomEnddatetime(f), - FSSamplecollectionMods.RandomEditdate(f), - FSSamplecollectionMods.RandomEditor(f), - FSSamplecollectionMods.RandomFieldtech(f), - FSSamplecollectionMods.RandomFlockid(f), - FSSamplecollectionMods.RandomGatewaysync(f), - FSSamplecollectionMods.RandomGlobalid(f), - FSSamplecollectionMods.RandomLab(f), - FSSamplecollectionMods.RandomLocationname(f), - FSSamplecollectionMods.RandomLocID(f), - FSSamplecollectionMods.RandomObjectid(f), - FSSamplecollectionMods.RandomProcessed(f), - FSSamplecollectionMods.RandomRaingauge(f), - FSSamplecollectionMods.RandomRecordstatus(f), - FSSamplecollectionMods.RandomReviewed(f), - FSSamplecollectionMods.RandomReviewedby(f), - FSSamplecollectionMods.RandomRevieweddate(f), - FSSamplecollectionMods.RandomSamplecond(f), - FSSamplecollectionMods.RandomSamplecount(f), - FSSamplecollectionMods.RandomSampleid(f), - FSSamplecollectionMods.RandomSampletype(f), - FSSamplecollectionMods.RandomSex(f), - FSSamplecollectionMods.RandomSitecond(f), - FSSamplecollectionMods.RandomSpecies(f), - FSSamplecollectionMods.RandomStartdatetime(f), - FSSamplecollectionMods.RandomSurvtech(f), - FSSamplecollectionMods.RandomTestmethod(f), - FSSamplecollectionMods.RandomTesttech(f), - FSSamplecollectionMods.RandomWinddir(f), - FSSamplecollectionMods.RandomWindspeed(f), - FSSamplecollectionMods.RandomZone(f), - FSSamplecollectionMods.RandomZone2(f), - FSSamplecollectionMods.RandomCreatedDate(f), - FSSamplecollectionMods.RandomCreatedUser(f), - FSSamplecollectionMods.RandomGeometryX(f), - FSSamplecollectionMods.RandomGeometryY(f), - FSSamplecollectionMods.RandomLastEditedDate(f), - FSSamplecollectionMods.RandomLastEditedUser(f), - FSSamplecollectionMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) OrganizationID(val int32) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) OrganizationIDFunc(f func() int32) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetOrganizationID() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - 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 fsSamplecollectionMods) RandomOrganizationID(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) Activity(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Activity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) ActivityFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Activity = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetActivity() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Activity = 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 fsSamplecollectionMods) RandomActivity(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Activity = 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) RandomActivityNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Activity = 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 fsSamplecollectionMods) Avetemp(val null.Val[float64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Avetemp = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) AvetempFunc(f func() null.Val[float64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Avetemp = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetAvetemp() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Avetemp = 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 fsSamplecollectionMods) RandomAvetemp(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Avetemp = 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 fsSamplecollectionMods) RandomAvetempNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Avetemp = 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 fsSamplecollectionMods) Chickenid(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Chickenid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) ChickenidFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Chickenid = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetChickenid() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Chickenid = 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 fsSamplecollectionMods) RandomChickenid(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Chickenid = 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) RandomChickenidNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Chickenid = 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 fsSamplecollectionMods) Comments(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) CommentsFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetComments() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Comments = 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 fsSamplecollectionMods) RandomComments(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Comments = 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 fsSamplecollectionMods) Creationdate(val null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) CreationdateFunc(f func() null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetCreationdate() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Creationdate = 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 fsSamplecollectionMods) RandomCreationdate(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) Creator(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) CreatorFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetCreator() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Creator = 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 fsSamplecollectionMods) RandomCreator(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Creator = 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 fsSamplecollectionMods) Datesent(val null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Datesent = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) DatesentFunc(f func() null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Datesent = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetDatesent() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Datesent = 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 fsSamplecollectionMods) RandomDatesent(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Datesent = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomDatesentNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Datesent = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) Datetested(val null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Datetested = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) DatetestedFunc(f func() null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Datetested = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetDatetested() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Datetested = 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 fsSamplecollectionMods) RandomDatetested(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Datetested = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomDatetestedNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Datetested = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) Diseasepos(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Diseasepos = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) DiseaseposFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Diseasepos = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetDiseasepos() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Diseasepos = 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 fsSamplecollectionMods) RandomDiseasepos(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Diseasepos = 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) RandomDiseaseposNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Diseasepos = 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 fsSamplecollectionMods) Diseasetested(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Diseasetested = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) DiseasetestedFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Diseasetested = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetDiseasetested() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Diseasetested = 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 fsSamplecollectionMods) RandomDiseasetested(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Diseasetested = 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) RandomDiseasetestedNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Diseasetested = 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 fsSamplecollectionMods) Enddatetime(val null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Enddatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) EnddatetimeFunc(f func() null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetEnddatetime() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Enddatetime = 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 fsSamplecollectionMods) RandomEnddatetime(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) Editdate(val null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) EditdateFunc(f func() null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetEditdate() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Editdate = 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 fsSamplecollectionMods) RandomEditdate(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) Editor(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) EditorFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetEditor() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Editor = 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 fsSamplecollectionMods) RandomEditor(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Editor = 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 fsSamplecollectionMods) Fieldtech(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) FieldtechFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetFieldtech() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Fieldtech = 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 fsSamplecollectionMods) RandomFieldtech(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Fieldtech = 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) RandomFieldtechNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Fieldtech = 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 fsSamplecollectionMods) Flockid(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Flockid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) FlockidFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Flockid = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetFlockid() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Flockid = 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 fsSamplecollectionMods) RandomFlockid(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Flockid = 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) RandomFlockidNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Flockid = 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 fsSamplecollectionMods) Gatewaysync(val null.Val[int16]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Gatewaysync = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) GatewaysyncFunc(f func() null.Val[int16]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Gatewaysync = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetGatewaysync() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Gatewaysync = 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 fsSamplecollectionMods) RandomGatewaysync(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomGatewaysyncNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) Globalid(val string) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) GlobalidFunc(f func() string) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetGlobalid() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsSamplecollectionMods) RandomGlobalid(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) Lab(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Lab = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) LabFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Lab = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetLab() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Lab = 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 fsSamplecollectionMods) RandomLab(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Lab = 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) RandomLabNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Lab = 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 fsSamplecollectionMods) Locationname(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) LocationnameFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetLocationname() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Locationname = 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 fsSamplecollectionMods) RandomLocationname(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Locationname = 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) RandomLocationnameNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Locationname = 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 fsSamplecollectionMods) LocID(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.LocID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) LocIDFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.LocID = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetLocID() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.LocID = 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 fsSamplecollectionMods) RandomLocID(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.LocID = 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) RandomLocIDNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.LocID = 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 fsSamplecollectionMods) Objectid(val int32) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) ObjectidFunc(f func() int32) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetObjectid() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsSamplecollectionMods) RandomObjectid(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) Processed(val null.Val[int16]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) ProcessedFunc(f func() null.Val[int16]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetProcessed() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Processed = 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 fsSamplecollectionMods) RandomProcessed(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) Raingauge(val null.Val[float64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Raingauge = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) RaingaugeFunc(f func() null.Val[float64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Raingauge = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetRaingauge() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Raingauge = 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 fsSamplecollectionMods) RandomRaingauge(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Raingauge = 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 fsSamplecollectionMods) RandomRaingaugeNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Raingauge = 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 fsSamplecollectionMods) Recordstatus(val null.Val[int16]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) RecordstatusFunc(f func() null.Val[int16]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetRecordstatus() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Recordstatus = 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 fsSamplecollectionMods) RandomRecordstatus(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) Reviewed(val null.Val[int16]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) ReviewedFunc(f func() null.Val[int16]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetReviewed() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Reviewed = 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 fsSamplecollectionMods) RandomReviewed(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) Reviewedby(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) ReviewedbyFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetReviewedby() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Reviewedby = 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 fsSamplecollectionMods) RandomReviewedby(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Reviewedby = 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) RandomReviewedbyNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Reviewedby = 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 fsSamplecollectionMods) Revieweddate(val null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Revieweddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) RevieweddateFunc(f func() null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetRevieweddate() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Revieweddate = 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 fsSamplecollectionMods) RandomRevieweddate(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) Samplecond(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Samplecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) SamplecondFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Samplecond = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetSamplecond() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Samplecond = 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 fsSamplecollectionMods) RandomSamplecond(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Samplecond = 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) RandomSamplecondNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Samplecond = 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 fsSamplecollectionMods) Samplecount(val null.Val[int16]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Samplecount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) SamplecountFunc(f func() null.Val[int16]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Samplecount = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetSamplecount() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Samplecount = 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 fsSamplecollectionMods) RandomSamplecount(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Samplecount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomSamplecountNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Samplecount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) Sampleid(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sampleid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) SampleidFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sampleid = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetSampleid() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sampleid = 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 fsSamplecollectionMods) RandomSampleid(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sampleid = 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) RandomSampleidNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sampleid = 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 fsSamplecollectionMods) Sampletype(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sampletype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) SampletypeFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sampletype = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetSampletype() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sampletype = 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 fsSamplecollectionMods) RandomSampletype(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sampletype = 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) RandomSampletypeNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sampletype = 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 fsSamplecollectionMods) Sex(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sex = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) SexFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sex = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetSex() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sex = 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 fsSamplecollectionMods) RandomSex(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sex = 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) RandomSexNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sex = 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 fsSamplecollectionMods) Sitecond(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sitecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) SitecondFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sitecond = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetSitecond() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sitecond = 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 fsSamplecollectionMods) RandomSitecond(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sitecond = 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) RandomSitecondNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Sitecond = 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 fsSamplecollectionMods) Species(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Species = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) SpeciesFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Species = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetSpecies() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Species = 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 fsSamplecollectionMods) RandomSpecies(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Species = 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) RandomSpeciesNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Species = 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 fsSamplecollectionMods) Startdatetime(val null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Startdatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) StartdatetimeFunc(f func() null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetStartdatetime() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Startdatetime = 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 fsSamplecollectionMods) RandomStartdatetime(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) Survtech(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Survtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) SurvtechFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Survtech = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetSurvtech() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Survtech = 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 fsSamplecollectionMods) RandomSurvtech(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Survtech = 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) RandomSurvtechNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Survtech = 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 fsSamplecollectionMods) Testmethod(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Testmethod = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) TestmethodFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Testmethod = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetTestmethod() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Testmethod = 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 fsSamplecollectionMods) RandomTestmethod(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Testmethod = 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) RandomTestmethodNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Testmethod = 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 fsSamplecollectionMods) Testtech(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Testtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) TesttechFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Testtech = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetTesttech() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Testtech = 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 fsSamplecollectionMods) RandomTesttech(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Testtech = 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) RandomTesttechNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Testtech = 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 fsSamplecollectionMods) Winddir(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Winddir = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) WinddirFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Winddir = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetWinddir() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Winddir = 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 fsSamplecollectionMods) RandomWinddir(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Winddir = 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) RandomWinddirNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Winddir = 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 fsSamplecollectionMods) Windspeed(val null.Val[float64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Windspeed = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) WindspeedFunc(f func() null.Val[float64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Windspeed = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetWindspeed() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Windspeed = 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 fsSamplecollectionMods) RandomWindspeed(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Windspeed = 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 fsSamplecollectionMods) RandomWindspeedNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Windspeed = 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 fsSamplecollectionMods) Zone(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) ZoneFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetZone() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Zone = 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 fsSamplecollectionMods) RandomZone(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Zone = 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) RandomZoneNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Zone = 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 fsSamplecollectionMods) Zone2(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) Zone2Func(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetZone2() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Zone2 = 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 fsSamplecollectionMods) RandomZone2(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Zone2 = 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) RandomZone2NotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Zone2 = 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 fsSamplecollectionMods) CreatedDate(val null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) CreatedDateFunc(f func() null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetCreatedDate() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.CreatedDate = 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 fsSamplecollectionMods) RandomCreatedDate(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) CreatedUser(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) CreatedUserFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetCreatedUser() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.CreatedUser = 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 fsSamplecollectionMods) RandomCreatedUser(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.CreatedUser = 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 fsSamplecollectionMods) GeometryX(val null.Val[float64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) GeometryXFunc(f func() null.Val[float64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetGeometryX() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.GeometryX = 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 fsSamplecollectionMods) RandomGeometryX(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - 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 fsSamplecollectionMods) RandomGeometryXNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.GeometryX = 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 fsSamplecollectionMods) GeometryY(val null.Val[float64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) GeometryYFunc(f func() null.Val[float64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetGeometryY() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.GeometryY = 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 fsSamplecollectionMods) RandomGeometryY(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - 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 fsSamplecollectionMods) RandomGeometryYNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.GeometryY = 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 fsSamplecollectionMods) LastEditedDate(val null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) LastEditedDateFunc(f func() null.Val[int64]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetLastEditedDate() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.LastEditedDate = 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 fsSamplecollectionMods) RandomLastEditedDate(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplecollectionMods) LastEditedUser(val null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) LastEditedUserFunc(f func() null.Val[string]) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetLastEditedUser() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.LastEditedUser = 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 fsSamplecollectionMods) RandomLastEditedUser(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.LastEditedUser = 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 fsSamplecollectionMods) Updated(val time.Time) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsSamplecollectionMods) UpdatedFunc(f func() time.Time) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsSamplecollectionMods) UnsetUpdated() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsSamplecollectionMods) RandomUpdated(f *faker.Faker) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsSamplecollectionMods) WithParentsCascading() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(ctx context.Context, o *FSSamplecollectionTemplate) { - if isDone, _ := fsSamplecollectionWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsSamplecollectionWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsSamplecollectionMods) WithOrganization(rel *OrganizationTemplate) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(ctx context.Context, o *FSSamplecollectionTemplate) { - o.r.Organization = &fsSamplecollectionROrganizationR{ - o: rel, - } - }) -} - -func (m fsSamplecollectionMods) WithNewOrganization(mods ...OrganizationMod) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(ctx context.Context, o *FSSamplecollectionTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsSamplecollectionMods) WithExistingOrganization(em *models.Organization) FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(ctx context.Context, o *FSSamplecollectionTemplate) { - o.r.Organization = &fsSamplecollectionROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsSamplecollectionMods) WithoutOrganization() FSSamplecollectionMod { - return FSSamplecollectionModFunc(func(ctx context.Context, o *FSSamplecollectionTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_samplelocation.bob.go b/db/factory/fs_samplelocation.bob.go deleted file mode 100644 index 7e0ec224..00000000 --- a/db/factory/fs_samplelocation.bob.go +++ /dev/null @@ -1,1944 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSSamplelocationMod interface { - Apply(context.Context, *FSSamplelocationTemplate) -} - -type FSSamplelocationModFunc func(context.Context, *FSSamplelocationTemplate) - -func (f FSSamplelocationModFunc) Apply(ctx context.Context, n *FSSamplelocationTemplate) { - f(ctx, n) -} - -type FSSamplelocationModSlice []FSSamplelocationMod - -func (mods FSSamplelocationModSlice) Apply(ctx context.Context, n *FSSamplelocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSSamplelocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSSamplelocationTemplate struct { - OrganizationID func() int32 - Accessdesc func() null.Val[string] - Active func() null.Val[int16] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Description func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Gatewaysync func() null.Val[int16] - Globalid func() string - Habitat func() null.Val[string] - Locationnumber func() null.Val[int64] - Name func() null.Val[string] - Nextactiondatescheduled func() null.Val[int64] - Objectid func() int32 - Priority func() null.Val[string] - Usetype func() null.Val[string] - Zone func() null.Val[string] - 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] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Updated func() time.Time - - r fsSamplelocationR - f *Factory - - alreadyPersisted bool -} - -type fsSamplelocationR struct { - Organization *fsSamplelocationROrganizationR -} - -type fsSamplelocationROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSSamplelocationTemplate -func (o *FSSamplelocationTemplate) Apply(ctx context.Context, mods ...FSSamplelocationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSSamplelocation -// according to the relationships in the template. Nothing is inserted into the db -func (t FSSamplelocationTemplate) setModelRels(o *models.FSSamplelocation) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSSamplelocations = append(rel.R.FSSamplelocations, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSSamplelocationSetter -// this does nothing with the relationship templates -func (o FSSamplelocationTemplate) BuildSetter() *models.FSSamplelocationSetter { - m := &models.FSSamplelocationSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Gatewaysync != nil { - val := o.Gatewaysync() - m.Gatewaysync = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Usetype != nil { - val := o.Usetype() - m.Usetype = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSSamplelocationSetter -// this does nothing with the relationship templates -func (o FSSamplelocationTemplate) BuildManySetter(number int) []*models.FSSamplelocationSetter { - m := make([]*models.FSSamplelocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSSamplelocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSSamplelocationTemplate.Create -func (o FSSamplelocationTemplate) Build() *models.FSSamplelocation { - m := &models.FSSamplelocation{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Gatewaysync != nil { - m.Gatewaysync = o.Gatewaysync() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSSamplelocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSSamplelocationTemplate.CreateMany -func (o FSSamplelocationTemplate) BuildMany(number int) models.FSSamplelocationSlice { - m := make(models.FSSamplelocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSSamplelocation(m *models.FSSamplelocationSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSSamplelocation -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSSamplelocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSSamplelocation) error { - var err error - - return err -} - -// Create builds a fsSamplelocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSSamplelocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSSamplelocation, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSSamplelocation(opt) - - if o.r.Organization == nil { - FSSamplelocationMods.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.FSSamplelocations.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 fsSamplelocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSSamplelocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSSamplelocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsSamplelocation 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 *FSSamplelocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSSamplelocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsSamplelocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSSamplelocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSSamplelocationSlice, error) { - var err error - m := make(models.FSSamplelocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsSamplelocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSSamplelocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSSamplelocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsSamplelocations 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 FSSamplelocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSSamplelocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSSamplelocation has methods that act as mods for the FSSamplelocationTemplate -var FSSamplelocationMods fsSamplelocationMods - -type fsSamplelocationMods struct{} - -func (m fsSamplelocationMods) RandomizeAllColumns(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModSlice{ - FSSamplelocationMods.RandomOrganizationID(f), - FSSamplelocationMods.RandomAccessdesc(f), - FSSamplelocationMods.RandomActive(f), - FSSamplelocationMods.RandomComments(f), - FSSamplelocationMods.RandomCreationdate(f), - FSSamplelocationMods.RandomCreator(f), - FSSamplelocationMods.RandomDescription(f), - FSSamplelocationMods.RandomExternalid(f), - FSSamplelocationMods.RandomEditdate(f), - FSSamplelocationMods.RandomEditor(f), - FSSamplelocationMods.RandomGatewaysync(f), - FSSamplelocationMods.RandomGlobalid(f), - FSSamplelocationMods.RandomHabitat(f), - FSSamplelocationMods.RandomLocationnumber(f), - FSSamplelocationMods.RandomName(f), - FSSamplelocationMods.RandomNextactiondatescheduled(f), - FSSamplelocationMods.RandomObjectid(f), - FSSamplelocationMods.RandomPriority(f), - FSSamplelocationMods.RandomUsetype(f), - FSSamplelocationMods.RandomZone(f), - FSSamplelocationMods.RandomZone2(f), - FSSamplelocationMods.RandomCreatedDate(f), - FSSamplelocationMods.RandomCreatedUser(f), - FSSamplelocationMods.RandomGeometryX(f), - FSSamplelocationMods.RandomGeometryY(f), - FSSamplelocationMods.RandomLastEditedDate(f), - FSSamplelocationMods.RandomLastEditedUser(f), - FSSamplelocationMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsSamplelocationMods) OrganizationID(val int32) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) OrganizationIDFunc(f func() int32) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetOrganizationID() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - 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 fsSamplelocationMods) RandomOrganizationID(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsSamplelocationMods) Accessdesc(val null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) AccessdescFunc(f func() null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetAccessdesc() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Accessdesc = 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 fsSamplelocationMods) RandomAccessdesc(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Accessdesc = 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) RandomAccessdescNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Accessdesc = 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 fsSamplelocationMods) Active(val null.Val[int16]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) ActiveFunc(f func() null.Val[int16]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetActive() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Active = 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 fsSamplelocationMods) RandomActive(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomActiveNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplelocationMods) Comments(val null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) CommentsFunc(f func() null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetComments() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Comments = 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 fsSamplelocationMods) RandomComments(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Comments = 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 fsSamplelocationMods) Creationdate(val null.Val[int64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) CreationdateFunc(f func() null.Val[int64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetCreationdate() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Creationdate = 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 fsSamplelocationMods) RandomCreationdate(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplelocationMods) Creator(val null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) CreatorFunc(f func() null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetCreator() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Creator = 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 fsSamplelocationMods) RandomCreator(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Creator = 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 fsSamplelocationMods) Description(val null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) DescriptionFunc(f func() null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetDescription() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Description = 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 fsSamplelocationMods) RandomDescription(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Description = 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) RandomDescriptionNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Description = 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 fsSamplelocationMods) Externalid(val null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) ExternalidFunc(f func() null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetExternalid() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Externalid = 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 fsSamplelocationMods) RandomExternalid(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Externalid = 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) RandomExternalidNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Externalid = 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 fsSamplelocationMods) Editdate(val null.Val[int64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) EditdateFunc(f func() null.Val[int64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetEditdate() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Editdate = 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 fsSamplelocationMods) RandomEditdate(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplelocationMods) Editor(val null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) EditorFunc(f func() null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetEditor() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Editor = 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 fsSamplelocationMods) RandomEditor(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Editor = 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 fsSamplelocationMods) Gatewaysync(val null.Val[int16]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Gatewaysync = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) GatewaysyncFunc(f func() null.Val[int16]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Gatewaysync = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetGatewaysync() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Gatewaysync = 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 fsSamplelocationMods) RandomGatewaysync(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomGatewaysyncNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplelocationMods) Globalid(val string) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) GlobalidFunc(f func() string) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetGlobalid() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsSamplelocationMods) RandomGlobalid(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsSamplelocationMods) Habitat(val null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) HabitatFunc(f func() null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetHabitat() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Habitat = 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 fsSamplelocationMods) RandomHabitat(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Habitat = 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) RandomHabitatNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Habitat = 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 fsSamplelocationMods) Locationnumber(val null.Val[int64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Locationnumber = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) LocationnumberFunc(f func() null.Val[int64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetLocationnumber() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Locationnumber = 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 fsSamplelocationMods) RandomLocationnumber(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplelocationMods) Name(val null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) NameFunc(f func() null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetName() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Name = 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 fsSamplelocationMods) RandomName(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Name = 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) RandomNameNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Name = 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 fsSamplelocationMods) Nextactiondatescheduled(val null.Val[int64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetNextactiondatescheduled() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Nextactiondatescheduled = 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 fsSamplelocationMods) RandomNextactiondatescheduled(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplelocationMods) Objectid(val int32) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) ObjectidFunc(f func() int32) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetObjectid() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsSamplelocationMods) RandomObjectid(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsSamplelocationMods) Priority(val null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) PriorityFunc(f func() null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetPriority() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Priority = 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 fsSamplelocationMods) RandomPriority(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Priority = 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) RandomPriorityNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Priority = 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 fsSamplelocationMods) Usetype(val null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) UsetypeFunc(f func() null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetUsetype() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Usetype = 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 fsSamplelocationMods) RandomUsetype(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Usetype = 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) RandomUsetypeNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Usetype = 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 fsSamplelocationMods) Zone(val null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) ZoneFunc(f func() null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetZone() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Zone = 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 fsSamplelocationMods) RandomZone(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Zone = 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) RandomZoneNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Zone = 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 fsSamplelocationMods) Zone2(val null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) Zone2Func(f func() null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetZone2() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Zone2 = 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 fsSamplelocationMods) RandomZone2(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Zone2 = 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) RandomZone2NotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Zone2 = 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 fsSamplelocationMods) CreatedDate(val null.Val[int64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) CreatedDateFunc(f func() null.Val[int64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetCreatedDate() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.CreatedDate = 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 fsSamplelocationMods) RandomCreatedDate(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplelocationMods) CreatedUser(val null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) CreatedUserFunc(f func() null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetCreatedUser() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.CreatedUser = 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 fsSamplelocationMods) RandomCreatedUser(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.CreatedUser = 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 fsSamplelocationMods) GeometryX(val null.Val[float64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) GeometryXFunc(f func() null.Val[float64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetGeometryX() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.GeometryX = 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 fsSamplelocationMods) RandomGeometryX(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - 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 fsSamplelocationMods) RandomGeometryXNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.GeometryX = 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 fsSamplelocationMods) GeometryY(val null.Val[float64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) GeometryYFunc(f func() null.Val[float64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetGeometryY() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.GeometryY = 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 fsSamplelocationMods) RandomGeometryY(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - 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 fsSamplelocationMods) RandomGeometryYNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.GeometryY = 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 fsSamplelocationMods) LastEditedDate(val null.Val[int64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) LastEditedDateFunc(f func() null.Val[int64]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetLastEditedDate() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.LastEditedDate = 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 fsSamplelocationMods) RandomLastEditedDate(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSamplelocationMods) LastEditedUser(val null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) LastEditedUserFunc(f func() null.Val[string]) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetLastEditedUser() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.LastEditedUser = 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 fsSamplelocationMods) RandomLastEditedUser(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.LastEditedUser = 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 fsSamplelocationMods) Updated(val time.Time) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsSamplelocationMods) UpdatedFunc(f func() time.Time) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsSamplelocationMods) UnsetUpdated() FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsSamplelocationMods) RandomUpdated(f *faker.Faker) FSSamplelocationMod { - return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsSamplelocationMods) WithParentsCascading() FSSamplelocationMod { - return FSSamplelocationModFunc(func(ctx context.Context, o *FSSamplelocationTemplate) { - if isDone, _ := fsSamplelocationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsSamplelocationWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsSamplelocationMods) WithOrganization(rel *OrganizationTemplate) FSSamplelocationMod { - return FSSamplelocationModFunc(func(ctx context.Context, o *FSSamplelocationTemplate) { - o.r.Organization = &fsSamplelocationROrganizationR{ - o: rel, - } - }) -} - -func (m fsSamplelocationMods) WithNewOrganization(mods ...OrganizationMod) FSSamplelocationMod { - return FSSamplelocationModFunc(func(ctx context.Context, o *FSSamplelocationTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsSamplelocationMods) WithExistingOrganization(em *models.Organization) FSSamplelocationMod { - return FSSamplelocationModFunc(func(ctx context.Context, o *FSSamplelocationTemplate) { - o.r.Organization = &fsSamplelocationROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsSamplelocationMods) WithoutOrganization() FSSamplelocationMod { - return FSSamplelocationModFunc(func(ctx context.Context, o *FSSamplelocationTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_servicerequest.bob.go b/db/factory/fs_servicerequest.bob.go deleted file mode 100644 index 39e15cf1..00000000 --- a/db/factory/fs_servicerequest.bob.go +++ /dev/null @@ -1,5752 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSServicerequestMod interface { - Apply(context.Context, *FSServicerequestTemplate) -} - -type FSServicerequestModFunc func(context.Context, *FSServicerequestTemplate) - -func (f FSServicerequestModFunc) Apply(ctx context.Context, n *FSServicerequestTemplate) { - f(ctx, n) -} - -type FSServicerequestModSlice []FSServicerequestMod - -func (mods FSServicerequestModSlice) Apply(ctx context.Context, n *FSServicerequestTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSServicerequestTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSServicerequestTemplate struct { - OrganizationID func() int32 - Accepted func() null.Val[int16] - Acceptedby func() null.Val[string] - Accepteddate func() null.Val[int64] - Allowed func() null.Val[string] - Assignedtech func() null.Val[string] - Clraddr1 func() null.Val[string] - Clraddr2 func() null.Val[string] - Clranon func() null.Val[int16] - Clrcity func() null.Val[string] - Clrcompany func() null.Val[string] - Clrcontpref func() null.Val[string] - Clremail func() null.Val[string] - Clrfname func() null.Val[string] - Clrother func() null.Val[string] - Clrphone1 func() null.Val[string] - Clrphone2 func() null.Val[string] - Clrstate func() null.Val[string] - Clrzip func() null.Val[string] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Datetimeclosed func() null.Val[int64] - Duedate func() null.Val[int64] - Entrytech func() null.Val[string] - Estcompletedate func() null.Val[int64] - Externalerror func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Firstresponsedate func() null.Val[int64] - Globalid func() string - Issuesreported func() null.Val[string] - Jurisdiction func() null.Val[string] - Nextaction func() null.Val[string] - Notificationtimestamp func() null.Val[string] - Notified func() null.Val[int16] - Notifieddate func() null.Val[int64] - Objectid func() int32 - Pointlocid func() null.Val[string] - Priority func() null.Val[string] - Recdatetime func() null.Val[int64] - Recordstatus func() null.Val[int16] - Rejectedby func() null.Val[string] - Rejecteddate func() null.Val[int64] - Rejectedreason func() null.Val[string] - Reqaddr1 func() null.Val[string] - Reqaddr2 func() null.Val[string] - Reqcity func() null.Val[string] - Reqcompany func() null.Val[string] - Reqcrossst func() null.Val[string] - Reqdescr func() null.Val[string] - Reqfldnotes func() null.Val[string] - Reqmapgrid func() null.Val[string] - Reqnotesforcust func() null.Val[string] - Reqnotesfortech func() null.Val[string] - Reqpermission func() null.Val[int16] - Reqprogramactions func() null.Val[string] - Reqstate func() null.Val[string] - Reqsubdiv func() null.Val[string] - Reqtarget func() null.Val[string] - Reqzip func() null.Val[string] - Responsedaycount func() null.Val[int16] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[int64] - Scheduled func() null.Val[int16] - Scheduleddate func() null.Val[int64] - Source func() null.Val[string] - SRNumber func() null.Val[int64] - Status func() null.Val[string] - Supervisor func() null.Val[string] - Techclosed func() null.Val[string] - Validx func() null.Val[string] - Validy func() null.Val[string] - Xvalue func() null.Val[string] - Yvalue func() null.Val[string] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() float64 - GeometryY func() float64 - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Dog func() null.Val[int64] - Spanish func() null.Val[int64] - ScheduleNotes func() null.Val[string] - SchedulePeriod func() null.Val[string] - Updated func() time.Time - - r fsServicerequestR - f *Factory - - alreadyPersisted bool -} - -type fsServicerequestR struct { - Organization *fsServicerequestROrganizationR -} - -type fsServicerequestROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSServicerequestTemplate -func (o *FSServicerequestTemplate) Apply(ctx context.Context, mods ...FSServicerequestMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSServicerequest -// according to the relationships in the template. Nothing is inserted into the db -func (t FSServicerequestTemplate) setModelRels(o *models.FSServicerequest) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSServicerequests = append(rel.R.FSServicerequests, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSServicerequestSetter -// this does nothing with the relationship templates -func (o FSServicerequestTemplate) BuildSetter() *models.FSServicerequestSetter { - m := &models.FSServicerequestSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accepted != nil { - val := o.Accepted() - m.Accepted = omitnull.FromNull(val) - } - if o.Acceptedby != nil { - val := o.Acceptedby() - m.Acceptedby = omitnull.FromNull(val) - } - if o.Accepteddate != nil { - val := o.Accepteddate() - m.Accepteddate = omitnull.FromNull(val) - } - if o.Allowed != nil { - val := o.Allowed() - m.Allowed = omitnull.FromNull(val) - } - if o.Assignedtech != nil { - val := o.Assignedtech() - m.Assignedtech = omitnull.FromNull(val) - } - if o.Clraddr1 != nil { - val := o.Clraddr1() - m.Clraddr1 = omitnull.FromNull(val) - } - if o.Clraddr2 != nil { - val := o.Clraddr2() - m.Clraddr2 = omitnull.FromNull(val) - } - if o.Clranon != nil { - val := o.Clranon() - m.Clranon = omitnull.FromNull(val) - } - if o.Clrcity != nil { - val := o.Clrcity() - m.Clrcity = omitnull.FromNull(val) - } - if o.Clrcompany != nil { - val := o.Clrcompany() - m.Clrcompany = omitnull.FromNull(val) - } - if o.Clrcontpref != nil { - val := o.Clrcontpref() - m.Clrcontpref = omitnull.FromNull(val) - } - if o.Clremail != nil { - val := o.Clremail() - m.Clremail = omitnull.FromNull(val) - } - if o.Clrfname != nil { - val := o.Clrfname() - m.Clrfname = omitnull.FromNull(val) - } - if o.Clrother != nil { - val := o.Clrother() - m.Clrother = omitnull.FromNull(val) - } - if o.Clrphone1 != nil { - val := o.Clrphone1() - m.Clrphone1 = omitnull.FromNull(val) - } - if o.Clrphone2 != nil { - val := o.Clrphone2() - m.Clrphone2 = omitnull.FromNull(val) - } - if o.Clrstate != nil { - val := o.Clrstate() - m.Clrstate = omitnull.FromNull(val) - } - if o.Clrzip != nil { - val := o.Clrzip() - m.Clrzip = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Datetimeclosed != nil { - val := o.Datetimeclosed() - m.Datetimeclosed = omitnull.FromNull(val) - } - if o.Duedate != nil { - val := o.Duedate() - m.Duedate = omitnull.FromNull(val) - } - if o.Entrytech != nil { - val := o.Entrytech() - m.Entrytech = omitnull.FromNull(val) - } - if o.Estcompletedate != nil { - val := o.Estcompletedate() - m.Estcompletedate = omitnull.FromNull(val) - } - if o.Externalerror != nil { - val := o.Externalerror() - m.Externalerror = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Firstresponsedate != nil { - val := o.Firstresponsedate() - m.Firstresponsedate = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Issuesreported != nil { - val := o.Issuesreported() - m.Issuesreported = omitnull.FromNull(val) - } - if o.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.Nextaction != nil { - val := o.Nextaction() - m.Nextaction = omitnull.FromNull(val) - } - if o.Notificationtimestamp != nil { - val := o.Notificationtimestamp() - m.Notificationtimestamp = omitnull.FromNull(val) - } - if o.Notified != nil { - val := o.Notified() - m.Notified = omitnull.FromNull(val) - } - if o.Notifieddate != nil { - val := o.Notifieddate() - m.Notifieddate = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Pointlocid != nil { - val := o.Pointlocid() - m.Pointlocid = omitnull.FromNull(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Recdatetime != nil { - val := o.Recdatetime() - m.Recdatetime = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Rejectedby != nil { - val := o.Rejectedby() - m.Rejectedby = omitnull.FromNull(val) - } - if o.Rejecteddate != nil { - val := o.Rejecteddate() - m.Rejecteddate = omitnull.FromNull(val) - } - if o.Rejectedreason != nil { - val := o.Rejectedreason() - m.Rejectedreason = omitnull.FromNull(val) - } - if o.Reqaddr1 != nil { - val := o.Reqaddr1() - m.Reqaddr1 = omitnull.FromNull(val) - } - if o.Reqaddr2 != nil { - val := o.Reqaddr2() - m.Reqaddr2 = omitnull.FromNull(val) - } - if o.Reqcity != nil { - val := o.Reqcity() - m.Reqcity = omitnull.FromNull(val) - } - if o.Reqcompany != nil { - val := o.Reqcompany() - m.Reqcompany = omitnull.FromNull(val) - } - if o.Reqcrossst != nil { - val := o.Reqcrossst() - m.Reqcrossst = omitnull.FromNull(val) - } - if o.Reqdescr != nil { - val := o.Reqdescr() - m.Reqdescr = omitnull.FromNull(val) - } - if o.Reqfldnotes != nil { - val := o.Reqfldnotes() - m.Reqfldnotes = omitnull.FromNull(val) - } - if o.Reqmapgrid != nil { - val := o.Reqmapgrid() - m.Reqmapgrid = omitnull.FromNull(val) - } - if o.Reqnotesforcust != nil { - val := o.Reqnotesforcust() - m.Reqnotesforcust = omitnull.FromNull(val) - } - if o.Reqnotesfortech != nil { - val := o.Reqnotesfortech() - m.Reqnotesfortech = omitnull.FromNull(val) - } - if o.Reqpermission != nil { - val := o.Reqpermission() - m.Reqpermission = omitnull.FromNull(val) - } - if o.Reqprogramactions != nil { - val := o.Reqprogramactions() - m.Reqprogramactions = omitnull.FromNull(val) - } - if o.Reqstate != nil { - val := o.Reqstate() - m.Reqstate = omitnull.FromNull(val) - } - if o.Reqsubdiv != nil { - val := o.Reqsubdiv() - m.Reqsubdiv = omitnull.FromNull(val) - } - if o.Reqtarget != nil { - val := o.Reqtarget() - m.Reqtarget = omitnull.FromNull(val) - } - if o.Reqzip != nil { - val := o.Reqzip() - m.Reqzip = omitnull.FromNull(val) - } - if o.Responsedaycount != nil { - val := o.Responsedaycount() - m.Responsedaycount = omitnull.FromNull(val) - } - if o.Reviewed != nil { - val := o.Reviewed() - m.Reviewed = omitnull.FromNull(val) - } - if o.Reviewedby != nil { - val := o.Reviewedby() - m.Reviewedby = omitnull.FromNull(val) - } - if o.Revieweddate != nil { - val := o.Revieweddate() - m.Revieweddate = omitnull.FromNull(val) - } - if o.Scheduled != nil { - val := o.Scheduled() - m.Scheduled = omitnull.FromNull(val) - } - if o.Scheduleddate != nil { - val := o.Scheduleddate() - m.Scheduleddate = omitnull.FromNull(val) - } - if o.Source != nil { - val := o.Source() - m.Source = omitnull.FromNull(val) - } - if o.SRNumber != nil { - val := o.SRNumber() - m.SRNumber = omitnull.FromNull(val) - } - if o.Status != nil { - val := o.Status() - m.Status = omitnull.FromNull(val) - } - if o.Supervisor != nil { - val := o.Supervisor() - m.Supervisor = omitnull.FromNull(val) - } - if o.Techclosed != nil { - val := o.Techclosed() - m.Techclosed = omitnull.FromNull(val) - } - if o.Validx != nil { - val := o.Validx() - m.Validx = omitnull.FromNull(val) - } - if o.Validy != nil { - val := o.Validy() - m.Validy = omitnull.FromNull(val) - } - if o.Xvalue != nil { - val := o.Xvalue() - m.Xvalue = omitnull.FromNull(val) - } - if o.Yvalue != nil { - val := o.Yvalue() - m.Yvalue = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omit.From(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omit.From(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Dog != nil { - val := o.Dog() - m.Dog = omitnull.FromNull(val) - } - if o.Spanish != nil { - val := o.Spanish() - m.Spanish = omitnull.FromNull(val) - } - if o.ScheduleNotes != nil { - val := o.ScheduleNotes() - m.ScheduleNotes = omitnull.FromNull(val) - } - if o.SchedulePeriod != nil { - val := o.SchedulePeriod() - m.SchedulePeriod = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSServicerequestSetter -// this does nothing with the relationship templates -func (o FSServicerequestTemplate) BuildManySetter(number int) []*models.FSServicerequestSetter { - m := make([]*models.FSServicerequestSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSServicerequest -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSServicerequestTemplate.Create -func (o FSServicerequestTemplate) Build() *models.FSServicerequest { - m := &models.FSServicerequest{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accepted != nil { - m.Accepted = o.Accepted() - } - if o.Acceptedby != nil { - m.Acceptedby = o.Acceptedby() - } - if o.Accepteddate != nil { - m.Accepteddate = o.Accepteddate() - } - if o.Allowed != nil { - m.Allowed = o.Allowed() - } - if o.Assignedtech != nil { - m.Assignedtech = o.Assignedtech() - } - if o.Clraddr1 != nil { - m.Clraddr1 = o.Clraddr1() - } - if o.Clraddr2 != nil { - m.Clraddr2 = o.Clraddr2() - } - if o.Clranon != nil { - m.Clranon = o.Clranon() - } - if o.Clrcity != nil { - m.Clrcity = o.Clrcity() - } - if o.Clrcompany != nil { - m.Clrcompany = o.Clrcompany() - } - if o.Clrcontpref != nil { - m.Clrcontpref = o.Clrcontpref() - } - if o.Clremail != nil { - m.Clremail = o.Clremail() - } - if o.Clrfname != nil { - m.Clrfname = o.Clrfname() - } - if o.Clrother != nil { - m.Clrother = o.Clrother() - } - if o.Clrphone1 != nil { - m.Clrphone1 = o.Clrphone1() - } - if o.Clrphone2 != nil { - m.Clrphone2 = o.Clrphone2() - } - if o.Clrstate != nil { - m.Clrstate = o.Clrstate() - } - if o.Clrzip != nil { - m.Clrzip = o.Clrzip() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Datetimeclosed != nil { - m.Datetimeclosed = o.Datetimeclosed() - } - if o.Duedate != nil { - m.Duedate = o.Duedate() - } - if o.Entrytech != nil { - m.Entrytech = o.Entrytech() - } - if o.Estcompletedate != nil { - m.Estcompletedate = o.Estcompletedate() - } - if o.Externalerror != nil { - m.Externalerror = o.Externalerror() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Firstresponsedate != nil { - m.Firstresponsedate = o.Firstresponsedate() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Issuesreported != nil { - m.Issuesreported = o.Issuesreported() - } - if o.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Nextaction != nil { - m.Nextaction = o.Nextaction() - } - if o.Notificationtimestamp != nil { - m.Notificationtimestamp = o.Notificationtimestamp() - } - if o.Notified != nil { - m.Notified = o.Notified() - } - if o.Notifieddate != nil { - m.Notifieddate = o.Notifieddate() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Pointlocid != nil { - m.Pointlocid = o.Pointlocid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Recdatetime != nil { - m.Recdatetime = o.Recdatetime() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Rejectedby != nil { - m.Rejectedby = o.Rejectedby() - } - if o.Rejecteddate != nil { - m.Rejecteddate = o.Rejecteddate() - } - if o.Rejectedreason != nil { - m.Rejectedreason = o.Rejectedreason() - } - if o.Reqaddr1 != nil { - m.Reqaddr1 = o.Reqaddr1() - } - if o.Reqaddr2 != nil { - m.Reqaddr2 = o.Reqaddr2() - } - if o.Reqcity != nil { - m.Reqcity = o.Reqcity() - } - if o.Reqcompany != nil { - m.Reqcompany = o.Reqcompany() - } - if o.Reqcrossst != nil { - m.Reqcrossst = o.Reqcrossst() - } - if o.Reqdescr != nil { - m.Reqdescr = o.Reqdescr() - } - if o.Reqfldnotes != nil { - m.Reqfldnotes = o.Reqfldnotes() - } - if o.Reqmapgrid != nil { - m.Reqmapgrid = o.Reqmapgrid() - } - if o.Reqnotesforcust != nil { - m.Reqnotesforcust = o.Reqnotesforcust() - } - if o.Reqnotesfortech != nil { - m.Reqnotesfortech = o.Reqnotesfortech() - } - if o.Reqpermission != nil { - m.Reqpermission = o.Reqpermission() - } - if o.Reqprogramactions != nil { - m.Reqprogramactions = o.Reqprogramactions() - } - if o.Reqstate != nil { - m.Reqstate = o.Reqstate() - } - if o.Reqsubdiv != nil { - m.Reqsubdiv = o.Reqsubdiv() - } - if o.Reqtarget != nil { - m.Reqtarget = o.Reqtarget() - } - if o.Reqzip != nil { - m.Reqzip = o.Reqzip() - } - if o.Responsedaycount != nil { - m.Responsedaycount = o.Responsedaycount() - } - if o.Reviewed != nil { - m.Reviewed = o.Reviewed() - } - if o.Reviewedby != nil { - m.Reviewedby = o.Reviewedby() - } - if o.Revieweddate != nil { - m.Revieweddate = o.Revieweddate() - } - if o.Scheduled != nil { - m.Scheduled = o.Scheduled() - } - if o.Scheduleddate != nil { - m.Scheduleddate = o.Scheduleddate() - } - if o.Source != nil { - m.Source = o.Source() - } - if o.SRNumber != nil { - m.SRNumber = o.SRNumber() - } - if o.Status != nil { - m.Status = o.Status() - } - if o.Supervisor != nil { - m.Supervisor = o.Supervisor() - } - if o.Techclosed != nil { - m.Techclosed = o.Techclosed() - } - if o.Validx != nil { - m.Validx = o.Validx() - } - if o.Validy != nil { - m.Validy = o.Validy() - } - if o.Xvalue != nil { - m.Xvalue = o.Xvalue() - } - if o.Yvalue != nil { - m.Yvalue = o.Yvalue() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Dog != nil { - m.Dog = o.Dog() - } - if o.Spanish != nil { - m.Spanish = o.Spanish() - } - if o.ScheduleNotes != nil { - m.ScheduleNotes = o.ScheduleNotes() - } - if o.SchedulePeriod != nil { - m.SchedulePeriod = o.SchedulePeriod() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSServicerequestSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSServicerequestTemplate.CreateMany -func (o FSServicerequestTemplate) BuildMany(number int) models.FSServicerequestSlice { - m := make(models.FSServicerequestSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSServicerequest(m *models.FSServicerequestSetter) { - if !(m.OrganizationID.IsValue()) { - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSServicerequestTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSServicerequest) error { - var err error - - return err -} - -// Create builds a fsServicerequest and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSServicerequestTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSServicerequest, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSServicerequest(opt) - - if o.r.Organization == nil { - FSServicerequestMods.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.FSServicerequests.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 fsServicerequest and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSServicerequestTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSServicerequest { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsServicerequest 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 *FSServicerequestTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSServicerequest { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsServicerequests and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSServicerequestTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSServicerequestSlice, error) { - var err error - m := make(models.FSServicerequestSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsServicerequests and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSServicerequestTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSServicerequestSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsServicerequests 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 FSServicerequestTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSServicerequestSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSServicerequest has methods that act as mods for the FSServicerequestTemplate -var FSServicerequestMods fsServicerequestMods - -type fsServicerequestMods struct{} - -func (m fsServicerequestMods) RandomizeAllColumns(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModSlice{ - FSServicerequestMods.RandomOrganizationID(f), - FSServicerequestMods.RandomAccepted(f), - FSServicerequestMods.RandomAcceptedby(f), - FSServicerequestMods.RandomAccepteddate(f), - FSServicerequestMods.RandomAllowed(f), - FSServicerequestMods.RandomAssignedtech(f), - FSServicerequestMods.RandomClraddr1(f), - FSServicerequestMods.RandomClraddr2(f), - FSServicerequestMods.RandomClranon(f), - FSServicerequestMods.RandomClrcity(f), - FSServicerequestMods.RandomClrcompany(f), - FSServicerequestMods.RandomClrcontpref(f), - FSServicerequestMods.RandomClremail(f), - FSServicerequestMods.RandomClrfname(f), - FSServicerequestMods.RandomClrother(f), - FSServicerequestMods.RandomClrphone1(f), - FSServicerequestMods.RandomClrphone2(f), - FSServicerequestMods.RandomClrstate(f), - FSServicerequestMods.RandomClrzip(f), - FSServicerequestMods.RandomComments(f), - FSServicerequestMods.RandomCreationdate(f), - FSServicerequestMods.RandomCreator(f), - FSServicerequestMods.RandomDatetimeclosed(f), - FSServicerequestMods.RandomDuedate(f), - FSServicerequestMods.RandomEntrytech(f), - FSServicerequestMods.RandomEstcompletedate(f), - FSServicerequestMods.RandomExternalerror(f), - FSServicerequestMods.RandomExternalid(f), - FSServicerequestMods.RandomEditdate(f), - FSServicerequestMods.RandomEditor(f), - FSServicerequestMods.RandomFirstresponsedate(f), - FSServicerequestMods.RandomGlobalid(f), - FSServicerequestMods.RandomIssuesreported(f), - FSServicerequestMods.RandomJurisdiction(f), - FSServicerequestMods.RandomNextaction(f), - FSServicerequestMods.RandomNotificationtimestamp(f), - FSServicerequestMods.RandomNotified(f), - FSServicerequestMods.RandomNotifieddate(f), - FSServicerequestMods.RandomObjectid(f), - FSServicerequestMods.RandomPointlocid(f), - FSServicerequestMods.RandomPriority(f), - FSServicerequestMods.RandomRecdatetime(f), - FSServicerequestMods.RandomRecordstatus(f), - FSServicerequestMods.RandomRejectedby(f), - FSServicerequestMods.RandomRejecteddate(f), - FSServicerequestMods.RandomRejectedreason(f), - FSServicerequestMods.RandomReqaddr1(f), - FSServicerequestMods.RandomReqaddr2(f), - FSServicerequestMods.RandomReqcity(f), - FSServicerequestMods.RandomReqcompany(f), - FSServicerequestMods.RandomReqcrossst(f), - FSServicerequestMods.RandomReqdescr(f), - FSServicerequestMods.RandomReqfldnotes(f), - FSServicerequestMods.RandomReqmapgrid(f), - FSServicerequestMods.RandomReqnotesforcust(f), - FSServicerequestMods.RandomReqnotesfortech(f), - FSServicerequestMods.RandomReqpermission(f), - FSServicerequestMods.RandomReqprogramactions(f), - FSServicerequestMods.RandomReqstate(f), - FSServicerequestMods.RandomReqsubdiv(f), - FSServicerequestMods.RandomReqtarget(f), - FSServicerequestMods.RandomReqzip(f), - FSServicerequestMods.RandomResponsedaycount(f), - FSServicerequestMods.RandomReviewed(f), - FSServicerequestMods.RandomReviewedby(f), - FSServicerequestMods.RandomRevieweddate(f), - FSServicerequestMods.RandomScheduled(f), - FSServicerequestMods.RandomScheduleddate(f), - FSServicerequestMods.RandomSource(f), - FSServicerequestMods.RandomSRNumber(f), - FSServicerequestMods.RandomStatus(f), - FSServicerequestMods.RandomSupervisor(f), - FSServicerequestMods.RandomTechclosed(f), - FSServicerequestMods.RandomValidx(f), - FSServicerequestMods.RandomValidy(f), - FSServicerequestMods.RandomXvalue(f), - FSServicerequestMods.RandomYvalue(f), - FSServicerequestMods.RandomZone(f), - FSServicerequestMods.RandomZone2(f), - FSServicerequestMods.RandomCreatedDate(f), - FSServicerequestMods.RandomCreatedUser(f), - FSServicerequestMods.RandomGeometryX(f), - FSServicerequestMods.RandomGeometryY(f), - FSServicerequestMods.RandomLastEditedDate(f), - FSServicerequestMods.RandomLastEditedUser(f), - FSServicerequestMods.RandomDog(f), - FSServicerequestMods.RandomSpanish(f), - FSServicerequestMods.RandomScheduleNotes(f), - FSServicerequestMods.RandomSchedulePeriod(f), - FSServicerequestMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsServicerequestMods) OrganizationID(val int32) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) OrganizationIDFunc(f func() int32) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetOrganizationID() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - 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 fsServicerequestMods) RandomOrganizationID(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Accepted(val null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Accepted = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) AcceptedFunc(f func() null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Accepted = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetAccepted() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Accepted = 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 fsServicerequestMods) RandomAccepted(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Accepted = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomAcceptedNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Accepted = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Acceptedby(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Acceptedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) AcceptedbyFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Acceptedby = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetAcceptedby() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Acceptedby = 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 fsServicerequestMods) RandomAcceptedby(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Acceptedby = 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) RandomAcceptedbyNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Acceptedby = 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 fsServicerequestMods) Accepteddate(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Accepteddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) AccepteddateFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Accepteddate = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetAccepteddate() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Accepteddate = 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 fsServicerequestMods) RandomAccepteddate(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Accepteddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomAccepteddateNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Accepteddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Allowed(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Allowed = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) AllowedFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Allowed = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetAllowed() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Allowed = 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 fsServicerequestMods) RandomAllowed(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Allowed = 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) RandomAllowedNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Allowed = 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 fsServicerequestMods) Assignedtech(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Assignedtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) AssignedtechFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Assignedtech = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetAssignedtech() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Assignedtech = 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 fsServicerequestMods) RandomAssignedtech(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Assignedtech = 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) RandomAssignedtechNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Assignedtech = 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 fsServicerequestMods) Clraddr1(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clraddr1 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) Clraddr1Func(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clraddr1 = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetClraddr1() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clraddr1 = 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 fsServicerequestMods) RandomClraddr1(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clraddr1 = 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) RandomClraddr1NotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clraddr1 = 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 fsServicerequestMods) Clraddr2(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clraddr2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) Clraddr2Func(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clraddr2 = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetClraddr2() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clraddr2 = 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 fsServicerequestMods) RandomClraddr2(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clraddr2 = 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) RandomClraddr2NotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clraddr2 = 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 fsServicerequestMods) Clranon(val null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clranon = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ClranonFunc(f func() null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clranon = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetClranon() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clranon = 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 fsServicerequestMods) RandomClranon(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clranon = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomClranonNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clranon = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Clrcity(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrcity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ClrcityFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrcity = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetClrcity() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrcity = 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 fsServicerequestMods) RandomClrcity(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrcity = 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) RandomClrcityNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrcity = 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 fsServicerequestMods) Clrcompany(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrcompany = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ClrcompanyFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrcompany = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetClrcompany() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrcompany = 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 fsServicerequestMods) RandomClrcompany(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrcompany = 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) RandomClrcompanyNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrcompany = 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 fsServicerequestMods) Clrcontpref(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrcontpref = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ClrcontprefFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrcontpref = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetClrcontpref() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrcontpref = 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 fsServicerequestMods) RandomClrcontpref(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrcontpref = 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) RandomClrcontprefNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrcontpref = 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 fsServicerequestMods) Clremail(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clremail = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ClremailFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clremail = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetClremail() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clremail = 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 fsServicerequestMods) RandomClremail(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clremail = 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) RandomClremailNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clremail = 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 fsServicerequestMods) Clrfname(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrfname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ClrfnameFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrfname = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetClrfname() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrfname = 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 fsServicerequestMods) RandomClrfname(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrfname = 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) RandomClrfnameNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrfname = 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 fsServicerequestMods) Clrother(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrother = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ClrotherFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrother = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetClrother() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrother = 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 fsServicerequestMods) RandomClrother(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrother = 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) RandomClrotherNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrother = 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 fsServicerequestMods) Clrphone1(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrphone1 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) Clrphone1Func(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrphone1 = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetClrphone1() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrphone1 = 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 fsServicerequestMods) RandomClrphone1(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrphone1 = 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) RandomClrphone1NotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrphone1 = 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 fsServicerequestMods) Clrphone2(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrphone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) Clrphone2Func(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrphone2 = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetClrphone2() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrphone2 = 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 fsServicerequestMods) RandomClrphone2(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrphone2 = 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) RandomClrphone2NotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrphone2 = 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 fsServicerequestMods) Clrstate(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrstate = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ClrstateFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrstate = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetClrstate() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrstate = 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 fsServicerequestMods) RandomClrstate(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrstate = 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) RandomClrstateNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrstate = 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 fsServicerequestMods) Clrzip(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrzip = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ClrzipFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrzip = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetClrzip() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrzip = 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 fsServicerequestMods) RandomClrzip(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrzip = 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) RandomClrzipNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Clrzip = 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 fsServicerequestMods) Comments(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) CommentsFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetComments() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Comments = 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 fsServicerequestMods) RandomComments(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Comments = 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 fsServicerequestMods) Creationdate(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) CreationdateFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetCreationdate() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Creationdate = 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 fsServicerequestMods) RandomCreationdate(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Creator(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) CreatorFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetCreator() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Creator = 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 fsServicerequestMods) RandomCreator(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Creator = 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 fsServicerequestMods) Datetimeclosed(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Datetimeclosed = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) DatetimeclosedFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Datetimeclosed = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetDatetimeclosed() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Datetimeclosed = 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 fsServicerequestMods) RandomDatetimeclosed(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Datetimeclosed = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomDatetimeclosedNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Datetimeclosed = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Duedate(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Duedate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) DuedateFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Duedate = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetDuedate() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Duedate = 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 fsServicerequestMods) RandomDuedate(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Duedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomDuedateNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Duedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Entrytech(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Entrytech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) EntrytechFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Entrytech = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetEntrytech() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Entrytech = 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 fsServicerequestMods) RandomEntrytech(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Entrytech = 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) RandomEntrytechNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Entrytech = 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 fsServicerequestMods) Estcompletedate(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Estcompletedate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) EstcompletedateFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Estcompletedate = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetEstcompletedate() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Estcompletedate = 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 fsServicerequestMods) RandomEstcompletedate(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Estcompletedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEstcompletedateNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Estcompletedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Externalerror(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Externalerror = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ExternalerrorFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Externalerror = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetExternalerror() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Externalerror = 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 fsServicerequestMods) RandomExternalerror(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Externalerror = 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) RandomExternalerrorNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Externalerror = 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 fsServicerequestMods) Externalid(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ExternalidFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetExternalid() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Externalid = 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 fsServicerequestMods) RandomExternalid(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Externalid = 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) RandomExternalidNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Externalid = 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 fsServicerequestMods) Editdate(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) EditdateFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetEditdate() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Editdate = 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 fsServicerequestMods) RandomEditdate(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Editor(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) EditorFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetEditor() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Editor = 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 fsServicerequestMods) RandomEditor(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Editor = 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 fsServicerequestMods) Firstresponsedate(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Firstresponsedate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) FirstresponsedateFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Firstresponsedate = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetFirstresponsedate() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Firstresponsedate = 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 fsServicerequestMods) RandomFirstresponsedate(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Firstresponsedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomFirstresponsedateNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Firstresponsedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Globalid(val string) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) GlobalidFunc(f func() string) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetGlobalid() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsServicerequestMods) RandomGlobalid(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Issuesreported(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Issuesreported = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) IssuesreportedFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Issuesreported = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetIssuesreported() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Issuesreported = 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 fsServicerequestMods) RandomIssuesreported(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Issuesreported = 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) RandomIssuesreportedNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Issuesreported = 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 fsServicerequestMods) Jurisdiction(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) JurisdictionFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetJurisdiction() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Jurisdiction = 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 fsServicerequestMods) RandomJurisdiction(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Jurisdiction = 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) RandomJurisdictionNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Jurisdiction = 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 fsServicerequestMods) Nextaction(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Nextaction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) NextactionFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Nextaction = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetNextaction() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Nextaction = 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 fsServicerequestMods) RandomNextaction(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Nextaction = 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) RandomNextactionNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Nextaction = 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 fsServicerequestMods) Notificationtimestamp(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Notificationtimestamp = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) NotificationtimestampFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Notificationtimestamp = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetNotificationtimestamp() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Notificationtimestamp = 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 fsServicerequestMods) RandomNotificationtimestamp(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Notificationtimestamp = 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) RandomNotificationtimestampNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Notificationtimestamp = 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 fsServicerequestMods) Notified(val null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Notified = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) NotifiedFunc(f func() null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Notified = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetNotified() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Notified = 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 fsServicerequestMods) RandomNotified(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Notified = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomNotifiedNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Notified = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Notifieddate(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Notifieddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) NotifieddateFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Notifieddate = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetNotifieddate() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Notifieddate = 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 fsServicerequestMods) RandomNotifieddate(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Notifieddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomNotifieddateNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Notifieddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Objectid(val int32) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ObjectidFunc(f func() int32) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetObjectid() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsServicerequestMods) RandomObjectid(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Pointlocid(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Pointlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) PointlocidFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Pointlocid = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetPointlocid() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Pointlocid = 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 fsServicerequestMods) RandomPointlocid(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Pointlocid = 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) RandomPointlocidNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Pointlocid = 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 fsServicerequestMods) Priority(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) PriorityFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetPriority() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Priority = 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 fsServicerequestMods) RandomPriority(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Priority = 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) RandomPriorityNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Priority = 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 fsServicerequestMods) Recdatetime(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Recdatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) RecdatetimeFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Recdatetime = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetRecdatetime() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Recdatetime = 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 fsServicerequestMods) RandomRecdatetime(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Recdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomRecdatetimeNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Recdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Recordstatus(val null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) RecordstatusFunc(f func() null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetRecordstatus() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Recordstatus = 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 fsServicerequestMods) RandomRecordstatus(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Rejectedby(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Rejectedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) RejectedbyFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Rejectedby = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetRejectedby() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Rejectedby = 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 fsServicerequestMods) RandomRejectedby(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Rejectedby = 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) RandomRejectedbyNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Rejectedby = 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 fsServicerequestMods) Rejecteddate(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Rejecteddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) RejecteddateFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Rejecteddate = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetRejecteddate() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Rejecteddate = 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 fsServicerequestMods) RandomRejecteddate(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Rejecteddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomRejecteddateNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Rejecteddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Rejectedreason(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Rejectedreason = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) RejectedreasonFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Rejectedreason = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetRejectedreason() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Rejectedreason = 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 fsServicerequestMods) RandomRejectedreason(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Rejectedreason = 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) RandomRejectedreasonNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Rejectedreason = 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 fsServicerequestMods) Reqaddr1(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqaddr1 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) Reqaddr1Func(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqaddr1 = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqaddr1() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqaddr1 = 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 fsServicerequestMods) RandomReqaddr1(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqaddr1 = 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) RandomReqaddr1NotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqaddr1 = 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 fsServicerequestMods) Reqaddr2(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqaddr2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) Reqaddr2Func(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqaddr2 = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqaddr2() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqaddr2 = 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 fsServicerequestMods) RandomReqaddr2(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqaddr2 = 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) RandomReqaddr2NotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqaddr2 = 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 fsServicerequestMods) Reqcity(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqcity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReqcityFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqcity = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqcity() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqcity = 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 fsServicerequestMods) RandomReqcity(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqcity = 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) RandomReqcityNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqcity = 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 fsServicerequestMods) Reqcompany(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqcompany = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReqcompanyFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqcompany = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqcompany() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqcompany = 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 fsServicerequestMods) RandomReqcompany(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqcompany = 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) RandomReqcompanyNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqcompany = 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 fsServicerequestMods) Reqcrossst(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqcrossst = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReqcrossstFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqcrossst = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqcrossst() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqcrossst = 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 fsServicerequestMods) RandomReqcrossst(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqcrossst = 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) RandomReqcrossstNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqcrossst = 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 fsServicerequestMods) Reqdescr(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqdescr = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReqdescrFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqdescr = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqdescr() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqdescr = 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 fsServicerequestMods) RandomReqdescr(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqdescr = 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) RandomReqdescrNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqdescr = 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 fsServicerequestMods) Reqfldnotes(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqfldnotes = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReqfldnotesFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqfldnotes = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqfldnotes() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqfldnotes = 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 fsServicerequestMods) RandomReqfldnotes(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqfldnotes = 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) RandomReqfldnotesNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqfldnotes = 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 fsServicerequestMods) Reqmapgrid(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqmapgrid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReqmapgridFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqmapgrid = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqmapgrid() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqmapgrid = 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 fsServicerequestMods) RandomReqmapgrid(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqmapgrid = 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) RandomReqmapgridNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqmapgrid = 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 fsServicerequestMods) Reqnotesforcust(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqnotesforcust = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReqnotesforcustFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqnotesforcust = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqnotesforcust() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqnotesforcust = 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 fsServicerequestMods) RandomReqnotesforcust(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqnotesforcust = 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) RandomReqnotesforcustNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqnotesforcust = 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 fsServicerequestMods) Reqnotesfortech(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqnotesfortech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReqnotesfortechFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqnotesfortech = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqnotesfortech() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqnotesfortech = 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 fsServicerequestMods) RandomReqnotesfortech(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqnotesfortech = 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) RandomReqnotesfortechNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqnotesfortech = 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 fsServicerequestMods) Reqpermission(val null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqpermission = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReqpermissionFunc(f func() null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqpermission = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqpermission() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqpermission = 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 fsServicerequestMods) RandomReqpermission(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqpermission = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomReqpermissionNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqpermission = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Reqprogramactions(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqprogramactions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReqprogramactionsFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqprogramactions = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqprogramactions() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqprogramactions = 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 fsServicerequestMods) RandomReqprogramactions(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqprogramactions = 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) RandomReqprogramactionsNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqprogramactions = 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 fsServicerequestMods) Reqstate(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqstate = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReqstateFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqstate = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqstate() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqstate = 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 fsServicerequestMods) RandomReqstate(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqstate = 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) RandomReqstateNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqstate = 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 fsServicerequestMods) Reqsubdiv(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqsubdiv = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReqsubdivFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqsubdiv = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqsubdiv() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqsubdiv = 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 fsServicerequestMods) RandomReqsubdiv(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqsubdiv = 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) RandomReqsubdivNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqsubdiv = 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 fsServicerequestMods) Reqtarget(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqtarget = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReqtargetFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqtarget = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqtarget() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqtarget = 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 fsServicerequestMods) RandomReqtarget(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqtarget = 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) RandomReqtargetNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqtarget = 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 fsServicerequestMods) Reqzip(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqzip = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReqzipFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqzip = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReqzip() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqzip = 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 fsServicerequestMods) RandomReqzip(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqzip = 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) RandomReqzipNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reqzip = 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 fsServicerequestMods) Responsedaycount(val null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Responsedaycount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ResponsedaycountFunc(f func() null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Responsedaycount = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetResponsedaycount() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Responsedaycount = 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 fsServicerequestMods) RandomResponsedaycount(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Responsedaycount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomResponsedaycountNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Responsedaycount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Reviewed(val null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReviewedFunc(f func() null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReviewed() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reviewed = 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 fsServicerequestMods) RandomReviewed(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Reviewedby(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ReviewedbyFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetReviewedby() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reviewedby = 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 fsServicerequestMods) RandomReviewedby(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reviewedby = 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) RandomReviewedbyNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Reviewedby = 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 fsServicerequestMods) Revieweddate(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Revieweddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) RevieweddateFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetRevieweddate() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Revieweddate = 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 fsServicerequestMods) RandomRevieweddate(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Scheduled(val null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Scheduled = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ScheduledFunc(f func() null.Val[int16]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Scheduled = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetScheduled() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Scheduled = 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 fsServicerequestMods) RandomScheduled(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Scheduled = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomScheduledNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Scheduled = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Scheduleddate(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Scheduleddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ScheduleddateFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Scheduleddate = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetScheduleddate() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Scheduleddate = 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 fsServicerequestMods) RandomScheduleddate(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Scheduleddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomScheduleddateNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Scheduleddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Source(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Source = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) SourceFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Source = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetSource() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Source = 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 fsServicerequestMods) RandomSource(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Source = 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) RandomSourceNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Source = 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 fsServicerequestMods) SRNumber(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.SRNumber = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) SRNumberFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.SRNumber = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetSRNumber() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.SRNumber = 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 fsServicerequestMods) RandomSRNumber(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.SRNumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomSRNumberNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.SRNumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Status(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Status = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) StatusFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Status = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetStatus() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Status = 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 fsServicerequestMods) RandomStatus(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Status = 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) RandomStatusNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Status = 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 fsServicerequestMods) Supervisor(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Supervisor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) SupervisorFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Supervisor = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetSupervisor() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Supervisor = 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 fsServicerequestMods) RandomSupervisor(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Supervisor = 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) RandomSupervisorNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Supervisor = 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 fsServicerequestMods) Techclosed(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Techclosed = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) TechclosedFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Techclosed = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetTechclosed() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Techclosed = 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 fsServicerequestMods) RandomTechclosed(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Techclosed = 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) RandomTechclosedNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Techclosed = 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 fsServicerequestMods) Validx(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Validx = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ValidxFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Validx = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetValidx() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Validx = 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 fsServicerequestMods) RandomValidx(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Validx = 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) RandomValidxNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Validx = 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 fsServicerequestMods) Validy(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Validy = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ValidyFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Validy = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetValidy() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Validy = 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 fsServicerequestMods) RandomValidy(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Validy = 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) RandomValidyNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Validy = 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 fsServicerequestMods) Xvalue(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Xvalue = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) XvalueFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Xvalue = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetXvalue() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Xvalue = 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 fsServicerequestMods) RandomXvalue(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Xvalue = 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) RandomXvalueNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Xvalue = 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 fsServicerequestMods) Yvalue(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Yvalue = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) YvalueFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Yvalue = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetYvalue() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Yvalue = 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 fsServicerequestMods) RandomYvalue(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Yvalue = 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) RandomYvalueNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Yvalue = 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 fsServicerequestMods) Zone(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ZoneFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetZone() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Zone = 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 fsServicerequestMods) RandomZone(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Zone = 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) RandomZoneNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Zone = 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 fsServicerequestMods) Zone2(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) Zone2Func(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetZone2() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Zone2 = 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 fsServicerequestMods) RandomZone2(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Zone2 = 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) RandomZone2NotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Zone2 = 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 fsServicerequestMods) CreatedDate(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) CreatedDateFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetCreatedDate() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.CreatedDate = 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 fsServicerequestMods) RandomCreatedDate(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) CreatedUser(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) CreatedUserFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetCreatedUser() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.CreatedUser = 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 fsServicerequestMods) RandomCreatedUser(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.CreatedUser = 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 fsServicerequestMods) GeometryX(val float64) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.GeometryX = func() float64 { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) GeometryXFunc(f func() float64) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetGeometryX() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.GeometryX = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsServicerequestMods) RandomGeometryX(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.GeometryX = func() float64 { - return random_float64(f) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) GeometryY(val float64) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.GeometryY = func() float64 { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) GeometryYFunc(f func() float64) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetGeometryY() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.GeometryY = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsServicerequestMods) RandomGeometryY(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.GeometryY = func() float64 { - return random_float64(f) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) LastEditedDate(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) LastEditedDateFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetLastEditedDate() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.LastEditedDate = 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 fsServicerequestMods) RandomLastEditedDate(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) LastEditedUser(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) LastEditedUserFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetLastEditedUser() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.LastEditedUser = 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 fsServicerequestMods) RandomLastEditedUser(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.LastEditedUser = 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 fsServicerequestMods) Dog(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Dog = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) DogFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Dog = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetDog() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Dog = 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 fsServicerequestMods) RandomDog(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Dog = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomDogNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Dog = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) Spanish(val null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Spanish = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) SpanishFunc(f func() null.Val[int64]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Spanish = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetSpanish() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Spanish = 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 fsServicerequestMods) RandomSpanish(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Spanish = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomSpanishNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Spanish = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsServicerequestMods) ScheduleNotes(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.ScheduleNotes = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) ScheduleNotesFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.ScheduleNotes = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetScheduleNotes() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.ScheduleNotes = 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 fsServicerequestMods) RandomScheduleNotes(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.ScheduleNotes = 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) RandomScheduleNotesNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.ScheduleNotes = 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 fsServicerequestMods) SchedulePeriod(val null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.SchedulePeriod = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) SchedulePeriodFunc(f func() null.Val[string]) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.SchedulePeriod = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetSchedulePeriod() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.SchedulePeriod = 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 fsServicerequestMods) RandomSchedulePeriod(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.SchedulePeriod = 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) RandomSchedulePeriodNotNull(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.SchedulePeriod = 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 fsServicerequestMods) Updated(val time.Time) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsServicerequestMods) UpdatedFunc(f func() time.Time) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsServicerequestMods) UnsetUpdated() FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsServicerequestMods) RandomUpdated(f *faker.Faker) FSServicerequestMod { - return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsServicerequestMods) WithParentsCascading() FSServicerequestMod { - return FSServicerequestModFunc(func(ctx context.Context, o *FSServicerequestTemplate) { - if isDone, _ := fsServicerequestWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsServicerequestWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsServicerequestMods) WithOrganization(rel *OrganizationTemplate) FSServicerequestMod { - return FSServicerequestModFunc(func(ctx context.Context, o *FSServicerequestTemplate) { - o.r.Organization = &fsServicerequestROrganizationR{ - o: rel, - } - }) -} - -func (m fsServicerequestMods) WithNewOrganization(mods ...OrganizationMod) FSServicerequestMod { - return FSServicerequestModFunc(func(ctx context.Context, o *FSServicerequestTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsServicerequestMods) WithExistingOrganization(em *models.Organization) FSServicerequestMod { - return FSServicerequestModFunc(func(ctx context.Context, o *FSServicerequestTemplate) { - o.r.Organization = &fsServicerequestROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsServicerequestMods) WithoutOrganization() FSServicerequestMod { - return FSServicerequestModFunc(func(ctx context.Context, o *FSServicerequestTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_speciesabundance.bob.go b/db/factory/fs_speciesabundance.bob.go deleted file mode 100644 index 7f3103de..00000000 --- a/db/factory/fs_speciesabundance.bob.go +++ /dev/null @@ -1,2254 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSSpeciesabundanceMod interface { - Apply(context.Context, *FSSpeciesabundanceTemplate) -} - -type FSSpeciesabundanceModFunc func(context.Context, *FSSpeciesabundanceTemplate) - -func (f FSSpeciesabundanceModFunc) Apply(ctx context.Context, n *FSSpeciesabundanceTemplate) { - f(ctx, n) -} - -type FSSpeciesabundanceModSlice []FSSpeciesabundanceMod - -func (mods FSSpeciesabundanceModSlice) Apply(ctx context.Context, n *FSSpeciesabundanceTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSSpeciesabundanceTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSSpeciesabundanceTemplate struct { - OrganizationID func() int32 - Bloodedfem func() null.Val[int16] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Eggs func() null.Val[int16] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Females func() null.Val[int64] - Gravidfem func() null.Val[int16] - Globalid func() string - Larvae func() null.Val[int16] - Males func() null.Val[int16] - Objectid func() int32 - Poolstogen func() null.Val[int16] - Processed func() null.Val[int16] - Pupae func() null.Val[int16] - Species func() null.Val[string] - Total func() null.Val[int64] - TrapdataID func() null.Val[string] - Unknown func() null.Val[int16] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Globalzscore func() null.Val[float64] - H3R7 func() null.Val[string] - H3R8 func() null.Val[string] - R7score func() null.Val[float64] - R8score func() null.Val[float64] - Yearweek func() null.Val[int64] - Updated func() time.Time - - r fsSpeciesabundanceR - f *Factory - - alreadyPersisted bool -} - -type fsSpeciesabundanceR struct { - Organization *fsSpeciesabundanceROrganizationR -} - -type fsSpeciesabundanceROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSSpeciesabundanceTemplate -func (o *FSSpeciesabundanceTemplate) Apply(ctx context.Context, mods ...FSSpeciesabundanceMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSSpeciesabundance -// according to the relationships in the template. Nothing is inserted into the db -func (t FSSpeciesabundanceTemplate) setModelRels(o *models.FSSpeciesabundance) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSSpeciesabundances = append(rel.R.FSSpeciesabundances, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSSpeciesabundanceSetter -// this does nothing with the relationship templates -func (o FSSpeciesabundanceTemplate) BuildSetter() *models.FSSpeciesabundanceSetter { - m := &models.FSSpeciesabundanceSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Bloodedfem != nil { - val := o.Bloodedfem() - m.Bloodedfem = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Eggs != nil { - val := o.Eggs() - m.Eggs = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Females != nil { - val := o.Females() - m.Females = omitnull.FromNull(val) - } - if o.Gravidfem != nil { - val := o.Gravidfem() - m.Gravidfem = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Larvae != nil { - val := o.Larvae() - m.Larvae = omitnull.FromNull(val) - } - if o.Males != nil { - val := o.Males() - m.Males = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Poolstogen != nil { - val := o.Poolstogen() - m.Poolstogen = omitnull.FromNull(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.Pupae != nil { - val := o.Pupae() - m.Pupae = omitnull.FromNull(val) - } - if o.Species != nil { - val := o.Species() - m.Species = omitnull.FromNull(val) - } - if o.Total != nil { - val := o.Total() - m.Total = omitnull.FromNull(val) - } - if o.TrapdataID != nil { - val := o.TrapdataID() - m.TrapdataID = omitnull.FromNull(val) - } - if o.Unknown != nil { - val := o.Unknown() - m.Unknown = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Globalzscore != nil { - val := o.Globalzscore() - m.Globalzscore = omitnull.FromNull(val) - } - if o.H3R7 != nil { - val := o.H3R7() - m.H3R7 = omitnull.FromNull(val) - } - if o.H3R8 != nil { - val := o.H3R8() - m.H3R8 = omitnull.FromNull(val) - } - if o.R7score != nil { - val := o.R7score() - m.R7score = omitnull.FromNull(val) - } - if o.R8score != nil { - val := o.R8score() - m.R8score = omitnull.FromNull(val) - } - if o.Yearweek != nil { - val := o.Yearweek() - m.Yearweek = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSSpeciesabundanceSetter -// this does nothing with the relationship templates -func (o FSSpeciesabundanceTemplate) BuildManySetter(number int) []*models.FSSpeciesabundanceSetter { - m := make([]*models.FSSpeciesabundanceSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSSpeciesabundance -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSSpeciesabundanceTemplate.Create -func (o FSSpeciesabundanceTemplate) Build() *models.FSSpeciesabundance { - m := &models.FSSpeciesabundance{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Bloodedfem != nil { - m.Bloodedfem = o.Bloodedfem() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Eggs != nil { - m.Eggs = o.Eggs() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Females != nil { - m.Females = o.Females() - } - if o.Gravidfem != nil { - m.Gravidfem = o.Gravidfem() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Larvae != nil { - m.Larvae = o.Larvae() - } - if o.Males != nil { - m.Males = o.Males() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Poolstogen != nil { - m.Poolstogen = o.Poolstogen() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.Pupae != nil { - m.Pupae = o.Pupae() - } - if o.Species != nil { - m.Species = o.Species() - } - if o.Total != nil { - m.Total = o.Total() - } - if o.TrapdataID != nil { - m.TrapdataID = o.TrapdataID() - } - if o.Unknown != nil { - m.Unknown = o.Unknown() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Globalzscore != nil { - m.Globalzscore = o.Globalzscore() - } - if o.H3R7 != nil { - m.H3R7 = o.H3R7() - } - if o.H3R8 != nil { - m.H3R8 = o.H3R8() - } - if o.R7score != nil { - m.R7score = o.R7score() - } - if o.R8score != nil { - m.R8score = o.R8score() - } - if o.Yearweek != nil { - m.Yearweek = o.Yearweek() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSSpeciesabundanceSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSSpeciesabundanceTemplate.CreateMany -func (o FSSpeciesabundanceTemplate) BuildMany(number int) models.FSSpeciesabundanceSlice { - m := make(models.FSSpeciesabundanceSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSSpeciesabundance(m *models.FSSpeciesabundanceSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSSpeciesabundance -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSSpeciesabundanceTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSSpeciesabundance) error { - var err error - - return err -} - -// Create builds a fsSpeciesabundance and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSSpeciesabundanceTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSSpeciesabundance, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSSpeciesabundance(opt) - - if o.r.Organization == nil { - FSSpeciesabundanceMods.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.FSSpeciesabundances.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 fsSpeciesabundance and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSSpeciesabundanceTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSSpeciesabundance { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsSpeciesabundance 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 *FSSpeciesabundanceTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSSpeciesabundance { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsSpeciesabundances and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSSpeciesabundanceTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSSpeciesabundanceSlice, error) { - var err error - m := make(models.FSSpeciesabundanceSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsSpeciesabundances and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSSpeciesabundanceTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSSpeciesabundanceSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsSpeciesabundances 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 FSSpeciesabundanceTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSSpeciesabundanceSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSSpeciesabundance has methods that act as mods for the FSSpeciesabundanceTemplate -var FSSpeciesabundanceMods fsSpeciesabundanceMods - -type fsSpeciesabundanceMods struct{} - -func (m fsSpeciesabundanceMods) RandomizeAllColumns(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModSlice{ - FSSpeciesabundanceMods.RandomOrganizationID(f), - FSSpeciesabundanceMods.RandomBloodedfem(f), - FSSpeciesabundanceMods.RandomCreationdate(f), - FSSpeciesabundanceMods.RandomCreator(f), - FSSpeciesabundanceMods.RandomEggs(f), - FSSpeciesabundanceMods.RandomEditdate(f), - FSSpeciesabundanceMods.RandomEditor(f), - FSSpeciesabundanceMods.RandomFemales(f), - FSSpeciesabundanceMods.RandomGravidfem(f), - FSSpeciesabundanceMods.RandomGlobalid(f), - FSSpeciesabundanceMods.RandomLarvae(f), - FSSpeciesabundanceMods.RandomMales(f), - FSSpeciesabundanceMods.RandomObjectid(f), - FSSpeciesabundanceMods.RandomPoolstogen(f), - FSSpeciesabundanceMods.RandomProcessed(f), - FSSpeciesabundanceMods.RandomPupae(f), - FSSpeciesabundanceMods.RandomSpecies(f), - FSSpeciesabundanceMods.RandomTotal(f), - FSSpeciesabundanceMods.RandomTrapdataID(f), - FSSpeciesabundanceMods.RandomUnknown(f), - FSSpeciesabundanceMods.RandomCreatedDate(f), - FSSpeciesabundanceMods.RandomCreatedUser(f), - FSSpeciesabundanceMods.RandomGeometryX(f), - FSSpeciesabundanceMods.RandomGeometryY(f), - FSSpeciesabundanceMods.RandomLastEditedDate(f), - FSSpeciesabundanceMods.RandomLastEditedUser(f), - FSSpeciesabundanceMods.RandomGlobalzscore(f), - FSSpeciesabundanceMods.RandomH3R7(f), - FSSpeciesabundanceMods.RandomH3R8(f), - FSSpeciesabundanceMods.RandomR7score(f), - FSSpeciesabundanceMods.RandomR8score(f), - FSSpeciesabundanceMods.RandomYearweek(f), - FSSpeciesabundanceMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) OrganizationID(val int32) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) OrganizationIDFunc(f func() int32) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetOrganizationID() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - 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 fsSpeciesabundanceMods) RandomOrganizationID(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) Bloodedfem(val null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Bloodedfem = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) BloodedfemFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Bloodedfem = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetBloodedfem() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Bloodedfem = 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 fsSpeciesabundanceMods) RandomBloodedfem(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Bloodedfem = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomBloodedfemNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Bloodedfem = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) Creationdate(val null.Val[int64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) CreationdateFunc(f func() null.Val[int64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetCreationdate() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Creationdate = 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 fsSpeciesabundanceMods) RandomCreationdate(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) Creator(val null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) CreatorFunc(f func() null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetCreator() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Creator = 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 fsSpeciesabundanceMods) RandomCreator(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Creator = 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 fsSpeciesabundanceMods) Eggs(val null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Eggs = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) EggsFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Eggs = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetEggs() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Eggs = 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 fsSpeciesabundanceMods) RandomEggs(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Eggs = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomEggsNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Eggs = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) Editdate(val null.Val[int64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) EditdateFunc(f func() null.Val[int64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetEditdate() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Editdate = 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 fsSpeciesabundanceMods) RandomEditdate(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) Editor(val null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) EditorFunc(f func() null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetEditor() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Editor = 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 fsSpeciesabundanceMods) RandomEditor(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Editor = 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 fsSpeciesabundanceMods) Females(val null.Val[int64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Females = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) FemalesFunc(f func() null.Val[int64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Females = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetFemales() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Females = 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 fsSpeciesabundanceMods) RandomFemales(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Females = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomFemalesNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Females = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) Gravidfem(val null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Gravidfem = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) GravidfemFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Gravidfem = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetGravidfem() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Gravidfem = 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 fsSpeciesabundanceMods) RandomGravidfem(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Gravidfem = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomGravidfemNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Gravidfem = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) Globalid(val string) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) GlobalidFunc(f func() string) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetGlobalid() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsSpeciesabundanceMods) RandomGlobalid(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) Larvae(val null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Larvae = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) LarvaeFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Larvae = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetLarvae() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Larvae = 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 fsSpeciesabundanceMods) RandomLarvae(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Larvae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomLarvaeNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Larvae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) Males(val null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Males = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) MalesFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Males = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetMales() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Males = 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 fsSpeciesabundanceMods) RandomMales(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Males = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomMalesNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Males = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) Objectid(val int32) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) ObjectidFunc(f func() int32) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetObjectid() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsSpeciesabundanceMods) RandomObjectid(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) Poolstogen(val null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Poolstogen = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) PoolstogenFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Poolstogen = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetPoolstogen() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Poolstogen = 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 fsSpeciesabundanceMods) RandomPoolstogen(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Poolstogen = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomPoolstogenNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Poolstogen = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) Processed(val null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) ProcessedFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetProcessed() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Processed = 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 fsSpeciesabundanceMods) RandomProcessed(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) Pupae(val null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Pupae = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) PupaeFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Pupae = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetPupae() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Pupae = 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 fsSpeciesabundanceMods) RandomPupae(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Pupae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomPupaeNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Pupae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) Species(val null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Species = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) SpeciesFunc(f func() null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Species = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetSpecies() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Species = 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 fsSpeciesabundanceMods) RandomSpecies(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Species = 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) RandomSpeciesNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Species = 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 fsSpeciesabundanceMods) Total(val null.Val[int64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Total = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) TotalFunc(f func() null.Val[int64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Total = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetTotal() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Total = 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 fsSpeciesabundanceMods) RandomTotal(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Total = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomTotalNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Total = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) TrapdataID(val null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.TrapdataID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) TrapdataIDFunc(f func() null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.TrapdataID = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetTrapdataID() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.TrapdataID = 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 fsSpeciesabundanceMods) RandomTrapdataID(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.TrapdataID = 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) RandomTrapdataIDNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.TrapdataID = 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 fsSpeciesabundanceMods) Unknown(val null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Unknown = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) UnknownFunc(f func() null.Val[int16]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Unknown = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetUnknown() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Unknown = 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 fsSpeciesabundanceMods) RandomUnknown(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Unknown = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomUnknownNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Unknown = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) CreatedDate(val null.Val[int64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) CreatedDateFunc(f func() null.Val[int64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetCreatedDate() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.CreatedDate = 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 fsSpeciesabundanceMods) RandomCreatedDate(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) CreatedUser(val null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) CreatedUserFunc(f func() null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetCreatedUser() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.CreatedUser = 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 fsSpeciesabundanceMods) RandomCreatedUser(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.CreatedUser = 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 fsSpeciesabundanceMods) GeometryX(val null.Val[float64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) GeometryXFunc(f func() null.Val[float64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetGeometryX() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.GeometryX = 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 fsSpeciesabundanceMods) RandomGeometryX(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - 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 fsSpeciesabundanceMods) RandomGeometryXNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.GeometryX = 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 fsSpeciesabundanceMods) GeometryY(val null.Val[float64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) GeometryYFunc(f func() null.Val[float64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetGeometryY() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.GeometryY = 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 fsSpeciesabundanceMods) RandomGeometryY(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - 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 fsSpeciesabundanceMods) RandomGeometryYNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.GeometryY = 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 fsSpeciesabundanceMods) LastEditedDate(val null.Val[int64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) LastEditedDateFunc(f func() null.Val[int64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetLastEditedDate() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.LastEditedDate = 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 fsSpeciesabundanceMods) RandomLastEditedDate(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) LastEditedUser(val null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) LastEditedUserFunc(f func() null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetLastEditedUser() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.LastEditedUser = 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 fsSpeciesabundanceMods) RandomLastEditedUser(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.LastEditedUser = 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 fsSpeciesabundanceMods) Globalzscore(val null.Val[float64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Globalzscore = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) GlobalzscoreFunc(f func() null.Val[float64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Globalzscore = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetGlobalzscore() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Globalzscore = 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 fsSpeciesabundanceMods) RandomGlobalzscore(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Globalzscore = 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 fsSpeciesabundanceMods) RandomGlobalzscoreNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Globalzscore = 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 fsSpeciesabundanceMods) H3R7(val null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.H3R7 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) H3R7Func(f func() null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.H3R7 = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetH3R7() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.H3R7 = 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 fsSpeciesabundanceMods) RandomH3R7(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.H3R7 = 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) RandomH3R7NotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.H3R7 = 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 fsSpeciesabundanceMods) H3R8(val null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.H3R8 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) H3R8Func(f func() null.Val[string]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.H3R8 = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetH3R8() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.H3R8 = 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 fsSpeciesabundanceMods) RandomH3R8(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.H3R8 = 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) RandomH3R8NotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.H3R8 = 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 fsSpeciesabundanceMods) R7score(val null.Val[float64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.R7score = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) R7scoreFunc(f func() null.Val[float64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.R7score = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetR7score() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.R7score = 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 fsSpeciesabundanceMods) RandomR7score(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.R7score = 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 fsSpeciesabundanceMods) RandomR7scoreNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.R7score = 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 fsSpeciesabundanceMods) R8score(val null.Val[float64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.R8score = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) R8scoreFunc(f func() null.Val[float64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.R8score = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetR8score() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.R8score = 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 fsSpeciesabundanceMods) RandomR8score(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.R8score = 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 fsSpeciesabundanceMods) RandomR8scoreNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.R8score = 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 fsSpeciesabundanceMods) Yearweek(val null.Val[int64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Yearweek = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) YearweekFunc(f func() null.Val[int64]) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Yearweek = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetYearweek() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Yearweek = 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 fsSpeciesabundanceMods) RandomYearweek(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Yearweek = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomYearweekNotNull(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Yearweek = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsSpeciesabundanceMods) Updated(val time.Time) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsSpeciesabundanceMods) UpdatedFunc(f func() time.Time) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsSpeciesabundanceMods) UnsetUpdated() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsSpeciesabundanceMods) RandomUpdated(f *faker.Faker) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsSpeciesabundanceMods) WithParentsCascading() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(ctx context.Context, o *FSSpeciesabundanceTemplate) { - if isDone, _ := fsSpeciesabundanceWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsSpeciesabundanceWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsSpeciesabundanceMods) WithOrganization(rel *OrganizationTemplate) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(ctx context.Context, o *FSSpeciesabundanceTemplate) { - o.r.Organization = &fsSpeciesabundanceROrganizationR{ - o: rel, - } - }) -} - -func (m fsSpeciesabundanceMods) WithNewOrganization(mods ...OrganizationMod) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(ctx context.Context, o *FSSpeciesabundanceTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsSpeciesabundanceMods) WithExistingOrganization(em *models.Organization) FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(ctx context.Context, o *FSSpeciesabundanceTemplate) { - o.r.Organization = &fsSpeciesabundanceROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsSpeciesabundanceMods) WithoutOrganization() FSSpeciesabundanceMod { - return FSSpeciesabundanceModFunc(func(ctx context.Context, o *FSSpeciesabundanceTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_stormdrain.bob.go b/db/factory/fs_stormdrain.bob.go deleted file mode 100644 index 57cf8897..00000000 --- a/db/factory/fs_stormdrain.bob.go +++ /dev/null @@ -1,1634 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSStormdrainMod interface { - Apply(context.Context, *FSStormdrainTemplate) -} - -type FSStormdrainModFunc func(context.Context, *FSStormdrainTemplate) - -func (f FSStormdrainModFunc) Apply(ctx context.Context, n *FSStormdrainTemplate) { - f(ctx, n) -} - -type FSStormdrainModSlice []FSStormdrainMod - -func (mods FSStormdrainModSlice) Apply(ctx context.Context, n *FSStormdrainTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSStormdrainTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSStormdrainTemplate struct { - OrganizationID func() int32 - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() string - Jurisdiction func() null.Val[string] - Lastaction func() null.Val[string] - Laststatus func() null.Val[string] - Lasttreatdate func() null.Val[int64] - Nexttreatmentdate func() null.Val[int64] - Objectid func() int32 - Symbology func() null.Val[string] - Type func() null.Val[string] - Zone func() null.Val[string] - 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] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Updated func() time.Time - - r fsStormdrainR - f *Factory - - alreadyPersisted bool -} - -type fsStormdrainR struct { - Organization *fsStormdrainROrganizationR -} - -type fsStormdrainROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSStormdrainTemplate -func (o *FSStormdrainTemplate) Apply(ctx context.Context, mods ...FSStormdrainMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSStormdrain -// according to the relationships in the template. Nothing is inserted into the db -func (t FSStormdrainTemplate) setModelRels(o *models.FSStormdrain) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSStormdrains = append(rel.R.FSStormdrains, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSStormdrainSetter -// this does nothing with the relationship templates -func (o FSStormdrainTemplate) BuildSetter() *models.FSStormdrainSetter { - m := &models.FSStormdrainSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.Lastaction != nil { - val := o.Lastaction() - m.Lastaction = omitnull.FromNull(val) - } - if o.Laststatus != nil { - val := o.Laststatus() - m.Laststatus = omitnull.FromNull(val) - } - if o.Lasttreatdate != nil { - val := o.Lasttreatdate() - m.Lasttreatdate = omitnull.FromNull(val) - } - if o.Nexttreatmentdate != nil { - val := o.Nexttreatmentdate() - m.Nexttreatmentdate = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Symbology != nil { - val := o.Symbology() - m.Symbology = omitnull.FromNull(val) - } - if o.Type != nil { - val := o.Type() - m.Type = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSStormdrainSetter -// this does nothing with the relationship templates -func (o FSStormdrainTemplate) BuildManySetter(number int) []*models.FSStormdrainSetter { - m := make([]*models.FSStormdrainSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSStormdrain -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSStormdrainTemplate.Create -func (o FSStormdrainTemplate) Build() *models.FSStormdrain { - m := &models.FSStormdrain{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Lastaction != nil { - m.Lastaction = o.Lastaction() - } - if o.Laststatus != nil { - m.Laststatus = o.Laststatus() - } - if o.Lasttreatdate != nil { - m.Lasttreatdate = o.Lasttreatdate() - } - if o.Nexttreatmentdate != nil { - m.Nexttreatmentdate = o.Nexttreatmentdate() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Symbology != nil { - m.Symbology = o.Symbology() - } - if o.Type != nil { - m.Type = o.Type() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSStormdrainSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSStormdrainTemplate.CreateMany -func (o FSStormdrainTemplate) BuildMany(number int) models.FSStormdrainSlice { - m := make(models.FSStormdrainSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSStormdrain(m *models.FSStormdrainSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSStormdrain -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSStormdrainTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSStormdrain) error { - var err error - - return err -} - -// Create builds a fsStormdrain and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSStormdrainTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSStormdrain, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSStormdrain(opt) - - if o.r.Organization == nil { - FSStormdrainMods.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.FSStormdrains.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 fsStormdrain and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSStormdrainTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSStormdrain { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsStormdrain 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 *FSStormdrainTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSStormdrain { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsStormdrains and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSStormdrainTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSStormdrainSlice, error) { - var err error - m := make(models.FSStormdrainSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsStormdrains and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSStormdrainTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSStormdrainSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsStormdrains 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 FSStormdrainTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSStormdrainSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSStormdrain has methods that act as mods for the FSStormdrainTemplate -var FSStormdrainMods fsStormdrainMods - -type fsStormdrainMods struct{} - -func (m fsStormdrainMods) RandomizeAllColumns(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModSlice{ - FSStormdrainMods.RandomOrganizationID(f), - FSStormdrainMods.RandomCreationdate(f), - FSStormdrainMods.RandomCreator(f), - FSStormdrainMods.RandomEditdate(f), - FSStormdrainMods.RandomEditor(f), - FSStormdrainMods.RandomGlobalid(f), - FSStormdrainMods.RandomJurisdiction(f), - FSStormdrainMods.RandomLastaction(f), - FSStormdrainMods.RandomLaststatus(f), - FSStormdrainMods.RandomLasttreatdate(f), - FSStormdrainMods.RandomNexttreatmentdate(f), - FSStormdrainMods.RandomObjectid(f), - FSStormdrainMods.RandomSymbology(f), - FSStormdrainMods.RandomType(f), - FSStormdrainMods.RandomZone(f), - FSStormdrainMods.RandomZone2(f), - FSStormdrainMods.RandomCreatedDate(f), - FSStormdrainMods.RandomCreatedUser(f), - FSStormdrainMods.RandomGeometryX(f), - FSStormdrainMods.RandomGeometryY(f), - FSStormdrainMods.RandomLastEditedDate(f), - FSStormdrainMods.RandomLastEditedUser(f), - FSStormdrainMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsStormdrainMods) OrganizationID(val int32) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) OrganizationIDFunc(f func() int32) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetOrganizationID() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - 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 fsStormdrainMods) RandomOrganizationID(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsStormdrainMods) Creationdate(val null.Val[int64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) CreationdateFunc(f func() null.Val[int64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetCreationdate() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Creationdate = 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 fsStormdrainMods) RandomCreationdate(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsStormdrainMods) Creator(val null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) CreatorFunc(f func() null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetCreator() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Creator = 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 fsStormdrainMods) RandomCreator(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Creator = 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 fsStormdrainMods) Editdate(val null.Val[int64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) EditdateFunc(f func() null.Val[int64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetEditdate() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Editdate = 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 fsStormdrainMods) RandomEditdate(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsStormdrainMods) Editor(val null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) EditorFunc(f func() null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetEditor() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Editor = 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 fsStormdrainMods) RandomEditor(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Editor = 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 fsStormdrainMods) Globalid(val string) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) GlobalidFunc(f func() string) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetGlobalid() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsStormdrainMods) RandomGlobalid(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsStormdrainMods) Jurisdiction(val null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) JurisdictionFunc(f func() null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetJurisdiction() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Jurisdiction = 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 fsStormdrainMods) RandomJurisdiction(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Jurisdiction = 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) RandomJurisdictionNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Jurisdiction = 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 fsStormdrainMods) Lastaction(val null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Lastaction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) LastactionFunc(f func() null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Lastaction = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetLastaction() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Lastaction = 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 fsStormdrainMods) RandomLastaction(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Lastaction = 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) RandomLastactionNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Lastaction = 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 fsStormdrainMods) Laststatus(val null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Laststatus = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) LaststatusFunc(f func() null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Laststatus = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetLaststatus() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Laststatus = 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 fsStormdrainMods) RandomLaststatus(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Laststatus = 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) RandomLaststatusNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Laststatus = 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 fsStormdrainMods) Lasttreatdate(val null.Val[int64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Lasttreatdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) LasttreatdateFunc(f func() null.Val[int64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Lasttreatdate = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetLasttreatdate() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Lasttreatdate = 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 fsStormdrainMods) RandomLasttreatdate(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLasttreatdateNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsStormdrainMods) Nexttreatmentdate(val null.Val[int64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Nexttreatmentdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) NexttreatmentdateFunc(f func() null.Val[int64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Nexttreatmentdate = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetNexttreatmentdate() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Nexttreatmentdate = 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 fsStormdrainMods) RandomNexttreatmentdate(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Nexttreatmentdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomNexttreatmentdateNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Nexttreatmentdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsStormdrainMods) Objectid(val int32) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) ObjectidFunc(f func() int32) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetObjectid() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsStormdrainMods) RandomObjectid(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsStormdrainMods) Symbology(val null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Symbology = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) SymbologyFunc(f func() null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Symbology = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetSymbology() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Symbology = 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 fsStormdrainMods) RandomSymbology(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Symbology = 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) RandomSymbologyNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Symbology = 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 fsStormdrainMods) Type(val null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Type = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) TypeFunc(f func() null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetType() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - 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 fsStormdrainMods) RandomType(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - 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 fsStormdrainMods) RandomTypeNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Type = 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 fsStormdrainMods) Zone(val null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) ZoneFunc(f func() null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetZone() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Zone = 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 fsStormdrainMods) RandomZone(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Zone = 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) RandomZoneNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Zone = 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 fsStormdrainMods) Zone2(val null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) Zone2Func(f func() null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetZone2() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Zone2 = 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 fsStormdrainMods) RandomZone2(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Zone2 = 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) RandomZone2NotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Zone2 = 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 fsStormdrainMods) CreatedDate(val null.Val[int64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) CreatedDateFunc(f func() null.Val[int64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetCreatedDate() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.CreatedDate = 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 fsStormdrainMods) RandomCreatedDate(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsStormdrainMods) CreatedUser(val null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) CreatedUserFunc(f func() null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetCreatedUser() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.CreatedUser = 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 fsStormdrainMods) RandomCreatedUser(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.CreatedUser = 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 fsStormdrainMods) GeometryX(val null.Val[float64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) GeometryXFunc(f func() null.Val[float64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetGeometryX() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.GeometryX = 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 fsStormdrainMods) RandomGeometryX(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - 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 fsStormdrainMods) RandomGeometryXNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.GeometryX = 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 fsStormdrainMods) GeometryY(val null.Val[float64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) GeometryYFunc(f func() null.Val[float64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetGeometryY() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.GeometryY = 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 fsStormdrainMods) RandomGeometryY(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - 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 fsStormdrainMods) RandomGeometryYNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.GeometryY = 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 fsStormdrainMods) LastEditedDate(val null.Val[int64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) LastEditedDateFunc(f func() null.Val[int64]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetLastEditedDate() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.LastEditedDate = 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 fsStormdrainMods) RandomLastEditedDate(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsStormdrainMods) LastEditedUser(val null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) LastEditedUserFunc(f func() null.Val[string]) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetLastEditedUser() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.LastEditedUser = 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 fsStormdrainMods) RandomLastEditedUser(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.LastEditedUser = 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 fsStormdrainMods) Updated(val time.Time) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsStormdrainMods) UpdatedFunc(f func() time.Time) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsStormdrainMods) UnsetUpdated() FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsStormdrainMods) RandomUpdated(f *faker.Faker) FSStormdrainMod { - return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsStormdrainMods) WithParentsCascading() FSStormdrainMod { - return FSStormdrainModFunc(func(ctx context.Context, o *FSStormdrainTemplate) { - if isDone, _ := fsStormdrainWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsStormdrainWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsStormdrainMods) WithOrganization(rel *OrganizationTemplate) FSStormdrainMod { - return FSStormdrainModFunc(func(ctx context.Context, o *FSStormdrainTemplate) { - o.r.Organization = &fsStormdrainROrganizationR{ - o: rel, - } - }) -} - -func (m fsStormdrainMods) WithNewOrganization(mods ...OrganizationMod) FSStormdrainMod { - return FSStormdrainModFunc(func(ctx context.Context, o *FSStormdrainTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsStormdrainMods) WithExistingOrganization(em *models.Organization) FSStormdrainMod { - return FSStormdrainModFunc(func(ctx context.Context, o *FSStormdrainTemplate) { - o.r.Organization = &fsStormdrainROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsStormdrainMods) WithoutOrganization() FSStormdrainMod { - return FSStormdrainModFunc(func(ctx context.Context, o *FSStormdrainTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_timecard.bob.go b/db/factory/fs_timecard.bob.go deleted file mode 100644 index d15333d6..00000000 --- a/db/factory/fs_timecard.bob.go +++ /dev/null @@ -1,2192 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSTimecardMod interface { - Apply(context.Context, *FSTimecardTemplate) -} - -type FSTimecardModFunc func(context.Context, *FSTimecardTemplate) - -func (f FSTimecardModFunc) Apply(ctx context.Context, n *FSTimecardTemplate) { - f(ctx, n) -} - -type FSTimecardModSlice []FSTimecardMod - -func (mods FSTimecardModSlice) Apply(ctx context.Context, n *FSTimecardTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSTimecardTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSTimecardTemplate struct { - OrganizationID func() int32 - Activity func() null.Val[string] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Enddatetime func() null.Val[int64] - Equiptype func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fieldtech func() null.Val[string] - Globalid func() string - Lclocid func() null.Val[string] - Linelocid func() null.Val[string] - Locationname func() null.Val[string] - Objectid func() int32 - Pointlocid func() null.Val[string] - Polygonlocid func() null.Val[string] - Samplelocid func() null.Val[string] - Srid func() null.Val[string] - Startdatetime func() null.Val[int64] - Traplocid func() null.Val[string] - Zone func() null.Val[string] - 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] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Rodentlocid func() null.Val[string] - Updated func() time.Time - - r fsTimecardR - f *Factory - - alreadyPersisted bool -} - -type fsTimecardR struct { - Organization *fsTimecardROrganizationR -} - -type fsTimecardROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSTimecardTemplate -func (o *FSTimecardTemplate) Apply(ctx context.Context, mods ...FSTimecardMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSTimecard -// according to the relationships in the template. Nothing is inserted into the db -func (t FSTimecardTemplate) setModelRels(o *models.FSTimecard) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSTimecards = append(rel.R.FSTimecards, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSTimecardSetter -// this does nothing with the relationship templates -func (o FSTimecardTemplate) BuildSetter() *models.FSTimecardSetter { - m := &models.FSTimecardSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Activity != nil { - val := o.Activity() - m.Activity = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Equiptype != nil { - val := o.Equiptype() - m.Equiptype = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Lclocid != nil { - val := o.Lclocid() - m.Lclocid = omitnull.FromNull(val) - } - if o.Linelocid != nil { - val := o.Linelocid() - m.Linelocid = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Pointlocid != nil { - val := o.Pointlocid() - m.Pointlocid = omitnull.FromNull(val) - } - if o.Polygonlocid != nil { - val := o.Polygonlocid() - m.Polygonlocid = omitnull.FromNull(val) - } - if o.Samplelocid != nil { - val := o.Samplelocid() - m.Samplelocid = omitnull.FromNull(val) - } - if o.Srid != nil { - val := o.Srid() - m.Srid = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Traplocid != nil { - val := o.Traplocid() - m.Traplocid = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Rodentlocid != nil { - val := o.Rodentlocid() - m.Rodentlocid = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSTimecardSetter -// this does nothing with the relationship templates -func (o FSTimecardTemplate) BuildManySetter(number int) []*models.FSTimecardSetter { - m := make([]*models.FSTimecardSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSTimecard -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSTimecardTemplate.Create -func (o FSTimecardTemplate) Build() *models.FSTimecard { - m := &models.FSTimecard{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Activity != nil { - m.Activity = o.Activity() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Equiptype != nil { - m.Equiptype = o.Equiptype() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Lclocid != nil { - m.Lclocid = o.Lclocid() - } - if o.Linelocid != nil { - m.Linelocid = o.Linelocid() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Pointlocid != nil { - m.Pointlocid = o.Pointlocid() - } - if o.Polygonlocid != nil { - m.Polygonlocid = o.Polygonlocid() - } - if o.Samplelocid != nil { - m.Samplelocid = o.Samplelocid() - } - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Traplocid != nil { - m.Traplocid = o.Traplocid() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Rodentlocid != nil { - m.Rodentlocid = o.Rodentlocid() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSTimecardSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSTimecardTemplate.CreateMany -func (o FSTimecardTemplate) BuildMany(number int) models.FSTimecardSlice { - m := make(models.FSTimecardSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSTimecard(m *models.FSTimecardSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSTimecard -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSTimecardTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSTimecard) error { - var err error - - return err -} - -// Create builds a fsTimecard and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSTimecardTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSTimecard, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSTimecard(opt) - - if o.r.Organization == nil { - FSTimecardMods.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.FSTimecards.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 fsTimecard and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSTimecardTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSTimecard { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsTimecard 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 *FSTimecardTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSTimecard { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsTimecards and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSTimecardTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSTimecardSlice, error) { - var err error - m := make(models.FSTimecardSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsTimecards and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSTimecardTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSTimecardSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsTimecards 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 FSTimecardTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSTimecardSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSTimecard has methods that act as mods for the FSTimecardTemplate -var FSTimecardMods fsTimecardMods - -type fsTimecardMods struct{} - -func (m fsTimecardMods) RandomizeAllColumns(f *faker.Faker) FSTimecardMod { - return FSTimecardModSlice{ - FSTimecardMods.RandomOrganizationID(f), - FSTimecardMods.RandomActivity(f), - FSTimecardMods.RandomComments(f), - FSTimecardMods.RandomCreationdate(f), - FSTimecardMods.RandomCreator(f), - FSTimecardMods.RandomEnddatetime(f), - FSTimecardMods.RandomEquiptype(f), - FSTimecardMods.RandomExternalid(f), - FSTimecardMods.RandomEditdate(f), - FSTimecardMods.RandomEditor(f), - FSTimecardMods.RandomFieldtech(f), - FSTimecardMods.RandomGlobalid(f), - FSTimecardMods.RandomLclocid(f), - FSTimecardMods.RandomLinelocid(f), - FSTimecardMods.RandomLocationname(f), - FSTimecardMods.RandomObjectid(f), - FSTimecardMods.RandomPointlocid(f), - FSTimecardMods.RandomPolygonlocid(f), - FSTimecardMods.RandomSamplelocid(f), - FSTimecardMods.RandomSrid(f), - FSTimecardMods.RandomStartdatetime(f), - FSTimecardMods.RandomTraplocid(f), - FSTimecardMods.RandomZone(f), - FSTimecardMods.RandomZone2(f), - FSTimecardMods.RandomCreatedDate(f), - FSTimecardMods.RandomCreatedUser(f), - FSTimecardMods.RandomGeometryX(f), - FSTimecardMods.RandomGeometryY(f), - FSTimecardMods.RandomLastEditedDate(f), - FSTimecardMods.RandomLastEditedUser(f), - FSTimecardMods.RandomRodentlocid(f), - FSTimecardMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsTimecardMods) OrganizationID(val int32) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) OrganizationIDFunc(f func() int32) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetOrganizationID() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - 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 fsTimecardMods) RandomOrganizationID(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsTimecardMods) Activity(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Activity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) ActivityFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Activity = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetActivity() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Activity = 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 fsTimecardMods) RandomActivity(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Activity = 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) RandomActivityNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Activity = 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 fsTimecardMods) Comments(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) CommentsFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetComments() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Comments = 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 fsTimecardMods) RandomComments(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Comments = 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 fsTimecardMods) Creationdate(val null.Val[int64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) CreationdateFunc(f func() null.Val[int64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetCreationdate() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Creationdate = 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 fsTimecardMods) RandomCreationdate(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTimecardMods) Creator(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) CreatorFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetCreator() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Creator = 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 fsTimecardMods) RandomCreator(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Creator = 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 fsTimecardMods) Enddatetime(val null.Val[int64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Enddatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) EnddatetimeFunc(f func() null.Val[int64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetEnddatetime() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Enddatetime = 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 fsTimecardMods) RandomEnddatetime(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTimecardMods) Equiptype(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Equiptype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) EquiptypeFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Equiptype = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetEquiptype() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Equiptype = 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 fsTimecardMods) RandomEquiptype(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Equiptype = 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) RandomEquiptypeNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Equiptype = 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 fsTimecardMods) Externalid(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) ExternalidFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetExternalid() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Externalid = 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 fsTimecardMods) RandomExternalid(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Externalid = 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) RandomExternalidNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Externalid = 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 fsTimecardMods) Editdate(val null.Val[int64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) EditdateFunc(f func() null.Val[int64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetEditdate() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Editdate = 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 fsTimecardMods) RandomEditdate(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTimecardMods) Editor(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) EditorFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetEditor() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Editor = 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 fsTimecardMods) RandomEditor(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Editor = 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 fsTimecardMods) Fieldtech(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) FieldtechFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetFieldtech() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Fieldtech = 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 fsTimecardMods) RandomFieldtech(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Fieldtech = 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) RandomFieldtechNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Fieldtech = 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 fsTimecardMods) Globalid(val string) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) GlobalidFunc(f func() string) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetGlobalid() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsTimecardMods) RandomGlobalid(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsTimecardMods) Lclocid(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Lclocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) LclocidFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Lclocid = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetLclocid() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Lclocid = 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 fsTimecardMods) RandomLclocid(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Lclocid = 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) RandomLclocidNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Lclocid = 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 fsTimecardMods) Linelocid(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Linelocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) LinelocidFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Linelocid = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetLinelocid() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Linelocid = 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 fsTimecardMods) RandomLinelocid(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Linelocid = 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) RandomLinelocidNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Linelocid = 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 fsTimecardMods) Locationname(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) LocationnameFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetLocationname() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Locationname = 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 fsTimecardMods) RandomLocationname(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Locationname = 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) RandomLocationnameNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Locationname = 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 fsTimecardMods) Objectid(val int32) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) ObjectidFunc(f func() int32) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetObjectid() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsTimecardMods) RandomObjectid(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsTimecardMods) Pointlocid(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Pointlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) PointlocidFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Pointlocid = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetPointlocid() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Pointlocid = 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 fsTimecardMods) RandomPointlocid(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Pointlocid = 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) RandomPointlocidNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Pointlocid = 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 fsTimecardMods) Polygonlocid(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Polygonlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) PolygonlocidFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Polygonlocid = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetPolygonlocid() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Polygonlocid = 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 fsTimecardMods) RandomPolygonlocid(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Polygonlocid = 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) RandomPolygonlocidNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Polygonlocid = 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 fsTimecardMods) Samplelocid(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Samplelocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) SamplelocidFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Samplelocid = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetSamplelocid() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Samplelocid = 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 fsTimecardMods) RandomSamplelocid(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Samplelocid = 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) RandomSamplelocidNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Samplelocid = 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 fsTimecardMods) Srid(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Srid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) SridFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetSrid() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - 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 fsTimecardMods) RandomSrid(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Srid = 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) RandomSridNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Srid = 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 fsTimecardMods) Startdatetime(val null.Val[int64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Startdatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) StartdatetimeFunc(f func() null.Val[int64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetStartdatetime() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Startdatetime = 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 fsTimecardMods) RandomStartdatetime(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTimecardMods) Traplocid(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Traplocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) TraplocidFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Traplocid = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetTraplocid() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Traplocid = 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 fsTimecardMods) RandomTraplocid(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Traplocid = 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) RandomTraplocidNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Traplocid = 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 fsTimecardMods) Zone(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) ZoneFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetZone() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Zone = 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 fsTimecardMods) RandomZone(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Zone = 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) RandomZoneNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Zone = 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 fsTimecardMods) Zone2(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) Zone2Func(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetZone2() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Zone2 = 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 fsTimecardMods) RandomZone2(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Zone2 = 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) RandomZone2NotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Zone2 = 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 fsTimecardMods) CreatedDate(val null.Val[int64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) CreatedDateFunc(f func() null.Val[int64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetCreatedDate() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.CreatedDate = 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 fsTimecardMods) RandomCreatedDate(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTimecardMods) CreatedUser(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) CreatedUserFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetCreatedUser() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.CreatedUser = 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 fsTimecardMods) RandomCreatedUser(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.CreatedUser = 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 fsTimecardMods) GeometryX(val null.Val[float64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) GeometryXFunc(f func() null.Val[float64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetGeometryX() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.GeometryX = 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 fsTimecardMods) RandomGeometryX(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - 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 fsTimecardMods) RandomGeometryXNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.GeometryX = 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 fsTimecardMods) GeometryY(val null.Val[float64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) GeometryYFunc(f func() null.Val[float64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetGeometryY() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.GeometryY = 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 fsTimecardMods) RandomGeometryY(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - 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 fsTimecardMods) RandomGeometryYNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.GeometryY = 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 fsTimecardMods) LastEditedDate(val null.Val[int64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) LastEditedDateFunc(f func() null.Val[int64]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetLastEditedDate() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.LastEditedDate = 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 fsTimecardMods) RandomLastEditedDate(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTimecardMods) LastEditedUser(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) LastEditedUserFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetLastEditedUser() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.LastEditedUser = 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 fsTimecardMods) RandomLastEditedUser(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.LastEditedUser = 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 fsTimecardMods) Rodentlocid(val null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Rodentlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) RodentlocidFunc(f func() null.Val[string]) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Rodentlocid = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetRodentlocid() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Rodentlocid = 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 fsTimecardMods) RandomRodentlocid(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Rodentlocid = 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) RandomRodentlocidNotNull(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Rodentlocid = 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 fsTimecardMods) Updated(val time.Time) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsTimecardMods) UpdatedFunc(f func() time.Time) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsTimecardMods) UnsetUpdated() FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsTimecardMods) RandomUpdated(f *faker.Faker) FSTimecardMod { - return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsTimecardMods) WithParentsCascading() FSTimecardMod { - return FSTimecardModFunc(func(ctx context.Context, o *FSTimecardTemplate) { - if isDone, _ := fsTimecardWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsTimecardWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsTimecardMods) WithOrganization(rel *OrganizationTemplate) FSTimecardMod { - return FSTimecardModFunc(func(ctx context.Context, o *FSTimecardTemplate) { - o.r.Organization = &fsTimecardROrganizationR{ - o: rel, - } - }) -} - -func (m fsTimecardMods) WithNewOrganization(mods ...OrganizationMod) FSTimecardMod { - return FSTimecardModFunc(func(ctx context.Context, o *FSTimecardTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsTimecardMods) WithExistingOrganization(em *models.Organization) FSTimecardMod { - return FSTimecardModFunc(func(ctx context.Context, o *FSTimecardTemplate) { - o.r.Organization = &fsTimecardROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsTimecardMods) WithoutOrganization() FSTimecardMod { - return FSTimecardModFunc(func(ctx context.Context, o *FSTimecardTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_trapdata.bob.go b/db/factory/fs_trapdata.bob.go deleted file mode 100644 index a7c8d426..00000000 --- a/db/factory/fs_trapdata.bob.go +++ /dev/null @@ -1,3060 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSTrapdatumMod interface { - Apply(context.Context, *FSTrapdatumTemplate) -} - -type FSTrapdatumModFunc func(context.Context, *FSTrapdatumTemplate) - -func (f FSTrapdatumModFunc) Apply(ctx context.Context, n *FSTrapdatumTemplate) { - f(ctx, n) -} - -type FSTrapdatumModSlice []FSTrapdatumMod - -func (mods FSTrapdatumModSlice) Apply(ctx context.Context, n *FSTrapdatumTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSTrapdatumTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSTrapdatumTemplate struct { - OrganizationID func() int32 - Avetemp func() null.Val[float64] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Enddatetime func() null.Val[int64] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fieldtech func() null.Val[string] - Field func() null.Val[int64] - Gatewaysync func() null.Val[int16] - Globalid func() string - Idbytech func() null.Val[string] - Locationname func() null.Val[string] - LocID func() null.Val[string] - LR func() null.Val[int16] - Objectid func() int32 - Processed func() null.Val[int16] - Raingauge func() null.Val[float64] - Recordstatus func() null.Val[int16] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[int64] - Sitecond func() null.Val[string] - Sortbytech func() null.Val[string] - Srid func() null.Val[string] - Startdatetime func() null.Val[int64] - Trapactivitytype func() null.Val[string] - Trapcondition func() null.Val[string] - Trapnights func() null.Val[int16] - Traptype func() null.Val[string] - Voltage func() null.Val[float64] - Winddir func() null.Val[string] - Windspeed func() null.Val[float64] - Zone func() null.Val[string] - 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] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Lure func() null.Val[string] - Vectorsurvtrapdataid func() null.Val[string] - Vectorsurvtraplocationid func() null.Val[string] - Updated func() time.Time - - r fsTrapdatumR - f *Factory - - alreadyPersisted bool -} - -type fsTrapdatumR struct { - Organization *fsTrapdatumROrganizationR -} - -type fsTrapdatumROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSTrapdatumTemplate -func (o *FSTrapdatumTemplate) Apply(ctx context.Context, mods ...FSTrapdatumMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSTrapdatum -// according to the relationships in the template. Nothing is inserted into the db -func (t FSTrapdatumTemplate) setModelRels(o *models.FSTrapdatum) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSTrapdata = append(rel.R.FSTrapdata, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSTrapdatumSetter -// this does nothing with the relationship templates -func (o FSTrapdatumTemplate) BuildSetter() *models.FSTrapdatumSetter { - m := &models.FSTrapdatumSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Avetemp != nil { - val := o.Avetemp() - m.Avetemp = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Field != nil { - val := o.Field() - m.Field = omitnull.FromNull(val) - } - if o.Gatewaysync != nil { - val := o.Gatewaysync() - m.Gatewaysync = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Idbytech != nil { - val := o.Idbytech() - m.Idbytech = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.LocID != nil { - val := o.LocID() - m.LocID = omitnull.FromNull(val) - } - if o.LR != nil { - val := o.LR() - m.LR = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.Raingauge != nil { - val := o.Raingauge() - m.Raingauge = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Reviewed != nil { - val := o.Reviewed() - m.Reviewed = omitnull.FromNull(val) - } - if o.Reviewedby != nil { - val := o.Reviewedby() - m.Reviewedby = omitnull.FromNull(val) - } - if o.Revieweddate != nil { - val := o.Revieweddate() - m.Revieweddate = omitnull.FromNull(val) - } - if o.Sitecond != nil { - val := o.Sitecond() - m.Sitecond = omitnull.FromNull(val) - } - if o.Sortbytech != nil { - val := o.Sortbytech() - m.Sortbytech = omitnull.FromNull(val) - } - if o.Srid != nil { - val := o.Srid() - m.Srid = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Trapactivitytype != nil { - val := o.Trapactivitytype() - m.Trapactivitytype = omitnull.FromNull(val) - } - if o.Trapcondition != nil { - val := o.Trapcondition() - m.Trapcondition = omitnull.FromNull(val) - } - if o.Trapnights != nil { - val := o.Trapnights() - m.Trapnights = omitnull.FromNull(val) - } - if o.Traptype != nil { - val := o.Traptype() - m.Traptype = omitnull.FromNull(val) - } - if o.Voltage != nil { - val := o.Voltage() - m.Voltage = omitnull.FromNull(val) - } - if o.Winddir != nil { - val := o.Winddir() - m.Winddir = omitnull.FromNull(val) - } - if o.Windspeed != nil { - val := o.Windspeed() - m.Windspeed = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Lure != nil { - val := o.Lure() - m.Lure = omitnull.FromNull(val) - } - if o.Vectorsurvtrapdataid != nil { - val := o.Vectorsurvtrapdataid() - m.Vectorsurvtrapdataid = omitnull.FromNull(val) - } - if o.Vectorsurvtraplocationid != nil { - val := o.Vectorsurvtraplocationid() - m.Vectorsurvtraplocationid = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSTrapdatumSetter -// this does nothing with the relationship templates -func (o FSTrapdatumTemplate) BuildManySetter(number int) []*models.FSTrapdatumSetter { - m := make([]*models.FSTrapdatumSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSTrapdatum -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSTrapdatumTemplate.Create -func (o FSTrapdatumTemplate) Build() *models.FSTrapdatum { - m := &models.FSTrapdatum{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Avetemp != nil { - m.Avetemp = o.Avetemp() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Field != nil { - m.Field = o.Field() - } - if o.Gatewaysync != nil { - m.Gatewaysync = o.Gatewaysync() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Idbytech != nil { - m.Idbytech = o.Idbytech() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.LocID != nil { - m.LocID = o.LocID() - } - if o.LR != nil { - m.LR = o.LR() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.Raingauge != nil { - m.Raingauge = o.Raingauge() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Reviewed != nil { - m.Reviewed = o.Reviewed() - } - if o.Reviewedby != nil { - m.Reviewedby = o.Reviewedby() - } - if o.Revieweddate != nil { - m.Revieweddate = o.Revieweddate() - } - if o.Sitecond != nil { - m.Sitecond = o.Sitecond() - } - if o.Sortbytech != nil { - m.Sortbytech = o.Sortbytech() - } - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Trapactivitytype != nil { - m.Trapactivitytype = o.Trapactivitytype() - } - if o.Trapcondition != nil { - m.Trapcondition = o.Trapcondition() - } - if o.Trapnights != nil { - m.Trapnights = o.Trapnights() - } - if o.Traptype != nil { - m.Traptype = o.Traptype() - } - if o.Voltage != nil { - m.Voltage = o.Voltage() - } - if o.Winddir != nil { - m.Winddir = o.Winddir() - } - if o.Windspeed != nil { - m.Windspeed = o.Windspeed() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Lure != nil { - m.Lure = o.Lure() - } - if o.Vectorsurvtrapdataid != nil { - m.Vectorsurvtrapdataid = o.Vectorsurvtrapdataid() - } - if o.Vectorsurvtraplocationid != nil { - m.Vectorsurvtraplocationid = o.Vectorsurvtraplocationid() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSTrapdatumSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSTrapdatumTemplate.CreateMany -func (o FSTrapdatumTemplate) BuildMany(number int) models.FSTrapdatumSlice { - m := make(models.FSTrapdatumSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSTrapdatum(m *models.FSTrapdatumSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSTrapdatum -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSTrapdatumTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSTrapdatum) error { - var err error - - return err -} - -// Create builds a fsTrapdatum and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSTrapdatumTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSTrapdatum, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSTrapdatum(opt) - - if o.r.Organization == nil { - FSTrapdatumMods.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.FSTrapdata.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 fsTrapdatum and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSTrapdatumTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSTrapdatum { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsTrapdatum 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 *FSTrapdatumTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSTrapdatum { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsTrapdata and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSTrapdatumTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSTrapdatumSlice, error) { - var err error - m := make(models.FSTrapdatumSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsTrapdata and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSTrapdatumTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSTrapdatumSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsTrapdata 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 FSTrapdatumTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSTrapdatumSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSTrapdatum has methods that act as mods for the FSTrapdatumTemplate -var FSTrapdatumMods fsTrapdatumMods - -type fsTrapdatumMods struct{} - -func (m fsTrapdatumMods) RandomizeAllColumns(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModSlice{ - FSTrapdatumMods.RandomOrganizationID(f), - FSTrapdatumMods.RandomAvetemp(f), - FSTrapdatumMods.RandomComments(f), - FSTrapdatumMods.RandomCreationdate(f), - FSTrapdatumMods.RandomCreator(f), - FSTrapdatumMods.RandomEnddatetime(f), - FSTrapdatumMods.RandomEditdate(f), - FSTrapdatumMods.RandomEditor(f), - FSTrapdatumMods.RandomFieldtech(f), - FSTrapdatumMods.RandomField(f), - FSTrapdatumMods.RandomGatewaysync(f), - FSTrapdatumMods.RandomGlobalid(f), - FSTrapdatumMods.RandomIdbytech(f), - FSTrapdatumMods.RandomLocationname(f), - FSTrapdatumMods.RandomLocID(f), - FSTrapdatumMods.RandomLR(f), - FSTrapdatumMods.RandomObjectid(f), - FSTrapdatumMods.RandomProcessed(f), - FSTrapdatumMods.RandomRaingauge(f), - FSTrapdatumMods.RandomRecordstatus(f), - FSTrapdatumMods.RandomReviewed(f), - FSTrapdatumMods.RandomReviewedby(f), - FSTrapdatumMods.RandomRevieweddate(f), - FSTrapdatumMods.RandomSitecond(f), - FSTrapdatumMods.RandomSortbytech(f), - FSTrapdatumMods.RandomSrid(f), - FSTrapdatumMods.RandomStartdatetime(f), - FSTrapdatumMods.RandomTrapactivitytype(f), - FSTrapdatumMods.RandomTrapcondition(f), - FSTrapdatumMods.RandomTrapnights(f), - FSTrapdatumMods.RandomTraptype(f), - FSTrapdatumMods.RandomVoltage(f), - FSTrapdatumMods.RandomWinddir(f), - FSTrapdatumMods.RandomWindspeed(f), - FSTrapdatumMods.RandomZone(f), - FSTrapdatumMods.RandomZone2(f), - FSTrapdatumMods.RandomCreatedDate(f), - FSTrapdatumMods.RandomCreatedUser(f), - FSTrapdatumMods.RandomGeometryX(f), - FSTrapdatumMods.RandomGeometryY(f), - FSTrapdatumMods.RandomLastEditedDate(f), - FSTrapdatumMods.RandomLastEditedUser(f), - FSTrapdatumMods.RandomLure(f), - FSTrapdatumMods.RandomVectorsurvtrapdataid(f), - FSTrapdatumMods.RandomVectorsurvtraplocationid(f), - FSTrapdatumMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsTrapdatumMods) OrganizationID(val int32) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) OrganizationIDFunc(f func() int32) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetOrganizationID() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - 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 fsTrapdatumMods) RandomOrganizationID(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) Avetemp(val null.Val[float64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Avetemp = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) AvetempFunc(f func() null.Val[float64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Avetemp = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetAvetemp() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Avetemp = 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 fsTrapdatumMods) RandomAvetemp(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Avetemp = 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 fsTrapdatumMods) RandomAvetempNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Avetemp = 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 fsTrapdatumMods) Comments(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) CommentsFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetComments() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Comments = 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 fsTrapdatumMods) RandomComments(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Comments = 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 fsTrapdatumMods) Creationdate(val null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) CreationdateFunc(f func() null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetCreationdate() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Creationdate = 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 fsTrapdatumMods) RandomCreationdate(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) Creator(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) CreatorFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetCreator() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Creator = 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 fsTrapdatumMods) RandomCreator(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Creator = 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 fsTrapdatumMods) Enddatetime(val null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Enddatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) EnddatetimeFunc(f func() null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetEnddatetime() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Enddatetime = 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 fsTrapdatumMods) RandomEnddatetime(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) Editdate(val null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) EditdateFunc(f func() null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetEditdate() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Editdate = 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 fsTrapdatumMods) RandomEditdate(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) Editor(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) EditorFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetEditor() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Editor = 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 fsTrapdatumMods) RandomEditor(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Editor = 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 fsTrapdatumMods) Fieldtech(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) FieldtechFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetFieldtech() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Fieldtech = 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 fsTrapdatumMods) RandomFieldtech(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Fieldtech = 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) RandomFieldtechNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Fieldtech = 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 fsTrapdatumMods) Field(val null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Field = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) FieldFunc(f func() null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Field = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetField() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Field = 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 fsTrapdatumMods) RandomField(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Field = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomFieldNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Field = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) Gatewaysync(val null.Val[int16]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Gatewaysync = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) GatewaysyncFunc(f func() null.Val[int16]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Gatewaysync = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetGatewaysync() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Gatewaysync = 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 fsTrapdatumMods) RandomGatewaysync(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomGatewaysyncNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) Globalid(val string) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) GlobalidFunc(f func() string) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetGlobalid() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsTrapdatumMods) RandomGlobalid(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) Idbytech(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Idbytech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) IdbytechFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Idbytech = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetIdbytech() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Idbytech = 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 fsTrapdatumMods) RandomIdbytech(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Idbytech = 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) RandomIdbytechNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Idbytech = 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 fsTrapdatumMods) Locationname(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) LocationnameFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetLocationname() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Locationname = 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 fsTrapdatumMods) RandomLocationname(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Locationname = 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) RandomLocationnameNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Locationname = 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 fsTrapdatumMods) LocID(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LocID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) LocIDFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LocID = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetLocID() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LocID = 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 fsTrapdatumMods) RandomLocID(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LocID = 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) RandomLocIDNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LocID = 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 fsTrapdatumMods) LR(val null.Val[int16]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LR = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) LRFunc(f func() null.Val[int16]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LR = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetLR() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LR = 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 fsTrapdatumMods) RandomLR(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LR = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomLRNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LR = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) Objectid(val int32) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) ObjectidFunc(f func() int32) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetObjectid() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsTrapdatumMods) RandomObjectid(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) Processed(val null.Val[int16]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) ProcessedFunc(f func() null.Val[int16]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetProcessed() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Processed = 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 fsTrapdatumMods) RandomProcessed(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomProcessedNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) Raingauge(val null.Val[float64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Raingauge = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) RaingaugeFunc(f func() null.Val[float64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Raingauge = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetRaingauge() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Raingauge = 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 fsTrapdatumMods) RandomRaingauge(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Raingauge = 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 fsTrapdatumMods) RandomRaingaugeNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Raingauge = 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 fsTrapdatumMods) Recordstatus(val null.Val[int16]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) RecordstatusFunc(f func() null.Val[int16]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetRecordstatus() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Recordstatus = 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 fsTrapdatumMods) RandomRecordstatus(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) Reviewed(val null.Val[int16]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) ReviewedFunc(f func() null.Val[int16]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetReviewed() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Reviewed = 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 fsTrapdatumMods) RandomReviewed(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) Reviewedby(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) ReviewedbyFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetReviewedby() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Reviewedby = 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 fsTrapdatumMods) RandomReviewedby(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Reviewedby = 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) RandomReviewedbyNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Reviewedby = 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 fsTrapdatumMods) Revieweddate(val null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Revieweddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) RevieweddateFunc(f func() null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetRevieweddate() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Revieweddate = 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 fsTrapdatumMods) RandomRevieweddate(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) Sitecond(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Sitecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) SitecondFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Sitecond = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetSitecond() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Sitecond = 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 fsTrapdatumMods) RandomSitecond(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Sitecond = 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) RandomSitecondNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Sitecond = 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 fsTrapdatumMods) Sortbytech(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Sortbytech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) SortbytechFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Sortbytech = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetSortbytech() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Sortbytech = 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 fsTrapdatumMods) RandomSortbytech(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Sortbytech = 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) RandomSortbytechNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Sortbytech = 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 fsTrapdatumMods) Srid(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Srid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) SridFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetSrid() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - 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 fsTrapdatumMods) RandomSrid(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Srid = 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) RandomSridNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Srid = 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 fsTrapdatumMods) Startdatetime(val null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Startdatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) StartdatetimeFunc(f func() null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetStartdatetime() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Startdatetime = 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 fsTrapdatumMods) RandomStartdatetime(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) Trapactivitytype(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Trapactivitytype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) TrapactivitytypeFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Trapactivitytype = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetTrapactivitytype() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Trapactivitytype = 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 fsTrapdatumMods) RandomTrapactivitytype(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Trapactivitytype = 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) RandomTrapactivitytypeNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Trapactivitytype = 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 fsTrapdatumMods) Trapcondition(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Trapcondition = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) TrapconditionFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Trapcondition = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetTrapcondition() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Trapcondition = 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 fsTrapdatumMods) RandomTrapcondition(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Trapcondition = 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) RandomTrapconditionNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Trapcondition = 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 fsTrapdatumMods) Trapnights(val null.Val[int16]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Trapnights = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) TrapnightsFunc(f func() null.Val[int16]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Trapnights = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetTrapnights() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Trapnights = 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 fsTrapdatumMods) RandomTrapnights(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Trapnights = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomTrapnightsNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Trapnights = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) Traptype(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Traptype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) TraptypeFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Traptype = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetTraptype() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Traptype = 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 fsTrapdatumMods) RandomTraptype(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Traptype = 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) RandomTraptypeNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Traptype = 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 fsTrapdatumMods) Voltage(val null.Val[float64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Voltage = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) VoltageFunc(f func() null.Val[float64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Voltage = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetVoltage() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Voltage = 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 fsTrapdatumMods) RandomVoltage(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Voltage = 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 fsTrapdatumMods) RandomVoltageNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Voltage = 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 fsTrapdatumMods) Winddir(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Winddir = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) WinddirFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Winddir = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetWinddir() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Winddir = 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 fsTrapdatumMods) RandomWinddir(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Winddir = 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) RandomWinddirNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Winddir = 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 fsTrapdatumMods) Windspeed(val null.Val[float64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Windspeed = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) WindspeedFunc(f func() null.Val[float64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Windspeed = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetWindspeed() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Windspeed = 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 fsTrapdatumMods) RandomWindspeed(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Windspeed = 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 fsTrapdatumMods) RandomWindspeedNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Windspeed = 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 fsTrapdatumMods) Zone(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) ZoneFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetZone() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Zone = 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 fsTrapdatumMods) RandomZone(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Zone = 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) RandomZoneNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Zone = 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 fsTrapdatumMods) Zone2(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) Zone2Func(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetZone2() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Zone2 = 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 fsTrapdatumMods) RandomZone2(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Zone2 = 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) RandomZone2NotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Zone2 = 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 fsTrapdatumMods) CreatedDate(val null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) CreatedDateFunc(f func() null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetCreatedDate() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.CreatedDate = 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 fsTrapdatumMods) RandomCreatedDate(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) CreatedUser(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) CreatedUserFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetCreatedUser() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.CreatedUser = 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 fsTrapdatumMods) RandomCreatedUser(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.CreatedUser = 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 fsTrapdatumMods) GeometryX(val null.Val[float64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) GeometryXFunc(f func() null.Val[float64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetGeometryX() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.GeometryX = 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 fsTrapdatumMods) RandomGeometryX(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - 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 fsTrapdatumMods) RandomGeometryXNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.GeometryX = 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 fsTrapdatumMods) GeometryY(val null.Val[float64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) GeometryYFunc(f func() null.Val[float64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetGeometryY() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.GeometryY = 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 fsTrapdatumMods) RandomGeometryY(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - 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 fsTrapdatumMods) RandomGeometryYNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.GeometryY = 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 fsTrapdatumMods) LastEditedDate(val null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) LastEditedDateFunc(f func() null.Val[int64]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetLastEditedDate() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LastEditedDate = 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 fsTrapdatumMods) RandomLastEditedDate(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTrapdatumMods) LastEditedUser(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) LastEditedUserFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetLastEditedUser() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LastEditedUser = 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 fsTrapdatumMods) RandomLastEditedUser(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.LastEditedUser = 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 fsTrapdatumMods) Lure(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Lure = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) LureFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Lure = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetLure() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Lure = 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 fsTrapdatumMods) RandomLure(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Lure = 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) RandomLureNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Lure = 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 fsTrapdatumMods) Vectorsurvtrapdataid(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Vectorsurvtrapdataid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) VectorsurvtrapdataidFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Vectorsurvtrapdataid = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetVectorsurvtrapdataid() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Vectorsurvtrapdataid = 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 fsTrapdatumMods) RandomVectorsurvtrapdataid(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Vectorsurvtrapdataid = 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) RandomVectorsurvtrapdataidNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Vectorsurvtrapdataid = 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 fsTrapdatumMods) Vectorsurvtraplocationid(val null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Vectorsurvtraplocationid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) VectorsurvtraplocationidFunc(f func() null.Val[string]) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Vectorsurvtraplocationid = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetVectorsurvtraplocationid() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Vectorsurvtraplocationid = 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 fsTrapdatumMods) RandomVectorsurvtraplocationid(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Vectorsurvtraplocationid = 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) RandomVectorsurvtraplocationidNotNull(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Vectorsurvtraplocationid = 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 fsTrapdatumMods) Updated(val time.Time) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsTrapdatumMods) UpdatedFunc(f func() time.Time) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsTrapdatumMods) UnsetUpdated() FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsTrapdatumMods) RandomUpdated(f *faker.Faker) FSTrapdatumMod { - return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsTrapdatumMods) WithParentsCascading() FSTrapdatumMod { - return FSTrapdatumModFunc(func(ctx context.Context, o *FSTrapdatumTemplate) { - if isDone, _ := fsTrapdatumWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsTrapdatumWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsTrapdatumMods) WithOrganization(rel *OrganizationTemplate) FSTrapdatumMod { - return FSTrapdatumModFunc(func(ctx context.Context, o *FSTrapdatumTemplate) { - o.r.Organization = &fsTrapdatumROrganizationR{ - o: rel, - } - }) -} - -func (m fsTrapdatumMods) WithNewOrganization(mods ...OrganizationMod) FSTrapdatumMod { - return FSTrapdatumModFunc(func(ctx context.Context, o *FSTrapdatumTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsTrapdatumMods) WithExistingOrganization(em *models.Organization) FSTrapdatumMod { - return FSTrapdatumModFunc(func(ctx context.Context, o *FSTrapdatumTemplate) { - o.r.Organization = &fsTrapdatumROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsTrapdatumMods) WithoutOrganization() FSTrapdatumMod { - return FSTrapdatumModFunc(func(ctx context.Context, o *FSTrapdatumTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_traplocation.bob.go b/db/factory/fs_traplocation.bob.go deleted file mode 100644 index 20ae25a1..00000000 --- a/db/factory/fs_traplocation.bob.go +++ /dev/null @@ -1,2378 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSTraplocationMod interface { - Apply(context.Context, *FSTraplocationTemplate) -} - -type FSTraplocationModFunc func(context.Context, *FSTraplocationTemplate) - -func (f FSTraplocationModFunc) Apply(ctx context.Context, n *FSTraplocationTemplate) { - f(ctx, n) -} - -type FSTraplocationModSlice []FSTraplocationMod - -func (mods FSTraplocationModSlice) Apply(ctx context.Context, n *FSTraplocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSTraplocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSTraplocationTemplate struct { - OrganizationID func() int32 - Accessdesc func() null.Val[string] - Active func() null.Val[int16] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Description func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Gatewaysync func() null.Val[int16] - Globalid func() string - Habitat func() null.Val[string] - Locationnumber func() null.Val[int64] - Name func() null.Val[string] - Nextactiondatescheduled func() null.Val[int64] - Objectid func() int32 - Priority func() null.Val[string] - Usetype func() null.Val[string] - Zone func() null.Val[string] - 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] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Route func() null.Val[int64] - RouteOrder func() null.Val[int64] - SetDow func() null.Val[int64] - Vectorsurvsiteid func() null.Val[string] - H3R7 func() null.Val[string] - H3R8 func() null.Val[string] - Updated func() time.Time - Geom func() null.Val[string] - - r fsTraplocationR - f *Factory - - alreadyPersisted bool -} - -type fsTraplocationR struct { - Organization *fsTraplocationROrganizationR -} - -type fsTraplocationROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSTraplocationTemplate -func (o *FSTraplocationTemplate) Apply(ctx context.Context, mods ...FSTraplocationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSTraplocation -// according to the relationships in the template. Nothing is inserted into the db -func (t FSTraplocationTemplate) setModelRels(o *models.FSTraplocation) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSTraplocations = append(rel.R.FSTraplocations, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSTraplocationSetter -// this does nothing with the relationship templates -func (o FSTraplocationTemplate) BuildSetter() *models.FSTraplocationSetter { - m := &models.FSTraplocationSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Gatewaysync != nil { - val := o.Gatewaysync() - m.Gatewaysync = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Usetype != nil { - val := o.Usetype() - m.Usetype = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Route != nil { - val := o.Route() - m.Route = omitnull.FromNull(val) - } - if o.RouteOrder != nil { - val := o.RouteOrder() - m.RouteOrder = omitnull.FromNull(val) - } - if o.SetDow != nil { - val := o.SetDow() - m.SetDow = omitnull.FromNull(val) - } - if o.Vectorsurvsiteid != nil { - val := o.Vectorsurvsiteid() - m.Vectorsurvsiteid = omitnull.FromNull(val) - } - if o.H3R7 != nil { - val := o.H3R7() - m.H3R7 = omitnull.FromNull(val) - } - if o.H3R8 != nil { - val := o.H3R8() - m.H3R8 = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - if o.Geom != nil { - val := o.Geom() - m.Geom = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSTraplocationSetter -// this does nothing with the relationship templates -func (o FSTraplocationTemplate) BuildManySetter(number int) []*models.FSTraplocationSetter { - m := make([]*models.FSTraplocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSTraplocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSTraplocationTemplate.Create -func (o FSTraplocationTemplate) Build() *models.FSTraplocation { - m := &models.FSTraplocation{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Gatewaysync != nil { - m.Gatewaysync = o.Gatewaysync() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Route != nil { - m.Route = o.Route() - } - if o.RouteOrder != nil { - m.RouteOrder = o.RouteOrder() - } - if o.SetDow != nil { - m.SetDow = o.SetDow() - } - if o.Vectorsurvsiteid != nil { - m.Vectorsurvsiteid = o.Vectorsurvsiteid() - } - if o.H3R7 != nil { - m.H3R7 = o.H3R7() - } - if o.H3R8 != nil { - m.H3R8 = o.H3R8() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - if o.Geom != nil { - m.Geom = o.Geom() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSTraplocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSTraplocationTemplate.CreateMany -func (o FSTraplocationTemplate) BuildMany(number int) models.FSTraplocationSlice { - m := make(models.FSTraplocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSTraplocation(m *models.FSTraplocationSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSTraplocation -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSTraplocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSTraplocation) error { - var err error - - return err -} - -// Create builds a fsTraplocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSTraplocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSTraplocation, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSTraplocation(opt) - - if o.r.Organization == nil { - FSTraplocationMods.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.FSTraplocations.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 fsTraplocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSTraplocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSTraplocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsTraplocation 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 *FSTraplocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSTraplocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsTraplocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSTraplocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSTraplocationSlice, error) { - var err error - m := make(models.FSTraplocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsTraplocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSTraplocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSTraplocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsTraplocations 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 FSTraplocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSTraplocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSTraplocation has methods that act as mods for the FSTraplocationTemplate -var FSTraplocationMods fsTraplocationMods - -type fsTraplocationMods struct{} - -func (m fsTraplocationMods) RandomizeAllColumns(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModSlice{ - FSTraplocationMods.RandomOrganizationID(f), - FSTraplocationMods.RandomAccessdesc(f), - FSTraplocationMods.RandomActive(f), - FSTraplocationMods.RandomComments(f), - FSTraplocationMods.RandomCreationdate(f), - FSTraplocationMods.RandomCreator(f), - FSTraplocationMods.RandomDescription(f), - FSTraplocationMods.RandomExternalid(f), - FSTraplocationMods.RandomEditdate(f), - FSTraplocationMods.RandomEditor(f), - FSTraplocationMods.RandomGatewaysync(f), - FSTraplocationMods.RandomGlobalid(f), - FSTraplocationMods.RandomHabitat(f), - FSTraplocationMods.RandomLocationnumber(f), - FSTraplocationMods.RandomName(f), - FSTraplocationMods.RandomNextactiondatescheduled(f), - FSTraplocationMods.RandomObjectid(f), - FSTraplocationMods.RandomPriority(f), - FSTraplocationMods.RandomUsetype(f), - FSTraplocationMods.RandomZone(f), - FSTraplocationMods.RandomZone2(f), - FSTraplocationMods.RandomCreatedDate(f), - FSTraplocationMods.RandomCreatedUser(f), - FSTraplocationMods.RandomGeometryX(f), - FSTraplocationMods.RandomGeometryY(f), - FSTraplocationMods.RandomLastEditedDate(f), - FSTraplocationMods.RandomLastEditedUser(f), - FSTraplocationMods.RandomRoute(f), - FSTraplocationMods.RandomRouteOrder(f), - FSTraplocationMods.RandomSetDow(f), - FSTraplocationMods.RandomVectorsurvsiteid(f), - FSTraplocationMods.RandomH3R7(f), - FSTraplocationMods.RandomH3R8(f), - FSTraplocationMods.RandomUpdated(f), - FSTraplocationMods.RandomGeom(f), - } -} - -// Set the model columns to this value -func (m fsTraplocationMods) OrganizationID(val int32) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) OrganizationIDFunc(f func() int32) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetOrganizationID() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - 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 fsTraplocationMods) RandomOrganizationID(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsTraplocationMods) Accessdesc(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) AccessdescFunc(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetAccessdesc() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Accessdesc = 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 fsTraplocationMods) RandomAccessdesc(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Accessdesc = 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) RandomAccessdescNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Accessdesc = 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 fsTraplocationMods) Active(val null.Val[int16]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) ActiveFunc(f func() null.Val[int16]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetActive() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Active = 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 fsTraplocationMods) RandomActive(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomActiveNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTraplocationMods) Comments(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) CommentsFunc(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetComments() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Comments = 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 fsTraplocationMods) RandomComments(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Comments = 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 fsTraplocationMods) Creationdate(val null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) CreationdateFunc(f func() null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetCreationdate() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Creationdate = 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 fsTraplocationMods) RandomCreationdate(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTraplocationMods) Creator(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) CreatorFunc(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetCreator() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Creator = 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 fsTraplocationMods) RandomCreator(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Creator = 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 fsTraplocationMods) Description(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) DescriptionFunc(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetDescription() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Description = 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 fsTraplocationMods) RandomDescription(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Description = 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) RandomDescriptionNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Description = 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 fsTraplocationMods) Externalid(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) ExternalidFunc(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetExternalid() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Externalid = 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 fsTraplocationMods) RandomExternalid(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Externalid = 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) RandomExternalidNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Externalid = 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 fsTraplocationMods) Editdate(val null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) EditdateFunc(f func() null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetEditdate() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Editdate = 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 fsTraplocationMods) RandomEditdate(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTraplocationMods) Editor(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) EditorFunc(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetEditor() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Editor = 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 fsTraplocationMods) RandomEditor(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Editor = 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 fsTraplocationMods) Gatewaysync(val null.Val[int16]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Gatewaysync = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) GatewaysyncFunc(f func() null.Val[int16]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Gatewaysync = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetGatewaysync() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Gatewaysync = 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 fsTraplocationMods) RandomGatewaysync(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomGatewaysyncNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTraplocationMods) Globalid(val string) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) GlobalidFunc(f func() string) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetGlobalid() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsTraplocationMods) RandomGlobalid(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsTraplocationMods) Habitat(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) HabitatFunc(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetHabitat() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Habitat = 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 fsTraplocationMods) RandomHabitat(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Habitat = 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) RandomHabitatNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Habitat = 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 fsTraplocationMods) Locationnumber(val null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Locationnumber = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) LocationnumberFunc(f func() null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetLocationnumber() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Locationnumber = 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 fsTraplocationMods) RandomLocationnumber(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLocationnumberNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTraplocationMods) Name(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) NameFunc(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetName() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Name = 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 fsTraplocationMods) RandomName(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Name = 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) RandomNameNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Name = 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 fsTraplocationMods) Nextactiondatescheduled(val null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetNextactiondatescheduled() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Nextactiondatescheduled = 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 fsTraplocationMods) RandomNextactiondatescheduled(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomNextactiondatescheduledNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTraplocationMods) Objectid(val int32) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) ObjectidFunc(f func() int32) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetObjectid() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsTraplocationMods) RandomObjectid(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsTraplocationMods) Priority(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) PriorityFunc(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetPriority() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Priority = 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 fsTraplocationMods) RandomPriority(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Priority = 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) RandomPriorityNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Priority = 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 fsTraplocationMods) Usetype(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) UsetypeFunc(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetUsetype() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Usetype = 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 fsTraplocationMods) RandomUsetype(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Usetype = 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) RandomUsetypeNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Usetype = 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 fsTraplocationMods) Zone(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) ZoneFunc(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetZone() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Zone = 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 fsTraplocationMods) RandomZone(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Zone = 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) RandomZoneNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Zone = 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 fsTraplocationMods) Zone2(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) Zone2Func(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetZone2() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Zone2 = 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 fsTraplocationMods) RandomZone2(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Zone2 = 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) RandomZone2NotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Zone2 = 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 fsTraplocationMods) CreatedDate(val null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) CreatedDateFunc(f func() null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetCreatedDate() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.CreatedDate = 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 fsTraplocationMods) RandomCreatedDate(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTraplocationMods) CreatedUser(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) CreatedUserFunc(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetCreatedUser() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.CreatedUser = 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 fsTraplocationMods) RandomCreatedUser(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.CreatedUser = 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 fsTraplocationMods) GeometryX(val null.Val[float64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) GeometryXFunc(f func() null.Val[float64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetGeometryX() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.GeometryX = 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 fsTraplocationMods) RandomGeometryX(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - 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 fsTraplocationMods) RandomGeometryXNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.GeometryX = 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 fsTraplocationMods) GeometryY(val null.Val[float64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) GeometryYFunc(f func() null.Val[float64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetGeometryY() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.GeometryY = 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 fsTraplocationMods) RandomGeometryY(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - 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 fsTraplocationMods) RandomGeometryYNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.GeometryY = 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 fsTraplocationMods) LastEditedDate(val null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) LastEditedDateFunc(f func() null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetLastEditedDate() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.LastEditedDate = 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 fsTraplocationMods) RandomLastEditedDate(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTraplocationMods) LastEditedUser(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) LastEditedUserFunc(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetLastEditedUser() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.LastEditedUser = 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 fsTraplocationMods) RandomLastEditedUser(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.LastEditedUser = 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 fsTraplocationMods) Route(val null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Route = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) RouteFunc(f func() null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Route = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetRoute() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Route = 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 fsTraplocationMods) RandomRoute(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Route = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomRouteNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Route = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTraplocationMods) RouteOrder(val null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.RouteOrder = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) RouteOrderFunc(f func() null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.RouteOrder = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetRouteOrder() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.RouteOrder = 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 fsTraplocationMods) RandomRouteOrder(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.RouteOrder = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomRouteOrderNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.RouteOrder = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTraplocationMods) SetDow(val null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.SetDow = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) SetDowFunc(f func() null.Val[int64]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.SetDow = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetSetDow() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.SetDow = 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 fsTraplocationMods) RandomSetDow(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.SetDow = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomSetDowNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.SetDow = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTraplocationMods) Vectorsurvsiteid(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Vectorsurvsiteid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) VectorsurvsiteidFunc(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Vectorsurvsiteid = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetVectorsurvsiteid() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Vectorsurvsiteid = 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 fsTraplocationMods) RandomVectorsurvsiteid(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Vectorsurvsiteid = 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) RandomVectorsurvsiteidNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Vectorsurvsiteid = 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 fsTraplocationMods) H3R7(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.H3R7 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) H3R7Func(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.H3R7 = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetH3R7() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.H3R7 = 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 fsTraplocationMods) RandomH3R7(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.H3R7 = 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) RandomH3R7NotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.H3R7 = 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 fsTraplocationMods) H3R8(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.H3R8 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) H3R8Func(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.H3R8 = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetH3R8() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.H3R8 = 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 fsTraplocationMods) RandomH3R8(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.H3R8 = 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) RandomH3R8NotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.H3R8 = 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 fsTraplocationMods) Updated(val time.Time) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) UpdatedFunc(f func() time.Time) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetUpdated() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsTraplocationMods) RandomUpdated(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m fsTraplocationMods) Geom(val null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Geom = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTraplocationMods) GeomFunc(f func() null.Val[string]) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Geom = f - }) -} - -// Clear any values for the column -func (m fsTraplocationMods) UnsetGeom() FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Geom = 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 fsTraplocationMods) RandomGeom(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Geom = 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) RandomGeomNotNull(f *faker.Faker) FSTraplocationMod { - return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) { - o.Geom = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -func (m fsTraplocationMods) WithParentsCascading() FSTraplocationMod { - return FSTraplocationModFunc(func(ctx context.Context, o *FSTraplocationTemplate) { - if isDone, _ := fsTraplocationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsTraplocationWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsTraplocationMods) WithOrganization(rel *OrganizationTemplate) FSTraplocationMod { - return FSTraplocationModFunc(func(ctx context.Context, o *FSTraplocationTemplate) { - o.r.Organization = &fsTraplocationROrganizationR{ - o: rel, - } - }) -} - -func (m fsTraplocationMods) WithNewOrganization(mods ...OrganizationMod) FSTraplocationMod { - return FSTraplocationModFunc(func(ctx context.Context, o *FSTraplocationTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsTraplocationMods) WithExistingOrganization(em *models.Organization) FSTraplocationMod { - return FSTraplocationModFunc(func(ctx context.Context, o *FSTraplocationTemplate) { - o.r.Organization = &fsTraplocationROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsTraplocationMods) WithoutOrganization() FSTraplocationMod { - return FSTraplocationModFunc(func(ctx context.Context, o *FSTraplocationTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_treatment.bob.go b/db/factory/fs_treatment.bob.go deleted file mode 100644 index 517602a3..00000000 --- a/db/factory/fs_treatment.bob.go +++ /dev/null @@ -1,3866 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSTreatmentMod interface { - Apply(context.Context, *FSTreatmentTemplate) -} - -type FSTreatmentModFunc func(context.Context, *FSTreatmentTemplate) - -func (f FSTreatmentModFunc) Apply(ctx context.Context, n *FSTreatmentTemplate) { - f(ctx, n) -} - -type FSTreatmentModSlice []FSTreatmentMod - -func (mods FSTreatmentModSlice) Apply(ctx context.Context, n *FSTreatmentTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSTreatmentTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSTreatmentTemplate struct { - OrganizationID func() int32 - Activity func() null.Val[string] - Areaunit func() null.Val[string] - Avetemp func() null.Val[float64] - Barrierrouteid func() null.Val[string] - Cbcount func() null.Val[int16] - Comments func() null.Val[string] - Containercount func() null.Val[int16] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Enddatetime func() null.Val[int64] - Equiptype func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fieldtech func() null.Val[string] - Flowrate func() null.Val[float64] - Globalid func() string - Habitat func() null.Val[string] - InspID func() null.Val[string] - Invloc func() null.Val[string] - Linelocid func() null.Val[string] - Locationname func() null.Val[string] - Method func() null.Val[string] - Objectid func() int32 - Pointlocid func() null.Val[string] - Polygonlocid func() null.Val[string] - Product func() null.Val[string] - Ptaid func() null.Val[string] - Qty func() null.Val[float64] - Qtyunit func() null.Val[string] - Raingauge func() null.Val[float64] - Recordstatus func() null.Val[int16] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[int64] - Sdid func() null.Val[string] - Sitecond func() null.Val[string] - Srid func() null.Val[string] - Startdatetime func() null.Val[int64] - Targetspecies func() null.Val[string] - Tirecount func() null.Val[int16] - Treatacres func() null.Val[float64] - Treatarea func() null.Val[float64] - Treathectares func() null.Val[float64] - Treatmenthours func() null.Val[float64] - Treatmentlength func() null.Val[float64] - Treatmentlengthunits func() null.Val[string] - Totalcostprodcut func() null.Val[float64] - Ulvrouteid func() null.Val[string] - Warningoverride func() null.Val[int16] - Winddir func() null.Val[string] - Windspeed func() null.Val[float64] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - TempSitecond func() null.Val[string] - Updated func() time.Time - Geom func() null.Val[string] - - r fsTreatmentR - f *Factory - - alreadyPersisted bool -} - -type fsTreatmentR struct { - Organization *fsTreatmentROrganizationR -} - -type fsTreatmentROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSTreatmentTemplate -func (o *FSTreatmentTemplate) Apply(ctx context.Context, mods ...FSTreatmentMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSTreatment -// according to the relationships in the template. Nothing is inserted into the db -func (t FSTreatmentTemplate) setModelRels(o *models.FSTreatment) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSTreatments = append(rel.R.FSTreatments, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSTreatmentSetter -// this does nothing with the relationship templates -func (o FSTreatmentTemplate) BuildSetter() *models.FSTreatmentSetter { - m := &models.FSTreatmentSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Activity != nil { - val := o.Activity() - m.Activity = omitnull.FromNull(val) - } - if o.Areaunit != nil { - val := o.Areaunit() - m.Areaunit = omitnull.FromNull(val) - } - if o.Avetemp != nil { - val := o.Avetemp() - m.Avetemp = omitnull.FromNull(val) - } - if o.Barrierrouteid != nil { - val := o.Barrierrouteid() - m.Barrierrouteid = omitnull.FromNull(val) - } - if o.Cbcount != nil { - val := o.Cbcount() - m.Cbcount = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Containercount != nil { - val := o.Containercount() - m.Containercount = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Equiptype != nil { - val := o.Equiptype() - m.Equiptype = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Flowrate != nil { - val := o.Flowrate() - m.Flowrate = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(val) - } - if o.InspID != nil { - val := o.InspID() - m.InspID = omitnull.FromNull(val) - } - if o.Invloc != nil { - val := o.Invloc() - m.Invloc = omitnull.FromNull(val) - } - if o.Linelocid != nil { - val := o.Linelocid() - m.Linelocid = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.Method != nil { - val := o.Method() - m.Method = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Pointlocid != nil { - val := o.Pointlocid() - m.Pointlocid = omitnull.FromNull(val) - } - if o.Polygonlocid != nil { - val := o.Polygonlocid() - m.Polygonlocid = omitnull.FromNull(val) - } - if o.Product != nil { - val := o.Product() - m.Product = omitnull.FromNull(val) - } - if o.Ptaid != nil { - val := o.Ptaid() - m.Ptaid = omitnull.FromNull(val) - } - if o.Qty != nil { - val := o.Qty() - m.Qty = omitnull.FromNull(val) - } - if o.Qtyunit != nil { - val := o.Qtyunit() - m.Qtyunit = omitnull.FromNull(val) - } - if o.Raingauge != nil { - val := o.Raingauge() - m.Raingauge = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Reviewed != nil { - val := o.Reviewed() - m.Reviewed = omitnull.FromNull(val) - } - if o.Reviewedby != nil { - val := o.Reviewedby() - m.Reviewedby = omitnull.FromNull(val) - } - if o.Revieweddate != nil { - val := o.Revieweddate() - m.Revieweddate = omitnull.FromNull(val) - } - if o.Sdid != nil { - val := o.Sdid() - m.Sdid = omitnull.FromNull(val) - } - if o.Sitecond != nil { - val := o.Sitecond() - m.Sitecond = omitnull.FromNull(val) - } - if o.Srid != nil { - val := o.Srid() - m.Srid = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Targetspecies != nil { - val := o.Targetspecies() - m.Targetspecies = omitnull.FromNull(val) - } - if o.Tirecount != nil { - val := o.Tirecount() - m.Tirecount = omitnull.FromNull(val) - } - if o.Treatacres != nil { - val := o.Treatacres() - m.Treatacres = omitnull.FromNull(val) - } - if o.Treatarea != nil { - val := o.Treatarea() - m.Treatarea = omitnull.FromNull(val) - } - if o.Treathectares != nil { - val := o.Treathectares() - m.Treathectares = omitnull.FromNull(val) - } - if o.Treatmenthours != nil { - val := o.Treatmenthours() - m.Treatmenthours = omitnull.FromNull(val) - } - if o.Treatmentlength != nil { - val := o.Treatmentlength() - m.Treatmentlength = omitnull.FromNull(val) - } - if o.Treatmentlengthunits != nil { - val := o.Treatmentlengthunits() - m.Treatmentlengthunits = omitnull.FromNull(val) - } - if o.Totalcostprodcut != nil { - val := o.Totalcostprodcut() - m.Totalcostprodcut = omitnull.FromNull(val) - } - if o.Ulvrouteid != nil { - val := o.Ulvrouteid() - m.Ulvrouteid = omitnull.FromNull(val) - } - if o.Warningoverride != nil { - val := o.Warningoverride() - m.Warningoverride = omitnull.FromNull(val) - } - if o.Winddir != nil { - val := o.Winddir() - m.Winddir = omitnull.FromNull(val) - } - if o.Windspeed != nil { - val := o.Windspeed() - m.Windspeed = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.TempSitecond != nil { - val := o.TempSitecond() - m.TempSitecond = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - if o.Geom != nil { - val := o.Geom() - m.Geom = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSTreatmentSetter -// this does nothing with the relationship templates -func (o FSTreatmentTemplate) BuildManySetter(number int) []*models.FSTreatmentSetter { - m := make([]*models.FSTreatmentSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSTreatment -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSTreatmentTemplate.Create -func (o FSTreatmentTemplate) Build() *models.FSTreatment { - m := &models.FSTreatment{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Activity != nil { - m.Activity = o.Activity() - } - if o.Areaunit != nil { - m.Areaunit = o.Areaunit() - } - if o.Avetemp != nil { - m.Avetemp = o.Avetemp() - } - if o.Barrierrouteid != nil { - m.Barrierrouteid = o.Barrierrouteid() - } - if o.Cbcount != nil { - m.Cbcount = o.Cbcount() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Containercount != nil { - m.Containercount = o.Containercount() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Equiptype != nil { - m.Equiptype = o.Equiptype() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Flowrate != nil { - m.Flowrate = o.Flowrate() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.InspID != nil { - m.InspID = o.InspID() - } - if o.Invloc != nil { - m.Invloc = o.Invloc() - } - if o.Linelocid != nil { - m.Linelocid = o.Linelocid() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.Method != nil { - m.Method = o.Method() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Pointlocid != nil { - m.Pointlocid = o.Pointlocid() - } - if o.Polygonlocid != nil { - m.Polygonlocid = o.Polygonlocid() - } - if o.Product != nil { - m.Product = o.Product() - } - if o.Ptaid != nil { - m.Ptaid = o.Ptaid() - } - if o.Qty != nil { - m.Qty = o.Qty() - } - if o.Qtyunit != nil { - m.Qtyunit = o.Qtyunit() - } - if o.Raingauge != nil { - m.Raingauge = o.Raingauge() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Reviewed != nil { - m.Reviewed = o.Reviewed() - } - if o.Reviewedby != nil { - m.Reviewedby = o.Reviewedby() - } - if o.Revieweddate != nil { - m.Revieweddate = o.Revieweddate() - } - if o.Sdid != nil { - m.Sdid = o.Sdid() - } - if o.Sitecond != nil { - m.Sitecond = o.Sitecond() - } - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Targetspecies != nil { - m.Targetspecies = o.Targetspecies() - } - if o.Tirecount != nil { - m.Tirecount = o.Tirecount() - } - if o.Treatacres != nil { - m.Treatacres = o.Treatacres() - } - if o.Treatarea != nil { - m.Treatarea = o.Treatarea() - } - if o.Treathectares != nil { - m.Treathectares = o.Treathectares() - } - if o.Treatmenthours != nil { - m.Treatmenthours = o.Treatmenthours() - } - if o.Treatmentlength != nil { - m.Treatmentlength = o.Treatmentlength() - } - if o.Treatmentlengthunits != nil { - m.Treatmentlengthunits = o.Treatmentlengthunits() - } - if o.Totalcostprodcut != nil { - m.Totalcostprodcut = o.Totalcostprodcut() - } - if o.Ulvrouteid != nil { - m.Ulvrouteid = o.Ulvrouteid() - } - if o.Warningoverride != nil { - m.Warningoverride = o.Warningoverride() - } - if o.Winddir != nil { - m.Winddir = o.Winddir() - } - if o.Windspeed != nil { - m.Windspeed = o.Windspeed() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.TempSitecond != nil { - m.TempSitecond = o.TempSitecond() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - if o.Geom != nil { - m.Geom = o.Geom() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSTreatmentSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSTreatmentTemplate.CreateMany -func (o FSTreatmentTemplate) BuildMany(number int) models.FSTreatmentSlice { - m := make(models.FSTreatmentSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSTreatment(m *models.FSTreatmentSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSTreatment -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSTreatmentTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSTreatment) error { - var err error - - return err -} - -// Create builds a fsTreatment and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSTreatmentTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSTreatment, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSTreatment(opt) - - if o.r.Organization == nil { - FSTreatmentMods.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.FSTreatments.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 fsTreatment and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSTreatmentTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSTreatment { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsTreatment 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 *FSTreatmentTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSTreatment { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsTreatments and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSTreatmentTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSTreatmentSlice, error) { - var err error - m := make(models.FSTreatmentSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsTreatments and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSTreatmentTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSTreatmentSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsTreatments 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 FSTreatmentTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSTreatmentSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSTreatment has methods that act as mods for the FSTreatmentTemplate -var FSTreatmentMods fsTreatmentMods - -type fsTreatmentMods struct{} - -func (m fsTreatmentMods) RandomizeAllColumns(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModSlice{ - FSTreatmentMods.RandomOrganizationID(f), - FSTreatmentMods.RandomActivity(f), - FSTreatmentMods.RandomAreaunit(f), - FSTreatmentMods.RandomAvetemp(f), - FSTreatmentMods.RandomBarrierrouteid(f), - FSTreatmentMods.RandomCbcount(f), - FSTreatmentMods.RandomComments(f), - FSTreatmentMods.RandomContainercount(f), - FSTreatmentMods.RandomCreationdate(f), - FSTreatmentMods.RandomCreator(f), - FSTreatmentMods.RandomEnddatetime(f), - FSTreatmentMods.RandomEquiptype(f), - FSTreatmentMods.RandomEditdate(f), - FSTreatmentMods.RandomEditor(f), - FSTreatmentMods.RandomFieldtech(f), - FSTreatmentMods.RandomFlowrate(f), - FSTreatmentMods.RandomGlobalid(f), - FSTreatmentMods.RandomHabitat(f), - FSTreatmentMods.RandomInspID(f), - FSTreatmentMods.RandomInvloc(f), - FSTreatmentMods.RandomLinelocid(f), - FSTreatmentMods.RandomLocationname(f), - FSTreatmentMods.RandomMethod(f), - FSTreatmentMods.RandomObjectid(f), - FSTreatmentMods.RandomPointlocid(f), - FSTreatmentMods.RandomPolygonlocid(f), - FSTreatmentMods.RandomProduct(f), - FSTreatmentMods.RandomPtaid(f), - FSTreatmentMods.RandomQty(f), - FSTreatmentMods.RandomQtyunit(f), - FSTreatmentMods.RandomRaingauge(f), - FSTreatmentMods.RandomRecordstatus(f), - FSTreatmentMods.RandomReviewed(f), - FSTreatmentMods.RandomReviewedby(f), - FSTreatmentMods.RandomRevieweddate(f), - FSTreatmentMods.RandomSdid(f), - FSTreatmentMods.RandomSitecond(f), - FSTreatmentMods.RandomSrid(f), - FSTreatmentMods.RandomStartdatetime(f), - FSTreatmentMods.RandomTargetspecies(f), - FSTreatmentMods.RandomTirecount(f), - FSTreatmentMods.RandomTreatacres(f), - FSTreatmentMods.RandomTreatarea(f), - FSTreatmentMods.RandomTreathectares(f), - FSTreatmentMods.RandomTreatmenthours(f), - FSTreatmentMods.RandomTreatmentlength(f), - FSTreatmentMods.RandomTreatmentlengthunits(f), - FSTreatmentMods.RandomTotalcostprodcut(f), - FSTreatmentMods.RandomUlvrouteid(f), - FSTreatmentMods.RandomWarningoverride(f), - FSTreatmentMods.RandomWinddir(f), - FSTreatmentMods.RandomWindspeed(f), - FSTreatmentMods.RandomZone(f), - FSTreatmentMods.RandomZone2(f), - FSTreatmentMods.RandomGeometryX(f), - FSTreatmentMods.RandomGeometryY(f), - FSTreatmentMods.RandomTempSitecond(f), - FSTreatmentMods.RandomUpdated(f), - FSTreatmentMods.RandomGeom(f), - } -} - -// Set the model columns to this value -func (m fsTreatmentMods) OrganizationID(val int32) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) OrganizationIDFunc(f func() int32) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetOrganizationID() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - 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 fsTreatmentMods) RandomOrganizationID(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentMods) Activity(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Activity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) ActivityFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Activity = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetActivity() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Activity = 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 fsTreatmentMods) RandomActivity(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Activity = 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) RandomActivityNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Activity = 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 fsTreatmentMods) Areaunit(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Areaunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) AreaunitFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Areaunit = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetAreaunit() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Areaunit = 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 fsTreatmentMods) RandomAreaunit(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Areaunit = 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) RandomAreaunitNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Areaunit = 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 fsTreatmentMods) Avetemp(val null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Avetemp = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) AvetempFunc(f func() null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Avetemp = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetAvetemp() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Avetemp = 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 fsTreatmentMods) RandomAvetemp(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Avetemp = 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 fsTreatmentMods) RandomAvetempNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Avetemp = 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 fsTreatmentMods) Barrierrouteid(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Barrierrouteid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) BarrierrouteidFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Barrierrouteid = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetBarrierrouteid() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Barrierrouteid = 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 fsTreatmentMods) RandomBarrierrouteid(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Barrierrouteid = 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) RandomBarrierrouteidNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Barrierrouteid = 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 fsTreatmentMods) Cbcount(val null.Val[int16]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Cbcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) CbcountFunc(f func() null.Val[int16]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Cbcount = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetCbcount() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Cbcount = 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 fsTreatmentMods) RandomCbcount(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Cbcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomCbcountNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Cbcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentMods) Comments(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) CommentsFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetComments() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Comments = 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 fsTreatmentMods) RandomComments(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Comments = 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 fsTreatmentMods) Containercount(val null.Val[int16]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Containercount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) ContainercountFunc(f func() null.Val[int16]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Containercount = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetContainercount() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Containercount = 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 fsTreatmentMods) RandomContainercount(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Containercount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomContainercountNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Containercount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentMods) Creationdate(val null.Val[int64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) CreationdateFunc(f func() null.Val[int64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetCreationdate() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Creationdate = 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 fsTreatmentMods) RandomCreationdate(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentMods) Creator(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) CreatorFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetCreator() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Creator = 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 fsTreatmentMods) RandomCreator(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Creator = 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 fsTreatmentMods) Enddatetime(val null.Val[int64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Enddatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) EnddatetimeFunc(f func() null.Val[int64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetEnddatetime() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Enddatetime = 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 fsTreatmentMods) RandomEnddatetime(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEnddatetimeNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentMods) Equiptype(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Equiptype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) EquiptypeFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Equiptype = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetEquiptype() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Equiptype = 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 fsTreatmentMods) RandomEquiptype(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Equiptype = 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) RandomEquiptypeNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Equiptype = 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 fsTreatmentMods) Editdate(val null.Val[int64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) EditdateFunc(f func() null.Val[int64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetEditdate() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Editdate = 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 fsTreatmentMods) RandomEditdate(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentMods) Editor(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) EditorFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetEditor() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Editor = 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 fsTreatmentMods) RandomEditor(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Editor = 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 fsTreatmentMods) Fieldtech(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) FieldtechFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetFieldtech() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Fieldtech = 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 fsTreatmentMods) RandomFieldtech(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Fieldtech = 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) RandomFieldtechNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Fieldtech = 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 fsTreatmentMods) Flowrate(val null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Flowrate = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) FlowrateFunc(f func() null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Flowrate = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetFlowrate() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Flowrate = 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 fsTreatmentMods) RandomFlowrate(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Flowrate = 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 fsTreatmentMods) RandomFlowrateNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Flowrate = 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 fsTreatmentMods) Globalid(val string) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) GlobalidFunc(f func() string) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetGlobalid() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsTreatmentMods) RandomGlobalid(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentMods) Habitat(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) HabitatFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetHabitat() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Habitat = 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 fsTreatmentMods) RandomHabitat(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Habitat = 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) RandomHabitatNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Habitat = 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 fsTreatmentMods) InspID(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.InspID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) InspIDFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.InspID = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetInspID() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.InspID = 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 fsTreatmentMods) RandomInspID(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.InspID = 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) RandomInspIDNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.InspID = 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 fsTreatmentMods) Invloc(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Invloc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) InvlocFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Invloc = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetInvloc() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Invloc = 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 fsTreatmentMods) RandomInvloc(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Invloc = 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) RandomInvlocNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Invloc = 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 fsTreatmentMods) Linelocid(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Linelocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) LinelocidFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Linelocid = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetLinelocid() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Linelocid = 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 fsTreatmentMods) RandomLinelocid(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Linelocid = 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) RandomLinelocidNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Linelocid = 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 fsTreatmentMods) Locationname(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) LocationnameFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetLocationname() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Locationname = 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 fsTreatmentMods) RandomLocationname(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Locationname = 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) RandomLocationnameNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Locationname = 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 fsTreatmentMods) Method(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Method = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) MethodFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Method = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetMethod() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Method = 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 fsTreatmentMods) RandomMethod(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Method = 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) RandomMethodNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Method = 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 fsTreatmentMods) Objectid(val int32) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) ObjectidFunc(f func() int32) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetObjectid() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsTreatmentMods) RandomObjectid(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentMods) Pointlocid(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Pointlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) PointlocidFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Pointlocid = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetPointlocid() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Pointlocid = 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 fsTreatmentMods) RandomPointlocid(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Pointlocid = 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) RandomPointlocidNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Pointlocid = 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 fsTreatmentMods) Polygonlocid(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Polygonlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) PolygonlocidFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Polygonlocid = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetPolygonlocid() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Polygonlocid = 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 fsTreatmentMods) RandomPolygonlocid(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Polygonlocid = 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) RandomPolygonlocidNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Polygonlocid = 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 fsTreatmentMods) Product(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Product = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) ProductFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Product = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetProduct() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Product = 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 fsTreatmentMods) RandomProduct(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Product = 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) RandomProductNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Product = 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 fsTreatmentMods) Ptaid(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Ptaid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) PtaidFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Ptaid = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetPtaid() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Ptaid = 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 fsTreatmentMods) RandomPtaid(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Ptaid = 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) RandomPtaidNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Ptaid = 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 fsTreatmentMods) Qty(val null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Qty = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) QtyFunc(f func() null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Qty = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetQty() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Qty = 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 fsTreatmentMods) RandomQty(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Qty = 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 fsTreatmentMods) RandomQtyNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Qty = 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 fsTreatmentMods) Qtyunit(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Qtyunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) QtyunitFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Qtyunit = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetQtyunit() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Qtyunit = 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 fsTreatmentMods) RandomQtyunit(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Qtyunit = 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) RandomQtyunitNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Qtyunit = 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 fsTreatmentMods) Raingauge(val null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Raingauge = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) RaingaugeFunc(f func() null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Raingauge = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetRaingauge() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Raingauge = 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 fsTreatmentMods) RandomRaingauge(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Raingauge = 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 fsTreatmentMods) RandomRaingaugeNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Raingauge = 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 fsTreatmentMods) Recordstatus(val null.Val[int16]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) RecordstatusFunc(f func() null.Val[int16]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetRecordstatus() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Recordstatus = 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 fsTreatmentMods) RandomRecordstatus(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomRecordstatusNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentMods) Reviewed(val null.Val[int16]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) ReviewedFunc(f func() null.Val[int16]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetReviewed() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Reviewed = 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 fsTreatmentMods) RandomReviewed(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomReviewedNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentMods) Reviewedby(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) ReviewedbyFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetReviewedby() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Reviewedby = 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 fsTreatmentMods) RandomReviewedby(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Reviewedby = 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) RandomReviewedbyNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Reviewedby = 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 fsTreatmentMods) Revieweddate(val null.Val[int64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Revieweddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) RevieweddateFunc(f func() null.Val[int64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetRevieweddate() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Revieweddate = 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 fsTreatmentMods) RandomRevieweddate(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomRevieweddateNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentMods) Sdid(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Sdid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) SdidFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Sdid = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetSdid() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Sdid = 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 fsTreatmentMods) RandomSdid(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Sdid = 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) RandomSdidNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Sdid = 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 fsTreatmentMods) Sitecond(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Sitecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) SitecondFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Sitecond = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetSitecond() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Sitecond = 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 fsTreatmentMods) RandomSitecond(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Sitecond = 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) RandomSitecondNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Sitecond = 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 fsTreatmentMods) Srid(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Srid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) SridFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetSrid() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - 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 fsTreatmentMods) RandomSrid(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Srid = 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) RandomSridNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Srid = 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 fsTreatmentMods) Startdatetime(val null.Val[int64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Startdatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) StartdatetimeFunc(f func() null.Val[int64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetStartdatetime() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Startdatetime = 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 fsTreatmentMods) RandomStartdatetime(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomStartdatetimeNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentMods) Targetspecies(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Targetspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) TargetspeciesFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Targetspecies = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetTargetspecies() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Targetspecies = 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 fsTreatmentMods) RandomTargetspecies(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Targetspecies = 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) RandomTargetspeciesNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Targetspecies = 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 fsTreatmentMods) Tirecount(val null.Val[int16]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Tirecount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) TirecountFunc(f func() null.Val[int16]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Tirecount = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetTirecount() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Tirecount = 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 fsTreatmentMods) RandomTirecount(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Tirecount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomTirecountNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Tirecount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentMods) Treatacres(val null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatacres = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) TreatacresFunc(f func() null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatacres = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetTreatacres() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatacres = 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 fsTreatmentMods) RandomTreatacres(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatacres = 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 fsTreatmentMods) RandomTreatacresNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatacres = 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 fsTreatmentMods) Treatarea(val null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatarea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) TreatareaFunc(f func() null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatarea = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetTreatarea() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatarea = 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 fsTreatmentMods) RandomTreatarea(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatarea = 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 fsTreatmentMods) RandomTreatareaNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatarea = 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 fsTreatmentMods) Treathectares(val null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treathectares = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) TreathectaresFunc(f func() null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treathectares = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetTreathectares() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treathectares = 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 fsTreatmentMods) RandomTreathectares(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treathectares = 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 fsTreatmentMods) RandomTreathectaresNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treathectares = 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 fsTreatmentMods) Treatmenthours(val null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatmenthours = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) TreatmenthoursFunc(f func() null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatmenthours = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetTreatmenthours() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatmenthours = 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 fsTreatmentMods) RandomTreatmenthours(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatmenthours = 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 fsTreatmentMods) RandomTreatmenthoursNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatmenthours = 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 fsTreatmentMods) Treatmentlength(val null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatmentlength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) TreatmentlengthFunc(f func() null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatmentlength = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetTreatmentlength() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatmentlength = 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 fsTreatmentMods) RandomTreatmentlength(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatmentlength = 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 fsTreatmentMods) RandomTreatmentlengthNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatmentlength = 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 fsTreatmentMods) Treatmentlengthunits(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatmentlengthunits = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) TreatmentlengthunitsFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatmentlengthunits = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetTreatmentlengthunits() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatmentlengthunits = 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 fsTreatmentMods) RandomTreatmentlengthunits(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatmentlengthunits = 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) RandomTreatmentlengthunitsNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Treatmentlengthunits = 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 fsTreatmentMods) Totalcostprodcut(val null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Totalcostprodcut = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) TotalcostprodcutFunc(f func() null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Totalcostprodcut = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetTotalcostprodcut() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Totalcostprodcut = 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 fsTreatmentMods) RandomTotalcostprodcut(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Totalcostprodcut = 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 fsTreatmentMods) RandomTotalcostprodcutNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Totalcostprodcut = 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 fsTreatmentMods) Ulvrouteid(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Ulvrouteid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) UlvrouteidFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Ulvrouteid = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetUlvrouteid() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Ulvrouteid = 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 fsTreatmentMods) RandomUlvrouteid(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Ulvrouteid = 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) RandomUlvrouteidNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Ulvrouteid = 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 fsTreatmentMods) Warningoverride(val null.Val[int16]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Warningoverride = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) WarningoverrideFunc(f func() null.Val[int16]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Warningoverride = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetWarningoverride() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Warningoverride = 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 fsTreatmentMods) RandomWarningoverride(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Warningoverride = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomWarningoverrideNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Warningoverride = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentMods) Winddir(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Winddir = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) WinddirFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Winddir = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetWinddir() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Winddir = 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 fsTreatmentMods) RandomWinddir(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Winddir = 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) RandomWinddirNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Winddir = 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 fsTreatmentMods) Windspeed(val null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Windspeed = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) WindspeedFunc(f func() null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Windspeed = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetWindspeed() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Windspeed = 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 fsTreatmentMods) RandomWindspeed(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Windspeed = 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 fsTreatmentMods) RandomWindspeedNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Windspeed = 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 fsTreatmentMods) Zone(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) ZoneFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetZone() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Zone = 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 fsTreatmentMods) RandomZone(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Zone = 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) RandomZoneNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Zone = 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 fsTreatmentMods) Zone2(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) Zone2Func(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetZone2() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Zone2 = 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 fsTreatmentMods) RandomZone2(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Zone2 = 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) RandomZone2NotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Zone2 = 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 fsTreatmentMods) GeometryX(val null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) GeometryXFunc(f func() null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetGeometryX() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.GeometryX = 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 fsTreatmentMods) RandomGeometryX(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - 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 fsTreatmentMods) RandomGeometryXNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.GeometryX = 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 fsTreatmentMods) GeometryY(val null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) GeometryYFunc(f func() null.Val[float64]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetGeometryY() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.GeometryY = 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 fsTreatmentMods) RandomGeometryY(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - 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 fsTreatmentMods) RandomGeometryYNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.GeometryY = 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 fsTreatmentMods) TempSitecond(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.TempSitecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) TempSitecondFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.TempSitecond = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetTempSitecond() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.TempSitecond = 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 fsTreatmentMods) RandomTempSitecond(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.TempSitecond = 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) RandomTempSitecondNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.TempSitecond = 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 fsTreatmentMods) Updated(val time.Time) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) UpdatedFunc(f func() time.Time) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetUpdated() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsTreatmentMods) RandomUpdated(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentMods) Geom(val null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Geom = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentMods) GeomFunc(f func() null.Val[string]) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Geom = f - }) -} - -// Clear any values for the column -func (m fsTreatmentMods) UnsetGeom() FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Geom = 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 fsTreatmentMods) RandomGeom(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Geom = 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) RandomGeomNotNull(f *faker.Faker) FSTreatmentMod { - return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) { - o.Geom = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -func (m fsTreatmentMods) WithParentsCascading() FSTreatmentMod { - return FSTreatmentModFunc(func(ctx context.Context, o *FSTreatmentTemplate) { - if isDone, _ := fsTreatmentWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsTreatmentWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsTreatmentMods) WithOrganization(rel *OrganizationTemplate) FSTreatmentMod { - return FSTreatmentModFunc(func(ctx context.Context, o *FSTreatmentTemplate) { - o.r.Organization = &fsTreatmentROrganizationR{ - o: rel, - } - }) -} - -func (m fsTreatmentMods) WithNewOrganization(mods ...OrganizationMod) FSTreatmentMod { - return FSTreatmentModFunc(func(ctx context.Context, o *FSTreatmentTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsTreatmentMods) WithExistingOrganization(em *models.Organization) FSTreatmentMod { - return FSTreatmentModFunc(func(ctx context.Context, o *FSTreatmentTemplate) { - o.r.Organization = &fsTreatmentROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsTreatmentMods) WithoutOrganization() FSTreatmentMod { - return FSTreatmentModFunc(func(ctx context.Context, o *FSTreatmentTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_treatmentarea.bob.go b/db/factory/fs_treatmentarea.bob.go deleted file mode 100644 index 0400b54a..00000000 --- a/db/factory/fs_treatmentarea.bob.go +++ /dev/null @@ -1,1572 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSTreatmentareaMod interface { - Apply(context.Context, *FSTreatmentareaTemplate) -} - -type FSTreatmentareaModFunc func(context.Context, *FSTreatmentareaTemplate) - -func (f FSTreatmentareaModFunc) Apply(ctx context.Context, n *FSTreatmentareaTemplate) { - f(ctx, n) -} - -type FSTreatmentareaModSlice []FSTreatmentareaMod - -func (mods FSTreatmentareaModSlice) Apply(ctx context.Context, n *FSTreatmentareaTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSTreatmentareaTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSTreatmentareaTemplate struct { - OrganizationID func() int32 - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() string - Notified func() null.Val[int16] - Objectid func() int32 - SessionID func() null.Val[string] - ShapeArea func() null.Val[float64] - ShapeLength func() null.Val[float64] - Treatdate func() null.Val[int64] - TreatID func() null.Val[string] - Type func() null.Val[string] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Updated func() time.Time - - r fsTreatmentareaR - f *Factory - - alreadyPersisted bool -} - -type fsTreatmentareaR struct { - Organization *fsTreatmentareaROrganizationR -} - -type fsTreatmentareaROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSTreatmentareaTemplate -func (o *FSTreatmentareaTemplate) Apply(ctx context.Context, mods ...FSTreatmentareaMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSTreatmentarea -// according to the relationships in the template. Nothing is inserted into the db -func (t FSTreatmentareaTemplate) setModelRels(o *models.FSTreatmentarea) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSTreatmentareas = append(rel.R.FSTreatmentareas, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSTreatmentareaSetter -// this does nothing with the relationship templates -func (o FSTreatmentareaTemplate) BuildSetter() *models.FSTreatmentareaSetter { - m := &models.FSTreatmentareaSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Notified != nil { - val := o.Notified() - m.Notified = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.SessionID != nil { - val := o.SessionID() - m.SessionID = omitnull.FromNull(val) - } - if o.ShapeArea != nil { - val := o.ShapeArea() - m.ShapeArea = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - val := o.ShapeLength() - m.ShapeLength = omitnull.FromNull(val) - } - if o.Treatdate != nil { - val := o.Treatdate() - m.Treatdate = omitnull.FromNull(val) - } - if o.TreatID != nil { - val := o.TreatID() - m.TreatID = omitnull.FromNull(val) - } - if o.Type != nil { - val := o.Type() - m.Type = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSTreatmentareaSetter -// this does nothing with the relationship templates -func (o FSTreatmentareaTemplate) BuildManySetter(number int) []*models.FSTreatmentareaSetter { - m := make([]*models.FSTreatmentareaSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSTreatmentarea -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSTreatmentareaTemplate.Create -func (o FSTreatmentareaTemplate) Build() *models.FSTreatmentarea { - m := &models.FSTreatmentarea{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Notified != nil { - m.Notified = o.Notified() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.SessionID != nil { - m.SessionID = o.SessionID() - } - if o.ShapeArea != nil { - m.ShapeArea = o.ShapeArea() - } - if o.ShapeLength != nil { - m.ShapeLength = o.ShapeLength() - } - if o.Treatdate != nil { - m.Treatdate = o.Treatdate() - } - if o.TreatID != nil { - m.TreatID = o.TreatID() - } - if o.Type != nil { - m.Type = o.Type() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSTreatmentareaSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSTreatmentareaTemplate.CreateMany -func (o FSTreatmentareaTemplate) BuildMany(number int) models.FSTreatmentareaSlice { - m := make(models.FSTreatmentareaSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSTreatmentarea(m *models.FSTreatmentareaSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSTreatmentarea -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSTreatmentareaTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSTreatmentarea) error { - var err error - - return err -} - -// Create builds a fsTreatmentarea and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSTreatmentareaTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSTreatmentarea, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSTreatmentarea(opt) - - if o.r.Organization == nil { - FSTreatmentareaMods.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.FSTreatmentareas.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 fsTreatmentarea and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSTreatmentareaTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSTreatmentarea { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsTreatmentarea 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 *FSTreatmentareaTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSTreatmentarea { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsTreatmentareas and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSTreatmentareaTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSTreatmentareaSlice, error) { - var err error - m := make(models.FSTreatmentareaSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsTreatmentareas and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSTreatmentareaTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSTreatmentareaSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsTreatmentareas 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 FSTreatmentareaTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSTreatmentareaSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSTreatmentarea has methods that act as mods for the FSTreatmentareaTemplate -var FSTreatmentareaMods fsTreatmentareaMods - -type fsTreatmentareaMods struct{} - -func (m fsTreatmentareaMods) RandomizeAllColumns(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModSlice{ - FSTreatmentareaMods.RandomOrganizationID(f), - FSTreatmentareaMods.RandomComments(f), - FSTreatmentareaMods.RandomCreationdate(f), - FSTreatmentareaMods.RandomCreator(f), - FSTreatmentareaMods.RandomEditdate(f), - FSTreatmentareaMods.RandomEditor(f), - FSTreatmentareaMods.RandomGlobalid(f), - FSTreatmentareaMods.RandomNotified(f), - FSTreatmentareaMods.RandomObjectid(f), - FSTreatmentareaMods.RandomSessionID(f), - FSTreatmentareaMods.RandomShapeArea(f), - FSTreatmentareaMods.RandomShapeLength(f), - FSTreatmentareaMods.RandomTreatdate(f), - FSTreatmentareaMods.RandomTreatID(f), - FSTreatmentareaMods.RandomType(f), - FSTreatmentareaMods.RandomCreatedDate(f), - FSTreatmentareaMods.RandomCreatedUser(f), - FSTreatmentareaMods.RandomGeometryX(f), - FSTreatmentareaMods.RandomGeometryY(f), - FSTreatmentareaMods.RandomLastEditedDate(f), - FSTreatmentareaMods.RandomLastEditedUser(f), - FSTreatmentareaMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsTreatmentareaMods) OrganizationID(val int32) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) OrganizationIDFunc(f func() int32) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetOrganizationID() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - 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 fsTreatmentareaMods) RandomOrganizationID(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentareaMods) Comments(val null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) CommentsFunc(f func() null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetComments() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Comments = 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 fsTreatmentareaMods) RandomComments(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Comments = 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) RandomCommentsNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Comments = 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 fsTreatmentareaMods) Creationdate(val null.Val[int64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) CreationdateFunc(f func() null.Val[int64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetCreationdate() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Creationdate = 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 fsTreatmentareaMods) RandomCreationdate(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentareaMods) Creator(val null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) CreatorFunc(f func() null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetCreator() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Creator = 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 fsTreatmentareaMods) RandomCreator(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Creator = 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 fsTreatmentareaMods) Editdate(val null.Val[int64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) EditdateFunc(f func() null.Val[int64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetEditdate() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Editdate = 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 fsTreatmentareaMods) RandomEditdate(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentareaMods) Editor(val null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) EditorFunc(f func() null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetEditor() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Editor = 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 fsTreatmentareaMods) RandomEditor(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Editor = 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 fsTreatmentareaMods) Globalid(val string) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) GlobalidFunc(f func() string) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetGlobalid() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsTreatmentareaMods) RandomGlobalid(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentareaMods) Notified(val null.Val[int16]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Notified = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) NotifiedFunc(f func() null.Val[int16]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Notified = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetNotified() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Notified = 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 fsTreatmentareaMods) RandomNotified(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Notified = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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) RandomNotifiedNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Notified = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentareaMods) Objectid(val int32) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) ObjectidFunc(f func() int32) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetObjectid() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsTreatmentareaMods) RandomObjectid(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentareaMods) SessionID(val null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.SessionID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) SessionIDFunc(f func() null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.SessionID = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetSessionID() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.SessionID = 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 fsTreatmentareaMods) RandomSessionID(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.SessionID = 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) RandomSessionIDNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.SessionID = 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 fsTreatmentareaMods) ShapeArea(val null.Val[float64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.ShapeArea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) ShapeAreaFunc(f func() null.Val[float64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.ShapeArea = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetShapeArea() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.ShapeArea = 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 fsTreatmentareaMods) RandomShapeArea(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.ShapeArea = 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 fsTreatmentareaMods) RandomShapeAreaNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.ShapeArea = 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 fsTreatmentareaMods) ShapeLength(val null.Val[float64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) ShapeLengthFunc(f func() null.Val[float64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetShapeLength() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.ShapeLength = 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 fsTreatmentareaMods) RandomShapeLength(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.ShapeLength = 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 fsTreatmentareaMods) RandomShapeLengthNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.ShapeLength = 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 fsTreatmentareaMods) Treatdate(val null.Val[int64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Treatdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) TreatdateFunc(f func() null.Val[int64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Treatdate = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetTreatdate() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Treatdate = 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 fsTreatmentareaMods) RandomTreatdate(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Treatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomTreatdateNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Treatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentareaMods) TreatID(val null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.TreatID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) TreatIDFunc(f func() null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.TreatID = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetTreatID() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.TreatID = 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 fsTreatmentareaMods) RandomTreatID(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.TreatID = 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) RandomTreatIDNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.TreatID = 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 fsTreatmentareaMods) Type(val null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Type = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) TypeFunc(f func() null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetType() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - 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 fsTreatmentareaMods) RandomType(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - 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 fsTreatmentareaMods) RandomTypeNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Type = 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 fsTreatmentareaMods) CreatedDate(val null.Val[int64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) CreatedDateFunc(f func() null.Val[int64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetCreatedDate() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.CreatedDate = 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 fsTreatmentareaMods) RandomCreatedDate(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentareaMods) CreatedUser(val null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) CreatedUserFunc(f func() null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetCreatedUser() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.CreatedUser = 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 fsTreatmentareaMods) RandomCreatedUser(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.CreatedUser = 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 fsTreatmentareaMods) GeometryX(val null.Val[float64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) GeometryXFunc(f func() null.Val[float64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetGeometryX() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.GeometryX = 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 fsTreatmentareaMods) RandomGeometryX(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - 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 fsTreatmentareaMods) RandomGeometryXNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.GeometryX = 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 fsTreatmentareaMods) GeometryY(val null.Val[float64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) GeometryYFunc(f func() null.Val[float64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetGeometryY() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.GeometryY = 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 fsTreatmentareaMods) RandomGeometryY(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - 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 fsTreatmentareaMods) RandomGeometryYNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.GeometryY = 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 fsTreatmentareaMods) LastEditedDate(val null.Val[int64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) LastEditedDateFunc(f func() null.Val[int64]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetLastEditedDate() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.LastEditedDate = 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 fsTreatmentareaMods) RandomLastEditedDate(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsTreatmentareaMods) LastEditedUser(val null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) LastEditedUserFunc(f func() null.Val[string]) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetLastEditedUser() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.LastEditedUser = 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 fsTreatmentareaMods) RandomLastEditedUser(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.LastEditedUser = 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 fsTreatmentareaMods) Updated(val time.Time) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsTreatmentareaMods) UpdatedFunc(f func() time.Time) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsTreatmentareaMods) UnsetUpdated() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsTreatmentareaMods) RandomUpdated(f *faker.Faker) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsTreatmentareaMods) WithParentsCascading() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(ctx context.Context, o *FSTreatmentareaTemplate) { - if isDone, _ := fsTreatmentareaWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsTreatmentareaWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsTreatmentareaMods) WithOrganization(rel *OrganizationTemplate) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(ctx context.Context, o *FSTreatmentareaTemplate) { - o.r.Organization = &fsTreatmentareaROrganizationR{ - o: rel, - } - }) -} - -func (m fsTreatmentareaMods) WithNewOrganization(mods ...OrganizationMod) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(ctx context.Context, o *FSTreatmentareaTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsTreatmentareaMods) WithExistingOrganization(em *models.Organization) FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(ctx context.Context, o *FSTreatmentareaTemplate) { - o.r.Organization = &fsTreatmentareaROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsTreatmentareaMods) WithoutOrganization() FSTreatmentareaMod { - return FSTreatmentareaModFunc(func(ctx context.Context, o *FSTreatmentareaTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_zones.bob.go b/db/factory/fs_zones.bob.go deleted file mode 100644 index 3da3b686..00000000 --- a/db/factory/fs_zones.bob.go +++ /dev/null @@ -1,1324 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSZoneMod interface { - Apply(context.Context, *FSZoneTemplate) -} - -type FSZoneModFunc func(context.Context, *FSZoneTemplate) - -func (f FSZoneModFunc) Apply(ctx context.Context, n *FSZoneTemplate) { - f(ctx, n) -} - -type FSZoneModSlice []FSZoneMod - -func (mods FSZoneModSlice) Apply(ctx context.Context, n *FSZoneTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSZoneTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FSZoneTemplate struct { - OrganizationID func() int32 - Active func() null.Val[int64] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() string - Name func() null.Val[string] - Objectid func() int32 - ShapeArea func() null.Val[float64] - ShapeLength func() null.Val[float64] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Updated func() time.Time - - r fsZoneR - f *Factory - - alreadyPersisted bool -} - -type fsZoneR struct { - Organization *fsZoneROrganizationR -} - -type fsZoneROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSZoneTemplate -func (o *FSZoneTemplate) Apply(ctx context.Context, mods ...FSZoneMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSZone -// according to the relationships in the template. Nothing is inserted into the db -func (t FSZoneTemplate) setModelRels(o *models.FSZone) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSZones = append(rel.R.FSZones, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSZoneSetter -// this does nothing with the relationship templates -func (o FSZoneTemplate) BuildSetter() *models.FSZoneSetter { - m := &models.FSZoneSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.ShapeArea != nil { - val := o.ShapeArea() - m.ShapeArea = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - val := o.ShapeLength() - m.ShapeLength = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSZoneSetter -// this does nothing with the relationship templates -func (o FSZoneTemplate) BuildManySetter(number int) []*models.FSZoneSetter { - m := make([]*models.FSZoneSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSZone -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSZoneTemplate.Create -func (o FSZoneTemplate) Build() *models.FSZone { - m := &models.FSZone{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.ShapeArea != nil { - m.ShapeArea = o.ShapeArea() - } - if o.ShapeLength != nil { - m.ShapeLength = o.ShapeLength() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSZoneSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSZoneTemplate.CreateMany -func (o FSZoneTemplate) BuildMany(number int) models.FSZoneSlice { - m := make(models.FSZoneSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSZone(m *models.FSZoneSetter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSZone -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSZoneTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSZone) error { - var err error - - return err -} - -// Create builds a fsZone and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSZoneTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FSZone, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSZone(opt) - - if o.r.Organization == nil { - FSZoneMods.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.FSZones.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 fsZone and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSZoneTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FSZone { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsZone 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 *FSZoneTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSZone { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsZones and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSZoneTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSZoneSlice, error) { - var err error - m := make(models.FSZoneSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsZones and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSZoneTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSZoneSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsZones 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 FSZoneTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSZoneSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSZone has methods that act as mods for the FSZoneTemplate -var FSZoneMods fsZoneMods - -type fsZoneMods struct{} - -func (m fsZoneMods) RandomizeAllColumns(f *faker.Faker) FSZoneMod { - return FSZoneModSlice{ - FSZoneMods.RandomOrganizationID(f), - FSZoneMods.RandomActive(f), - FSZoneMods.RandomCreationdate(f), - FSZoneMods.RandomCreator(f), - FSZoneMods.RandomEditdate(f), - FSZoneMods.RandomEditor(f), - FSZoneMods.RandomGlobalid(f), - FSZoneMods.RandomName(f), - FSZoneMods.RandomObjectid(f), - FSZoneMods.RandomShapeArea(f), - FSZoneMods.RandomShapeLength(f), - FSZoneMods.RandomCreatedDate(f), - FSZoneMods.RandomCreatedUser(f), - FSZoneMods.RandomGeometryX(f), - FSZoneMods.RandomGeometryY(f), - FSZoneMods.RandomLastEditedDate(f), - FSZoneMods.RandomLastEditedUser(f), - FSZoneMods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsZoneMods) OrganizationID(val int32) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) OrganizationIDFunc(f func() int32) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetOrganizationID() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - 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 fsZoneMods) RandomOrganizationID(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsZoneMods) Active(val null.Val[int64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Active = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) ActiveFunc(f func() null.Val[int64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetActive() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Active = 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 fsZoneMods) RandomActive(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Active = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomActiveNotNull(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Active = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsZoneMods) Creationdate(val null.Val[int64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) CreationdateFunc(f func() null.Val[int64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetCreationdate() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Creationdate = 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 fsZoneMods) RandomCreationdate(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsZoneMods) Creator(val null.Val[string]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) CreatorFunc(f func() null.Val[string]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetCreator() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Creator = 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 fsZoneMods) RandomCreator(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Creator = 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 fsZoneMods) Editdate(val null.Val[int64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) EditdateFunc(f func() null.Val[int64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetEditdate() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Editdate = 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 fsZoneMods) RandomEditdate(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsZoneMods) Editor(val null.Val[string]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) EditorFunc(f func() null.Val[string]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetEditor() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Editor = 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 fsZoneMods) RandomEditor(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Editor = 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 fsZoneMods) Globalid(val string) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) GlobalidFunc(f func() string) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetGlobalid() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsZoneMods) RandomGlobalid(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsZoneMods) Name(val null.Val[string]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) NameFunc(f func() null.Val[string]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetName() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Name = 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 fsZoneMods) RandomName(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Name = 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) RandomNameNotNull(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Name = 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 fsZoneMods) Objectid(val int32) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) ObjectidFunc(f func() int32) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetObjectid() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsZoneMods) RandomObjectid(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsZoneMods) ShapeArea(val null.Val[float64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.ShapeArea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) ShapeAreaFunc(f func() null.Val[float64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.ShapeArea = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetShapeArea() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.ShapeArea = 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 fsZoneMods) RandomShapeArea(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.ShapeArea = 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 fsZoneMods) RandomShapeAreaNotNull(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.ShapeArea = 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 fsZoneMods) ShapeLength(val null.Val[float64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) ShapeLengthFunc(f func() null.Val[float64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetShapeLength() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.ShapeLength = 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 fsZoneMods) RandomShapeLength(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.ShapeLength = 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 fsZoneMods) RandomShapeLengthNotNull(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.ShapeLength = 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 fsZoneMods) CreatedDate(val null.Val[int64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) CreatedDateFunc(f func() null.Val[int64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetCreatedDate() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.CreatedDate = 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 fsZoneMods) RandomCreatedDate(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsZoneMods) CreatedUser(val null.Val[string]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) CreatedUserFunc(f func() null.Val[string]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetCreatedUser() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.CreatedUser = 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 fsZoneMods) RandomCreatedUser(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.CreatedUser = 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 fsZoneMods) GeometryX(val null.Val[float64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) GeometryXFunc(f func() null.Val[float64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetGeometryX() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.GeometryX = 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 fsZoneMods) RandomGeometryX(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - 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 fsZoneMods) RandomGeometryXNotNull(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.GeometryX = 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 fsZoneMods) GeometryY(val null.Val[float64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) GeometryYFunc(f func() null.Val[float64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetGeometryY() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.GeometryY = 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 fsZoneMods) RandomGeometryY(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - 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 fsZoneMods) RandomGeometryYNotNull(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.GeometryY = 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 fsZoneMods) LastEditedDate(val null.Val[int64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) LastEditedDateFunc(f func() null.Val[int64]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetLastEditedDate() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.LastEditedDate = 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 fsZoneMods) RandomLastEditedDate(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsZoneMods) LastEditedUser(val null.Val[string]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) LastEditedUserFunc(f func() null.Val[string]) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetLastEditedUser() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.LastEditedUser = 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 fsZoneMods) RandomLastEditedUser(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.LastEditedUser = 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 fsZoneMods) Updated(val time.Time) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsZoneMods) UpdatedFunc(f func() time.Time) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsZoneMods) UnsetUpdated() FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsZoneMods) RandomUpdated(f *faker.Faker) FSZoneMod { - return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsZoneMods) WithParentsCascading() FSZoneMod { - return FSZoneModFunc(func(ctx context.Context, o *FSZoneTemplate) { - if isDone, _ := fsZoneWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsZoneWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsZoneMods) WithOrganization(rel *OrganizationTemplate) FSZoneMod { - return FSZoneModFunc(func(ctx context.Context, o *FSZoneTemplate) { - o.r.Organization = &fsZoneROrganizationR{ - o: rel, - } - }) -} - -func (m fsZoneMods) WithNewOrganization(mods ...OrganizationMod) FSZoneMod { - return FSZoneModFunc(func(ctx context.Context, o *FSZoneTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsZoneMods) WithExistingOrganization(em *models.Organization) FSZoneMod { - return FSZoneModFunc(func(ctx context.Context, o *FSZoneTemplate) { - o.r.Organization = &fsZoneROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsZoneMods) WithoutOrganization() FSZoneMod { - return FSZoneModFunc(func(ctx context.Context, o *FSZoneTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fs_zones2.bob.go b/db/factory/fs_zones2.bob.go deleted file mode 100644 index 6f1bb999..00000000 --- a/db/factory/fs_zones2.bob.go +++ /dev/null @@ -1,1262 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type FSZones2Mod interface { - Apply(context.Context, *FSZones2Template) -} - -type FSZones2ModFunc func(context.Context, *FSZones2Template) - -func (f FSZones2ModFunc) Apply(ctx context.Context, n *FSZones2Template) { - f(ctx, n) -} - -type FSZones2ModSlice []FSZones2Mod - -func (mods FSZones2ModSlice) Apply(ctx context.Context, n *FSZones2Template) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FSZones2Template is an object representing the database table. -// all columns are optional and should be set by mods -type FSZones2Template struct { - OrganizationID func() int32 - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() string - Name func() null.Val[string] - Objectid func() int32 - ShapeArea func() null.Val[float64] - ShapeLength func() null.Val[float64] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Updated func() time.Time - - r fsZones2R - f *Factory - - alreadyPersisted bool -} - -type fsZones2R struct { - Organization *fsZones2ROrganizationR -} - -type fsZones2ROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FSZones2Template -func (o *FSZones2Template) Apply(ctx context.Context, mods ...FSZones2Mod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FSZones2 -// according to the relationships in the template. Nothing is inserted into the db -func (t FSZones2Template) setModelRels(o *models.FSZones2) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FSZones2s = append(rel.R.FSZones2s, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FSZones2Setter -// this does nothing with the relationship templates -func (o FSZones2Template) BuildSetter() *models.FSZones2Setter { - m := &models.FSZones2Setter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.ShapeArea != nil { - val := o.ShapeArea() - m.ShapeArea = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - val := o.ShapeLength() - m.ShapeLength = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Updated != nil { - val := o.Updated() - m.Updated = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FSZones2Setter -// this does nothing with the relationship templates -func (o FSZones2Template) BuildManySetter(number int) []*models.FSZones2Setter { - m := make([]*models.FSZones2Setter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FSZones2 -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSZones2Template.Create -func (o FSZones2Template) Build() *models.FSZones2 { - m := &models.FSZones2{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.ShapeArea != nil { - m.ShapeArea = o.ShapeArea() - } - if o.ShapeLength != nil { - m.ShapeLength = o.ShapeLength() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Updated != nil { - m.Updated = o.Updated() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FSZones2Slice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FSZones2Template.CreateMany -func (o FSZones2Template) BuildMany(number int) models.FSZones2Slice { - m := make(models.FSZones2Slice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFSZones2(m *models.FSZones2Setter) { - if !(m.OrganizationID.IsValue()) { - 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) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FSZones2 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FSZones2Template) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSZones2) error { - var err error - - return err -} - -// Create builds a fsZones2 and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FSZones2Template) Create(ctx context.Context, exec bob.Executor) (*models.FSZones2, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFSZones2(opt) - - if o.r.Organization == nil { - FSZones2Mods.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.FSZones2s.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 fsZones2 and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FSZones2Template) MustCreate(ctx context.Context, exec bob.Executor) *models.FSZones2 { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fsZones2 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 *FSZones2Template) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FSZones2 { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fsZones2s and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FSZones2Template) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FSZones2Slice, error) { - var err error - m := make(models.FSZones2Slice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fsZones2s and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FSZones2Template) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FSZones2Slice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fsZones2s 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 FSZones2Template) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FSZones2Slice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FSZones2 has methods that act as mods for the FSZones2Template -var FSZones2Mods fsZones2Mods - -type fsZones2Mods struct{} - -func (m fsZones2Mods) RandomizeAllColumns(f *faker.Faker) FSZones2Mod { - return FSZones2ModSlice{ - FSZones2Mods.RandomOrganizationID(f), - FSZones2Mods.RandomCreationdate(f), - FSZones2Mods.RandomCreator(f), - FSZones2Mods.RandomEditdate(f), - FSZones2Mods.RandomEditor(f), - FSZones2Mods.RandomGlobalid(f), - FSZones2Mods.RandomName(f), - FSZones2Mods.RandomObjectid(f), - FSZones2Mods.RandomShapeArea(f), - FSZones2Mods.RandomShapeLength(f), - FSZones2Mods.RandomCreatedDate(f), - FSZones2Mods.RandomCreatedUser(f), - FSZones2Mods.RandomGeometryX(f), - FSZones2Mods.RandomGeometryY(f), - FSZones2Mods.RandomLastEditedDate(f), - FSZones2Mods.RandomLastEditedUser(f), - FSZones2Mods.RandomUpdated(f), - } -} - -// Set the model columns to this value -func (m fsZones2Mods) OrganizationID(val int32) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) OrganizationIDFunc(f func() int32) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetOrganizationID() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - 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 fsZones2Mods) RandomOrganizationID(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsZones2Mods) Creationdate(val null.Val[int64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) CreationdateFunc(f func() null.Val[int64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetCreationdate() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Creationdate = 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 fsZones2Mods) RandomCreationdate(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreationdateNotNull(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsZones2Mods) Creator(val null.Val[string]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) CreatorFunc(f func() null.Val[string]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetCreator() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Creator = 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 fsZones2Mods) RandomCreator(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Creator = 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) RandomCreatorNotNull(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Creator = 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 fsZones2Mods) Editdate(val null.Val[int64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) EditdateFunc(f func() null.Val[int64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetEditdate() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Editdate = 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 fsZones2Mods) RandomEditdate(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomEditdateNotNull(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsZones2Mods) Editor(val null.Val[string]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) EditorFunc(f func() null.Val[string]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetEditor() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Editor = 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 fsZones2Mods) RandomEditor(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Editor = 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) RandomEditorNotNull(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Editor = 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 fsZones2Mods) Globalid(val string) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Globalid = func() string { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) GlobalidFunc(f func() string) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetGlobalid() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Globalid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsZones2Mods) RandomGlobalid(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Globalid = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fsZones2Mods) Name(val null.Val[string]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) NameFunc(f func() null.Val[string]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetName() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Name = 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 fsZones2Mods) RandomName(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Name = 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) RandomNameNotNull(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Name = 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 fsZones2Mods) Objectid(val int32) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) ObjectidFunc(f func() int32) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetObjectid() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsZones2Mods) RandomObjectid(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fsZones2Mods) ShapeArea(val null.Val[float64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.ShapeArea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) ShapeAreaFunc(f func() null.Val[float64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.ShapeArea = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetShapeArea() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.ShapeArea = 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 fsZones2Mods) RandomShapeArea(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.ShapeArea = 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 fsZones2Mods) RandomShapeAreaNotNull(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.ShapeArea = 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 fsZones2Mods) ShapeLength(val null.Val[float64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) ShapeLengthFunc(f func() null.Val[float64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetShapeLength() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.ShapeLength = 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 fsZones2Mods) RandomShapeLength(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.ShapeLength = 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 fsZones2Mods) RandomShapeLengthNotNull(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.ShapeLength = 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 fsZones2Mods) CreatedDate(val null.Val[int64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) CreatedDateFunc(f func() null.Val[int64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetCreatedDate() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.CreatedDate = 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 fsZones2Mods) RandomCreatedDate(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomCreatedDateNotNull(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsZones2Mods) CreatedUser(val null.Val[string]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) CreatedUserFunc(f func() null.Val[string]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetCreatedUser() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.CreatedUser = 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 fsZones2Mods) RandomCreatedUser(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.CreatedUser = 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) RandomCreatedUserNotNull(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.CreatedUser = 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 fsZones2Mods) GeometryX(val null.Val[float64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) GeometryXFunc(f func() null.Val[float64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetGeometryX() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.GeometryX = 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 fsZones2Mods) RandomGeometryX(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - 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 fsZones2Mods) RandomGeometryXNotNull(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.GeometryX = 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 fsZones2Mods) GeometryY(val null.Val[float64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) GeometryYFunc(f func() null.Val[float64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetGeometryY() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.GeometryY = 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 fsZones2Mods) RandomGeometryY(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - 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 fsZones2Mods) RandomGeometryYNotNull(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.GeometryY = 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 fsZones2Mods) LastEditedDate(val null.Val[int64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) LastEditedDateFunc(f func() null.Val[int64]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetLastEditedDate() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.LastEditedDate = 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 fsZones2Mods) RandomLastEditedDate(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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) RandomLastEditedDateNotNull(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fsZones2Mods) LastEditedUser(val null.Val[string]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) LastEditedUserFunc(f func() null.Val[string]) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetLastEditedUser() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.LastEditedUser = 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 fsZones2Mods) RandomLastEditedUser(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.LastEditedUser = 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) RandomLastEditedUserNotNull(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.LastEditedUser = 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 fsZones2Mods) Updated(val time.Time) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Updated = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fsZones2Mods) UpdatedFunc(f func() time.Time) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Updated = f - }) -} - -// Clear any values for the column -func (m fsZones2Mods) UnsetUpdated() FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Updated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fsZones2Mods) RandomUpdated(f *faker.Faker) FSZones2Mod { - return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) { - o.Updated = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m fsZones2Mods) WithParentsCascading() FSZones2Mod { - return FSZones2ModFunc(func(ctx context.Context, o *FSZones2Template) { - if isDone, _ := fsZones2WithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fsZones2WithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fsZones2Mods) WithOrganization(rel *OrganizationTemplate) FSZones2Mod { - return FSZones2ModFunc(func(ctx context.Context, o *FSZones2Template) { - o.r.Organization = &fsZones2ROrganizationR{ - o: rel, - } - }) -} - -func (m fsZones2Mods) WithNewOrganization(mods ...OrganizationMod) FSZones2Mod { - return FSZones2ModFunc(func(ctx context.Context, o *FSZones2Template) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fsZones2Mods) WithExistingOrganization(em *models.Organization) FSZones2Mod { - return FSZones2ModFunc(func(ctx context.Context, o *FSZones2Template) { - o.r.Organization = &fsZones2ROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fsZones2Mods) WithoutOrganization() FSZones2Mod { - return FSZones2ModFunc(func(ctx context.Context, o *FSZones2Template) { - o.r.Organization = nil - }) -} diff --git a/db/factory/geography_columns.bob.go b/db/factory/geography_columns.bob.go index 6c5a7591..7d8ba492 100644 --- a/db/factory/geography_columns.bob.go +++ b/db/factory/geography_columns.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory diff --git a/db/factory/geometry_columns.bob.go b/db/factory/geometry_columns.bob.go index 548afabe..c51e3ef9 100644 --- a/db/factory/geometry_columns.bob.go +++ b/db/factory/geometry_columns.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory diff --git a/db/factory/goose_db_version.bob.go b/db/factory/goose_db_version.bob.go index 3c3d1e4e..ebcd2717 100644 --- a/db/factory/goose_db_version.bob.go +++ b/db/factory/goose_db_version.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory diff --git a/db/factory/h3_aggregation.bob.go b/db/factory/h3_aggregation.bob.go index 3f132999..9d393e52 100644 --- a/db/factory/h3_aggregation.bob.go +++ b/db/factory/h3_aggregation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory diff --git a/db/factory/history_containerrelate.bob.go b/db/factory/history_containerrelate.bob.go deleted file mode 100644 index 1a1fea0a..00000000 --- a/db/factory/history_containerrelate.bob.go +++ /dev/null @@ -1,1408 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryContainerrelateMod interface { - Apply(context.Context, *HistoryContainerrelateTemplate) -} - -type HistoryContainerrelateModFunc func(context.Context, *HistoryContainerrelateTemplate) - -func (f HistoryContainerrelateModFunc) Apply(ctx context.Context, n *HistoryContainerrelateTemplate) { - f(ctx, n) -} - -type HistoryContainerrelateModSlice []HistoryContainerrelateMod - -func (mods HistoryContainerrelateModSlice) Apply(ctx context.Context, n *HistoryContainerrelateTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryContainerrelateTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryContainerrelateTemplate struct { - OrganizationID func() int32 - Containertype func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() null.Val[string] - Inspsampleid func() null.Val[string] - Mosquitoinspid func() null.Val[string] - Objectid func() int32 - Treatmentid func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Version func() int32 - - r historyContainerrelateR - f *Factory - - alreadyPersisted bool -} - -type historyContainerrelateR struct { - Organization *historyContainerrelateROrganizationR -} - -type historyContainerrelateROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryContainerrelateTemplate -func (o *HistoryContainerrelateTemplate) Apply(ctx context.Context, mods ...HistoryContainerrelateMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryContainerrelate -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryContainerrelateTemplate) setModelRels(o *models.HistoryContainerrelate) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryContainerrelates = append(rel.R.HistoryContainerrelates, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryContainerrelateSetter -// this does nothing with the relationship templates -func (o HistoryContainerrelateTemplate) BuildSetter() *models.HistoryContainerrelateSetter { - m := &models.HistoryContainerrelateSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Containertype != nil { - val := o.Containertype() - m.Containertype = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Inspsampleid != nil { - val := o.Inspsampleid() - m.Inspsampleid = omitnull.FromNull(val) - } - if o.Mosquitoinspid != nil { - val := o.Mosquitoinspid() - m.Mosquitoinspid = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Treatmentid != nil { - val := o.Treatmentid() - m.Treatmentid = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryContainerrelateSetter -// this does nothing with the relationship templates -func (o HistoryContainerrelateTemplate) BuildManySetter(number int) []*models.HistoryContainerrelateSetter { - m := make([]*models.HistoryContainerrelateSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryContainerrelate -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryContainerrelateTemplate.Create -func (o HistoryContainerrelateTemplate) Build() *models.HistoryContainerrelate { - m := &models.HistoryContainerrelate{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Containertype != nil { - m.Containertype = o.Containertype() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Inspsampleid != nil { - m.Inspsampleid = o.Inspsampleid() - } - if o.Mosquitoinspid != nil { - m.Mosquitoinspid = o.Mosquitoinspid() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Treatmentid != nil { - m.Treatmentid = o.Treatmentid() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryContainerrelateSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryContainerrelateTemplate.CreateMany -func (o HistoryContainerrelateTemplate) BuildMany(number int) models.HistoryContainerrelateSlice { - m := make(models.HistoryContainerrelateSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryContainerrelate(m *models.HistoryContainerrelateSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryContainerrelate -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryContainerrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryContainerrelate) error { - var err error - - return err -} - -// Create builds a historyContainerrelate and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryContainerrelateTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryContainerrelate, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryContainerrelate(opt) - - if o.r.Organization == nil { - HistoryContainerrelateMods.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.HistoryContainerrelates.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 historyContainerrelate and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryContainerrelateTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryContainerrelate { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyContainerrelate 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 *HistoryContainerrelateTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryContainerrelate { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyContainerrelates and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryContainerrelateTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryContainerrelateSlice, error) { - var err error - m := make(models.HistoryContainerrelateSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyContainerrelates and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryContainerrelateTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryContainerrelateSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyContainerrelates 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 HistoryContainerrelateTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryContainerrelateSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryContainerrelate has methods that act as mods for the HistoryContainerrelateTemplate -var HistoryContainerrelateMods historyContainerrelateMods - -type historyContainerrelateMods struct{} - -func (m historyContainerrelateMods) RandomizeAllColumns(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModSlice{ - HistoryContainerrelateMods.RandomOrganizationID(f), - HistoryContainerrelateMods.RandomContainertype(f), - HistoryContainerrelateMods.RandomCreationdate(f), - HistoryContainerrelateMods.RandomCreator(f), - HistoryContainerrelateMods.RandomEditdate(f), - HistoryContainerrelateMods.RandomEditor(f), - HistoryContainerrelateMods.RandomGlobalid(f), - HistoryContainerrelateMods.RandomInspsampleid(f), - HistoryContainerrelateMods.RandomMosquitoinspid(f), - HistoryContainerrelateMods.RandomObjectid(f), - HistoryContainerrelateMods.RandomTreatmentid(f), - HistoryContainerrelateMods.RandomCreated(f), - HistoryContainerrelateMods.RandomCreatedDate(f), - HistoryContainerrelateMods.RandomCreatedUser(f), - HistoryContainerrelateMods.RandomGeometryX(f), - HistoryContainerrelateMods.RandomGeometryY(f), - HistoryContainerrelateMods.RandomLastEditedDate(f), - HistoryContainerrelateMods.RandomLastEditedUser(f), - HistoryContainerrelateMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyContainerrelateMods) OrganizationID(val int32) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) OrganizationIDFunc(f func() int32) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetOrganizationID() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - 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 historyContainerrelateMods) RandomOrganizationID(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyContainerrelateMods) Containertype(val null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Containertype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) ContainertypeFunc(f func() null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Containertype = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetContainertype() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Containertype = 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 historyContainerrelateMods) RandomContainertype(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Containertype = 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 historyContainerrelateMods) RandomContainertypeNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Containertype = 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 historyContainerrelateMods) Creationdate(val null.Val[int64]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) CreationdateFunc(f func() null.Val[int64]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetCreationdate() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Creationdate = 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 historyContainerrelateMods) RandomCreationdate(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyContainerrelateMods) RandomCreationdateNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyContainerrelateMods) Creator(val null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) CreatorFunc(f func() null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetCreator() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Creator = 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 historyContainerrelateMods) RandomCreator(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Creator = 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 historyContainerrelateMods) RandomCreatorNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Creator = 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 historyContainerrelateMods) Editdate(val null.Val[int64]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) EditdateFunc(f func() null.Val[int64]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetEditdate() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Editdate = 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 historyContainerrelateMods) RandomEditdate(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyContainerrelateMods) RandomEditdateNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyContainerrelateMods) Editor(val null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) EditorFunc(f func() null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetEditor() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Editor = 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 historyContainerrelateMods) RandomEditor(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Editor = 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 historyContainerrelateMods) RandomEditorNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Editor = 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 historyContainerrelateMods) Globalid(val null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) GlobalidFunc(f func() null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetGlobalid() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Globalid = 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 historyContainerrelateMods) RandomGlobalid(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - 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 historyContainerrelateMods) RandomGlobalidNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Globalid = 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 historyContainerrelateMods) Inspsampleid(val null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Inspsampleid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) InspsampleidFunc(f func() null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Inspsampleid = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetInspsampleid() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Inspsampleid = 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 historyContainerrelateMods) RandomInspsampleid(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Inspsampleid = 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 historyContainerrelateMods) RandomInspsampleidNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Inspsampleid = 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 historyContainerrelateMods) Mosquitoinspid(val null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Mosquitoinspid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) MosquitoinspidFunc(f func() null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Mosquitoinspid = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetMosquitoinspid() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Mosquitoinspid = 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 historyContainerrelateMods) RandomMosquitoinspid(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Mosquitoinspid = 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 historyContainerrelateMods) RandomMosquitoinspidNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Mosquitoinspid = 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 historyContainerrelateMods) Objectid(val int32) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) ObjectidFunc(f func() int32) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetObjectid() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyContainerrelateMods) RandomObjectid(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyContainerrelateMods) Treatmentid(val null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Treatmentid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) TreatmentidFunc(f func() null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Treatmentid = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetTreatmentid() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Treatmentid = 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 historyContainerrelateMods) RandomTreatmentid(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Treatmentid = 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 historyContainerrelateMods) RandomTreatmentidNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Treatmentid = 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 historyContainerrelateMods) Created(val null.Val[time.Time]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) CreatedFunc(f func() null.Val[time.Time]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetCreated() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Created = 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 historyContainerrelateMods) RandomCreated(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyContainerrelateMods) RandomCreatedNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyContainerrelateMods) CreatedDate(val null.Val[int64]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) CreatedDateFunc(f func() null.Val[int64]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetCreatedDate() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.CreatedDate = 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 historyContainerrelateMods) RandomCreatedDate(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyContainerrelateMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyContainerrelateMods) CreatedUser(val null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) CreatedUserFunc(f func() null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetCreatedUser() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.CreatedUser = 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 historyContainerrelateMods) RandomCreatedUser(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.CreatedUser = 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 historyContainerrelateMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.CreatedUser = 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 historyContainerrelateMods) GeometryX(val null.Val[float64]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) GeometryXFunc(f func() null.Val[float64]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetGeometryX() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.GeometryX = 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 historyContainerrelateMods) RandomGeometryX(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - 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 historyContainerrelateMods) RandomGeometryXNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.GeometryX = 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 historyContainerrelateMods) GeometryY(val null.Val[float64]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) GeometryYFunc(f func() null.Val[float64]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetGeometryY() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.GeometryY = 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 historyContainerrelateMods) RandomGeometryY(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - 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 historyContainerrelateMods) RandomGeometryYNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.GeometryY = 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 historyContainerrelateMods) LastEditedDate(val null.Val[int64]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetLastEditedDate() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.LastEditedDate = 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 historyContainerrelateMods) RandomLastEditedDate(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyContainerrelateMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyContainerrelateMods) LastEditedUser(val null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) LastEditedUserFunc(f func() null.Val[string]) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetLastEditedUser() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.LastEditedUser = 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 historyContainerrelateMods) RandomLastEditedUser(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.LastEditedUser = 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 historyContainerrelateMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.LastEditedUser = 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 historyContainerrelateMods) Version(val int32) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyContainerrelateMods) VersionFunc(f func() int32) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyContainerrelateMods) UnsetVersion() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyContainerrelateMods) RandomVersion(f *faker.Faker) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyContainerrelateMods) WithParentsCascading() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(ctx context.Context, o *HistoryContainerrelateTemplate) { - if isDone, _ := historyContainerrelateWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyContainerrelateWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyContainerrelateMods) WithOrganization(rel *OrganizationTemplate) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(ctx context.Context, o *HistoryContainerrelateTemplate) { - o.r.Organization = &historyContainerrelateROrganizationR{ - o: rel, - } - }) -} - -func (m historyContainerrelateMods) WithNewOrganization(mods ...OrganizationMod) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(ctx context.Context, o *HistoryContainerrelateTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyContainerrelateMods) WithExistingOrganization(em *models.Organization) HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(ctx context.Context, o *HistoryContainerrelateTemplate) { - o.r.Organization = &historyContainerrelateROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyContainerrelateMods) WithoutOrganization() HistoryContainerrelateMod { - return HistoryContainerrelateModFunc(func(ctx context.Context, o *HistoryContainerrelateTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_fieldscoutinglog.bob.go b/db/factory/history_fieldscoutinglog.bob.go deleted file mode 100644 index cf95ac0c..00000000 --- a/db/factory/history_fieldscoutinglog.bob.go +++ /dev/null @@ -1,1222 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryFieldscoutinglogMod interface { - Apply(context.Context, *HistoryFieldscoutinglogTemplate) -} - -type HistoryFieldscoutinglogModFunc func(context.Context, *HistoryFieldscoutinglogTemplate) - -func (f HistoryFieldscoutinglogModFunc) Apply(ctx context.Context, n *HistoryFieldscoutinglogTemplate) { - f(ctx, n) -} - -type HistoryFieldscoutinglogModSlice []HistoryFieldscoutinglogMod - -func (mods HistoryFieldscoutinglogModSlice) Apply(ctx context.Context, n *HistoryFieldscoutinglogTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryFieldscoutinglogTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryFieldscoutinglogTemplate struct { - OrganizationID func() int32 - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() null.Val[string] - Objectid func() int32 - Status func() null.Val[int16] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Version func() int32 - - r historyFieldscoutinglogR - f *Factory - - alreadyPersisted bool -} - -type historyFieldscoutinglogR struct { - Organization *historyFieldscoutinglogROrganizationR -} - -type historyFieldscoutinglogROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryFieldscoutinglogTemplate -func (o *HistoryFieldscoutinglogTemplate) Apply(ctx context.Context, mods ...HistoryFieldscoutinglogMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryFieldscoutinglog -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryFieldscoutinglogTemplate) setModelRels(o *models.HistoryFieldscoutinglog) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryFieldscoutinglogs = append(rel.R.HistoryFieldscoutinglogs, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryFieldscoutinglogSetter -// this does nothing with the relationship templates -func (o HistoryFieldscoutinglogTemplate) BuildSetter() *models.HistoryFieldscoutinglogSetter { - m := &models.HistoryFieldscoutinglogSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Status != nil { - val := o.Status() - m.Status = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryFieldscoutinglogSetter -// this does nothing with the relationship templates -func (o HistoryFieldscoutinglogTemplate) BuildManySetter(number int) []*models.HistoryFieldscoutinglogSetter { - m := make([]*models.HistoryFieldscoutinglogSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryFieldscoutinglog -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryFieldscoutinglogTemplate.Create -func (o HistoryFieldscoutinglogTemplate) Build() *models.HistoryFieldscoutinglog { - m := &models.HistoryFieldscoutinglog{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Status != nil { - m.Status = o.Status() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryFieldscoutinglogSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryFieldscoutinglogTemplate.CreateMany -func (o HistoryFieldscoutinglogTemplate) BuildMany(number int) models.HistoryFieldscoutinglogSlice { - m := make(models.HistoryFieldscoutinglogSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryFieldscoutinglog(m *models.HistoryFieldscoutinglogSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryFieldscoutinglog -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryFieldscoutinglogTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryFieldscoutinglog) error { - var err error - - return err -} - -// Create builds a historyFieldscoutinglog and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryFieldscoutinglogTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryFieldscoutinglog, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryFieldscoutinglog(opt) - - if o.r.Organization == nil { - HistoryFieldscoutinglogMods.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.HistoryFieldscoutinglogs.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 historyFieldscoutinglog and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryFieldscoutinglogTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryFieldscoutinglog { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyFieldscoutinglog 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 *HistoryFieldscoutinglogTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryFieldscoutinglog { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyFieldscoutinglogs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryFieldscoutinglogTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryFieldscoutinglogSlice, error) { - var err error - m := make(models.HistoryFieldscoutinglogSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyFieldscoutinglogs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryFieldscoutinglogTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryFieldscoutinglogSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyFieldscoutinglogs 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 HistoryFieldscoutinglogTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryFieldscoutinglogSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryFieldscoutinglog has methods that act as mods for the HistoryFieldscoutinglogTemplate -var HistoryFieldscoutinglogMods historyFieldscoutinglogMods - -type historyFieldscoutinglogMods struct{} - -func (m historyFieldscoutinglogMods) RandomizeAllColumns(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModSlice{ - HistoryFieldscoutinglogMods.RandomOrganizationID(f), - HistoryFieldscoutinglogMods.RandomCreationdate(f), - HistoryFieldscoutinglogMods.RandomCreator(f), - HistoryFieldscoutinglogMods.RandomEditdate(f), - HistoryFieldscoutinglogMods.RandomEditor(f), - HistoryFieldscoutinglogMods.RandomGlobalid(f), - HistoryFieldscoutinglogMods.RandomObjectid(f), - HistoryFieldscoutinglogMods.RandomStatus(f), - HistoryFieldscoutinglogMods.RandomCreated(f), - HistoryFieldscoutinglogMods.RandomCreatedDate(f), - HistoryFieldscoutinglogMods.RandomCreatedUser(f), - HistoryFieldscoutinglogMods.RandomGeometryX(f), - HistoryFieldscoutinglogMods.RandomGeometryY(f), - HistoryFieldscoutinglogMods.RandomLastEditedDate(f), - HistoryFieldscoutinglogMods.RandomLastEditedUser(f), - HistoryFieldscoutinglogMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyFieldscoutinglogMods) OrganizationID(val int32) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) OrganizationIDFunc(f func() int32) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetOrganizationID() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - 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 historyFieldscoutinglogMods) RandomOrganizationID(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyFieldscoutinglogMods) Creationdate(val null.Val[int64]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) CreationdateFunc(f func() null.Val[int64]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetCreationdate() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Creationdate = 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 historyFieldscoutinglogMods) RandomCreationdate(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyFieldscoutinglogMods) RandomCreationdateNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyFieldscoutinglogMods) Creator(val null.Val[string]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) CreatorFunc(f func() null.Val[string]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetCreator() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Creator = 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 historyFieldscoutinglogMods) RandomCreator(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Creator = 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 historyFieldscoutinglogMods) RandomCreatorNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Creator = 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 historyFieldscoutinglogMods) Editdate(val null.Val[int64]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) EditdateFunc(f func() null.Val[int64]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetEditdate() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Editdate = 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 historyFieldscoutinglogMods) RandomEditdate(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyFieldscoutinglogMods) RandomEditdateNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyFieldscoutinglogMods) Editor(val null.Val[string]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) EditorFunc(f func() null.Val[string]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetEditor() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Editor = 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 historyFieldscoutinglogMods) RandomEditor(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Editor = 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 historyFieldscoutinglogMods) RandomEditorNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Editor = 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 historyFieldscoutinglogMods) Globalid(val null.Val[string]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) GlobalidFunc(f func() null.Val[string]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetGlobalid() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Globalid = 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 historyFieldscoutinglogMods) RandomGlobalid(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - 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 historyFieldscoutinglogMods) RandomGlobalidNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Globalid = 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 historyFieldscoutinglogMods) Objectid(val int32) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) ObjectidFunc(f func() int32) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetObjectid() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyFieldscoutinglogMods) RandomObjectid(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyFieldscoutinglogMods) Status(val null.Val[int16]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Status = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) StatusFunc(f func() null.Val[int16]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Status = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetStatus() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Status = 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 historyFieldscoutinglogMods) RandomStatus(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Status = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyFieldscoutinglogMods) RandomStatusNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Status = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyFieldscoutinglogMods) Created(val null.Val[time.Time]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) CreatedFunc(f func() null.Val[time.Time]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetCreated() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Created = 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 historyFieldscoutinglogMods) RandomCreated(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyFieldscoutinglogMods) RandomCreatedNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyFieldscoutinglogMods) CreatedDate(val null.Val[int64]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) CreatedDateFunc(f func() null.Val[int64]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetCreatedDate() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.CreatedDate = 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 historyFieldscoutinglogMods) RandomCreatedDate(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyFieldscoutinglogMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyFieldscoutinglogMods) CreatedUser(val null.Val[string]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) CreatedUserFunc(f func() null.Val[string]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetCreatedUser() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.CreatedUser = 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 historyFieldscoutinglogMods) RandomCreatedUser(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.CreatedUser = 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 historyFieldscoutinglogMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.CreatedUser = 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 historyFieldscoutinglogMods) GeometryX(val null.Val[float64]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) GeometryXFunc(f func() null.Val[float64]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetGeometryX() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.GeometryX = 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 historyFieldscoutinglogMods) RandomGeometryX(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - 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 historyFieldscoutinglogMods) RandomGeometryXNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.GeometryX = 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 historyFieldscoutinglogMods) GeometryY(val null.Val[float64]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) GeometryYFunc(f func() null.Val[float64]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetGeometryY() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.GeometryY = 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 historyFieldscoutinglogMods) RandomGeometryY(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - 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 historyFieldscoutinglogMods) RandomGeometryYNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.GeometryY = 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 historyFieldscoutinglogMods) LastEditedDate(val null.Val[int64]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetLastEditedDate() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.LastEditedDate = 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 historyFieldscoutinglogMods) RandomLastEditedDate(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyFieldscoutinglogMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyFieldscoutinglogMods) LastEditedUser(val null.Val[string]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) LastEditedUserFunc(f func() null.Val[string]) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetLastEditedUser() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.LastEditedUser = 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 historyFieldscoutinglogMods) RandomLastEditedUser(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.LastEditedUser = 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 historyFieldscoutinglogMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.LastEditedUser = 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 historyFieldscoutinglogMods) Version(val int32) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyFieldscoutinglogMods) VersionFunc(f func() int32) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyFieldscoutinglogMods) UnsetVersion() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyFieldscoutinglogMods) RandomVersion(f *faker.Faker) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyFieldscoutinglogMods) WithParentsCascading() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(ctx context.Context, o *HistoryFieldscoutinglogTemplate) { - if isDone, _ := historyFieldscoutinglogWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyFieldscoutinglogWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyFieldscoutinglogMods) WithOrganization(rel *OrganizationTemplate) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(ctx context.Context, o *HistoryFieldscoutinglogTemplate) { - o.r.Organization = &historyFieldscoutinglogROrganizationR{ - o: rel, - } - }) -} - -func (m historyFieldscoutinglogMods) WithNewOrganization(mods ...OrganizationMod) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(ctx context.Context, o *HistoryFieldscoutinglogTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyFieldscoutinglogMods) WithExistingOrganization(em *models.Organization) HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(ctx context.Context, o *HistoryFieldscoutinglogTemplate) { - o.r.Organization = &historyFieldscoutinglogROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyFieldscoutinglogMods) WithoutOrganization() HistoryFieldscoutinglogMod { - return HistoryFieldscoutinglogModFunc(func(ctx context.Context, o *HistoryFieldscoutinglogTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_habitatrelate.bob.go b/db/factory/history_habitatrelate.bob.go deleted file mode 100644 index b2e9e4c9..00000000 --- a/db/factory/history_habitatrelate.bob.go +++ /dev/null @@ -1,1284 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryHabitatrelateMod interface { - Apply(context.Context, *HistoryHabitatrelateTemplate) -} - -type HistoryHabitatrelateModFunc func(context.Context, *HistoryHabitatrelateTemplate) - -func (f HistoryHabitatrelateModFunc) Apply(ctx context.Context, n *HistoryHabitatrelateTemplate) { - f(ctx, n) -} - -type HistoryHabitatrelateModSlice []HistoryHabitatrelateMod - -func (mods HistoryHabitatrelateModSlice) Apply(ctx context.Context, n *HistoryHabitatrelateTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryHabitatrelateTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryHabitatrelateTemplate struct { - OrganizationID func() int32 - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - ForeignID func() null.Val[string] - Globalid func() null.Val[string] - Habitattype func() null.Val[string] - Objectid func() int32 - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Version func() int32 - - r historyHabitatrelateR - f *Factory - - alreadyPersisted bool -} - -type historyHabitatrelateR struct { - Organization *historyHabitatrelateROrganizationR -} - -type historyHabitatrelateROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryHabitatrelateTemplate -func (o *HistoryHabitatrelateTemplate) Apply(ctx context.Context, mods ...HistoryHabitatrelateMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryHabitatrelate -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryHabitatrelateTemplate) setModelRels(o *models.HistoryHabitatrelate) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryHabitatrelates = append(rel.R.HistoryHabitatrelates, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryHabitatrelateSetter -// this does nothing with the relationship templates -func (o HistoryHabitatrelateTemplate) BuildSetter() *models.HistoryHabitatrelateSetter { - m := &models.HistoryHabitatrelateSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.ForeignID != nil { - val := o.ForeignID() - m.ForeignID = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Habitattype != nil { - val := o.Habitattype() - m.Habitattype = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryHabitatrelateSetter -// this does nothing with the relationship templates -func (o HistoryHabitatrelateTemplate) BuildManySetter(number int) []*models.HistoryHabitatrelateSetter { - m := make([]*models.HistoryHabitatrelateSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryHabitatrelate -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryHabitatrelateTemplate.Create -func (o HistoryHabitatrelateTemplate) Build() *models.HistoryHabitatrelate { - m := &models.HistoryHabitatrelate{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.ForeignID != nil { - m.ForeignID = o.ForeignID() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitattype != nil { - m.Habitattype = o.Habitattype() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryHabitatrelateSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryHabitatrelateTemplate.CreateMany -func (o HistoryHabitatrelateTemplate) BuildMany(number int) models.HistoryHabitatrelateSlice { - m := make(models.HistoryHabitatrelateSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryHabitatrelate(m *models.HistoryHabitatrelateSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryHabitatrelate -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryHabitatrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryHabitatrelate) error { - var err error - - return err -} - -// Create builds a historyHabitatrelate and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryHabitatrelateTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryHabitatrelate, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryHabitatrelate(opt) - - if o.r.Organization == nil { - HistoryHabitatrelateMods.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.HistoryHabitatrelates.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 historyHabitatrelate and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryHabitatrelateTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryHabitatrelate { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyHabitatrelate 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 *HistoryHabitatrelateTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryHabitatrelate { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyHabitatrelates and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryHabitatrelateTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryHabitatrelateSlice, error) { - var err error - m := make(models.HistoryHabitatrelateSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyHabitatrelates and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryHabitatrelateTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryHabitatrelateSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyHabitatrelates 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 HistoryHabitatrelateTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryHabitatrelateSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryHabitatrelate has methods that act as mods for the HistoryHabitatrelateTemplate -var HistoryHabitatrelateMods historyHabitatrelateMods - -type historyHabitatrelateMods struct{} - -func (m historyHabitatrelateMods) RandomizeAllColumns(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModSlice{ - HistoryHabitatrelateMods.RandomOrganizationID(f), - HistoryHabitatrelateMods.RandomCreationdate(f), - HistoryHabitatrelateMods.RandomCreator(f), - HistoryHabitatrelateMods.RandomEditdate(f), - HistoryHabitatrelateMods.RandomEditor(f), - HistoryHabitatrelateMods.RandomForeignID(f), - HistoryHabitatrelateMods.RandomGlobalid(f), - HistoryHabitatrelateMods.RandomHabitattype(f), - HistoryHabitatrelateMods.RandomObjectid(f), - HistoryHabitatrelateMods.RandomCreated(f), - HistoryHabitatrelateMods.RandomCreatedDate(f), - HistoryHabitatrelateMods.RandomCreatedUser(f), - HistoryHabitatrelateMods.RandomGeometryX(f), - HistoryHabitatrelateMods.RandomGeometryY(f), - HistoryHabitatrelateMods.RandomLastEditedDate(f), - HistoryHabitatrelateMods.RandomLastEditedUser(f), - HistoryHabitatrelateMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyHabitatrelateMods) OrganizationID(val int32) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) OrganizationIDFunc(f func() int32) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetOrganizationID() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - 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 historyHabitatrelateMods) RandomOrganizationID(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyHabitatrelateMods) Creationdate(val null.Val[int64]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) CreationdateFunc(f func() null.Val[int64]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetCreationdate() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Creationdate = 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 historyHabitatrelateMods) RandomCreationdate(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyHabitatrelateMods) RandomCreationdateNotNull(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyHabitatrelateMods) Creator(val null.Val[string]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) CreatorFunc(f func() null.Val[string]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetCreator() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Creator = 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 historyHabitatrelateMods) RandomCreator(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Creator = 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 historyHabitatrelateMods) RandomCreatorNotNull(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Creator = 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 historyHabitatrelateMods) Editdate(val null.Val[int64]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) EditdateFunc(f func() null.Val[int64]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetEditdate() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Editdate = 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 historyHabitatrelateMods) RandomEditdate(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyHabitatrelateMods) RandomEditdateNotNull(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyHabitatrelateMods) Editor(val null.Val[string]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) EditorFunc(f func() null.Val[string]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetEditor() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Editor = 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 historyHabitatrelateMods) RandomEditor(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Editor = 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 historyHabitatrelateMods) RandomEditorNotNull(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Editor = 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 historyHabitatrelateMods) ForeignID(val null.Val[string]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.ForeignID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) ForeignIDFunc(f func() null.Val[string]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.ForeignID = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetForeignID() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.ForeignID = 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 historyHabitatrelateMods) RandomForeignID(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.ForeignID = 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 historyHabitatrelateMods) RandomForeignIDNotNull(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.ForeignID = 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 historyHabitatrelateMods) Globalid(val null.Val[string]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) GlobalidFunc(f func() null.Val[string]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetGlobalid() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Globalid = 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 historyHabitatrelateMods) RandomGlobalid(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - 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 historyHabitatrelateMods) RandomGlobalidNotNull(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Globalid = 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 historyHabitatrelateMods) Habitattype(val null.Val[string]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Habitattype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) HabitattypeFunc(f func() null.Val[string]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Habitattype = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetHabitattype() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Habitattype = 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 historyHabitatrelateMods) RandomHabitattype(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Habitattype = 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 historyHabitatrelateMods) RandomHabitattypeNotNull(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Habitattype = 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 historyHabitatrelateMods) Objectid(val int32) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) ObjectidFunc(f func() int32) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetObjectid() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyHabitatrelateMods) RandomObjectid(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyHabitatrelateMods) Created(val null.Val[time.Time]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) CreatedFunc(f func() null.Val[time.Time]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetCreated() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Created = 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 historyHabitatrelateMods) RandomCreated(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyHabitatrelateMods) RandomCreatedNotNull(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyHabitatrelateMods) CreatedDate(val null.Val[int64]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) CreatedDateFunc(f func() null.Val[int64]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetCreatedDate() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.CreatedDate = 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 historyHabitatrelateMods) RandomCreatedDate(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyHabitatrelateMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyHabitatrelateMods) CreatedUser(val null.Val[string]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) CreatedUserFunc(f func() null.Val[string]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetCreatedUser() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.CreatedUser = 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 historyHabitatrelateMods) RandomCreatedUser(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.CreatedUser = 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 historyHabitatrelateMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.CreatedUser = 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 historyHabitatrelateMods) GeometryX(val null.Val[float64]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) GeometryXFunc(f func() null.Val[float64]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetGeometryX() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.GeometryX = 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 historyHabitatrelateMods) RandomGeometryX(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - 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 historyHabitatrelateMods) RandomGeometryXNotNull(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.GeometryX = 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 historyHabitatrelateMods) GeometryY(val null.Val[float64]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) GeometryYFunc(f func() null.Val[float64]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetGeometryY() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.GeometryY = 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 historyHabitatrelateMods) RandomGeometryY(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - 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 historyHabitatrelateMods) RandomGeometryYNotNull(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.GeometryY = 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 historyHabitatrelateMods) LastEditedDate(val null.Val[int64]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetLastEditedDate() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.LastEditedDate = 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 historyHabitatrelateMods) RandomLastEditedDate(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyHabitatrelateMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyHabitatrelateMods) LastEditedUser(val null.Val[string]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) LastEditedUserFunc(f func() null.Val[string]) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetLastEditedUser() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.LastEditedUser = 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 historyHabitatrelateMods) RandomLastEditedUser(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.LastEditedUser = 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 historyHabitatrelateMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.LastEditedUser = 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 historyHabitatrelateMods) Version(val int32) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyHabitatrelateMods) VersionFunc(f func() int32) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyHabitatrelateMods) UnsetVersion() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyHabitatrelateMods) RandomVersion(f *faker.Faker) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyHabitatrelateMods) WithParentsCascading() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(ctx context.Context, o *HistoryHabitatrelateTemplate) { - if isDone, _ := historyHabitatrelateWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyHabitatrelateWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyHabitatrelateMods) WithOrganization(rel *OrganizationTemplate) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(ctx context.Context, o *HistoryHabitatrelateTemplate) { - o.r.Organization = &historyHabitatrelateROrganizationR{ - o: rel, - } - }) -} - -func (m historyHabitatrelateMods) WithNewOrganization(mods ...OrganizationMod) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(ctx context.Context, o *HistoryHabitatrelateTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyHabitatrelateMods) WithExistingOrganization(em *models.Organization) HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(ctx context.Context, o *HistoryHabitatrelateTemplate) { - o.r.Organization = &historyHabitatrelateROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyHabitatrelateMods) WithoutOrganization() HistoryHabitatrelateMod { - return HistoryHabitatrelateModFunc(func(ctx context.Context, o *HistoryHabitatrelateTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_inspectionsample.bob.go b/db/factory/history_inspectionsample.bob.go deleted file mode 100644 index da882997..00000000 --- a/db/factory/history_inspectionsample.bob.go +++ /dev/null @@ -1,1408 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryInspectionsampleMod interface { - Apply(context.Context, *HistoryInspectionsampleTemplate) -} - -type HistoryInspectionsampleModFunc func(context.Context, *HistoryInspectionsampleTemplate) - -func (f HistoryInspectionsampleModFunc) Apply(ctx context.Context, n *HistoryInspectionsampleTemplate) { - f(ctx, n) -} - -type HistoryInspectionsampleModSlice []HistoryInspectionsampleMod - -func (mods HistoryInspectionsampleModSlice) Apply(ctx context.Context, n *HistoryInspectionsampleTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryInspectionsampleTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryInspectionsampleTemplate struct { - OrganizationID func() int32 - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() null.Val[string] - Idbytech func() null.Val[string] - InspID func() null.Val[string] - Objectid func() int32 - Processed func() null.Val[int16] - Sampleid func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Version func() int32 - - r historyInspectionsampleR - f *Factory - - alreadyPersisted bool -} - -type historyInspectionsampleR struct { - Organization *historyInspectionsampleROrganizationR -} - -type historyInspectionsampleROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryInspectionsampleTemplate -func (o *HistoryInspectionsampleTemplate) Apply(ctx context.Context, mods ...HistoryInspectionsampleMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryInspectionsample -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryInspectionsampleTemplate) setModelRels(o *models.HistoryInspectionsample) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryInspectionsamples = append(rel.R.HistoryInspectionsamples, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryInspectionsampleSetter -// this does nothing with the relationship templates -func (o HistoryInspectionsampleTemplate) BuildSetter() *models.HistoryInspectionsampleSetter { - m := &models.HistoryInspectionsampleSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Idbytech != nil { - val := o.Idbytech() - m.Idbytech = omitnull.FromNull(val) - } - if o.InspID != nil { - val := o.InspID() - m.InspID = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.Sampleid != nil { - val := o.Sampleid() - m.Sampleid = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryInspectionsampleSetter -// this does nothing with the relationship templates -func (o HistoryInspectionsampleTemplate) BuildManySetter(number int) []*models.HistoryInspectionsampleSetter { - m := make([]*models.HistoryInspectionsampleSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryInspectionsample -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryInspectionsampleTemplate.Create -func (o HistoryInspectionsampleTemplate) Build() *models.HistoryInspectionsample { - m := &models.HistoryInspectionsample{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Idbytech != nil { - m.Idbytech = o.Idbytech() - } - if o.InspID != nil { - m.InspID = o.InspID() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.Sampleid != nil { - m.Sampleid = o.Sampleid() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryInspectionsampleSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryInspectionsampleTemplate.CreateMany -func (o HistoryInspectionsampleTemplate) BuildMany(number int) models.HistoryInspectionsampleSlice { - m := make(models.HistoryInspectionsampleSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryInspectionsample(m *models.HistoryInspectionsampleSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryInspectionsample -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryInspectionsampleTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryInspectionsample) error { - var err error - - return err -} - -// Create builds a historyInspectionsample and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryInspectionsampleTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryInspectionsample, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryInspectionsample(opt) - - if o.r.Organization == nil { - HistoryInspectionsampleMods.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.HistoryInspectionsamples.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 historyInspectionsample and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryInspectionsampleTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryInspectionsample { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyInspectionsample 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 *HistoryInspectionsampleTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryInspectionsample { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyInspectionsamples and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryInspectionsampleTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryInspectionsampleSlice, error) { - var err error - m := make(models.HistoryInspectionsampleSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyInspectionsamples and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryInspectionsampleTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryInspectionsampleSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyInspectionsamples 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 HistoryInspectionsampleTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryInspectionsampleSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryInspectionsample has methods that act as mods for the HistoryInspectionsampleTemplate -var HistoryInspectionsampleMods historyInspectionsampleMods - -type historyInspectionsampleMods struct{} - -func (m historyInspectionsampleMods) RandomizeAllColumns(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModSlice{ - HistoryInspectionsampleMods.RandomOrganizationID(f), - HistoryInspectionsampleMods.RandomCreationdate(f), - HistoryInspectionsampleMods.RandomCreator(f), - HistoryInspectionsampleMods.RandomEditdate(f), - HistoryInspectionsampleMods.RandomEditor(f), - HistoryInspectionsampleMods.RandomGlobalid(f), - HistoryInspectionsampleMods.RandomIdbytech(f), - HistoryInspectionsampleMods.RandomInspID(f), - HistoryInspectionsampleMods.RandomObjectid(f), - HistoryInspectionsampleMods.RandomProcessed(f), - HistoryInspectionsampleMods.RandomSampleid(f), - HistoryInspectionsampleMods.RandomCreated(f), - HistoryInspectionsampleMods.RandomCreatedDate(f), - HistoryInspectionsampleMods.RandomCreatedUser(f), - HistoryInspectionsampleMods.RandomGeometryX(f), - HistoryInspectionsampleMods.RandomGeometryY(f), - HistoryInspectionsampleMods.RandomLastEditedDate(f), - HistoryInspectionsampleMods.RandomLastEditedUser(f), - HistoryInspectionsampleMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyInspectionsampleMods) OrganizationID(val int32) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) OrganizationIDFunc(f func() int32) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetOrganizationID() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - 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 historyInspectionsampleMods) RandomOrganizationID(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampleMods) Creationdate(val null.Val[int64]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) CreationdateFunc(f func() null.Val[int64]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetCreationdate() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Creationdate = 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 historyInspectionsampleMods) RandomCreationdate(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyInspectionsampleMods) RandomCreationdateNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampleMods) Creator(val null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) CreatorFunc(f func() null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetCreator() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Creator = 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 historyInspectionsampleMods) RandomCreator(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Creator = 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 historyInspectionsampleMods) RandomCreatorNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Creator = 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 historyInspectionsampleMods) Editdate(val null.Val[int64]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) EditdateFunc(f func() null.Val[int64]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetEditdate() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Editdate = 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 historyInspectionsampleMods) RandomEditdate(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyInspectionsampleMods) RandomEditdateNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampleMods) Editor(val null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) EditorFunc(f func() null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetEditor() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Editor = 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 historyInspectionsampleMods) RandomEditor(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Editor = 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 historyInspectionsampleMods) RandomEditorNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Editor = 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 historyInspectionsampleMods) Globalid(val null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) GlobalidFunc(f func() null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetGlobalid() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Globalid = 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 historyInspectionsampleMods) RandomGlobalid(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - 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 historyInspectionsampleMods) RandomGlobalidNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Globalid = 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 historyInspectionsampleMods) Idbytech(val null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Idbytech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) IdbytechFunc(f func() null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Idbytech = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetIdbytech() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Idbytech = 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 historyInspectionsampleMods) RandomIdbytech(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Idbytech = 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 historyInspectionsampleMods) RandomIdbytechNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Idbytech = 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 historyInspectionsampleMods) InspID(val null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.InspID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) InspIDFunc(f func() null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.InspID = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetInspID() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.InspID = 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 historyInspectionsampleMods) RandomInspID(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.InspID = 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 historyInspectionsampleMods) RandomInspIDNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.InspID = 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 historyInspectionsampleMods) Objectid(val int32) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) ObjectidFunc(f func() int32) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetObjectid() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyInspectionsampleMods) RandomObjectid(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampleMods) Processed(val null.Val[int16]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) ProcessedFunc(f func() null.Val[int16]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetProcessed() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Processed = 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 historyInspectionsampleMods) RandomProcessed(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyInspectionsampleMods) RandomProcessedNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampleMods) Sampleid(val null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Sampleid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) SampleidFunc(f func() null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Sampleid = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetSampleid() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Sampleid = 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 historyInspectionsampleMods) RandomSampleid(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Sampleid = 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 historyInspectionsampleMods) RandomSampleidNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Sampleid = 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 historyInspectionsampleMods) Created(val null.Val[time.Time]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) CreatedFunc(f func() null.Val[time.Time]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetCreated() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Created = 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 historyInspectionsampleMods) RandomCreated(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyInspectionsampleMods) RandomCreatedNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampleMods) CreatedDate(val null.Val[int64]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) CreatedDateFunc(f func() null.Val[int64]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetCreatedDate() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.CreatedDate = 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 historyInspectionsampleMods) RandomCreatedDate(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyInspectionsampleMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampleMods) CreatedUser(val null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) CreatedUserFunc(f func() null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetCreatedUser() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.CreatedUser = 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 historyInspectionsampleMods) RandomCreatedUser(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.CreatedUser = 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 historyInspectionsampleMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.CreatedUser = 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 historyInspectionsampleMods) GeometryX(val null.Val[float64]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) GeometryXFunc(f func() null.Val[float64]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetGeometryX() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.GeometryX = 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 historyInspectionsampleMods) RandomGeometryX(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - 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 historyInspectionsampleMods) RandomGeometryXNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.GeometryX = 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 historyInspectionsampleMods) GeometryY(val null.Val[float64]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) GeometryYFunc(f func() null.Val[float64]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetGeometryY() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.GeometryY = 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 historyInspectionsampleMods) RandomGeometryY(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - 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 historyInspectionsampleMods) RandomGeometryYNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.GeometryY = 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 historyInspectionsampleMods) LastEditedDate(val null.Val[int64]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetLastEditedDate() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.LastEditedDate = 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 historyInspectionsampleMods) RandomLastEditedDate(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyInspectionsampleMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampleMods) LastEditedUser(val null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) LastEditedUserFunc(f func() null.Val[string]) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetLastEditedUser() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.LastEditedUser = 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 historyInspectionsampleMods) RandomLastEditedUser(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.LastEditedUser = 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 historyInspectionsampleMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.LastEditedUser = 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 historyInspectionsampleMods) Version(val int32) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampleMods) VersionFunc(f func() int32) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampleMods) UnsetVersion() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyInspectionsampleMods) RandomVersion(f *faker.Faker) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyInspectionsampleMods) WithParentsCascading() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(ctx context.Context, o *HistoryInspectionsampleTemplate) { - if isDone, _ := historyInspectionsampleWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyInspectionsampleWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyInspectionsampleMods) WithOrganization(rel *OrganizationTemplate) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(ctx context.Context, o *HistoryInspectionsampleTemplate) { - o.r.Organization = &historyInspectionsampleROrganizationR{ - o: rel, - } - }) -} - -func (m historyInspectionsampleMods) WithNewOrganization(mods ...OrganizationMod) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(ctx context.Context, o *HistoryInspectionsampleTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyInspectionsampleMods) WithExistingOrganization(em *models.Organization) HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(ctx context.Context, o *HistoryInspectionsampleTemplate) { - o.r.Organization = &historyInspectionsampleROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyInspectionsampleMods) WithoutOrganization() HistoryInspectionsampleMod { - return HistoryInspectionsampleModFunc(func(ctx context.Context, o *HistoryInspectionsampleTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_inspectionsampledetail.bob.go b/db/factory/history_inspectionsampledetail.bob.go deleted file mode 100644 index e6ef5cb0..00000000 --- a/db/factory/history_inspectionsampledetail.bob.go +++ /dev/null @@ -1,2090 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryInspectionsampledetailMod interface { - Apply(context.Context, *HistoryInspectionsampledetailTemplate) -} - -type HistoryInspectionsampledetailModFunc func(context.Context, *HistoryInspectionsampledetailTemplate) - -func (f HistoryInspectionsampledetailModFunc) Apply(ctx context.Context, n *HistoryInspectionsampledetailTemplate) { - f(ctx, n) -} - -type HistoryInspectionsampledetailModSlice []HistoryInspectionsampledetailMod - -func (mods HistoryInspectionsampledetailModSlice) Apply(ctx context.Context, n *HistoryInspectionsampledetailTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryInspectionsampledetailTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryInspectionsampledetailTemplate struct { - OrganizationID func() int32 - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fadultact func() null.Val[string] - Fdomstage func() null.Val[string] - Feggcount func() null.Val[int16] - Fieldspecies func() null.Val[string] - Flarvcount func() null.Val[int16] - Flstages func() null.Val[string] - Fpupcount func() null.Val[int16] - Globalid func() null.Val[string] - InspsampleID func() null.Val[string] - Labspecies func() null.Val[string] - Ldomstage func() null.Val[string] - Leggcount func() null.Val[int16] - Llarvcount func() null.Val[int16] - Lpupcount func() null.Val[int16] - Objectid func() int32 - Processed func() null.Val[int16] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Version func() int32 - - r historyInspectionsampledetailR - f *Factory - - alreadyPersisted bool -} - -type historyInspectionsampledetailR struct { - Organization *historyInspectionsampledetailROrganizationR -} - -type historyInspectionsampledetailROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryInspectionsampledetailTemplate -func (o *HistoryInspectionsampledetailTemplate) Apply(ctx context.Context, mods ...HistoryInspectionsampledetailMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryInspectionsampledetail -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryInspectionsampledetailTemplate) setModelRels(o *models.HistoryInspectionsampledetail) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryInspectionsampledetails = append(rel.R.HistoryInspectionsampledetails, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryInspectionsampledetailSetter -// this does nothing with the relationship templates -func (o HistoryInspectionsampledetailTemplate) BuildSetter() *models.HistoryInspectionsampledetailSetter { - m := &models.HistoryInspectionsampledetailSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fadultact != nil { - val := o.Fadultact() - m.Fadultact = omitnull.FromNull(val) - } - if o.Fdomstage != nil { - val := o.Fdomstage() - m.Fdomstage = omitnull.FromNull(val) - } - if o.Feggcount != nil { - val := o.Feggcount() - m.Feggcount = omitnull.FromNull(val) - } - if o.Fieldspecies != nil { - val := o.Fieldspecies() - m.Fieldspecies = omitnull.FromNull(val) - } - if o.Flarvcount != nil { - val := o.Flarvcount() - m.Flarvcount = omitnull.FromNull(val) - } - if o.Flstages != nil { - val := o.Flstages() - m.Flstages = omitnull.FromNull(val) - } - if o.Fpupcount != nil { - val := o.Fpupcount() - m.Fpupcount = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.InspsampleID != nil { - val := o.InspsampleID() - m.InspsampleID = omitnull.FromNull(val) - } - if o.Labspecies != nil { - val := o.Labspecies() - m.Labspecies = omitnull.FromNull(val) - } - if o.Ldomstage != nil { - val := o.Ldomstage() - m.Ldomstage = omitnull.FromNull(val) - } - if o.Leggcount != nil { - val := o.Leggcount() - m.Leggcount = omitnull.FromNull(val) - } - if o.Llarvcount != nil { - val := o.Llarvcount() - m.Llarvcount = omitnull.FromNull(val) - } - if o.Lpupcount != nil { - val := o.Lpupcount() - m.Lpupcount = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryInspectionsampledetailSetter -// this does nothing with the relationship templates -func (o HistoryInspectionsampledetailTemplate) BuildManySetter(number int) []*models.HistoryInspectionsampledetailSetter { - m := make([]*models.HistoryInspectionsampledetailSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryInspectionsampledetail -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryInspectionsampledetailTemplate.Create -func (o HistoryInspectionsampledetailTemplate) Build() *models.HistoryInspectionsampledetail { - m := &models.HistoryInspectionsampledetail{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fadultact != nil { - m.Fadultact = o.Fadultact() - } - if o.Fdomstage != nil { - m.Fdomstage = o.Fdomstage() - } - if o.Feggcount != nil { - m.Feggcount = o.Feggcount() - } - if o.Fieldspecies != nil { - m.Fieldspecies = o.Fieldspecies() - } - if o.Flarvcount != nil { - m.Flarvcount = o.Flarvcount() - } - if o.Flstages != nil { - m.Flstages = o.Flstages() - } - if o.Fpupcount != nil { - m.Fpupcount = o.Fpupcount() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.InspsampleID != nil { - m.InspsampleID = o.InspsampleID() - } - if o.Labspecies != nil { - m.Labspecies = o.Labspecies() - } - if o.Ldomstage != nil { - m.Ldomstage = o.Ldomstage() - } - if o.Leggcount != nil { - m.Leggcount = o.Leggcount() - } - if o.Llarvcount != nil { - m.Llarvcount = o.Llarvcount() - } - if o.Lpupcount != nil { - m.Lpupcount = o.Lpupcount() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryInspectionsampledetailSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryInspectionsampledetailTemplate.CreateMany -func (o HistoryInspectionsampledetailTemplate) BuildMany(number int) models.HistoryInspectionsampledetailSlice { - m := make(models.HistoryInspectionsampledetailSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryInspectionsampledetail(m *models.HistoryInspectionsampledetailSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryInspectionsampledetail -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryInspectionsampledetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryInspectionsampledetail) error { - var err error - - return err -} - -// Create builds a historyInspectionsampledetail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryInspectionsampledetailTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryInspectionsampledetail, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryInspectionsampledetail(opt) - - if o.r.Organization == nil { - HistoryInspectionsampledetailMods.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.HistoryInspectionsampledetails.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 historyInspectionsampledetail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryInspectionsampledetailTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryInspectionsampledetail { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyInspectionsampledetail 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 *HistoryInspectionsampledetailTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryInspectionsampledetail { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyInspectionsampledetails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryInspectionsampledetailTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryInspectionsampledetailSlice, error) { - var err error - m := make(models.HistoryInspectionsampledetailSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyInspectionsampledetails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryInspectionsampledetailTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryInspectionsampledetailSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyInspectionsampledetails 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 HistoryInspectionsampledetailTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryInspectionsampledetailSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryInspectionsampledetail has methods that act as mods for the HistoryInspectionsampledetailTemplate -var HistoryInspectionsampledetailMods historyInspectionsampledetailMods - -type historyInspectionsampledetailMods struct{} - -func (m historyInspectionsampledetailMods) RandomizeAllColumns(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModSlice{ - HistoryInspectionsampledetailMods.RandomOrganizationID(f), - HistoryInspectionsampledetailMods.RandomComments(f), - HistoryInspectionsampledetailMods.RandomCreationdate(f), - HistoryInspectionsampledetailMods.RandomCreator(f), - HistoryInspectionsampledetailMods.RandomEditdate(f), - HistoryInspectionsampledetailMods.RandomEditor(f), - HistoryInspectionsampledetailMods.RandomFadultact(f), - HistoryInspectionsampledetailMods.RandomFdomstage(f), - HistoryInspectionsampledetailMods.RandomFeggcount(f), - HistoryInspectionsampledetailMods.RandomFieldspecies(f), - HistoryInspectionsampledetailMods.RandomFlarvcount(f), - HistoryInspectionsampledetailMods.RandomFlstages(f), - HistoryInspectionsampledetailMods.RandomFpupcount(f), - HistoryInspectionsampledetailMods.RandomGlobalid(f), - HistoryInspectionsampledetailMods.RandomInspsampleID(f), - HistoryInspectionsampledetailMods.RandomLabspecies(f), - HistoryInspectionsampledetailMods.RandomLdomstage(f), - HistoryInspectionsampledetailMods.RandomLeggcount(f), - HistoryInspectionsampledetailMods.RandomLlarvcount(f), - HistoryInspectionsampledetailMods.RandomLpupcount(f), - HistoryInspectionsampledetailMods.RandomObjectid(f), - HistoryInspectionsampledetailMods.RandomProcessed(f), - HistoryInspectionsampledetailMods.RandomCreated(f), - HistoryInspectionsampledetailMods.RandomCreatedDate(f), - HistoryInspectionsampledetailMods.RandomCreatedUser(f), - HistoryInspectionsampledetailMods.RandomGeometryX(f), - HistoryInspectionsampledetailMods.RandomGeometryY(f), - HistoryInspectionsampledetailMods.RandomLastEditedDate(f), - HistoryInspectionsampledetailMods.RandomLastEditedUser(f), - HistoryInspectionsampledetailMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyInspectionsampledetailMods) OrganizationID(val int32) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) OrganizationIDFunc(f func() int32) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetOrganizationID() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - 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 historyInspectionsampledetailMods) RandomOrganizationID(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampledetailMods) Comments(val null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) CommentsFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetComments() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Comments = 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 historyInspectionsampledetailMods) RandomComments(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Comments = 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 historyInspectionsampledetailMods) RandomCommentsNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Comments = 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 historyInspectionsampledetailMods) Creationdate(val null.Val[int64]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) CreationdateFunc(f func() null.Val[int64]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetCreationdate() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Creationdate = 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 historyInspectionsampledetailMods) RandomCreationdate(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyInspectionsampledetailMods) RandomCreationdateNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampledetailMods) Creator(val null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) CreatorFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetCreator() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Creator = 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 historyInspectionsampledetailMods) RandomCreator(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Creator = 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 historyInspectionsampledetailMods) RandomCreatorNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Creator = 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 historyInspectionsampledetailMods) Editdate(val null.Val[int64]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) EditdateFunc(f func() null.Val[int64]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetEditdate() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Editdate = 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 historyInspectionsampledetailMods) RandomEditdate(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyInspectionsampledetailMods) RandomEditdateNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampledetailMods) Editor(val null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) EditorFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetEditor() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Editor = 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 historyInspectionsampledetailMods) RandomEditor(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Editor = 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 historyInspectionsampledetailMods) RandomEditorNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Editor = 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 historyInspectionsampledetailMods) Fadultact(val null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fadultact = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) FadultactFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fadultact = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetFadultact() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fadultact = 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 historyInspectionsampledetailMods) RandomFadultact(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fadultact = 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 historyInspectionsampledetailMods) RandomFadultactNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fadultact = 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 historyInspectionsampledetailMods) Fdomstage(val null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fdomstage = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) FdomstageFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fdomstage = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetFdomstage() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fdomstage = 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 historyInspectionsampledetailMods) RandomFdomstage(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fdomstage = 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 historyInspectionsampledetailMods) RandomFdomstageNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fdomstage = 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 historyInspectionsampledetailMods) Feggcount(val null.Val[int16]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Feggcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) FeggcountFunc(f func() null.Val[int16]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Feggcount = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetFeggcount() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Feggcount = 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 historyInspectionsampledetailMods) RandomFeggcount(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Feggcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyInspectionsampledetailMods) RandomFeggcountNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Feggcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampledetailMods) Fieldspecies(val null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fieldspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) FieldspeciesFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fieldspecies = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetFieldspecies() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fieldspecies = 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 historyInspectionsampledetailMods) RandomFieldspecies(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fieldspecies = 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 historyInspectionsampledetailMods) RandomFieldspeciesNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fieldspecies = 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 historyInspectionsampledetailMods) Flarvcount(val null.Val[int16]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Flarvcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) FlarvcountFunc(f func() null.Val[int16]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Flarvcount = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetFlarvcount() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Flarvcount = 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 historyInspectionsampledetailMods) RandomFlarvcount(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Flarvcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyInspectionsampledetailMods) RandomFlarvcountNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Flarvcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampledetailMods) Flstages(val null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Flstages = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) FlstagesFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Flstages = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetFlstages() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Flstages = 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 historyInspectionsampledetailMods) RandomFlstages(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Flstages = 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 historyInspectionsampledetailMods) RandomFlstagesNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Flstages = 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 historyInspectionsampledetailMods) Fpupcount(val null.Val[int16]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fpupcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) FpupcountFunc(f func() null.Val[int16]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fpupcount = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetFpupcount() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fpupcount = 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 historyInspectionsampledetailMods) RandomFpupcount(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fpupcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyInspectionsampledetailMods) RandomFpupcountNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Fpupcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampledetailMods) Globalid(val null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) GlobalidFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetGlobalid() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Globalid = 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 historyInspectionsampledetailMods) RandomGlobalid(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - 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 historyInspectionsampledetailMods) RandomGlobalidNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Globalid = 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 historyInspectionsampledetailMods) InspsampleID(val null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.InspsampleID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) InspsampleIDFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.InspsampleID = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetInspsampleID() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.InspsampleID = 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 historyInspectionsampledetailMods) RandomInspsampleID(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.InspsampleID = 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 historyInspectionsampledetailMods) RandomInspsampleIDNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.InspsampleID = 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 historyInspectionsampledetailMods) Labspecies(val null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Labspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) LabspeciesFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Labspecies = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetLabspecies() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Labspecies = 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 historyInspectionsampledetailMods) RandomLabspecies(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Labspecies = 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 historyInspectionsampledetailMods) RandomLabspeciesNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Labspecies = 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 historyInspectionsampledetailMods) Ldomstage(val null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Ldomstage = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) LdomstageFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Ldomstage = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetLdomstage() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Ldomstage = 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 historyInspectionsampledetailMods) RandomLdomstage(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Ldomstage = 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 historyInspectionsampledetailMods) RandomLdomstageNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Ldomstage = 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 historyInspectionsampledetailMods) Leggcount(val null.Val[int16]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Leggcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) LeggcountFunc(f func() null.Val[int16]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Leggcount = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetLeggcount() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Leggcount = 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 historyInspectionsampledetailMods) RandomLeggcount(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Leggcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyInspectionsampledetailMods) RandomLeggcountNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Leggcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampledetailMods) Llarvcount(val null.Val[int16]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Llarvcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) LlarvcountFunc(f func() null.Val[int16]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Llarvcount = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetLlarvcount() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Llarvcount = 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 historyInspectionsampledetailMods) RandomLlarvcount(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Llarvcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyInspectionsampledetailMods) RandomLlarvcountNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Llarvcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampledetailMods) Lpupcount(val null.Val[int16]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Lpupcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) LpupcountFunc(f func() null.Val[int16]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Lpupcount = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetLpupcount() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Lpupcount = 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 historyInspectionsampledetailMods) RandomLpupcount(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Lpupcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyInspectionsampledetailMods) RandomLpupcountNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Lpupcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampledetailMods) Objectid(val int32) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) ObjectidFunc(f func() int32) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetObjectid() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyInspectionsampledetailMods) RandomObjectid(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampledetailMods) Processed(val null.Val[int16]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) ProcessedFunc(f func() null.Val[int16]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetProcessed() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Processed = 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 historyInspectionsampledetailMods) RandomProcessed(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyInspectionsampledetailMods) RandomProcessedNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampledetailMods) Created(val null.Val[time.Time]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) CreatedFunc(f func() null.Val[time.Time]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetCreated() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Created = 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 historyInspectionsampledetailMods) RandomCreated(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyInspectionsampledetailMods) RandomCreatedNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampledetailMods) CreatedDate(val null.Val[int64]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) CreatedDateFunc(f func() null.Val[int64]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetCreatedDate() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.CreatedDate = 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 historyInspectionsampledetailMods) RandomCreatedDate(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyInspectionsampledetailMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampledetailMods) CreatedUser(val null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) CreatedUserFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetCreatedUser() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.CreatedUser = 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 historyInspectionsampledetailMods) RandomCreatedUser(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.CreatedUser = 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 historyInspectionsampledetailMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.CreatedUser = 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 historyInspectionsampledetailMods) GeometryX(val null.Val[float64]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) GeometryXFunc(f func() null.Val[float64]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetGeometryX() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.GeometryX = 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 historyInspectionsampledetailMods) RandomGeometryX(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - 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 historyInspectionsampledetailMods) RandomGeometryXNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.GeometryX = 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 historyInspectionsampledetailMods) GeometryY(val null.Val[float64]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) GeometryYFunc(f func() null.Val[float64]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetGeometryY() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.GeometryY = 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 historyInspectionsampledetailMods) RandomGeometryY(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - 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 historyInspectionsampledetailMods) RandomGeometryYNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.GeometryY = 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 historyInspectionsampledetailMods) LastEditedDate(val null.Val[int64]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetLastEditedDate() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.LastEditedDate = 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 historyInspectionsampledetailMods) RandomLastEditedDate(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyInspectionsampledetailMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyInspectionsampledetailMods) LastEditedUser(val null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) LastEditedUserFunc(f func() null.Val[string]) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetLastEditedUser() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.LastEditedUser = 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 historyInspectionsampledetailMods) RandomLastEditedUser(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.LastEditedUser = 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 historyInspectionsampledetailMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.LastEditedUser = 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 historyInspectionsampledetailMods) Version(val int32) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyInspectionsampledetailMods) VersionFunc(f func() int32) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyInspectionsampledetailMods) UnsetVersion() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyInspectionsampledetailMods) RandomVersion(f *faker.Faker) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyInspectionsampledetailMods) WithParentsCascading() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(ctx context.Context, o *HistoryInspectionsampledetailTemplate) { - if isDone, _ := historyInspectionsampledetailWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyInspectionsampledetailWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyInspectionsampledetailMods) WithOrganization(rel *OrganizationTemplate) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(ctx context.Context, o *HistoryInspectionsampledetailTemplate) { - o.r.Organization = &historyInspectionsampledetailROrganizationR{ - o: rel, - } - }) -} - -func (m historyInspectionsampledetailMods) WithNewOrganization(mods ...OrganizationMod) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(ctx context.Context, o *HistoryInspectionsampledetailTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyInspectionsampledetailMods) WithExistingOrganization(em *models.Organization) HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(ctx context.Context, o *HistoryInspectionsampledetailTemplate) { - o.r.Organization = &historyInspectionsampledetailROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyInspectionsampledetailMods) WithoutOrganization() HistoryInspectionsampledetailMod { - return HistoryInspectionsampledetailModFunc(func(ctx context.Context, o *HistoryInspectionsampledetailTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_linelocation.bob.go b/db/factory/history_linelocation.bob.go deleted file mode 100644 index bd157e6a..00000000 --- a/db/factory/history_linelocation.bob.go +++ /dev/null @@ -1,3516 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryLinelocationMod interface { - Apply(context.Context, *HistoryLinelocationTemplate) -} - -type HistoryLinelocationModFunc func(context.Context, *HistoryLinelocationTemplate) - -func (f HistoryLinelocationModFunc) Apply(ctx context.Context, n *HistoryLinelocationTemplate) { - f(ctx, n) -} - -type HistoryLinelocationModSlice []HistoryLinelocationMod - -func (mods HistoryLinelocationModSlice) Apply(ctx context.Context, n *HistoryLinelocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryLinelocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryLinelocationTemplate struct { - OrganizationID func() int32 - Accessdesc func() null.Val[string] - Acres func() null.Val[float64] - Active func() null.Val[int16] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Description func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() null.Val[string] - Habitat func() null.Val[string] - Hectares func() null.Val[float64] - Jurisdiction func() null.Val[string] - Larvinspectinterval func() null.Val[int16] - Lastinspectactiontaken func() null.Val[string] - Lastinspectactivity func() null.Val[string] - Lastinspectavglarvae func() null.Val[float64] - Lastinspectavgpupae func() null.Val[float64] - Lastinspectbreeding func() null.Val[string] - Lastinspectconditions func() null.Val[string] - Lastinspectdate func() null.Val[int64] - Lastinspectfieldspecies func() null.Val[string] - Lastinspectlstages func() null.Val[string] - Lasttreatactivity func() null.Val[string] - Lasttreatdate func() null.Val[int64] - Lasttreatproduct func() null.Val[string] - Lasttreatqty func() null.Val[float64] - Lasttreatqtyunit func() null.Val[string] - LengthFT func() null.Val[float64] - LengthMeters func() null.Val[float64] - Locationnumber func() null.Val[int64] - Name func() null.Val[string] - Nextactiondatescheduled func() null.Val[int64] - Objectid func() int32 - Priority func() null.Val[string] - Symbology func() null.Val[string] - ShapeLength func() null.Val[float64] - Usetype func() null.Val[string] - Waterorigin func() null.Val[string] - WidthFT func() null.Val[float64] - WidthMeters func() null.Val[float64] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Version func() int32 - - r historyLinelocationR - f *Factory - - alreadyPersisted bool -} - -type historyLinelocationR struct { - Organization *historyLinelocationROrganizationR -} - -type historyLinelocationROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryLinelocationTemplate -func (o *HistoryLinelocationTemplate) Apply(ctx context.Context, mods ...HistoryLinelocationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryLinelocation -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryLinelocationTemplate) setModelRels(o *models.HistoryLinelocation) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryLinelocations = append(rel.R.HistoryLinelocations, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryLinelocationSetter -// this does nothing with the relationship templates -func (o HistoryLinelocationTemplate) BuildSetter() *models.HistoryLinelocationSetter { - m := &models.HistoryLinelocationSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Acres != nil { - val := o.Acres() - m.Acres = omitnull.FromNull(val) - } - if o.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(val) - } - if o.Hectares != nil { - val := o.Hectares() - m.Hectares = omitnull.FromNull(val) - } - if o.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.Larvinspectinterval != nil { - val := o.Larvinspectinterval() - m.Larvinspectinterval = omitnull.FromNull(val) - } - if o.Lastinspectactiontaken != nil { - val := o.Lastinspectactiontaken() - m.Lastinspectactiontaken = omitnull.FromNull(val) - } - if o.Lastinspectactivity != nil { - val := o.Lastinspectactivity() - m.Lastinspectactivity = omitnull.FromNull(val) - } - if o.Lastinspectavglarvae != nil { - val := o.Lastinspectavglarvae() - m.Lastinspectavglarvae = omitnull.FromNull(val) - } - if o.Lastinspectavgpupae != nil { - val := o.Lastinspectavgpupae() - m.Lastinspectavgpupae = omitnull.FromNull(val) - } - if o.Lastinspectbreeding != nil { - val := o.Lastinspectbreeding() - m.Lastinspectbreeding = omitnull.FromNull(val) - } - if o.Lastinspectconditions != nil { - val := o.Lastinspectconditions() - m.Lastinspectconditions = omitnull.FromNull(val) - } - if o.Lastinspectdate != nil { - val := o.Lastinspectdate() - m.Lastinspectdate = omitnull.FromNull(val) - } - if o.Lastinspectfieldspecies != nil { - val := o.Lastinspectfieldspecies() - m.Lastinspectfieldspecies = omitnull.FromNull(val) - } - if o.Lastinspectlstages != nil { - val := o.Lastinspectlstages() - m.Lastinspectlstages = omitnull.FromNull(val) - } - if o.Lasttreatactivity != nil { - val := o.Lasttreatactivity() - m.Lasttreatactivity = omitnull.FromNull(val) - } - if o.Lasttreatdate != nil { - val := o.Lasttreatdate() - m.Lasttreatdate = omitnull.FromNull(val) - } - if o.Lasttreatproduct != nil { - val := o.Lasttreatproduct() - m.Lasttreatproduct = omitnull.FromNull(val) - } - if o.Lasttreatqty != nil { - val := o.Lasttreatqty() - m.Lasttreatqty = omitnull.FromNull(val) - } - if o.Lasttreatqtyunit != nil { - val := o.Lasttreatqtyunit() - m.Lasttreatqtyunit = omitnull.FromNull(val) - } - if o.LengthFT != nil { - val := o.LengthFT() - m.LengthFT = omitnull.FromNull(val) - } - if o.LengthMeters != nil { - val := o.LengthMeters() - m.LengthMeters = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Symbology != nil { - val := o.Symbology() - m.Symbology = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - val := o.ShapeLength() - m.ShapeLength = omitnull.FromNull(val) - } - if o.Usetype != nil { - val := o.Usetype() - m.Usetype = omitnull.FromNull(val) - } - if o.Waterorigin != nil { - val := o.Waterorigin() - m.Waterorigin = omitnull.FromNull(val) - } - if o.WidthFT != nil { - val := o.WidthFT() - m.WidthFT = omitnull.FromNull(val) - } - if o.WidthMeters != nil { - val := o.WidthMeters() - m.WidthMeters = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryLinelocationSetter -// this does nothing with the relationship templates -func (o HistoryLinelocationTemplate) BuildManySetter(number int) []*models.HistoryLinelocationSetter { - m := make([]*models.HistoryLinelocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryLinelocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryLinelocationTemplate.Create -func (o HistoryLinelocationTemplate) Build() *models.HistoryLinelocation { - m := &models.HistoryLinelocation{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Acres != nil { - m.Acres = o.Acres() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Hectares != nil { - m.Hectares = o.Hectares() - } - if o.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Larvinspectinterval != nil { - m.Larvinspectinterval = o.Larvinspectinterval() - } - if o.Lastinspectactiontaken != nil { - m.Lastinspectactiontaken = o.Lastinspectactiontaken() - } - if o.Lastinspectactivity != nil { - m.Lastinspectactivity = o.Lastinspectactivity() - } - if o.Lastinspectavglarvae != nil { - m.Lastinspectavglarvae = o.Lastinspectavglarvae() - } - if o.Lastinspectavgpupae != nil { - m.Lastinspectavgpupae = o.Lastinspectavgpupae() - } - if o.Lastinspectbreeding != nil { - m.Lastinspectbreeding = o.Lastinspectbreeding() - } - if o.Lastinspectconditions != nil { - m.Lastinspectconditions = o.Lastinspectconditions() - } - if o.Lastinspectdate != nil { - m.Lastinspectdate = o.Lastinspectdate() - } - if o.Lastinspectfieldspecies != nil { - m.Lastinspectfieldspecies = o.Lastinspectfieldspecies() - } - if o.Lastinspectlstages != nil { - m.Lastinspectlstages = o.Lastinspectlstages() - } - if o.Lasttreatactivity != nil { - m.Lasttreatactivity = o.Lasttreatactivity() - } - if o.Lasttreatdate != nil { - m.Lasttreatdate = o.Lasttreatdate() - } - if o.Lasttreatproduct != nil { - m.Lasttreatproduct = o.Lasttreatproduct() - } - if o.Lasttreatqty != nil { - m.Lasttreatqty = o.Lasttreatqty() - } - if o.Lasttreatqtyunit != nil { - m.Lasttreatqtyunit = o.Lasttreatqtyunit() - } - if o.LengthFT != nil { - m.LengthFT = o.LengthFT() - } - if o.LengthMeters != nil { - m.LengthMeters = o.LengthMeters() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Symbology != nil { - m.Symbology = o.Symbology() - } - if o.ShapeLength != nil { - m.ShapeLength = o.ShapeLength() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Waterorigin != nil { - m.Waterorigin = o.Waterorigin() - } - if o.WidthFT != nil { - m.WidthFT = o.WidthFT() - } - if o.WidthMeters != nil { - m.WidthMeters = o.WidthMeters() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryLinelocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryLinelocationTemplate.CreateMany -func (o HistoryLinelocationTemplate) BuildMany(number int) models.HistoryLinelocationSlice { - m := make(models.HistoryLinelocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryLinelocation(m *models.HistoryLinelocationSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryLinelocation -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryLinelocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryLinelocation) error { - var err error - - return err -} - -// Create builds a historyLinelocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryLinelocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryLinelocation, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryLinelocation(opt) - - if o.r.Organization == nil { - HistoryLinelocationMods.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.HistoryLinelocations.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 historyLinelocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryLinelocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryLinelocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyLinelocation 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 *HistoryLinelocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryLinelocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyLinelocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryLinelocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryLinelocationSlice, error) { - var err error - m := make(models.HistoryLinelocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyLinelocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryLinelocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryLinelocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyLinelocations 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 HistoryLinelocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryLinelocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryLinelocation has methods that act as mods for the HistoryLinelocationTemplate -var HistoryLinelocationMods historyLinelocationMods - -type historyLinelocationMods struct{} - -func (m historyLinelocationMods) RandomizeAllColumns(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModSlice{ - HistoryLinelocationMods.RandomOrganizationID(f), - HistoryLinelocationMods.RandomAccessdesc(f), - HistoryLinelocationMods.RandomAcres(f), - HistoryLinelocationMods.RandomActive(f), - HistoryLinelocationMods.RandomComments(f), - HistoryLinelocationMods.RandomCreationdate(f), - HistoryLinelocationMods.RandomCreator(f), - HistoryLinelocationMods.RandomDescription(f), - HistoryLinelocationMods.RandomExternalid(f), - HistoryLinelocationMods.RandomEditdate(f), - HistoryLinelocationMods.RandomEditor(f), - HistoryLinelocationMods.RandomGlobalid(f), - HistoryLinelocationMods.RandomHabitat(f), - HistoryLinelocationMods.RandomHectares(f), - HistoryLinelocationMods.RandomJurisdiction(f), - HistoryLinelocationMods.RandomLarvinspectinterval(f), - HistoryLinelocationMods.RandomLastinspectactiontaken(f), - HistoryLinelocationMods.RandomLastinspectactivity(f), - HistoryLinelocationMods.RandomLastinspectavglarvae(f), - HistoryLinelocationMods.RandomLastinspectavgpupae(f), - HistoryLinelocationMods.RandomLastinspectbreeding(f), - HistoryLinelocationMods.RandomLastinspectconditions(f), - HistoryLinelocationMods.RandomLastinspectdate(f), - HistoryLinelocationMods.RandomLastinspectfieldspecies(f), - HistoryLinelocationMods.RandomLastinspectlstages(f), - HistoryLinelocationMods.RandomLasttreatactivity(f), - HistoryLinelocationMods.RandomLasttreatdate(f), - HistoryLinelocationMods.RandomLasttreatproduct(f), - HistoryLinelocationMods.RandomLasttreatqty(f), - HistoryLinelocationMods.RandomLasttreatqtyunit(f), - HistoryLinelocationMods.RandomLengthFT(f), - HistoryLinelocationMods.RandomLengthMeters(f), - HistoryLinelocationMods.RandomLocationnumber(f), - HistoryLinelocationMods.RandomName(f), - HistoryLinelocationMods.RandomNextactiondatescheduled(f), - HistoryLinelocationMods.RandomObjectid(f), - HistoryLinelocationMods.RandomPriority(f), - HistoryLinelocationMods.RandomSymbology(f), - HistoryLinelocationMods.RandomShapeLength(f), - HistoryLinelocationMods.RandomUsetype(f), - HistoryLinelocationMods.RandomWaterorigin(f), - HistoryLinelocationMods.RandomWidthFT(f), - HistoryLinelocationMods.RandomWidthMeters(f), - HistoryLinelocationMods.RandomZone(f), - HistoryLinelocationMods.RandomZone2(f), - HistoryLinelocationMods.RandomCreated(f), - HistoryLinelocationMods.RandomCreatedDate(f), - HistoryLinelocationMods.RandomCreatedUser(f), - HistoryLinelocationMods.RandomGeometryX(f), - HistoryLinelocationMods.RandomGeometryY(f), - HistoryLinelocationMods.RandomLastEditedDate(f), - HistoryLinelocationMods.RandomLastEditedUser(f), - HistoryLinelocationMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyLinelocationMods) OrganizationID(val int32) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) OrganizationIDFunc(f func() int32) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetOrganizationID() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - 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 historyLinelocationMods) RandomOrganizationID(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyLinelocationMods) Accessdesc(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) AccessdescFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetAccessdesc() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Accessdesc = 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 historyLinelocationMods) RandomAccessdesc(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Accessdesc = 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 historyLinelocationMods) RandomAccessdescNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Accessdesc = 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 historyLinelocationMods) Acres(val null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Acres = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) AcresFunc(f func() null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Acres = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetAcres() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Acres = 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 historyLinelocationMods) RandomAcres(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Acres = 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 historyLinelocationMods) RandomAcresNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Acres = 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 historyLinelocationMods) Active(val null.Val[int16]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) ActiveFunc(f func() null.Val[int16]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetActive() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Active = 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 historyLinelocationMods) RandomActive(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyLinelocationMods) RandomActiveNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLinelocationMods) Comments(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) CommentsFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetComments() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Comments = 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 historyLinelocationMods) RandomComments(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Comments = 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 historyLinelocationMods) RandomCommentsNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Comments = 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 historyLinelocationMods) Creationdate(val null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) CreationdateFunc(f func() null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetCreationdate() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Creationdate = 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 historyLinelocationMods) RandomCreationdate(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyLinelocationMods) RandomCreationdateNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLinelocationMods) Creator(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) CreatorFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetCreator() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Creator = 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 historyLinelocationMods) RandomCreator(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Creator = 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 historyLinelocationMods) RandomCreatorNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Creator = 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 historyLinelocationMods) Description(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) DescriptionFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetDescription() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Description = 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 historyLinelocationMods) RandomDescription(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Description = 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 historyLinelocationMods) RandomDescriptionNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Description = 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 historyLinelocationMods) Externalid(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) ExternalidFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetExternalid() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Externalid = 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 historyLinelocationMods) RandomExternalid(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Externalid = 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 historyLinelocationMods) RandomExternalidNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Externalid = 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 historyLinelocationMods) Editdate(val null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) EditdateFunc(f func() null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetEditdate() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Editdate = 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 historyLinelocationMods) RandomEditdate(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyLinelocationMods) RandomEditdateNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLinelocationMods) Editor(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) EditorFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetEditor() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Editor = 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 historyLinelocationMods) RandomEditor(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Editor = 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 historyLinelocationMods) RandomEditorNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Editor = 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 historyLinelocationMods) Globalid(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) GlobalidFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetGlobalid() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Globalid = 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 historyLinelocationMods) RandomGlobalid(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - 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 historyLinelocationMods) RandomGlobalidNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Globalid = 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 historyLinelocationMods) Habitat(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) HabitatFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetHabitat() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Habitat = 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 historyLinelocationMods) RandomHabitat(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Habitat = 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 historyLinelocationMods) RandomHabitatNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Habitat = 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 historyLinelocationMods) Hectares(val null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Hectares = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) HectaresFunc(f func() null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Hectares = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetHectares() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Hectares = 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 historyLinelocationMods) RandomHectares(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Hectares = 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 historyLinelocationMods) RandomHectaresNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Hectares = 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 historyLinelocationMods) Jurisdiction(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) JurisdictionFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetJurisdiction() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Jurisdiction = 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 historyLinelocationMods) RandomJurisdiction(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Jurisdiction = 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 historyLinelocationMods) RandomJurisdictionNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Jurisdiction = 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 historyLinelocationMods) Larvinspectinterval(val null.Val[int16]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LarvinspectintervalFunc(f func() null.Val[int16]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Larvinspectinterval = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLarvinspectinterval() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Larvinspectinterval = 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 historyLinelocationMods) RandomLarvinspectinterval(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyLinelocationMods) RandomLarvinspectintervalNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLinelocationMods) Lastinspectactiontaken(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectactiontaken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LastinspectactiontakenFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectactiontaken = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLastinspectactiontaken() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectactiontaken = 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 historyLinelocationMods) RandomLastinspectactiontaken(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectactiontaken = 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 historyLinelocationMods) RandomLastinspectactiontakenNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectactiontaken = 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 historyLinelocationMods) Lastinspectactivity(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LastinspectactivityFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectactivity = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLastinspectactivity() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectactivity = 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 historyLinelocationMods) RandomLastinspectactivity(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectactivity = 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 historyLinelocationMods) RandomLastinspectactivityNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectactivity = 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 historyLinelocationMods) Lastinspectavglarvae(val null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectavglarvae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LastinspectavglarvaeFunc(f func() null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectavglarvae = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLastinspectavglarvae() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectavglarvae = 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 historyLinelocationMods) RandomLastinspectavglarvae(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectavglarvae = 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 historyLinelocationMods) RandomLastinspectavglarvaeNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectavglarvae = 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 historyLinelocationMods) Lastinspectavgpupae(val null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectavgpupae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LastinspectavgpupaeFunc(f func() null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectavgpupae = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLastinspectavgpupae() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectavgpupae = 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 historyLinelocationMods) RandomLastinspectavgpupae(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectavgpupae = 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 historyLinelocationMods) RandomLastinspectavgpupaeNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectavgpupae = 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 historyLinelocationMods) Lastinspectbreeding(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectbreeding = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LastinspectbreedingFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectbreeding = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLastinspectbreeding() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectbreeding = 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 historyLinelocationMods) RandomLastinspectbreeding(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectbreeding = 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 historyLinelocationMods) RandomLastinspectbreedingNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectbreeding = 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 historyLinelocationMods) Lastinspectconditions(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LastinspectconditionsFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectconditions = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLastinspectconditions() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectconditions = 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 historyLinelocationMods) RandomLastinspectconditions(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectconditions = 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 historyLinelocationMods) RandomLastinspectconditionsNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectconditions = 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 historyLinelocationMods) Lastinspectdate(val null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LastinspectdateFunc(f func() null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectdate = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLastinspectdate() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectdate = 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 historyLinelocationMods) RandomLastinspectdate(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyLinelocationMods) RandomLastinspectdateNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLinelocationMods) Lastinspectfieldspecies(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectfieldspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LastinspectfieldspeciesFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectfieldspecies = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLastinspectfieldspecies() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectfieldspecies = 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 historyLinelocationMods) RandomLastinspectfieldspecies(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectfieldspecies = 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 historyLinelocationMods) RandomLastinspectfieldspeciesNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectfieldspecies = 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 historyLinelocationMods) Lastinspectlstages(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectlstages = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LastinspectlstagesFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectlstages = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLastinspectlstages() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectlstages = 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 historyLinelocationMods) RandomLastinspectlstages(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectlstages = 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 historyLinelocationMods) RandomLastinspectlstagesNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lastinspectlstages = 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 historyLinelocationMods) Lasttreatactivity(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LasttreatactivityFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatactivity = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLasttreatactivity() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatactivity = 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 historyLinelocationMods) RandomLasttreatactivity(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatactivity = 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 historyLinelocationMods) RandomLasttreatactivityNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatactivity = 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 historyLinelocationMods) Lasttreatdate(val null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LasttreatdateFunc(f func() null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatdate = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLasttreatdate() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatdate = 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 historyLinelocationMods) RandomLasttreatdate(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyLinelocationMods) RandomLasttreatdateNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLinelocationMods) Lasttreatproduct(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatproduct = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LasttreatproductFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatproduct = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLasttreatproduct() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatproduct = 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 historyLinelocationMods) RandomLasttreatproduct(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatproduct = 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 historyLinelocationMods) RandomLasttreatproductNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatproduct = 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 historyLinelocationMods) Lasttreatqty(val null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatqty = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LasttreatqtyFunc(f func() null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatqty = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLasttreatqty() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatqty = 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 historyLinelocationMods) RandomLasttreatqty(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatqty = 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 historyLinelocationMods) RandomLasttreatqtyNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatqty = 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 historyLinelocationMods) Lasttreatqtyunit(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LasttreatqtyunitFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatqtyunit = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLasttreatqtyunit() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatqtyunit = 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 historyLinelocationMods) RandomLasttreatqtyunit(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatqtyunit = 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 historyLinelocationMods) RandomLasttreatqtyunitNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Lasttreatqtyunit = 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 historyLinelocationMods) LengthFT(val null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LengthFT = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LengthFTFunc(f func() null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LengthFT = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLengthFT() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LengthFT = 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 historyLinelocationMods) RandomLengthFT(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LengthFT = 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 historyLinelocationMods) RandomLengthFTNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LengthFT = 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 historyLinelocationMods) LengthMeters(val null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LengthMeters = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LengthMetersFunc(f func() null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LengthMeters = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLengthMeters() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LengthMeters = 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 historyLinelocationMods) RandomLengthMeters(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LengthMeters = 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 historyLinelocationMods) RandomLengthMetersNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LengthMeters = 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 historyLinelocationMods) Locationnumber(val null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Locationnumber = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LocationnumberFunc(f func() null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLocationnumber() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Locationnumber = 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 historyLinelocationMods) RandomLocationnumber(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyLinelocationMods) RandomLocationnumberNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLinelocationMods) Name(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) NameFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetName() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Name = 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 historyLinelocationMods) RandomName(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Name = 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 historyLinelocationMods) RandomNameNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Name = 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 historyLinelocationMods) Nextactiondatescheduled(val null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetNextactiondatescheduled() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Nextactiondatescheduled = 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 historyLinelocationMods) RandomNextactiondatescheduled(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyLinelocationMods) RandomNextactiondatescheduledNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLinelocationMods) Objectid(val int32) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) ObjectidFunc(f func() int32) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetObjectid() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyLinelocationMods) RandomObjectid(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyLinelocationMods) Priority(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) PriorityFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetPriority() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Priority = 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 historyLinelocationMods) RandomPriority(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Priority = 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 historyLinelocationMods) RandomPriorityNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Priority = 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 historyLinelocationMods) Symbology(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Symbology = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) SymbologyFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Symbology = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetSymbology() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Symbology = 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 historyLinelocationMods) RandomSymbology(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Symbology = 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 historyLinelocationMods) RandomSymbologyNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Symbology = 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 historyLinelocationMods) ShapeLength(val null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) ShapeLengthFunc(f func() null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetShapeLength() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.ShapeLength = 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 historyLinelocationMods) RandomShapeLength(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.ShapeLength = 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 historyLinelocationMods) RandomShapeLengthNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.ShapeLength = 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 historyLinelocationMods) Usetype(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) UsetypeFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetUsetype() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Usetype = 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 historyLinelocationMods) RandomUsetype(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Usetype = 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 historyLinelocationMods) RandomUsetypeNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Usetype = 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 historyLinelocationMods) Waterorigin(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Waterorigin = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) WateroriginFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Waterorigin = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetWaterorigin() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Waterorigin = 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 historyLinelocationMods) RandomWaterorigin(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Waterorigin = 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 historyLinelocationMods) RandomWateroriginNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Waterorigin = 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 historyLinelocationMods) WidthFT(val null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.WidthFT = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) WidthFTFunc(f func() null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.WidthFT = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetWidthFT() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.WidthFT = 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 historyLinelocationMods) RandomWidthFT(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.WidthFT = 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 historyLinelocationMods) RandomWidthFTNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.WidthFT = 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 historyLinelocationMods) WidthMeters(val null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.WidthMeters = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) WidthMetersFunc(f func() null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.WidthMeters = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetWidthMeters() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.WidthMeters = 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 historyLinelocationMods) RandomWidthMeters(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.WidthMeters = 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 historyLinelocationMods) RandomWidthMetersNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.WidthMeters = 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 historyLinelocationMods) Zone(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) ZoneFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetZone() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Zone = 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 historyLinelocationMods) RandomZone(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Zone = 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 historyLinelocationMods) RandomZoneNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Zone = 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 historyLinelocationMods) Zone2(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) Zone2Func(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetZone2() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Zone2 = 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 historyLinelocationMods) RandomZone2(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Zone2 = 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 historyLinelocationMods) RandomZone2NotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Zone2 = 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 historyLinelocationMods) Created(val null.Val[time.Time]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) CreatedFunc(f func() null.Val[time.Time]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetCreated() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Created = 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 historyLinelocationMods) RandomCreated(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyLinelocationMods) RandomCreatedNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLinelocationMods) CreatedDate(val null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) CreatedDateFunc(f func() null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetCreatedDate() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.CreatedDate = 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 historyLinelocationMods) RandomCreatedDate(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyLinelocationMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLinelocationMods) CreatedUser(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) CreatedUserFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetCreatedUser() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.CreatedUser = 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 historyLinelocationMods) RandomCreatedUser(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.CreatedUser = 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 historyLinelocationMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.CreatedUser = 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 historyLinelocationMods) GeometryX(val null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) GeometryXFunc(f func() null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetGeometryX() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.GeometryX = 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 historyLinelocationMods) RandomGeometryX(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - 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 historyLinelocationMods) RandomGeometryXNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.GeometryX = 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 historyLinelocationMods) GeometryY(val null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) GeometryYFunc(f func() null.Val[float64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetGeometryY() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.GeometryY = 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 historyLinelocationMods) RandomGeometryY(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - 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 historyLinelocationMods) RandomGeometryYNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.GeometryY = 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 historyLinelocationMods) LastEditedDate(val null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLastEditedDate() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LastEditedDate = 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 historyLinelocationMods) RandomLastEditedDate(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyLinelocationMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLinelocationMods) LastEditedUser(val null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) LastEditedUserFunc(f func() null.Val[string]) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetLastEditedUser() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LastEditedUser = 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 historyLinelocationMods) RandomLastEditedUser(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LastEditedUser = 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 historyLinelocationMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.LastEditedUser = 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 historyLinelocationMods) Version(val int32) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyLinelocationMods) VersionFunc(f func() int32) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyLinelocationMods) UnsetVersion() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyLinelocationMods) RandomVersion(f *faker.Faker) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyLinelocationMods) WithParentsCascading() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(ctx context.Context, o *HistoryLinelocationTemplate) { - if isDone, _ := historyLinelocationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyLinelocationWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyLinelocationMods) WithOrganization(rel *OrganizationTemplate) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(ctx context.Context, o *HistoryLinelocationTemplate) { - o.r.Organization = &historyLinelocationROrganizationR{ - o: rel, - } - }) -} - -func (m historyLinelocationMods) WithNewOrganization(mods ...OrganizationMod) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(ctx context.Context, o *HistoryLinelocationTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyLinelocationMods) WithExistingOrganization(em *models.Organization) HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(ctx context.Context, o *HistoryLinelocationTemplate) { - o.r.Organization = &historyLinelocationROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyLinelocationMods) WithoutOrganization() HistoryLinelocationMod { - return HistoryLinelocationModFunc(func(ctx context.Context, o *HistoryLinelocationTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_locationtracking.bob.go b/db/factory/history_locationtracking.bob.go deleted file mode 100644 index a0ae01f6..00000000 --- a/db/factory/history_locationtracking.bob.go +++ /dev/null @@ -1,1284 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryLocationtrackingMod interface { - Apply(context.Context, *HistoryLocationtrackingTemplate) -} - -type HistoryLocationtrackingModFunc func(context.Context, *HistoryLocationtrackingTemplate) - -func (f HistoryLocationtrackingModFunc) Apply(ctx context.Context, n *HistoryLocationtrackingTemplate) { - f(ctx, n) -} - -type HistoryLocationtrackingModSlice []HistoryLocationtrackingMod - -func (mods HistoryLocationtrackingModSlice) Apply(ctx context.Context, n *HistoryLocationtrackingTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryLocationtrackingTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryLocationtrackingTemplate struct { - OrganizationID func() int32 - Accuracy func() null.Val[float64] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fieldtech func() null.Val[string] - Globalid func() null.Val[string] - Objectid func() int32 - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Version func() int32 - - r historyLocationtrackingR - f *Factory - - alreadyPersisted bool -} - -type historyLocationtrackingR struct { - Organization *historyLocationtrackingROrganizationR -} - -type historyLocationtrackingROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryLocationtrackingTemplate -func (o *HistoryLocationtrackingTemplate) Apply(ctx context.Context, mods ...HistoryLocationtrackingMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryLocationtracking -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryLocationtrackingTemplate) setModelRels(o *models.HistoryLocationtracking) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryLocationtrackings = append(rel.R.HistoryLocationtrackings, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryLocationtrackingSetter -// this does nothing with the relationship templates -func (o HistoryLocationtrackingTemplate) BuildSetter() *models.HistoryLocationtrackingSetter { - m := &models.HistoryLocationtrackingSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accuracy != nil { - val := o.Accuracy() - m.Accuracy = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryLocationtrackingSetter -// this does nothing with the relationship templates -func (o HistoryLocationtrackingTemplate) BuildManySetter(number int) []*models.HistoryLocationtrackingSetter { - m := make([]*models.HistoryLocationtrackingSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryLocationtracking -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryLocationtrackingTemplate.Create -func (o HistoryLocationtrackingTemplate) Build() *models.HistoryLocationtracking { - m := &models.HistoryLocationtracking{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accuracy != nil { - m.Accuracy = o.Accuracy() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryLocationtrackingSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryLocationtrackingTemplate.CreateMany -func (o HistoryLocationtrackingTemplate) BuildMany(number int) models.HistoryLocationtrackingSlice { - m := make(models.HistoryLocationtrackingSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryLocationtracking(m *models.HistoryLocationtrackingSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryLocationtracking -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryLocationtrackingTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryLocationtracking) error { - var err error - - return err -} - -// Create builds a historyLocationtracking and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryLocationtrackingTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryLocationtracking, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryLocationtracking(opt) - - if o.r.Organization == nil { - HistoryLocationtrackingMods.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.HistoryLocationtrackings.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 historyLocationtracking and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryLocationtrackingTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryLocationtracking { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyLocationtracking 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 *HistoryLocationtrackingTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryLocationtracking { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyLocationtrackings and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryLocationtrackingTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryLocationtrackingSlice, error) { - var err error - m := make(models.HistoryLocationtrackingSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyLocationtrackings and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryLocationtrackingTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryLocationtrackingSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyLocationtrackings 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 HistoryLocationtrackingTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryLocationtrackingSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryLocationtracking has methods that act as mods for the HistoryLocationtrackingTemplate -var HistoryLocationtrackingMods historyLocationtrackingMods - -type historyLocationtrackingMods struct{} - -func (m historyLocationtrackingMods) RandomizeAllColumns(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModSlice{ - HistoryLocationtrackingMods.RandomOrganizationID(f), - HistoryLocationtrackingMods.RandomAccuracy(f), - HistoryLocationtrackingMods.RandomCreationdate(f), - HistoryLocationtrackingMods.RandomCreator(f), - HistoryLocationtrackingMods.RandomEditdate(f), - HistoryLocationtrackingMods.RandomEditor(f), - HistoryLocationtrackingMods.RandomFieldtech(f), - HistoryLocationtrackingMods.RandomGlobalid(f), - HistoryLocationtrackingMods.RandomObjectid(f), - HistoryLocationtrackingMods.RandomCreated(f), - HistoryLocationtrackingMods.RandomCreatedDate(f), - HistoryLocationtrackingMods.RandomCreatedUser(f), - HistoryLocationtrackingMods.RandomGeometryX(f), - HistoryLocationtrackingMods.RandomGeometryY(f), - HistoryLocationtrackingMods.RandomLastEditedDate(f), - HistoryLocationtrackingMods.RandomLastEditedUser(f), - HistoryLocationtrackingMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyLocationtrackingMods) OrganizationID(val int32) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) OrganizationIDFunc(f func() int32) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetOrganizationID() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - 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 historyLocationtrackingMods) RandomOrganizationID(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyLocationtrackingMods) Accuracy(val null.Val[float64]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Accuracy = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) AccuracyFunc(f func() null.Val[float64]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Accuracy = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetAccuracy() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Accuracy = 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 historyLocationtrackingMods) RandomAccuracy(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Accuracy = 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 historyLocationtrackingMods) RandomAccuracyNotNull(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Accuracy = 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 historyLocationtrackingMods) Creationdate(val null.Val[int64]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) CreationdateFunc(f func() null.Val[int64]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetCreationdate() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Creationdate = 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 historyLocationtrackingMods) RandomCreationdate(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyLocationtrackingMods) RandomCreationdateNotNull(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLocationtrackingMods) Creator(val null.Val[string]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) CreatorFunc(f func() null.Val[string]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetCreator() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Creator = 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 historyLocationtrackingMods) RandomCreator(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Creator = 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 historyLocationtrackingMods) RandomCreatorNotNull(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Creator = 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 historyLocationtrackingMods) Editdate(val null.Val[int64]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) EditdateFunc(f func() null.Val[int64]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetEditdate() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Editdate = 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 historyLocationtrackingMods) RandomEditdate(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyLocationtrackingMods) RandomEditdateNotNull(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLocationtrackingMods) Editor(val null.Val[string]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) EditorFunc(f func() null.Val[string]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetEditor() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Editor = 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 historyLocationtrackingMods) RandomEditor(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Editor = 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 historyLocationtrackingMods) RandomEditorNotNull(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Editor = 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 historyLocationtrackingMods) Fieldtech(val null.Val[string]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) FieldtechFunc(f func() null.Val[string]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetFieldtech() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Fieldtech = 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 historyLocationtrackingMods) RandomFieldtech(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Fieldtech = 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 historyLocationtrackingMods) RandomFieldtechNotNull(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Fieldtech = 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 historyLocationtrackingMods) Globalid(val null.Val[string]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) GlobalidFunc(f func() null.Val[string]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetGlobalid() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Globalid = 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 historyLocationtrackingMods) RandomGlobalid(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - 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 historyLocationtrackingMods) RandomGlobalidNotNull(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Globalid = 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 historyLocationtrackingMods) Objectid(val int32) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) ObjectidFunc(f func() int32) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetObjectid() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyLocationtrackingMods) RandomObjectid(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyLocationtrackingMods) Created(val null.Val[time.Time]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) CreatedFunc(f func() null.Val[time.Time]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetCreated() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Created = 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 historyLocationtrackingMods) RandomCreated(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyLocationtrackingMods) RandomCreatedNotNull(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLocationtrackingMods) CreatedDate(val null.Val[int64]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) CreatedDateFunc(f func() null.Val[int64]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetCreatedDate() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.CreatedDate = 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 historyLocationtrackingMods) RandomCreatedDate(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyLocationtrackingMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLocationtrackingMods) CreatedUser(val null.Val[string]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) CreatedUserFunc(f func() null.Val[string]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetCreatedUser() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.CreatedUser = 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 historyLocationtrackingMods) RandomCreatedUser(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.CreatedUser = 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 historyLocationtrackingMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.CreatedUser = 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 historyLocationtrackingMods) GeometryX(val null.Val[float64]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) GeometryXFunc(f func() null.Val[float64]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetGeometryX() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.GeometryX = 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 historyLocationtrackingMods) RandomGeometryX(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - 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 historyLocationtrackingMods) RandomGeometryXNotNull(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.GeometryX = 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 historyLocationtrackingMods) GeometryY(val null.Val[float64]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) GeometryYFunc(f func() null.Val[float64]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetGeometryY() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.GeometryY = 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 historyLocationtrackingMods) RandomGeometryY(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - 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 historyLocationtrackingMods) RandomGeometryYNotNull(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.GeometryY = 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 historyLocationtrackingMods) LastEditedDate(val null.Val[int64]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetLastEditedDate() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.LastEditedDate = 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 historyLocationtrackingMods) RandomLastEditedDate(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyLocationtrackingMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyLocationtrackingMods) LastEditedUser(val null.Val[string]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) LastEditedUserFunc(f func() null.Val[string]) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetLastEditedUser() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.LastEditedUser = 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 historyLocationtrackingMods) RandomLastEditedUser(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.LastEditedUser = 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 historyLocationtrackingMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.LastEditedUser = 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 historyLocationtrackingMods) Version(val int32) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyLocationtrackingMods) VersionFunc(f func() int32) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyLocationtrackingMods) UnsetVersion() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyLocationtrackingMods) RandomVersion(f *faker.Faker) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyLocationtrackingMods) WithParentsCascading() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(ctx context.Context, o *HistoryLocationtrackingTemplate) { - if isDone, _ := historyLocationtrackingWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyLocationtrackingWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyLocationtrackingMods) WithOrganization(rel *OrganizationTemplate) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(ctx context.Context, o *HistoryLocationtrackingTemplate) { - o.r.Organization = &historyLocationtrackingROrganizationR{ - o: rel, - } - }) -} - -func (m historyLocationtrackingMods) WithNewOrganization(mods ...OrganizationMod) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(ctx context.Context, o *HistoryLocationtrackingTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyLocationtrackingMods) WithExistingOrganization(em *models.Organization) HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(ctx context.Context, o *HistoryLocationtrackingTemplate) { - o.r.Organization = &historyLocationtrackingROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyLocationtrackingMods) WithoutOrganization() HistoryLocationtrackingMod { - return HistoryLocationtrackingModFunc(func(ctx context.Context, o *HistoryLocationtrackingTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_mosquitoinspection.bob.go b/db/factory/history_mosquitoinspection.bob.go deleted file mode 100644 index fe8f2fde..00000000 --- a/db/factory/history_mosquitoinspection.bob.go +++ /dev/null @@ -1,4074 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryMosquitoinspectionMod interface { - Apply(context.Context, *HistoryMosquitoinspectionTemplate) -} - -type HistoryMosquitoinspectionModFunc func(context.Context, *HistoryMosquitoinspectionTemplate) - -func (f HistoryMosquitoinspectionModFunc) Apply(ctx context.Context, n *HistoryMosquitoinspectionTemplate) { - f(ctx, n) -} - -type HistoryMosquitoinspectionModSlice []HistoryMosquitoinspectionMod - -func (mods HistoryMosquitoinspectionModSlice) Apply(ctx context.Context, n *HistoryMosquitoinspectionTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryMosquitoinspectionTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryMosquitoinspectionTemplate struct { - OrganizationID func() int32 - Actiontaken func() null.Val[string] - Activity func() null.Val[string] - Adultact func() null.Val[string] - Avetemp func() null.Val[float64] - Avglarvae func() null.Val[float64] - Avgpupae func() null.Val[float64] - Breeding func() null.Val[string] - Cbcount func() null.Val[int16] - Comments func() null.Val[string] - Containercount func() null.Val[int16] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Domstage func() null.Val[string] - Eggs func() null.Val[int16] - Enddatetime func() null.Val[int64] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fieldspecies func() null.Val[string] - Fieldtech func() null.Val[string] - Globalid func() null.Val[string] - Jurisdiction func() null.Val[string] - Larvaepresent func() null.Val[int16] - Linelocid func() null.Val[string] - Locationname func() null.Val[string] - Lstages func() null.Val[string] - Numdips func() null.Val[int16] - Objectid func() int32 - Personalcontact func() null.Val[int16] - Pointlocid func() null.Val[string] - Polygonlocid func() null.Val[string] - Posdips func() null.Val[int16] - Positivecontainercount func() null.Val[int16] - Pupaepresent func() null.Val[int16] - Raingauge func() null.Val[float64] - Recordstatus func() null.Val[int16] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[int64] - Sdid func() null.Val[string] - Sitecond func() null.Val[string] - Srid func() null.Val[string] - Startdatetime func() null.Val[int64] - Tirecount func() null.Val[int16] - Totlarvae func() null.Val[int16] - Totpupae func() null.Val[int16] - Visualmonitoring func() null.Val[int16] - Vmcomments func() null.Val[string] - Winddir func() null.Val[string] - Windspeed func() null.Val[float64] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Adminaction func() null.Val[string] - Ptaid func() null.Val[string] - Version func() int32 - - r historyMosquitoinspectionR - f *Factory - - alreadyPersisted bool -} - -type historyMosquitoinspectionR struct { - Organization *historyMosquitoinspectionROrganizationR -} - -type historyMosquitoinspectionROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryMosquitoinspectionTemplate -func (o *HistoryMosquitoinspectionTemplate) Apply(ctx context.Context, mods ...HistoryMosquitoinspectionMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryMosquitoinspection -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryMosquitoinspectionTemplate) setModelRels(o *models.HistoryMosquitoinspection) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryMosquitoinspections = append(rel.R.HistoryMosquitoinspections, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryMosquitoinspectionSetter -// this does nothing with the relationship templates -func (o HistoryMosquitoinspectionTemplate) BuildSetter() *models.HistoryMosquitoinspectionSetter { - m := &models.HistoryMosquitoinspectionSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Actiontaken != nil { - val := o.Actiontaken() - m.Actiontaken = omitnull.FromNull(val) - } - if o.Activity != nil { - val := o.Activity() - m.Activity = omitnull.FromNull(val) - } - if o.Adultact != nil { - val := o.Adultact() - m.Adultact = omitnull.FromNull(val) - } - if o.Avetemp != nil { - val := o.Avetemp() - m.Avetemp = omitnull.FromNull(val) - } - if o.Avglarvae != nil { - val := o.Avglarvae() - m.Avglarvae = omitnull.FromNull(val) - } - if o.Avgpupae != nil { - val := o.Avgpupae() - m.Avgpupae = omitnull.FromNull(val) - } - if o.Breeding != nil { - val := o.Breeding() - m.Breeding = omitnull.FromNull(val) - } - if o.Cbcount != nil { - val := o.Cbcount() - m.Cbcount = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Containercount != nil { - val := o.Containercount() - m.Containercount = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Domstage != nil { - val := o.Domstage() - m.Domstage = omitnull.FromNull(val) - } - if o.Eggs != nil { - val := o.Eggs() - m.Eggs = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fieldspecies != nil { - val := o.Fieldspecies() - m.Fieldspecies = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.Larvaepresent != nil { - val := o.Larvaepresent() - m.Larvaepresent = omitnull.FromNull(val) - } - if o.Linelocid != nil { - val := o.Linelocid() - m.Linelocid = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.Lstages != nil { - val := o.Lstages() - m.Lstages = omitnull.FromNull(val) - } - if o.Numdips != nil { - val := o.Numdips() - m.Numdips = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Personalcontact != nil { - val := o.Personalcontact() - m.Personalcontact = omitnull.FromNull(val) - } - if o.Pointlocid != nil { - val := o.Pointlocid() - m.Pointlocid = omitnull.FromNull(val) - } - if o.Polygonlocid != nil { - val := o.Polygonlocid() - m.Polygonlocid = omitnull.FromNull(val) - } - if o.Posdips != nil { - val := o.Posdips() - m.Posdips = omitnull.FromNull(val) - } - if o.Positivecontainercount != nil { - val := o.Positivecontainercount() - m.Positivecontainercount = omitnull.FromNull(val) - } - if o.Pupaepresent != nil { - val := o.Pupaepresent() - m.Pupaepresent = omitnull.FromNull(val) - } - if o.Raingauge != nil { - val := o.Raingauge() - m.Raingauge = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Reviewed != nil { - val := o.Reviewed() - m.Reviewed = omitnull.FromNull(val) - } - if o.Reviewedby != nil { - val := o.Reviewedby() - m.Reviewedby = omitnull.FromNull(val) - } - if o.Revieweddate != nil { - val := o.Revieweddate() - m.Revieweddate = omitnull.FromNull(val) - } - if o.Sdid != nil { - val := o.Sdid() - m.Sdid = omitnull.FromNull(val) - } - if o.Sitecond != nil { - val := o.Sitecond() - m.Sitecond = omitnull.FromNull(val) - } - if o.Srid != nil { - val := o.Srid() - m.Srid = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Tirecount != nil { - val := o.Tirecount() - m.Tirecount = omitnull.FromNull(val) - } - if o.Totlarvae != nil { - val := o.Totlarvae() - m.Totlarvae = omitnull.FromNull(val) - } - if o.Totpupae != nil { - val := o.Totpupae() - m.Totpupae = omitnull.FromNull(val) - } - if o.Visualmonitoring != nil { - val := o.Visualmonitoring() - m.Visualmonitoring = omitnull.FromNull(val) - } - if o.Vmcomments != nil { - val := o.Vmcomments() - m.Vmcomments = omitnull.FromNull(val) - } - if o.Winddir != nil { - val := o.Winddir() - m.Winddir = omitnull.FromNull(val) - } - if o.Windspeed != nil { - val := o.Windspeed() - m.Windspeed = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Adminaction != nil { - val := o.Adminaction() - m.Adminaction = omitnull.FromNull(val) - } - if o.Ptaid != nil { - val := o.Ptaid() - m.Ptaid = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryMosquitoinspectionSetter -// this does nothing with the relationship templates -func (o HistoryMosquitoinspectionTemplate) BuildManySetter(number int) []*models.HistoryMosquitoinspectionSetter { - m := make([]*models.HistoryMosquitoinspectionSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryMosquitoinspection -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryMosquitoinspectionTemplate.Create -func (o HistoryMosquitoinspectionTemplate) Build() *models.HistoryMosquitoinspection { - m := &models.HistoryMosquitoinspection{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Actiontaken != nil { - m.Actiontaken = o.Actiontaken() - } - if o.Activity != nil { - m.Activity = o.Activity() - } - if o.Adultact != nil { - m.Adultact = o.Adultact() - } - if o.Avetemp != nil { - m.Avetemp = o.Avetemp() - } - if o.Avglarvae != nil { - m.Avglarvae = o.Avglarvae() - } - if o.Avgpupae != nil { - m.Avgpupae = o.Avgpupae() - } - if o.Breeding != nil { - m.Breeding = o.Breeding() - } - if o.Cbcount != nil { - m.Cbcount = o.Cbcount() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Containercount != nil { - m.Containercount = o.Containercount() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Domstage != nil { - m.Domstage = o.Domstage() - } - if o.Eggs != nil { - m.Eggs = o.Eggs() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fieldspecies != nil { - m.Fieldspecies = o.Fieldspecies() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Larvaepresent != nil { - m.Larvaepresent = o.Larvaepresent() - } - if o.Linelocid != nil { - m.Linelocid = o.Linelocid() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.Lstages != nil { - m.Lstages = o.Lstages() - } - if o.Numdips != nil { - m.Numdips = o.Numdips() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Personalcontact != nil { - m.Personalcontact = o.Personalcontact() - } - if o.Pointlocid != nil { - m.Pointlocid = o.Pointlocid() - } - if o.Polygonlocid != nil { - m.Polygonlocid = o.Polygonlocid() - } - if o.Posdips != nil { - m.Posdips = o.Posdips() - } - if o.Positivecontainercount != nil { - m.Positivecontainercount = o.Positivecontainercount() - } - if o.Pupaepresent != nil { - m.Pupaepresent = o.Pupaepresent() - } - if o.Raingauge != nil { - m.Raingauge = o.Raingauge() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Reviewed != nil { - m.Reviewed = o.Reviewed() - } - if o.Reviewedby != nil { - m.Reviewedby = o.Reviewedby() - } - if o.Revieweddate != nil { - m.Revieweddate = o.Revieweddate() - } - if o.Sdid != nil { - m.Sdid = o.Sdid() - } - if o.Sitecond != nil { - m.Sitecond = o.Sitecond() - } - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Tirecount != nil { - m.Tirecount = o.Tirecount() - } - if o.Totlarvae != nil { - m.Totlarvae = o.Totlarvae() - } - if o.Totpupae != nil { - m.Totpupae = o.Totpupae() - } - if o.Visualmonitoring != nil { - m.Visualmonitoring = o.Visualmonitoring() - } - if o.Vmcomments != nil { - m.Vmcomments = o.Vmcomments() - } - if o.Winddir != nil { - m.Winddir = o.Winddir() - } - if o.Windspeed != nil { - m.Windspeed = o.Windspeed() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Adminaction != nil { - m.Adminaction = o.Adminaction() - } - if o.Ptaid != nil { - m.Ptaid = o.Ptaid() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryMosquitoinspectionSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryMosquitoinspectionTemplate.CreateMany -func (o HistoryMosquitoinspectionTemplate) BuildMany(number int) models.HistoryMosquitoinspectionSlice { - m := make(models.HistoryMosquitoinspectionSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryMosquitoinspection(m *models.HistoryMosquitoinspectionSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryMosquitoinspection -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryMosquitoinspectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryMosquitoinspection) error { - var err error - - return err -} - -// Create builds a historyMosquitoinspection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryMosquitoinspectionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryMosquitoinspection, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryMosquitoinspection(opt) - - if o.r.Organization == nil { - HistoryMosquitoinspectionMods.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.HistoryMosquitoinspections.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 historyMosquitoinspection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryMosquitoinspectionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryMosquitoinspection { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyMosquitoinspection 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 *HistoryMosquitoinspectionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryMosquitoinspection { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyMosquitoinspections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryMosquitoinspectionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryMosquitoinspectionSlice, error) { - var err error - m := make(models.HistoryMosquitoinspectionSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyMosquitoinspections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryMosquitoinspectionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryMosquitoinspectionSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyMosquitoinspections 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 HistoryMosquitoinspectionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryMosquitoinspectionSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryMosquitoinspection has methods that act as mods for the HistoryMosquitoinspectionTemplate -var HistoryMosquitoinspectionMods historyMosquitoinspectionMods - -type historyMosquitoinspectionMods struct{} - -func (m historyMosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModSlice{ - HistoryMosquitoinspectionMods.RandomOrganizationID(f), - HistoryMosquitoinspectionMods.RandomActiontaken(f), - HistoryMosquitoinspectionMods.RandomActivity(f), - HistoryMosquitoinspectionMods.RandomAdultact(f), - HistoryMosquitoinspectionMods.RandomAvetemp(f), - HistoryMosquitoinspectionMods.RandomAvglarvae(f), - HistoryMosquitoinspectionMods.RandomAvgpupae(f), - HistoryMosquitoinspectionMods.RandomBreeding(f), - HistoryMosquitoinspectionMods.RandomCbcount(f), - HistoryMosquitoinspectionMods.RandomComments(f), - HistoryMosquitoinspectionMods.RandomContainercount(f), - HistoryMosquitoinspectionMods.RandomCreationdate(f), - HistoryMosquitoinspectionMods.RandomCreator(f), - HistoryMosquitoinspectionMods.RandomDomstage(f), - HistoryMosquitoinspectionMods.RandomEggs(f), - HistoryMosquitoinspectionMods.RandomEnddatetime(f), - HistoryMosquitoinspectionMods.RandomEditdate(f), - HistoryMosquitoinspectionMods.RandomEditor(f), - HistoryMosquitoinspectionMods.RandomFieldspecies(f), - HistoryMosquitoinspectionMods.RandomFieldtech(f), - HistoryMosquitoinspectionMods.RandomGlobalid(f), - HistoryMosquitoinspectionMods.RandomJurisdiction(f), - HistoryMosquitoinspectionMods.RandomLarvaepresent(f), - HistoryMosquitoinspectionMods.RandomLinelocid(f), - HistoryMosquitoinspectionMods.RandomLocationname(f), - HistoryMosquitoinspectionMods.RandomLstages(f), - HistoryMosquitoinspectionMods.RandomNumdips(f), - HistoryMosquitoinspectionMods.RandomObjectid(f), - HistoryMosquitoinspectionMods.RandomPersonalcontact(f), - HistoryMosquitoinspectionMods.RandomPointlocid(f), - HistoryMosquitoinspectionMods.RandomPolygonlocid(f), - HistoryMosquitoinspectionMods.RandomPosdips(f), - HistoryMosquitoinspectionMods.RandomPositivecontainercount(f), - HistoryMosquitoinspectionMods.RandomPupaepresent(f), - HistoryMosquitoinspectionMods.RandomRaingauge(f), - HistoryMosquitoinspectionMods.RandomRecordstatus(f), - HistoryMosquitoinspectionMods.RandomReviewed(f), - HistoryMosquitoinspectionMods.RandomReviewedby(f), - HistoryMosquitoinspectionMods.RandomRevieweddate(f), - HistoryMosquitoinspectionMods.RandomSdid(f), - HistoryMosquitoinspectionMods.RandomSitecond(f), - HistoryMosquitoinspectionMods.RandomSrid(f), - HistoryMosquitoinspectionMods.RandomStartdatetime(f), - HistoryMosquitoinspectionMods.RandomTirecount(f), - HistoryMosquitoinspectionMods.RandomTotlarvae(f), - HistoryMosquitoinspectionMods.RandomTotpupae(f), - HistoryMosquitoinspectionMods.RandomVisualmonitoring(f), - HistoryMosquitoinspectionMods.RandomVmcomments(f), - HistoryMosquitoinspectionMods.RandomWinddir(f), - HistoryMosquitoinspectionMods.RandomWindspeed(f), - HistoryMosquitoinspectionMods.RandomZone(f), - HistoryMosquitoinspectionMods.RandomZone2(f), - HistoryMosquitoinspectionMods.RandomCreated(f), - HistoryMosquitoinspectionMods.RandomCreatedDate(f), - HistoryMosquitoinspectionMods.RandomCreatedUser(f), - HistoryMosquitoinspectionMods.RandomGeometryX(f), - HistoryMosquitoinspectionMods.RandomGeometryY(f), - HistoryMosquitoinspectionMods.RandomLastEditedDate(f), - HistoryMosquitoinspectionMods.RandomLastEditedUser(f), - HistoryMosquitoinspectionMods.RandomAdminaction(f), - HistoryMosquitoinspectionMods.RandomPtaid(f), - HistoryMosquitoinspectionMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) OrganizationID(val int32) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) OrganizationIDFunc(f func() int32) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetOrganizationID() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - 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 historyMosquitoinspectionMods) RandomOrganizationID(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Actiontaken(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) ActiontakenFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Actiontaken = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetActiontaken() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Actiontaken = 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 historyMosquitoinspectionMods) RandomActiontaken(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Actiontaken = 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 historyMosquitoinspectionMods) RandomActiontakenNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Actiontaken = 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 historyMosquitoinspectionMods) Activity(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Activity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) ActivityFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Activity = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetActivity() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Activity = 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 historyMosquitoinspectionMods) RandomActivity(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Activity = 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 historyMosquitoinspectionMods) RandomActivityNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Activity = 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 historyMosquitoinspectionMods) Adultact(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Adultact = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) AdultactFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Adultact = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetAdultact() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Adultact = 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 historyMosquitoinspectionMods) RandomAdultact(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Adultact = 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 historyMosquitoinspectionMods) RandomAdultactNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Adultact = 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 historyMosquitoinspectionMods) Avetemp(val null.Val[float64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Avetemp = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) AvetempFunc(f func() null.Val[float64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Avetemp = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetAvetemp() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Avetemp = 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 historyMosquitoinspectionMods) RandomAvetemp(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Avetemp = 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 historyMosquitoinspectionMods) RandomAvetempNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Avetemp = 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 historyMosquitoinspectionMods) Avglarvae(val null.Val[float64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Avglarvae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) AvglarvaeFunc(f func() null.Val[float64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Avglarvae = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetAvglarvae() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Avglarvae = 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 historyMosquitoinspectionMods) RandomAvglarvae(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Avglarvae = 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 historyMosquitoinspectionMods) RandomAvglarvaeNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Avglarvae = 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 historyMosquitoinspectionMods) Avgpupae(val null.Val[float64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Avgpupae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) AvgpupaeFunc(f func() null.Val[float64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Avgpupae = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetAvgpupae() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Avgpupae = 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 historyMosquitoinspectionMods) RandomAvgpupae(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Avgpupae = 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 historyMosquitoinspectionMods) RandomAvgpupaeNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Avgpupae = 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 historyMosquitoinspectionMods) Breeding(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Breeding = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) BreedingFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Breeding = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetBreeding() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Breeding = 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 historyMosquitoinspectionMods) RandomBreeding(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Breeding = 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 historyMosquitoinspectionMods) RandomBreedingNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Breeding = 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 historyMosquitoinspectionMods) Cbcount(val null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Cbcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) CbcountFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Cbcount = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetCbcount() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Cbcount = 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 historyMosquitoinspectionMods) RandomCbcount(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Cbcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyMosquitoinspectionMods) RandomCbcountNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Cbcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Comments(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) CommentsFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetComments() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Comments = 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 historyMosquitoinspectionMods) RandomComments(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Comments = 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 historyMosquitoinspectionMods) RandomCommentsNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Comments = 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 historyMosquitoinspectionMods) Containercount(val null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Containercount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) ContainercountFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Containercount = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetContainercount() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Containercount = 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 historyMosquitoinspectionMods) RandomContainercount(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Containercount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyMosquitoinspectionMods) RandomContainercountNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Containercount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Creationdate(val null.Val[int64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) CreationdateFunc(f func() null.Val[int64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetCreationdate() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Creationdate = 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 historyMosquitoinspectionMods) RandomCreationdate(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyMosquitoinspectionMods) RandomCreationdateNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Creator(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) CreatorFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetCreator() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Creator = 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 historyMosquitoinspectionMods) RandomCreator(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Creator = 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 historyMosquitoinspectionMods) RandomCreatorNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Creator = 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 historyMosquitoinspectionMods) Domstage(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Domstage = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) DomstageFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Domstage = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetDomstage() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Domstage = 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 historyMosquitoinspectionMods) RandomDomstage(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Domstage = 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 historyMosquitoinspectionMods) RandomDomstageNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Domstage = 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 historyMosquitoinspectionMods) Eggs(val null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Eggs = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) EggsFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Eggs = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetEggs() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Eggs = 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 historyMosquitoinspectionMods) RandomEggs(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Eggs = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyMosquitoinspectionMods) RandomEggsNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Eggs = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Enddatetime(val null.Val[int64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Enddatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) EnddatetimeFunc(f func() null.Val[int64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetEnddatetime() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Enddatetime = 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 historyMosquitoinspectionMods) RandomEnddatetime(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyMosquitoinspectionMods) RandomEnddatetimeNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Editdate(val null.Val[int64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) EditdateFunc(f func() null.Val[int64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetEditdate() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Editdate = 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 historyMosquitoinspectionMods) RandomEditdate(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyMosquitoinspectionMods) RandomEditdateNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Editor(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) EditorFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetEditor() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Editor = 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 historyMosquitoinspectionMods) RandomEditor(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Editor = 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 historyMosquitoinspectionMods) RandomEditorNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Editor = 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 historyMosquitoinspectionMods) Fieldspecies(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Fieldspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) FieldspeciesFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Fieldspecies = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetFieldspecies() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Fieldspecies = 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 historyMosquitoinspectionMods) RandomFieldspecies(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Fieldspecies = 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 historyMosquitoinspectionMods) RandomFieldspeciesNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Fieldspecies = 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 historyMosquitoinspectionMods) Fieldtech(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) FieldtechFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetFieldtech() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Fieldtech = 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 historyMosquitoinspectionMods) RandomFieldtech(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Fieldtech = 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 historyMosquitoinspectionMods) RandomFieldtechNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Fieldtech = 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 historyMosquitoinspectionMods) Globalid(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) GlobalidFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetGlobalid() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Globalid = 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 historyMosquitoinspectionMods) RandomGlobalid(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - 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 historyMosquitoinspectionMods) RandomGlobalidNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Globalid = 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 historyMosquitoinspectionMods) Jurisdiction(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) JurisdictionFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetJurisdiction() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Jurisdiction = 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 historyMosquitoinspectionMods) RandomJurisdiction(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Jurisdiction = 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 historyMosquitoinspectionMods) RandomJurisdictionNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Jurisdiction = 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 historyMosquitoinspectionMods) Larvaepresent(val null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) LarvaepresentFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Larvaepresent = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetLarvaepresent() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Larvaepresent = 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 historyMosquitoinspectionMods) RandomLarvaepresent(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyMosquitoinspectionMods) RandomLarvaepresentNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Linelocid(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Linelocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) LinelocidFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Linelocid = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetLinelocid() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Linelocid = 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 historyMosquitoinspectionMods) RandomLinelocid(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Linelocid = 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 historyMosquitoinspectionMods) RandomLinelocidNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Linelocid = 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 historyMosquitoinspectionMods) Locationname(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) LocationnameFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetLocationname() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Locationname = 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 historyMosquitoinspectionMods) RandomLocationname(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Locationname = 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 historyMosquitoinspectionMods) RandomLocationnameNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Locationname = 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 historyMosquitoinspectionMods) Lstages(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Lstages = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) LstagesFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Lstages = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetLstages() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Lstages = 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 historyMosquitoinspectionMods) RandomLstages(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Lstages = 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 historyMosquitoinspectionMods) RandomLstagesNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Lstages = 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 historyMosquitoinspectionMods) Numdips(val null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Numdips = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) NumdipsFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Numdips = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetNumdips() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Numdips = 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 historyMosquitoinspectionMods) RandomNumdips(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Numdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyMosquitoinspectionMods) RandomNumdipsNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Numdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Objectid(val int32) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) ObjectidFunc(f func() int32) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetObjectid() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyMosquitoinspectionMods) RandomObjectid(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Personalcontact(val null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Personalcontact = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) PersonalcontactFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Personalcontact = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetPersonalcontact() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Personalcontact = 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 historyMosquitoinspectionMods) RandomPersonalcontact(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Personalcontact = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyMosquitoinspectionMods) RandomPersonalcontactNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Personalcontact = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Pointlocid(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Pointlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) PointlocidFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Pointlocid = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetPointlocid() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Pointlocid = 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 historyMosquitoinspectionMods) RandomPointlocid(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Pointlocid = 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 historyMosquitoinspectionMods) RandomPointlocidNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Pointlocid = 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 historyMosquitoinspectionMods) Polygonlocid(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Polygonlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) PolygonlocidFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Polygonlocid = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetPolygonlocid() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Polygonlocid = 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 historyMosquitoinspectionMods) RandomPolygonlocid(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Polygonlocid = 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 historyMosquitoinspectionMods) RandomPolygonlocidNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Polygonlocid = 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 historyMosquitoinspectionMods) Posdips(val null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Posdips = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) PosdipsFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Posdips = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetPosdips() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Posdips = 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 historyMosquitoinspectionMods) RandomPosdips(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Posdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyMosquitoinspectionMods) RandomPosdipsNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Posdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Positivecontainercount(val null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Positivecontainercount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) PositivecontainercountFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Positivecontainercount = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetPositivecontainercount() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Positivecontainercount = 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 historyMosquitoinspectionMods) RandomPositivecontainercount(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Positivecontainercount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyMosquitoinspectionMods) RandomPositivecontainercountNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Positivecontainercount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Pupaepresent(val null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Pupaepresent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) PupaepresentFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Pupaepresent = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetPupaepresent() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Pupaepresent = 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 historyMosquitoinspectionMods) RandomPupaepresent(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Pupaepresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyMosquitoinspectionMods) RandomPupaepresentNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Pupaepresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Raingauge(val null.Val[float64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Raingauge = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) RaingaugeFunc(f func() null.Val[float64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Raingauge = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetRaingauge() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Raingauge = 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 historyMosquitoinspectionMods) RandomRaingauge(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Raingauge = 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 historyMosquitoinspectionMods) RandomRaingaugeNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Raingauge = 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 historyMosquitoinspectionMods) Recordstatus(val null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) RecordstatusFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetRecordstatus() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Recordstatus = 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 historyMosquitoinspectionMods) RandomRecordstatus(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyMosquitoinspectionMods) RandomRecordstatusNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Reviewed(val null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) ReviewedFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetReviewed() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Reviewed = 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 historyMosquitoinspectionMods) RandomReviewed(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyMosquitoinspectionMods) RandomReviewedNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Reviewedby(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) ReviewedbyFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetReviewedby() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Reviewedby = 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 historyMosquitoinspectionMods) RandomReviewedby(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Reviewedby = 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 historyMosquitoinspectionMods) RandomReviewedbyNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Reviewedby = 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 historyMosquitoinspectionMods) Revieweddate(val null.Val[int64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Revieweddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) RevieweddateFunc(f func() null.Val[int64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetRevieweddate() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Revieweddate = 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 historyMosquitoinspectionMods) RandomRevieweddate(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyMosquitoinspectionMods) RandomRevieweddateNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Sdid(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Sdid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) SdidFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Sdid = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetSdid() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Sdid = 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 historyMosquitoinspectionMods) RandomSdid(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Sdid = 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 historyMosquitoinspectionMods) RandomSdidNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Sdid = 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 historyMosquitoinspectionMods) Sitecond(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Sitecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) SitecondFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Sitecond = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetSitecond() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Sitecond = 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 historyMosquitoinspectionMods) RandomSitecond(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Sitecond = 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 historyMosquitoinspectionMods) RandomSitecondNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Sitecond = 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 historyMosquitoinspectionMods) Srid(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Srid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) SridFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetSrid() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - 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 historyMosquitoinspectionMods) RandomSrid(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Srid = 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 historyMosquitoinspectionMods) RandomSridNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Srid = 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 historyMosquitoinspectionMods) Startdatetime(val null.Val[int64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Startdatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) StartdatetimeFunc(f func() null.Val[int64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetStartdatetime() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Startdatetime = 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 historyMosquitoinspectionMods) RandomStartdatetime(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyMosquitoinspectionMods) RandomStartdatetimeNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Tirecount(val null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Tirecount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) TirecountFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Tirecount = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetTirecount() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Tirecount = 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 historyMosquitoinspectionMods) RandomTirecount(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Tirecount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyMosquitoinspectionMods) RandomTirecountNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Tirecount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Totlarvae(val null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Totlarvae = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) TotlarvaeFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Totlarvae = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetTotlarvae() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Totlarvae = 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 historyMosquitoinspectionMods) RandomTotlarvae(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Totlarvae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyMosquitoinspectionMods) RandomTotlarvaeNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Totlarvae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Totpupae(val null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Totpupae = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) TotpupaeFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Totpupae = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetTotpupae() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Totpupae = 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 historyMosquitoinspectionMods) RandomTotpupae(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Totpupae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyMosquitoinspectionMods) RandomTotpupaeNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Totpupae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Visualmonitoring(val null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Visualmonitoring = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) VisualmonitoringFunc(f func() null.Val[int16]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Visualmonitoring = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetVisualmonitoring() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Visualmonitoring = 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 historyMosquitoinspectionMods) RandomVisualmonitoring(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Visualmonitoring = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyMosquitoinspectionMods) RandomVisualmonitoringNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Visualmonitoring = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) Vmcomments(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Vmcomments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) VmcommentsFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Vmcomments = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetVmcomments() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Vmcomments = 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 historyMosquitoinspectionMods) RandomVmcomments(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Vmcomments = 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 historyMosquitoinspectionMods) RandomVmcommentsNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Vmcomments = 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 historyMosquitoinspectionMods) Winddir(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Winddir = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) WinddirFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Winddir = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetWinddir() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Winddir = 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 historyMosquitoinspectionMods) RandomWinddir(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Winddir = 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 historyMosquitoinspectionMods) RandomWinddirNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Winddir = 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 historyMosquitoinspectionMods) Windspeed(val null.Val[float64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Windspeed = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) WindspeedFunc(f func() null.Val[float64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Windspeed = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetWindspeed() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Windspeed = 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 historyMosquitoinspectionMods) RandomWindspeed(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Windspeed = 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 historyMosquitoinspectionMods) RandomWindspeedNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Windspeed = 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 historyMosquitoinspectionMods) Zone(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) ZoneFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetZone() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Zone = 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 historyMosquitoinspectionMods) RandomZone(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Zone = 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 historyMosquitoinspectionMods) RandomZoneNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Zone = 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 historyMosquitoinspectionMods) Zone2(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) Zone2Func(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetZone2() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Zone2 = 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 historyMosquitoinspectionMods) RandomZone2(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Zone2 = 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 historyMosquitoinspectionMods) RandomZone2NotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Zone2 = 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 historyMosquitoinspectionMods) Created(val null.Val[time.Time]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) CreatedFunc(f func() null.Val[time.Time]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetCreated() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Created = 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 historyMosquitoinspectionMods) RandomCreated(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyMosquitoinspectionMods) RandomCreatedNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) CreatedDate(val null.Val[int64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) CreatedDateFunc(f func() null.Val[int64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetCreatedDate() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.CreatedDate = 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 historyMosquitoinspectionMods) RandomCreatedDate(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyMosquitoinspectionMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) CreatedUser(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) CreatedUserFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetCreatedUser() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.CreatedUser = 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 historyMosquitoinspectionMods) RandomCreatedUser(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.CreatedUser = 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 historyMosquitoinspectionMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.CreatedUser = 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 historyMosquitoinspectionMods) GeometryX(val null.Val[float64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) GeometryXFunc(f func() null.Val[float64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetGeometryX() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.GeometryX = 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 historyMosquitoinspectionMods) RandomGeometryX(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - 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 historyMosquitoinspectionMods) RandomGeometryXNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.GeometryX = 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 historyMosquitoinspectionMods) GeometryY(val null.Val[float64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) GeometryYFunc(f func() null.Val[float64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetGeometryY() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.GeometryY = 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 historyMosquitoinspectionMods) RandomGeometryY(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - 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 historyMosquitoinspectionMods) RandomGeometryYNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.GeometryY = 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 historyMosquitoinspectionMods) LastEditedDate(val null.Val[int64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetLastEditedDate() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.LastEditedDate = 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 historyMosquitoinspectionMods) RandomLastEditedDate(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyMosquitoinspectionMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyMosquitoinspectionMods) LastEditedUser(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) LastEditedUserFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetLastEditedUser() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.LastEditedUser = 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 historyMosquitoinspectionMods) RandomLastEditedUser(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.LastEditedUser = 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 historyMosquitoinspectionMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.LastEditedUser = 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 historyMosquitoinspectionMods) Adminaction(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Adminaction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) AdminactionFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Adminaction = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetAdminaction() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Adminaction = 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 historyMosquitoinspectionMods) RandomAdminaction(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Adminaction = 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 historyMosquitoinspectionMods) RandomAdminactionNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Adminaction = 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 historyMosquitoinspectionMods) Ptaid(val null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Ptaid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) PtaidFunc(f func() null.Val[string]) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Ptaid = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetPtaid() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Ptaid = 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 historyMosquitoinspectionMods) RandomPtaid(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Ptaid = 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 historyMosquitoinspectionMods) RandomPtaidNotNull(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Ptaid = 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 historyMosquitoinspectionMods) Version(val int32) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyMosquitoinspectionMods) VersionFunc(f func() int32) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyMosquitoinspectionMods) UnsetVersion() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyMosquitoinspectionMods) RandomVersion(f *faker.Faker) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyMosquitoinspectionMods) WithParentsCascading() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(ctx context.Context, o *HistoryMosquitoinspectionTemplate) { - if isDone, _ := historyMosquitoinspectionWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyMosquitoinspectionWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyMosquitoinspectionMods) WithOrganization(rel *OrganizationTemplate) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(ctx context.Context, o *HistoryMosquitoinspectionTemplate) { - o.r.Organization = &historyMosquitoinspectionROrganizationR{ - o: rel, - } - }) -} - -func (m historyMosquitoinspectionMods) WithNewOrganization(mods ...OrganizationMod) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(ctx context.Context, o *HistoryMosquitoinspectionTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyMosquitoinspectionMods) WithExistingOrganization(em *models.Organization) HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(ctx context.Context, o *HistoryMosquitoinspectionTemplate) { - o.r.Organization = &historyMosquitoinspectionROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyMosquitoinspectionMods) WithoutOrganization() HistoryMosquitoinspectionMod { - return HistoryMosquitoinspectionModFunc(func(ctx context.Context, o *HistoryMosquitoinspectionTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_pointlocation.bob.go b/db/factory/history_pointlocation.bob.go deleted file mode 100644 index 1aa24d63..00000000 --- a/db/factory/history_pointlocation.bob.go +++ /dev/null @@ -1,3268 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryPointlocationMod interface { - Apply(context.Context, *HistoryPointlocationTemplate) -} - -type HistoryPointlocationModFunc func(context.Context, *HistoryPointlocationTemplate) - -func (f HistoryPointlocationModFunc) Apply(ctx context.Context, n *HistoryPointlocationTemplate) { - f(ctx, n) -} - -type HistoryPointlocationModSlice []HistoryPointlocationMod - -func (mods HistoryPointlocationModSlice) Apply(ctx context.Context, n *HistoryPointlocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryPointlocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryPointlocationTemplate struct { - OrganizationID func() int32 - Accessdesc func() null.Val[string] - Active func() null.Val[int16] - Comments func() null.Val[string] - Created func() null.Val[time.Time] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Description func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() null.Val[string] - Habitat func() null.Val[string] - Jurisdiction func() null.Val[string] - Larvinspectinterval func() null.Val[int16] - Lastinspectactiontaken func() null.Val[string] - Lastinspectactivity func() null.Val[string] - Lastinspectavglarvae func() null.Val[float64] - Lastinspectavgpupae func() null.Val[float64] - Lastinspectbreeding func() null.Val[string] - Lastinspectconditions func() null.Val[string] - Lastinspectdate func() null.Val[int64] - Lastinspectfieldspecies func() null.Val[string] - Lastinspectlstages func() null.Val[string] - Lasttreatactivity func() null.Val[string] - Lasttreatdate func() null.Val[int64] - Lasttreatproduct func() null.Val[string] - Lasttreatqty func() null.Val[float64] - Lasttreatqtyunit func() null.Val[string] - Locationnumber func() null.Val[int64] - Name func() null.Val[string] - Nextactiondatescheduled func() null.Val[int64] - Objectid func() int32 - Priority func() null.Val[string] - Stype func() null.Val[string] - Symbology func() null.Val[string] - Usetype func() null.Val[string] - Waterorigin func() null.Val[string] - X func() null.Val[float64] - 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] - Assignedtech func() null.Val[string] - DeactivateReason func() null.Val[string] - Scalarpriority func() null.Val[int64] - Sourcestatus func() null.Val[string] - Version func() int32 - - r historyPointlocationR - f *Factory - - alreadyPersisted bool -} - -type historyPointlocationR struct { - Organization *historyPointlocationROrganizationR -} - -type historyPointlocationROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryPointlocationTemplate -func (o *HistoryPointlocationTemplate) Apply(ctx context.Context, mods ...HistoryPointlocationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryPointlocation -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryPointlocationTemplate) setModelRels(o *models.HistoryPointlocation) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryPointlocations = append(rel.R.HistoryPointlocations, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryPointlocationSetter -// this does nothing with the relationship templates -func (o HistoryPointlocationTemplate) BuildSetter() *models.HistoryPointlocationSetter { - m := &models.HistoryPointlocationSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(val) - } - if o.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.Larvinspectinterval != nil { - val := o.Larvinspectinterval() - m.Larvinspectinterval = omitnull.FromNull(val) - } - if o.Lastinspectactiontaken != nil { - val := o.Lastinspectactiontaken() - m.Lastinspectactiontaken = omitnull.FromNull(val) - } - if o.Lastinspectactivity != nil { - val := o.Lastinspectactivity() - m.Lastinspectactivity = omitnull.FromNull(val) - } - if o.Lastinspectavglarvae != nil { - val := o.Lastinspectavglarvae() - m.Lastinspectavglarvae = omitnull.FromNull(val) - } - if o.Lastinspectavgpupae != nil { - val := o.Lastinspectavgpupae() - m.Lastinspectavgpupae = omitnull.FromNull(val) - } - if o.Lastinspectbreeding != nil { - val := o.Lastinspectbreeding() - m.Lastinspectbreeding = omitnull.FromNull(val) - } - if o.Lastinspectconditions != nil { - val := o.Lastinspectconditions() - m.Lastinspectconditions = omitnull.FromNull(val) - } - if o.Lastinspectdate != nil { - val := o.Lastinspectdate() - m.Lastinspectdate = omitnull.FromNull(val) - } - if o.Lastinspectfieldspecies != nil { - val := o.Lastinspectfieldspecies() - m.Lastinspectfieldspecies = omitnull.FromNull(val) - } - if o.Lastinspectlstages != nil { - val := o.Lastinspectlstages() - m.Lastinspectlstages = omitnull.FromNull(val) - } - if o.Lasttreatactivity != nil { - val := o.Lasttreatactivity() - m.Lasttreatactivity = omitnull.FromNull(val) - } - if o.Lasttreatdate != nil { - val := o.Lasttreatdate() - m.Lasttreatdate = omitnull.FromNull(val) - } - if o.Lasttreatproduct != nil { - val := o.Lasttreatproduct() - m.Lasttreatproduct = omitnull.FromNull(val) - } - if o.Lasttreatqty != nil { - val := o.Lasttreatqty() - m.Lasttreatqty = omitnull.FromNull(val) - } - if o.Lasttreatqtyunit != nil { - val := o.Lasttreatqtyunit() - m.Lasttreatqtyunit = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Stype != nil { - val := o.Stype() - m.Stype = omitnull.FromNull(val) - } - if o.Symbology != nil { - val := o.Symbology() - m.Symbology = omitnull.FromNull(val) - } - if o.Usetype != nil { - val := o.Usetype() - m.Usetype = omitnull.FromNull(val) - } - if o.Waterorigin != nil { - val := o.Waterorigin() - m.Waterorigin = omitnull.FromNull(val) - } - if o.X != nil { - val := o.X() - m.X = omitnull.FromNull(val) - } - if o.Y != nil { - val := o.Y() - m.Y = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.Assignedtech != nil { - val := o.Assignedtech() - m.Assignedtech = omitnull.FromNull(val) - } - if o.DeactivateReason != nil { - val := o.DeactivateReason() - m.DeactivateReason = omitnull.FromNull(val) - } - if o.Scalarpriority != nil { - val := o.Scalarpriority() - m.Scalarpriority = omitnull.FromNull(val) - } - if o.Sourcestatus != nil { - val := o.Sourcestatus() - m.Sourcestatus = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryPointlocationSetter -// this does nothing with the relationship templates -func (o HistoryPointlocationTemplate) BuildManySetter(number int) []*models.HistoryPointlocationSetter { - m := make([]*models.HistoryPointlocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryPointlocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryPointlocationTemplate.Create -func (o HistoryPointlocationTemplate) Build() *models.HistoryPointlocation { - m := &models.HistoryPointlocation{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Larvinspectinterval != nil { - m.Larvinspectinterval = o.Larvinspectinterval() - } - if o.Lastinspectactiontaken != nil { - m.Lastinspectactiontaken = o.Lastinspectactiontaken() - } - if o.Lastinspectactivity != nil { - m.Lastinspectactivity = o.Lastinspectactivity() - } - if o.Lastinspectavglarvae != nil { - m.Lastinspectavglarvae = o.Lastinspectavglarvae() - } - if o.Lastinspectavgpupae != nil { - m.Lastinspectavgpupae = o.Lastinspectavgpupae() - } - if o.Lastinspectbreeding != nil { - m.Lastinspectbreeding = o.Lastinspectbreeding() - } - if o.Lastinspectconditions != nil { - m.Lastinspectconditions = o.Lastinspectconditions() - } - if o.Lastinspectdate != nil { - m.Lastinspectdate = o.Lastinspectdate() - } - if o.Lastinspectfieldspecies != nil { - m.Lastinspectfieldspecies = o.Lastinspectfieldspecies() - } - if o.Lastinspectlstages != nil { - m.Lastinspectlstages = o.Lastinspectlstages() - } - if o.Lasttreatactivity != nil { - m.Lasttreatactivity = o.Lasttreatactivity() - } - if o.Lasttreatdate != nil { - m.Lasttreatdate = o.Lasttreatdate() - } - if o.Lasttreatproduct != nil { - m.Lasttreatproduct = o.Lasttreatproduct() - } - if o.Lasttreatqty != nil { - m.Lasttreatqty = o.Lasttreatqty() - } - if o.Lasttreatqtyunit != nil { - m.Lasttreatqtyunit = o.Lasttreatqtyunit() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Stype != nil { - m.Stype = o.Stype() - } - if o.Symbology != nil { - m.Symbology = o.Symbology() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Waterorigin != nil { - m.Waterorigin = o.Waterorigin() - } - if o.X != nil { - m.X = o.X() - } - if o.Y != nil { - m.Y = o.Y() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.Assignedtech != nil { - m.Assignedtech = o.Assignedtech() - } - if o.DeactivateReason != nil { - m.DeactivateReason = o.DeactivateReason() - } - if o.Scalarpriority != nil { - m.Scalarpriority = o.Scalarpriority() - } - if o.Sourcestatus != nil { - m.Sourcestatus = o.Sourcestatus() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryPointlocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryPointlocationTemplate.CreateMany -func (o HistoryPointlocationTemplate) BuildMany(number int) models.HistoryPointlocationSlice { - m := make(models.HistoryPointlocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryPointlocation(m *models.HistoryPointlocationSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryPointlocation -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryPointlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryPointlocation) error { - var err error - - return err -} - -// Create builds a historyPointlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryPointlocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryPointlocation, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryPointlocation(opt) - - if o.r.Organization == nil { - HistoryPointlocationMods.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.HistoryPointlocations.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 historyPointlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryPointlocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryPointlocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyPointlocation 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 *HistoryPointlocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryPointlocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyPointlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryPointlocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryPointlocationSlice, error) { - var err error - m := make(models.HistoryPointlocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyPointlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryPointlocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryPointlocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyPointlocations 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 HistoryPointlocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryPointlocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryPointlocation has methods that act as mods for the HistoryPointlocationTemplate -var HistoryPointlocationMods historyPointlocationMods - -type historyPointlocationMods struct{} - -func (m historyPointlocationMods) RandomizeAllColumns(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModSlice{ - HistoryPointlocationMods.RandomOrganizationID(f), - HistoryPointlocationMods.RandomAccessdesc(f), - HistoryPointlocationMods.RandomActive(f), - HistoryPointlocationMods.RandomComments(f), - HistoryPointlocationMods.RandomCreated(f), - HistoryPointlocationMods.RandomCreationdate(f), - HistoryPointlocationMods.RandomCreator(f), - HistoryPointlocationMods.RandomDescription(f), - HistoryPointlocationMods.RandomExternalid(f), - HistoryPointlocationMods.RandomEditdate(f), - HistoryPointlocationMods.RandomEditor(f), - HistoryPointlocationMods.RandomGlobalid(f), - HistoryPointlocationMods.RandomHabitat(f), - HistoryPointlocationMods.RandomJurisdiction(f), - HistoryPointlocationMods.RandomLarvinspectinterval(f), - HistoryPointlocationMods.RandomLastinspectactiontaken(f), - HistoryPointlocationMods.RandomLastinspectactivity(f), - HistoryPointlocationMods.RandomLastinspectavglarvae(f), - HistoryPointlocationMods.RandomLastinspectavgpupae(f), - HistoryPointlocationMods.RandomLastinspectbreeding(f), - HistoryPointlocationMods.RandomLastinspectconditions(f), - HistoryPointlocationMods.RandomLastinspectdate(f), - HistoryPointlocationMods.RandomLastinspectfieldspecies(f), - HistoryPointlocationMods.RandomLastinspectlstages(f), - HistoryPointlocationMods.RandomLasttreatactivity(f), - HistoryPointlocationMods.RandomLasttreatdate(f), - HistoryPointlocationMods.RandomLasttreatproduct(f), - HistoryPointlocationMods.RandomLasttreatqty(f), - HistoryPointlocationMods.RandomLasttreatqtyunit(f), - HistoryPointlocationMods.RandomLocationnumber(f), - HistoryPointlocationMods.RandomName(f), - HistoryPointlocationMods.RandomNextactiondatescheduled(f), - HistoryPointlocationMods.RandomObjectid(f), - HistoryPointlocationMods.RandomPriority(f), - HistoryPointlocationMods.RandomStype(f), - HistoryPointlocationMods.RandomSymbology(f), - HistoryPointlocationMods.RandomUsetype(f), - HistoryPointlocationMods.RandomWaterorigin(f), - HistoryPointlocationMods.RandomX(f), - HistoryPointlocationMods.RandomY(f), - HistoryPointlocationMods.RandomZone(f), - HistoryPointlocationMods.RandomZone2(f), - HistoryPointlocationMods.RandomGeometryX(f), - HistoryPointlocationMods.RandomGeometryY(f), - HistoryPointlocationMods.RandomAssignedtech(f), - HistoryPointlocationMods.RandomDeactivateReason(f), - HistoryPointlocationMods.RandomScalarpriority(f), - HistoryPointlocationMods.RandomSourcestatus(f), - HistoryPointlocationMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyPointlocationMods) OrganizationID(val int32) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) OrganizationIDFunc(f func() int32) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetOrganizationID() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - 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 historyPointlocationMods) RandomOrganizationID(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyPointlocationMods) Accessdesc(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) AccessdescFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetAccessdesc() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Accessdesc = 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 historyPointlocationMods) RandomAccessdesc(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Accessdesc = 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 historyPointlocationMods) RandomAccessdescNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Accessdesc = 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 historyPointlocationMods) Active(val null.Val[int16]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) ActiveFunc(f func() null.Val[int16]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetActive() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Active = 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 historyPointlocationMods) RandomActive(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyPointlocationMods) RandomActiveNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPointlocationMods) Comments(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) CommentsFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetComments() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Comments = 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 historyPointlocationMods) RandomComments(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Comments = 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 historyPointlocationMods) RandomCommentsNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Comments = 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 historyPointlocationMods) Created(val null.Val[time.Time]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) CreatedFunc(f func() null.Val[time.Time]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetCreated() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Created = 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 historyPointlocationMods) RandomCreated(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyPointlocationMods) RandomCreatedNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPointlocationMods) Creationdate(val null.Val[int64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) CreationdateFunc(f func() null.Val[int64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetCreationdate() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Creationdate = 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 historyPointlocationMods) RandomCreationdate(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPointlocationMods) RandomCreationdateNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPointlocationMods) Creator(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) CreatorFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetCreator() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Creator = 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 historyPointlocationMods) RandomCreator(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Creator = 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 historyPointlocationMods) RandomCreatorNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Creator = 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 historyPointlocationMods) Description(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) DescriptionFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetDescription() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Description = 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 historyPointlocationMods) RandomDescription(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Description = 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 historyPointlocationMods) RandomDescriptionNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Description = 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 historyPointlocationMods) Externalid(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) ExternalidFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetExternalid() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Externalid = 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 historyPointlocationMods) RandomExternalid(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Externalid = 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 historyPointlocationMods) RandomExternalidNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Externalid = 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 historyPointlocationMods) Editdate(val null.Val[int64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) EditdateFunc(f func() null.Val[int64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetEditdate() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Editdate = 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 historyPointlocationMods) RandomEditdate(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPointlocationMods) RandomEditdateNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPointlocationMods) Editor(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) EditorFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetEditor() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Editor = 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 historyPointlocationMods) RandomEditor(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Editor = 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 historyPointlocationMods) RandomEditorNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Editor = 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 historyPointlocationMods) Globalid(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) GlobalidFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetGlobalid() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Globalid = 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 historyPointlocationMods) RandomGlobalid(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - 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 historyPointlocationMods) RandomGlobalidNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Globalid = 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 historyPointlocationMods) Habitat(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) HabitatFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetHabitat() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Habitat = 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 historyPointlocationMods) RandomHabitat(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Habitat = 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 historyPointlocationMods) RandomHabitatNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Habitat = 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 historyPointlocationMods) Jurisdiction(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) JurisdictionFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetJurisdiction() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Jurisdiction = 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 historyPointlocationMods) RandomJurisdiction(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Jurisdiction = 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 historyPointlocationMods) RandomJurisdictionNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Jurisdiction = 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 historyPointlocationMods) Larvinspectinterval(val null.Val[int16]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LarvinspectintervalFunc(f func() null.Val[int16]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Larvinspectinterval = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLarvinspectinterval() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Larvinspectinterval = 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 historyPointlocationMods) RandomLarvinspectinterval(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyPointlocationMods) RandomLarvinspectintervalNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPointlocationMods) Lastinspectactiontaken(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectactiontaken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LastinspectactiontakenFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectactiontaken = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLastinspectactiontaken() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectactiontaken = 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 historyPointlocationMods) RandomLastinspectactiontaken(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectactiontaken = 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 historyPointlocationMods) RandomLastinspectactiontakenNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectactiontaken = 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 historyPointlocationMods) Lastinspectactivity(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LastinspectactivityFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectactivity = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLastinspectactivity() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectactivity = 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 historyPointlocationMods) RandomLastinspectactivity(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectactivity = 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 historyPointlocationMods) RandomLastinspectactivityNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectactivity = 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 historyPointlocationMods) Lastinspectavglarvae(val null.Val[float64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectavglarvae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LastinspectavglarvaeFunc(f func() null.Val[float64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectavglarvae = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLastinspectavglarvae() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectavglarvae = 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 historyPointlocationMods) RandomLastinspectavglarvae(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectavglarvae = 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 historyPointlocationMods) RandomLastinspectavglarvaeNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectavglarvae = 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 historyPointlocationMods) Lastinspectavgpupae(val null.Val[float64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectavgpupae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LastinspectavgpupaeFunc(f func() null.Val[float64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectavgpupae = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLastinspectavgpupae() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectavgpupae = 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 historyPointlocationMods) RandomLastinspectavgpupae(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectavgpupae = 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 historyPointlocationMods) RandomLastinspectavgpupaeNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectavgpupae = 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 historyPointlocationMods) Lastinspectbreeding(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectbreeding = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LastinspectbreedingFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectbreeding = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLastinspectbreeding() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectbreeding = 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 historyPointlocationMods) RandomLastinspectbreeding(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectbreeding = 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 historyPointlocationMods) RandomLastinspectbreedingNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectbreeding = 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 historyPointlocationMods) Lastinspectconditions(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LastinspectconditionsFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectconditions = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLastinspectconditions() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectconditions = 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 historyPointlocationMods) RandomLastinspectconditions(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectconditions = 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 historyPointlocationMods) RandomLastinspectconditionsNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectconditions = 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 historyPointlocationMods) Lastinspectdate(val null.Val[int64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LastinspectdateFunc(f func() null.Val[int64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectdate = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLastinspectdate() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectdate = 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 historyPointlocationMods) RandomLastinspectdate(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPointlocationMods) RandomLastinspectdateNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPointlocationMods) Lastinspectfieldspecies(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectfieldspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LastinspectfieldspeciesFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectfieldspecies = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLastinspectfieldspecies() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectfieldspecies = 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 historyPointlocationMods) RandomLastinspectfieldspecies(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectfieldspecies = 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 historyPointlocationMods) RandomLastinspectfieldspeciesNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectfieldspecies = 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 historyPointlocationMods) Lastinspectlstages(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectlstages = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LastinspectlstagesFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectlstages = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLastinspectlstages() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectlstages = 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 historyPointlocationMods) RandomLastinspectlstages(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectlstages = 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 historyPointlocationMods) RandomLastinspectlstagesNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lastinspectlstages = 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 historyPointlocationMods) Lasttreatactivity(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LasttreatactivityFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatactivity = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLasttreatactivity() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatactivity = 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 historyPointlocationMods) RandomLasttreatactivity(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatactivity = 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 historyPointlocationMods) RandomLasttreatactivityNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatactivity = 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 historyPointlocationMods) Lasttreatdate(val null.Val[int64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LasttreatdateFunc(f func() null.Val[int64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatdate = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLasttreatdate() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatdate = 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 historyPointlocationMods) RandomLasttreatdate(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPointlocationMods) RandomLasttreatdateNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPointlocationMods) Lasttreatproduct(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatproduct = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LasttreatproductFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatproduct = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLasttreatproduct() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatproduct = 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 historyPointlocationMods) RandomLasttreatproduct(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatproduct = 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 historyPointlocationMods) RandomLasttreatproductNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatproduct = 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 historyPointlocationMods) Lasttreatqty(val null.Val[float64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatqty = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LasttreatqtyFunc(f func() null.Val[float64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatqty = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLasttreatqty() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatqty = 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 historyPointlocationMods) RandomLasttreatqty(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatqty = 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 historyPointlocationMods) RandomLasttreatqtyNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatqty = 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 historyPointlocationMods) Lasttreatqtyunit(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LasttreatqtyunitFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatqtyunit = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLasttreatqtyunit() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatqtyunit = 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 historyPointlocationMods) RandomLasttreatqtyunit(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatqtyunit = 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 historyPointlocationMods) RandomLasttreatqtyunitNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Lasttreatqtyunit = 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 historyPointlocationMods) Locationnumber(val null.Val[int64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) LocationnumberFunc(f func() null.Val[int64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetLocationnumber() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Locationnumber = 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 historyPointlocationMods) RandomLocationnumber(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPointlocationMods) RandomLocationnumberNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPointlocationMods) Name(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) NameFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetName() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Name = 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 historyPointlocationMods) RandomName(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Name = 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 historyPointlocationMods) RandomNameNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Name = 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 historyPointlocationMods) Nextactiondatescheduled(val null.Val[int64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetNextactiondatescheduled() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Nextactiondatescheduled = 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 historyPointlocationMods) RandomNextactiondatescheduled(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPointlocationMods) RandomNextactiondatescheduledNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPointlocationMods) Objectid(val int32) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) ObjectidFunc(f func() int32) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetObjectid() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyPointlocationMods) RandomObjectid(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyPointlocationMods) Priority(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) PriorityFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetPriority() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Priority = 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 historyPointlocationMods) RandomPriority(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Priority = 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 historyPointlocationMods) RandomPriorityNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Priority = 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 historyPointlocationMods) Stype(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Stype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) StypeFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Stype = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetStype() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Stype = 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 historyPointlocationMods) RandomStype(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Stype = 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 historyPointlocationMods) RandomStypeNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Stype = 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 historyPointlocationMods) Symbology(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Symbology = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) SymbologyFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Symbology = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetSymbology() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Symbology = 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 historyPointlocationMods) RandomSymbology(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Symbology = 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 historyPointlocationMods) RandomSymbologyNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Symbology = 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 historyPointlocationMods) Usetype(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) UsetypeFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetUsetype() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Usetype = 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 historyPointlocationMods) RandomUsetype(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Usetype = 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 historyPointlocationMods) RandomUsetypeNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Usetype = 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 historyPointlocationMods) Waterorigin(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Waterorigin = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) WateroriginFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Waterorigin = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetWaterorigin() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Waterorigin = 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 historyPointlocationMods) RandomWaterorigin(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Waterorigin = 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 historyPointlocationMods) RandomWateroriginNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Waterorigin = 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 historyPointlocationMods) X(val null.Val[float64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.X = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) XFunc(f func() null.Val[float64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.X = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetX() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.X = 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 historyPointlocationMods) RandomX(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.X = 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 historyPointlocationMods) RandomXNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.X = 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 historyPointlocationMods) Y(val null.Val[float64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Y = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) YFunc(f func() null.Val[float64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Y = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetY() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Y = 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 historyPointlocationMods) RandomY(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Y = 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 historyPointlocationMods) RandomYNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Y = 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 historyPointlocationMods) Zone(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) ZoneFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetZone() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Zone = 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 historyPointlocationMods) RandomZone(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Zone = 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 historyPointlocationMods) RandomZoneNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Zone = 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 historyPointlocationMods) Zone2(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) Zone2Func(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetZone2() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Zone2 = 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 historyPointlocationMods) RandomZone2(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Zone2 = 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 historyPointlocationMods) RandomZone2NotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Zone2 = 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 historyPointlocationMods) GeometryX(val null.Val[float64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) GeometryXFunc(f func() null.Val[float64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetGeometryX() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.GeometryX = 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 historyPointlocationMods) RandomGeometryX(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - 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 historyPointlocationMods) RandomGeometryXNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.GeometryX = 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 historyPointlocationMods) GeometryY(val null.Val[float64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) GeometryYFunc(f func() null.Val[float64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetGeometryY() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.GeometryY = 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 historyPointlocationMods) RandomGeometryY(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - 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 historyPointlocationMods) RandomGeometryYNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.GeometryY = 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 historyPointlocationMods) Assignedtech(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Assignedtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) AssignedtechFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Assignedtech = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetAssignedtech() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Assignedtech = 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 historyPointlocationMods) RandomAssignedtech(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Assignedtech = 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 historyPointlocationMods) RandomAssignedtechNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Assignedtech = 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 historyPointlocationMods) DeactivateReason(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.DeactivateReason = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) DeactivateReasonFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.DeactivateReason = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetDeactivateReason() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.DeactivateReason = 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 historyPointlocationMods) RandomDeactivateReason(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.DeactivateReason = 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 historyPointlocationMods) RandomDeactivateReasonNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.DeactivateReason = 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 historyPointlocationMods) Scalarpriority(val null.Val[int64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Scalarpriority = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) ScalarpriorityFunc(f func() null.Val[int64]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Scalarpriority = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetScalarpriority() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Scalarpriority = 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 historyPointlocationMods) RandomScalarpriority(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Scalarpriority = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPointlocationMods) RandomScalarpriorityNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Scalarpriority = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPointlocationMods) Sourcestatus(val null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Sourcestatus = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) SourcestatusFunc(f func() null.Val[string]) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Sourcestatus = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetSourcestatus() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Sourcestatus = 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 historyPointlocationMods) RandomSourcestatus(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Sourcestatus = 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 historyPointlocationMods) RandomSourcestatusNotNull(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Sourcestatus = 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 historyPointlocationMods) Version(val int32) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyPointlocationMods) VersionFunc(f func() int32) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyPointlocationMods) UnsetVersion() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyPointlocationMods) RandomVersion(f *faker.Faker) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyPointlocationMods) WithParentsCascading() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(ctx context.Context, o *HistoryPointlocationTemplate) { - if isDone, _ := historyPointlocationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyPointlocationWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyPointlocationMods) WithOrganization(rel *OrganizationTemplate) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(ctx context.Context, o *HistoryPointlocationTemplate) { - o.r.Organization = &historyPointlocationROrganizationR{ - o: rel, - } - }) -} - -func (m historyPointlocationMods) WithNewOrganization(mods ...OrganizationMod) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(ctx context.Context, o *HistoryPointlocationTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyPointlocationMods) WithExistingOrganization(em *models.Organization) HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(ctx context.Context, o *HistoryPointlocationTemplate) { - o.r.Organization = &historyPointlocationROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyPointlocationMods) WithoutOrganization() HistoryPointlocationMod { - return HistoryPointlocationModFunc(func(ctx context.Context, o *HistoryPointlocationTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_polygonlocation.bob.go b/db/factory/history_polygonlocation.bob.go deleted file mode 100644 index 1421cb39..00000000 --- a/db/factory/history_polygonlocation.bob.go +++ /dev/null @@ -1,3144 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryPolygonlocationMod interface { - Apply(context.Context, *HistoryPolygonlocationTemplate) -} - -type HistoryPolygonlocationModFunc func(context.Context, *HistoryPolygonlocationTemplate) - -func (f HistoryPolygonlocationModFunc) Apply(ctx context.Context, n *HistoryPolygonlocationTemplate) { - f(ctx, n) -} - -type HistoryPolygonlocationModSlice []HistoryPolygonlocationMod - -func (mods HistoryPolygonlocationModSlice) Apply(ctx context.Context, n *HistoryPolygonlocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryPolygonlocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryPolygonlocationTemplate struct { - OrganizationID func() int32 - Accessdesc func() null.Val[string] - Acres func() null.Val[float64] - Active func() null.Val[int16] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Description func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Filter func() null.Val[string] - Globalid func() null.Val[string] - Habitat func() null.Val[string] - Hectares func() null.Val[float64] - Jurisdiction func() null.Val[string] - Larvinspectinterval func() null.Val[int16] - Lastinspectactiontaken func() null.Val[string] - Lastinspectactivity func() null.Val[string] - Lastinspectavglarvae func() null.Val[float64] - Lastinspectavgpupae func() null.Val[float64] - Lastinspectbreeding func() null.Val[string] - Lastinspectconditions func() null.Val[string] - Lastinspectdate func() null.Val[int64] - Lastinspectfieldspecies func() null.Val[string] - Lastinspectlstages func() null.Val[string] - Lasttreatactivity func() null.Val[string] - Lasttreatdate func() null.Val[int64] - Lasttreatproduct func() null.Val[string] - Lasttreatqty func() null.Val[float64] - Lasttreatqtyunit func() null.Val[string] - Locationnumber func() null.Val[int64] - Name func() null.Val[string] - Nextactiondatescheduled func() null.Val[int64] - Objectid func() int32 - Priority func() null.Val[string] - Symbology func() null.Val[string] - ShapeArea func() null.Val[float64] - ShapeLength func() null.Val[float64] - Usetype func() null.Val[string] - Waterorigin func() null.Val[string] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - Version func() int32 - Created func() null.Val[time.Time] - - r historyPolygonlocationR - f *Factory - - alreadyPersisted bool -} - -type historyPolygonlocationR struct { - Organization *historyPolygonlocationROrganizationR -} - -type historyPolygonlocationROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryPolygonlocationTemplate -func (o *HistoryPolygonlocationTemplate) Apply(ctx context.Context, mods ...HistoryPolygonlocationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryPolygonlocation -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryPolygonlocationTemplate) setModelRels(o *models.HistoryPolygonlocation) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryPolygonlocations = append(rel.R.HistoryPolygonlocations, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryPolygonlocationSetter -// this does nothing with the relationship templates -func (o HistoryPolygonlocationTemplate) BuildSetter() *models.HistoryPolygonlocationSetter { - m := &models.HistoryPolygonlocationSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Acres != nil { - val := o.Acres() - m.Acres = omitnull.FromNull(val) - } - if o.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Filter != nil { - val := o.Filter() - m.Filter = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(val) - } - if o.Hectares != nil { - val := o.Hectares() - m.Hectares = omitnull.FromNull(val) - } - if o.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.Larvinspectinterval != nil { - val := o.Larvinspectinterval() - m.Larvinspectinterval = omitnull.FromNull(val) - } - if o.Lastinspectactiontaken != nil { - val := o.Lastinspectactiontaken() - m.Lastinspectactiontaken = omitnull.FromNull(val) - } - if o.Lastinspectactivity != nil { - val := o.Lastinspectactivity() - m.Lastinspectactivity = omitnull.FromNull(val) - } - if o.Lastinspectavglarvae != nil { - val := o.Lastinspectavglarvae() - m.Lastinspectavglarvae = omitnull.FromNull(val) - } - if o.Lastinspectavgpupae != nil { - val := o.Lastinspectavgpupae() - m.Lastinspectavgpupae = omitnull.FromNull(val) - } - if o.Lastinspectbreeding != nil { - val := o.Lastinspectbreeding() - m.Lastinspectbreeding = omitnull.FromNull(val) - } - if o.Lastinspectconditions != nil { - val := o.Lastinspectconditions() - m.Lastinspectconditions = omitnull.FromNull(val) - } - if o.Lastinspectdate != nil { - val := o.Lastinspectdate() - m.Lastinspectdate = omitnull.FromNull(val) - } - if o.Lastinspectfieldspecies != nil { - val := o.Lastinspectfieldspecies() - m.Lastinspectfieldspecies = omitnull.FromNull(val) - } - if o.Lastinspectlstages != nil { - val := o.Lastinspectlstages() - m.Lastinspectlstages = omitnull.FromNull(val) - } - if o.Lasttreatactivity != nil { - val := o.Lasttreatactivity() - m.Lasttreatactivity = omitnull.FromNull(val) - } - if o.Lasttreatdate != nil { - val := o.Lasttreatdate() - m.Lasttreatdate = omitnull.FromNull(val) - } - if o.Lasttreatproduct != nil { - val := o.Lasttreatproduct() - m.Lasttreatproduct = omitnull.FromNull(val) - } - if o.Lasttreatqty != nil { - val := o.Lasttreatqty() - m.Lasttreatqty = omitnull.FromNull(val) - } - if o.Lasttreatqtyunit != nil { - val := o.Lasttreatqtyunit() - m.Lasttreatqtyunit = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Symbology != nil { - val := o.Symbology() - m.Symbology = omitnull.FromNull(val) - } - if o.ShapeArea != nil { - val := o.ShapeArea() - m.ShapeArea = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - val := o.ShapeLength() - m.ShapeLength = omitnull.FromNull(val) - } - if o.Usetype != nil { - val := o.Usetype() - m.Usetype = omitnull.FromNull(val) - } - if o.Waterorigin != nil { - val := o.Waterorigin() - m.Waterorigin = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryPolygonlocationSetter -// this does nothing with the relationship templates -func (o HistoryPolygonlocationTemplate) BuildManySetter(number int) []*models.HistoryPolygonlocationSetter { - m := make([]*models.HistoryPolygonlocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryPolygonlocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryPolygonlocationTemplate.Create -func (o HistoryPolygonlocationTemplate) Build() *models.HistoryPolygonlocation { - m := &models.HistoryPolygonlocation{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Acres != nil { - m.Acres = o.Acres() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Filter != nil { - m.Filter = o.Filter() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Hectares != nil { - m.Hectares = o.Hectares() - } - if o.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Larvinspectinterval != nil { - m.Larvinspectinterval = o.Larvinspectinterval() - } - if o.Lastinspectactiontaken != nil { - m.Lastinspectactiontaken = o.Lastinspectactiontaken() - } - if o.Lastinspectactivity != nil { - m.Lastinspectactivity = o.Lastinspectactivity() - } - if o.Lastinspectavglarvae != nil { - m.Lastinspectavglarvae = o.Lastinspectavglarvae() - } - if o.Lastinspectavgpupae != nil { - m.Lastinspectavgpupae = o.Lastinspectavgpupae() - } - if o.Lastinspectbreeding != nil { - m.Lastinspectbreeding = o.Lastinspectbreeding() - } - if o.Lastinspectconditions != nil { - m.Lastinspectconditions = o.Lastinspectconditions() - } - if o.Lastinspectdate != nil { - m.Lastinspectdate = o.Lastinspectdate() - } - if o.Lastinspectfieldspecies != nil { - m.Lastinspectfieldspecies = o.Lastinspectfieldspecies() - } - if o.Lastinspectlstages != nil { - m.Lastinspectlstages = o.Lastinspectlstages() - } - if o.Lasttreatactivity != nil { - m.Lasttreatactivity = o.Lasttreatactivity() - } - if o.Lasttreatdate != nil { - m.Lasttreatdate = o.Lasttreatdate() - } - if o.Lasttreatproduct != nil { - m.Lasttreatproduct = o.Lasttreatproduct() - } - if o.Lasttreatqty != nil { - m.Lasttreatqty = o.Lasttreatqty() - } - if o.Lasttreatqtyunit != nil { - m.Lasttreatqtyunit = o.Lasttreatqtyunit() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Symbology != nil { - m.Symbology = o.Symbology() - } - if o.ShapeArea != nil { - m.ShapeArea = o.ShapeArea() - } - if o.ShapeLength != nil { - m.ShapeLength = o.ShapeLength() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Waterorigin != nil { - m.Waterorigin = o.Waterorigin() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.Version != nil { - m.Version = o.Version() - } - if o.Created != nil { - m.Created = o.Created() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryPolygonlocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryPolygonlocationTemplate.CreateMany -func (o HistoryPolygonlocationTemplate) BuildMany(number int) models.HistoryPolygonlocationSlice { - m := make(models.HistoryPolygonlocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryPolygonlocation(m *models.HistoryPolygonlocationSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryPolygonlocation -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryPolygonlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryPolygonlocation) error { - var err error - - return err -} - -// Create builds a historyPolygonlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryPolygonlocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryPolygonlocation, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryPolygonlocation(opt) - - if o.r.Organization == nil { - HistoryPolygonlocationMods.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.HistoryPolygonlocations.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 historyPolygonlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryPolygonlocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryPolygonlocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyPolygonlocation 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 *HistoryPolygonlocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryPolygonlocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyPolygonlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryPolygonlocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryPolygonlocationSlice, error) { - var err error - m := make(models.HistoryPolygonlocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyPolygonlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryPolygonlocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryPolygonlocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyPolygonlocations 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 HistoryPolygonlocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryPolygonlocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryPolygonlocation has methods that act as mods for the HistoryPolygonlocationTemplate -var HistoryPolygonlocationMods historyPolygonlocationMods - -type historyPolygonlocationMods struct{} - -func (m historyPolygonlocationMods) RandomizeAllColumns(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModSlice{ - HistoryPolygonlocationMods.RandomOrganizationID(f), - HistoryPolygonlocationMods.RandomAccessdesc(f), - HistoryPolygonlocationMods.RandomAcres(f), - HistoryPolygonlocationMods.RandomActive(f), - HistoryPolygonlocationMods.RandomComments(f), - HistoryPolygonlocationMods.RandomCreationdate(f), - HistoryPolygonlocationMods.RandomCreator(f), - HistoryPolygonlocationMods.RandomDescription(f), - HistoryPolygonlocationMods.RandomExternalid(f), - HistoryPolygonlocationMods.RandomEditdate(f), - HistoryPolygonlocationMods.RandomEditor(f), - HistoryPolygonlocationMods.RandomFilter(f), - HistoryPolygonlocationMods.RandomGlobalid(f), - HistoryPolygonlocationMods.RandomHabitat(f), - HistoryPolygonlocationMods.RandomHectares(f), - HistoryPolygonlocationMods.RandomJurisdiction(f), - HistoryPolygonlocationMods.RandomLarvinspectinterval(f), - HistoryPolygonlocationMods.RandomLastinspectactiontaken(f), - HistoryPolygonlocationMods.RandomLastinspectactivity(f), - HistoryPolygonlocationMods.RandomLastinspectavglarvae(f), - HistoryPolygonlocationMods.RandomLastinspectavgpupae(f), - HistoryPolygonlocationMods.RandomLastinspectbreeding(f), - HistoryPolygonlocationMods.RandomLastinspectconditions(f), - HistoryPolygonlocationMods.RandomLastinspectdate(f), - HistoryPolygonlocationMods.RandomLastinspectfieldspecies(f), - HistoryPolygonlocationMods.RandomLastinspectlstages(f), - HistoryPolygonlocationMods.RandomLasttreatactivity(f), - HistoryPolygonlocationMods.RandomLasttreatdate(f), - HistoryPolygonlocationMods.RandomLasttreatproduct(f), - HistoryPolygonlocationMods.RandomLasttreatqty(f), - HistoryPolygonlocationMods.RandomLasttreatqtyunit(f), - HistoryPolygonlocationMods.RandomLocationnumber(f), - HistoryPolygonlocationMods.RandomName(f), - HistoryPolygonlocationMods.RandomNextactiondatescheduled(f), - HistoryPolygonlocationMods.RandomObjectid(f), - HistoryPolygonlocationMods.RandomPriority(f), - HistoryPolygonlocationMods.RandomSymbology(f), - HistoryPolygonlocationMods.RandomShapeArea(f), - HistoryPolygonlocationMods.RandomShapeLength(f), - HistoryPolygonlocationMods.RandomUsetype(f), - HistoryPolygonlocationMods.RandomWaterorigin(f), - HistoryPolygonlocationMods.RandomZone(f), - HistoryPolygonlocationMods.RandomZone2(f), - HistoryPolygonlocationMods.RandomGeometryX(f), - HistoryPolygonlocationMods.RandomGeometryY(f), - HistoryPolygonlocationMods.RandomVersion(f), - HistoryPolygonlocationMods.RandomCreated(f), - } -} - -// Set the model columns to this value -func (m historyPolygonlocationMods) OrganizationID(val int32) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) OrganizationIDFunc(f func() int32) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetOrganizationID() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - 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 historyPolygonlocationMods) RandomOrganizationID(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyPolygonlocationMods) Accessdesc(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) AccessdescFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetAccessdesc() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Accessdesc = 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 historyPolygonlocationMods) RandomAccessdesc(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Accessdesc = 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 historyPolygonlocationMods) RandomAccessdescNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Accessdesc = 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 historyPolygonlocationMods) Acres(val null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Acres = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) AcresFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Acres = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetAcres() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Acres = 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 historyPolygonlocationMods) RandomAcres(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Acres = 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 historyPolygonlocationMods) RandomAcresNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Acres = 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 historyPolygonlocationMods) Active(val null.Val[int16]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) ActiveFunc(f func() null.Val[int16]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetActive() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Active = 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 historyPolygonlocationMods) RandomActive(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyPolygonlocationMods) RandomActiveNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPolygonlocationMods) Comments(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) CommentsFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetComments() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Comments = 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 historyPolygonlocationMods) RandomComments(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Comments = 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 historyPolygonlocationMods) RandomCommentsNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Comments = 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 historyPolygonlocationMods) Creationdate(val null.Val[int64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) CreationdateFunc(f func() null.Val[int64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetCreationdate() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Creationdate = 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 historyPolygonlocationMods) RandomCreationdate(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPolygonlocationMods) RandomCreationdateNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPolygonlocationMods) Creator(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) CreatorFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetCreator() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Creator = 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 historyPolygonlocationMods) RandomCreator(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Creator = 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 historyPolygonlocationMods) RandomCreatorNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Creator = 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 historyPolygonlocationMods) Description(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) DescriptionFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetDescription() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Description = 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 historyPolygonlocationMods) RandomDescription(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Description = 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 historyPolygonlocationMods) RandomDescriptionNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Description = 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 historyPolygonlocationMods) Externalid(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) ExternalidFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetExternalid() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Externalid = 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 historyPolygonlocationMods) RandomExternalid(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Externalid = 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 historyPolygonlocationMods) RandomExternalidNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Externalid = 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 historyPolygonlocationMods) Editdate(val null.Val[int64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) EditdateFunc(f func() null.Val[int64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetEditdate() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Editdate = 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 historyPolygonlocationMods) RandomEditdate(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPolygonlocationMods) RandomEditdateNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPolygonlocationMods) Editor(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) EditorFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetEditor() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Editor = 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 historyPolygonlocationMods) RandomEditor(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Editor = 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 historyPolygonlocationMods) RandomEditorNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Editor = 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 historyPolygonlocationMods) Filter(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Filter = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) FilterFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Filter = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetFilter() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Filter = 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 historyPolygonlocationMods) RandomFilter(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Filter = 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 historyPolygonlocationMods) RandomFilterNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Filter = 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 historyPolygonlocationMods) Globalid(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) GlobalidFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetGlobalid() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Globalid = 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 historyPolygonlocationMods) RandomGlobalid(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - 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 historyPolygonlocationMods) RandomGlobalidNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Globalid = 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 historyPolygonlocationMods) Habitat(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) HabitatFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetHabitat() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Habitat = 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 historyPolygonlocationMods) RandomHabitat(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Habitat = 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 historyPolygonlocationMods) RandomHabitatNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Habitat = 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 historyPolygonlocationMods) Hectares(val null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Hectares = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) HectaresFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Hectares = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetHectares() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Hectares = 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 historyPolygonlocationMods) RandomHectares(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Hectares = 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 historyPolygonlocationMods) RandomHectaresNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Hectares = 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 historyPolygonlocationMods) Jurisdiction(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) JurisdictionFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetJurisdiction() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Jurisdiction = 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 historyPolygonlocationMods) RandomJurisdiction(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Jurisdiction = 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 historyPolygonlocationMods) RandomJurisdictionNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Jurisdiction = 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 historyPolygonlocationMods) Larvinspectinterval(val null.Val[int16]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LarvinspectintervalFunc(f func() null.Val[int16]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Larvinspectinterval = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLarvinspectinterval() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Larvinspectinterval = 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 historyPolygonlocationMods) RandomLarvinspectinterval(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyPolygonlocationMods) RandomLarvinspectintervalNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPolygonlocationMods) Lastinspectactiontaken(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectactiontaken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LastinspectactiontakenFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectactiontaken = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLastinspectactiontaken() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectactiontaken = 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 historyPolygonlocationMods) RandomLastinspectactiontaken(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectactiontaken = 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 historyPolygonlocationMods) RandomLastinspectactiontakenNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectactiontaken = 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 historyPolygonlocationMods) Lastinspectactivity(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LastinspectactivityFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectactivity = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLastinspectactivity() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectactivity = 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 historyPolygonlocationMods) RandomLastinspectactivity(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectactivity = 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 historyPolygonlocationMods) RandomLastinspectactivityNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectactivity = 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 historyPolygonlocationMods) Lastinspectavglarvae(val null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectavglarvae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LastinspectavglarvaeFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectavglarvae = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLastinspectavglarvae() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectavglarvae = 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 historyPolygonlocationMods) RandomLastinspectavglarvae(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectavglarvae = 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 historyPolygonlocationMods) RandomLastinspectavglarvaeNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectavglarvae = 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 historyPolygonlocationMods) Lastinspectavgpupae(val null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectavgpupae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LastinspectavgpupaeFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectavgpupae = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLastinspectavgpupae() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectavgpupae = 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 historyPolygonlocationMods) RandomLastinspectavgpupae(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectavgpupae = 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 historyPolygonlocationMods) RandomLastinspectavgpupaeNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectavgpupae = 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 historyPolygonlocationMods) Lastinspectbreeding(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectbreeding = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LastinspectbreedingFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectbreeding = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLastinspectbreeding() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectbreeding = 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 historyPolygonlocationMods) RandomLastinspectbreeding(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectbreeding = 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 historyPolygonlocationMods) RandomLastinspectbreedingNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectbreeding = 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 historyPolygonlocationMods) Lastinspectconditions(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LastinspectconditionsFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectconditions = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLastinspectconditions() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectconditions = 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 historyPolygonlocationMods) RandomLastinspectconditions(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectconditions = 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 historyPolygonlocationMods) RandomLastinspectconditionsNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectconditions = 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 historyPolygonlocationMods) Lastinspectdate(val null.Val[int64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LastinspectdateFunc(f func() null.Val[int64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectdate = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLastinspectdate() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectdate = 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 historyPolygonlocationMods) RandomLastinspectdate(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPolygonlocationMods) RandomLastinspectdateNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPolygonlocationMods) Lastinspectfieldspecies(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectfieldspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LastinspectfieldspeciesFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectfieldspecies = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLastinspectfieldspecies() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectfieldspecies = 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 historyPolygonlocationMods) RandomLastinspectfieldspecies(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectfieldspecies = 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 historyPolygonlocationMods) RandomLastinspectfieldspeciesNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectfieldspecies = 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 historyPolygonlocationMods) Lastinspectlstages(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectlstages = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LastinspectlstagesFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectlstages = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLastinspectlstages() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectlstages = 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 historyPolygonlocationMods) RandomLastinspectlstages(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectlstages = 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 historyPolygonlocationMods) RandomLastinspectlstagesNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lastinspectlstages = 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 historyPolygonlocationMods) Lasttreatactivity(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LasttreatactivityFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatactivity = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLasttreatactivity() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatactivity = 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 historyPolygonlocationMods) RandomLasttreatactivity(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatactivity = 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 historyPolygonlocationMods) RandomLasttreatactivityNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatactivity = 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 historyPolygonlocationMods) Lasttreatdate(val null.Val[int64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LasttreatdateFunc(f func() null.Val[int64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatdate = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLasttreatdate() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatdate = 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 historyPolygonlocationMods) RandomLasttreatdate(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPolygonlocationMods) RandomLasttreatdateNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPolygonlocationMods) Lasttreatproduct(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatproduct = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LasttreatproductFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatproduct = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLasttreatproduct() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatproduct = 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 historyPolygonlocationMods) RandomLasttreatproduct(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatproduct = 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 historyPolygonlocationMods) RandomLasttreatproductNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatproduct = 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 historyPolygonlocationMods) Lasttreatqty(val null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatqty = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LasttreatqtyFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatqty = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLasttreatqty() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatqty = 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 historyPolygonlocationMods) RandomLasttreatqty(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatqty = 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 historyPolygonlocationMods) RandomLasttreatqtyNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatqty = 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 historyPolygonlocationMods) Lasttreatqtyunit(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LasttreatqtyunitFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatqtyunit = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLasttreatqtyunit() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatqtyunit = 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 historyPolygonlocationMods) RandomLasttreatqtyunit(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatqtyunit = 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 historyPolygonlocationMods) RandomLasttreatqtyunitNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Lasttreatqtyunit = 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 historyPolygonlocationMods) Locationnumber(val null.Val[int64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) LocationnumberFunc(f func() null.Val[int64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetLocationnumber() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Locationnumber = 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 historyPolygonlocationMods) RandomLocationnumber(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPolygonlocationMods) RandomLocationnumberNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPolygonlocationMods) Name(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) NameFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetName() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Name = 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 historyPolygonlocationMods) RandomName(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Name = 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 historyPolygonlocationMods) RandomNameNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Name = 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 historyPolygonlocationMods) Nextactiondatescheduled(val null.Val[int64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetNextactiondatescheduled() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Nextactiondatescheduled = 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 historyPolygonlocationMods) RandomNextactiondatescheduled(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPolygonlocationMods) RandomNextactiondatescheduledNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPolygonlocationMods) Objectid(val int32) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) ObjectidFunc(f func() int32) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetObjectid() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyPolygonlocationMods) RandomObjectid(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyPolygonlocationMods) Priority(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) PriorityFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetPriority() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Priority = 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 historyPolygonlocationMods) RandomPriority(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Priority = 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 historyPolygonlocationMods) RandomPriorityNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Priority = 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 historyPolygonlocationMods) Symbology(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Symbology = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) SymbologyFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Symbology = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetSymbology() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Symbology = 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 historyPolygonlocationMods) RandomSymbology(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Symbology = 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 historyPolygonlocationMods) RandomSymbologyNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Symbology = 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 historyPolygonlocationMods) ShapeArea(val null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.ShapeArea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) ShapeAreaFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.ShapeArea = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetShapeArea() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.ShapeArea = 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 historyPolygonlocationMods) RandomShapeArea(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.ShapeArea = 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 historyPolygonlocationMods) RandomShapeAreaNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.ShapeArea = 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 historyPolygonlocationMods) ShapeLength(val null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) ShapeLengthFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetShapeLength() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.ShapeLength = 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 historyPolygonlocationMods) RandomShapeLength(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.ShapeLength = 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 historyPolygonlocationMods) RandomShapeLengthNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.ShapeLength = 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 historyPolygonlocationMods) Usetype(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) UsetypeFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetUsetype() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Usetype = 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 historyPolygonlocationMods) RandomUsetype(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Usetype = 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 historyPolygonlocationMods) RandomUsetypeNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Usetype = 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 historyPolygonlocationMods) Waterorigin(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Waterorigin = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) WateroriginFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Waterorigin = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetWaterorigin() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Waterorigin = 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 historyPolygonlocationMods) RandomWaterorigin(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Waterorigin = 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 historyPolygonlocationMods) RandomWateroriginNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Waterorigin = 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 historyPolygonlocationMods) Zone(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) ZoneFunc(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetZone() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Zone = 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 historyPolygonlocationMods) RandomZone(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Zone = 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 historyPolygonlocationMods) RandomZoneNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Zone = 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 historyPolygonlocationMods) Zone2(val null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) Zone2Func(f func() null.Val[string]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetZone2() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Zone2 = 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 historyPolygonlocationMods) RandomZone2(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Zone2 = 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 historyPolygonlocationMods) RandomZone2NotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Zone2 = 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 historyPolygonlocationMods) GeometryX(val null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) GeometryXFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetGeometryX() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.GeometryX = 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 historyPolygonlocationMods) RandomGeometryX(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - 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 historyPolygonlocationMods) RandomGeometryXNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.GeometryX = 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 historyPolygonlocationMods) GeometryY(val null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) GeometryYFunc(f func() null.Val[float64]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetGeometryY() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.GeometryY = 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 historyPolygonlocationMods) RandomGeometryY(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - 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 historyPolygonlocationMods) RandomGeometryYNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.GeometryY = 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 historyPolygonlocationMods) Version(val int32) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) VersionFunc(f func() int32) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetVersion() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyPolygonlocationMods) RandomVersion(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyPolygonlocationMods) Created(val null.Val[time.Time]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyPolygonlocationMods) CreatedFunc(f func() null.Val[time.Time]) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyPolygonlocationMods) UnsetCreated() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Created = 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 historyPolygonlocationMods) RandomCreated(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyPolygonlocationMods) RandomCreatedNotNull(f *faker.Faker) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -func (m historyPolygonlocationMods) WithParentsCascading() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(ctx context.Context, o *HistoryPolygonlocationTemplate) { - if isDone, _ := historyPolygonlocationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyPolygonlocationWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyPolygonlocationMods) WithOrganization(rel *OrganizationTemplate) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(ctx context.Context, o *HistoryPolygonlocationTemplate) { - o.r.Organization = &historyPolygonlocationROrganizationR{ - o: rel, - } - }) -} - -func (m historyPolygonlocationMods) WithNewOrganization(mods ...OrganizationMod) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(ctx context.Context, o *HistoryPolygonlocationTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyPolygonlocationMods) WithExistingOrganization(em *models.Organization) HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(ctx context.Context, o *HistoryPolygonlocationTemplate) { - o.r.Organization = &historyPolygonlocationROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyPolygonlocationMods) WithoutOrganization() HistoryPolygonlocationMod { - return HistoryPolygonlocationModFunc(func(ctx context.Context, o *HistoryPolygonlocationTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_pool.bob.go b/db/factory/history_pool.bob.go deleted file mode 100644 index 1be3703f..00000000 --- a/db/factory/history_pool.bob.go +++ /dev/null @@ -1,2276 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryPoolMod interface { - Apply(context.Context, *HistoryPoolTemplate) -} - -type HistoryPoolModFunc func(context.Context, *HistoryPoolTemplate) - -func (f HistoryPoolModFunc) Apply(ctx context.Context, n *HistoryPoolTemplate) { - f(ctx, n) -} - -type HistoryPoolModSlice []HistoryPoolMod - -func (mods HistoryPoolModSlice) Apply(ctx context.Context, n *HistoryPoolTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryPoolTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryPoolTemplate struct { - OrganizationID func() int32 - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Datesent func() null.Val[int64] - Datetested func() null.Val[int64] - Diseasepos func() null.Val[string] - Diseasetested func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Gatewaysync func() null.Val[int16] - Globalid func() null.Val[string] - Lab func() null.Val[string] - LabID func() null.Val[string] - Objectid func() int32 - Poolyear func() null.Val[int16] - Processed func() null.Val[int16] - Sampleid func() null.Val[string] - Survtech func() null.Val[string] - Testmethod func() null.Val[string] - Testtech func() null.Val[string] - TrapdataID func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Vectorsurvcollectionid func() null.Val[string] - Vectorsurvpoolid func() null.Val[string] - Vectorsurvtrapdataid func() null.Val[string] - Version func() int32 - - r historyPoolR - f *Factory - - alreadyPersisted bool -} - -type historyPoolR struct { - Organization *historyPoolROrganizationR -} - -type historyPoolROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryPoolTemplate -func (o *HistoryPoolTemplate) Apply(ctx context.Context, mods ...HistoryPoolMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryPool -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryPoolTemplate) setModelRels(o *models.HistoryPool) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryPools = append(rel.R.HistoryPools, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryPoolSetter -// this does nothing with the relationship templates -func (o HistoryPoolTemplate) BuildSetter() *models.HistoryPoolSetter { - m := &models.HistoryPoolSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Datesent != nil { - val := o.Datesent() - m.Datesent = omitnull.FromNull(val) - } - if o.Datetested != nil { - val := o.Datetested() - m.Datetested = omitnull.FromNull(val) - } - if o.Diseasepos != nil { - val := o.Diseasepos() - m.Diseasepos = omitnull.FromNull(val) - } - if o.Diseasetested != nil { - val := o.Diseasetested() - m.Diseasetested = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Gatewaysync != nil { - val := o.Gatewaysync() - m.Gatewaysync = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Lab != nil { - val := o.Lab() - m.Lab = omitnull.FromNull(val) - } - if o.LabID != nil { - val := o.LabID() - m.LabID = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Poolyear != nil { - val := o.Poolyear() - m.Poolyear = omitnull.FromNull(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.Sampleid != nil { - val := o.Sampleid() - m.Sampleid = omitnull.FromNull(val) - } - if o.Survtech != nil { - val := o.Survtech() - m.Survtech = omitnull.FromNull(val) - } - if o.Testmethod != nil { - val := o.Testmethod() - m.Testmethod = omitnull.FromNull(val) - } - if o.Testtech != nil { - val := o.Testtech() - m.Testtech = omitnull.FromNull(val) - } - if o.TrapdataID != nil { - val := o.TrapdataID() - m.TrapdataID = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Vectorsurvcollectionid != nil { - val := o.Vectorsurvcollectionid() - m.Vectorsurvcollectionid = omitnull.FromNull(val) - } - if o.Vectorsurvpoolid != nil { - val := o.Vectorsurvpoolid() - m.Vectorsurvpoolid = omitnull.FromNull(val) - } - if o.Vectorsurvtrapdataid != nil { - val := o.Vectorsurvtrapdataid() - m.Vectorsurvtrapdataid = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryPoolSetter -// this does nothing with the relationship templates -func (o HistoryPoolTemplate) BuildManySetter(number int) []*models.HistoryPoolSetter { - m := make([]*models.HistoryPoolSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryPool -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryPoolTemplate.Create -func (o HistoryPoolTemplate) Build() *models.HistoryPool { - m := &models.HistoryPool{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Datesent != nil { - m.Datesent = o.Datesent() - } - if o.Datetested != nil { - m.Datetested = o.Datetested() - } - if o.Diseasepos != nil { - m.Diseasepos = o.Diseasepos() - } - if o.Diseasetested != nil { - m.Diseasetested = o.Diseasetested() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Gatewaysync != nil { - m.Gatewaysync = o.Gatewaysync() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Lab != nil { - m.Lab = o.Lab() - } - if o.LabID != nil { - m.LabID = o.LabID() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Poolyear != nil { - m.Poolyear = o.Poolyear() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.Sampleid != nil { - m.Sampleid = o.Sampleid() - } - if o.Survtech != nil { - m.Survtech = o.Survtech() - } - if o.Testmethod != nil { - m.Testmethod = o.Testmethod() - } - if o.Testtech != nil { - m.Testtech = o.Testtech() - } - if o.TrapdataID != nil { - m.TrapdataID = o.TrapdataID() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Vectorsurvcollectionid != nil { - m.Vectorsurvcollectionid = o.Vectorsurvcollectionid() - } - if o.Vectorsurvpoolid != nil { - m.Vectorsurvpoolid = o.Vectorsurvpoolid() - } - if o.Vectorsurvtrapdataid != nil { - m.Vectorsurvtrapdataid = o.Vectorsurvtrapdataid() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryPoolSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryPoolTemplate.CreateMany -func (o HistoryPoolTemplate) BuildMany(number int) models.HistoryPoolSlice { - m := make(models.HistoryPoolSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryPool(m *models.HistoryPoolSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryPool -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryPoolTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryPool) error { - var err error - - return err -} - -// Create builds a historyPool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryPoolTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryPool, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryPool(opt) - - if o.r.Organization == nil { - HistoryPoolMods.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.HistoryPools.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 historyPool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryPoolTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryPool { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyPool 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 *HistoryPoolTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryPool { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyPools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryPoolTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryPoolSlice, error) { - var err error - m := make(models.HistoryPoolSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyPools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryPoolTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryPoolSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyPools 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 HistoryPoolTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryPoolSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryPool has methods that act as mods for the HistoryPoolTemplate -var HistoryPoolMods historyPoolMods - -type historyPoolMods struct{} - -func (m historyPoolMods) RandomizeAllColumns(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModSlice{ - HistoryPoolMods.RandomOrganizationID(f), - HistoryPoolMods.RandomComments(f), - HistoryPoolMods.RandomCreationdate(f), - HistoryPoolMods.RandomCreator(f), - HistoryPoolMods.RandomDatesent(f), - HistoryPoolMods.RandomDatetested(f), - HistoryPoolMods.RandomDiseasepos(f), - HistoryPoolMods.RandomDiseasetested(f), - HistoryPoolMods.RandomEditdate(f), - HistoryPoolMods.RandomEditor(f), - HistoryPoolMods.RandomGatewaysync(f), - HistoryPoolMods.RandomGlobalid(f), - HistoryPoolMods.RandomLab(f), - HistoryPoolMods.RandomLabID(f), - HistoryPoolMods.RandomObjectid(f), - HistoryPoolMods.RandomPoolyear(f), - HistoryPoolMods.RandomProcessed(f), - HistoryPoolMods.RandomSampleid(f), - HistoryPoolMods.RandomSurvtech(f), - HistoryPoolMods.RandomTestmethod(f), - HistoryPoolMods.RandomTesttech(f), - HistoryPoolMods.RandomTrapdataID(f), - HistoryPoolMods.RandomCreated(f), - HistoryPoolMods.RandomCreatedDate(f), - HistoryPoolMods.RandomCreatedUser(f), - HistoryPoolMods.RandomGeometryX(f), - HistoryPoolMods.RandomGeometryY(f), - HistoryPoolMods.RandomLastEditedDate(f), - HistoryPoolMods.RandomLastEditedUser(f), - HistoryPoolMods.RandomVectorsurvcollectionid(f), - HistoryPoolMods.RandomVectorsurvpoolid(f), - HistoryPoolMods.RandomVectorsurvtrapdataid(f), - HistoryPoolMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyPoolMods) OrganizationID(val int32) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) OrganizationIDFunc(f func() int32) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetOrganizationID() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - 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 historyPoolMods) RandomOrganizationID(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyPoolMods) Comments(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) CommentsFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetComments() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Comments = 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 historyPoolMods) RandomComments(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Comments = 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 historyPoolMods) RandomCommentsNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Comments = 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 historyPoolMods) Creationdate(val null.Val[int64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) CreationdateFunc(f func() null.Val[int64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetCreationdate() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Creationdate = 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 historyPoolMods) RandomCreationdate(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPoolMods) RandomCreationdateNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPoolMods) Creator(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) CreatorFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetCreator() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Creator = 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 historyPoolMods) RandomCreator(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Creator = 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 historyPoolMods) RandomCreatorNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Creator = 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 historyPoolMods) Datesent(val null.Val[int64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Datesent = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) DatesentFunc(f func() null.Val[int64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Datesent = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetDatesent() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Datesent = 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 historyPoolMods) RandomDatesent(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Datesent = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPoolMods) RandomDatesentNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Datesent = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPoolMods) Datetested(val null.Val[int64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Datetested = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) DatetestedFunc(f func() null.Val[int64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Datetested = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetDatetested() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Datetested = 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 historyPoolMods) RandomDatetested(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Datetested = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPoolMods) RandomDatetestedNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Datetested = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPoolMods) Diseasepos(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Diseasepos = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) DiseaseposFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Diseasepos = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetDiseasepos() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Diseasepos = 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 historyPoolMods) RandomDiseasepos(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Diseasepos = 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 historyPoolMods) RandomDiseaseposNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Diseasepos = 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 historyPoolMods) Diseasetested(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Diseasetested = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) DiseasetestedFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Diseasetested = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetDiseasetested() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Diseasetested = 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 historyPoolMods) RandomDiseasetested(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Diseasetested = 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 historyPoolMods) RandomDiseasetestedNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Diseasetested = 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 historyPoolMods) Editdate(val null.Val[int64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) EditdateFunc(f func() null.Val[int64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetEditdate() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Editdate = 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 historyPoolMods) RandomEditdate(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPoolMods) RandomEditdateNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPoolMods) Editor(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) EditorFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetEditor() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Editor = 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 historyPoolMods) RandomEditor(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Editor = 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 historyPoolMods) RandomEditorNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Editor = 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 historyPoolMods) Gatewaysync(val null.Val[int16]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Gatewaysync = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) GatewaysyncFunc(f func() null.Val[int16]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Gatewaysync = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetGatewaysync() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Gatewaysync = 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 historyPoolMods) RandomGatewaysync(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyPoolMods) RandomGatewaysyncNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPoolMods) Globalid(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) GlobalidFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetGlobalid() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Globalid = 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 historyPoolMods) RandomGlobalid(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - 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 historyPoolMods) RandomGlobalidNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Globalid = 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 historyPoolMods) Lab(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Lab = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) LabFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Lab = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetLab() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Lab = 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 historyPoolMods) RandomLab(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Lab = 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 historyPoolMods) RandomLabNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Lab = 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 historyPoolMods) LabID(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.LabID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) LabIDFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.LabID = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetLabID() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.LabID = 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 historyPoolMods) RandomLabID(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.LabID = 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 historyPoolMods) RandomLabIDNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.LabID = 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 historyPoolMods) Objectid(val int32) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) ObjectidFunc(f func() int32) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetObjectid() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyPoolMods) RandomObjectid(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyPoolMods) Poolyear(val null.Val[int16]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Poolyear = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) PoolyearFunc(f func() null.Val[int16]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Poolyear = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetPoolyear() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Poolyear = 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 historyPoolMods) RandomPoolyear(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Poolyear = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyPoolMods) RandomPoolyearNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Poolyear = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPoolMods) Processed(val null.Val[int16]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) ProcessedFunc(f func() null.Val[int16]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetProcessed() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Processed = 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 historyPoolMods) RandomProcessed(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyPoolMods) RandomProcessedNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPoolMods) Sampleid(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Sampleid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) SampleidFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Sampleid = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetSampleid() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Sampleid = 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 historyPoolMods) RandomSampleid(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Sampleid = 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 historyPoolMods) RandomSampleidNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Sampleid = 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 historyPoolMods) Survtech(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Survtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) SurvtechFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Survtech = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetSurvtech() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Survtech = 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 historyPoolMods) RandomSurvtech(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Survtech = 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 historyPoolMods) RandomSurvtechNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Survtech = 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 historyPoolMods) Testmethod(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Testmethod = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) TestmethodFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Testmethod = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetTestmethod() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Testmethod = 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 historyPoolMods) RandomTestmethod(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Testmethod = 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 historyPoolMods) RandomTestmethodNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Testmethod = 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 historyPoolMods) Testtech(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Testtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) TesttechFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Testtech = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetTesttech() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Testtech = 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 historyPoolMods) RandomTesttech(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Testtech = 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 historyPoolMods) RandomTesttechNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Testtech = 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 historyPoolMods) TrapdataID(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.TrapdataID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) TrapdataIDFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.TrapdataID = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetTrapdataID() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.TrapdataID = 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 historyPoolMods) RandomTrapdataID(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.TrapdataID = 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 historyPoolMods) RandomTrapdataIDNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.TrapdataID = 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 historyPoolMods) Created(val null.Val[time.Time]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) CreatedFunc(f func() null.Val[time.Time]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetCreated() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Created = 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 historyPoolMods) RandomCreated(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyPoolMods) RandomCreatedNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPoolMods) CreatedDate(val null.Val[int64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) CreatedDateFunc(f func() null.Val[int64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetCreatedDate() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.CreatedDate = 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 historyPoolMods) RandomCreatedDate(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPoolMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPoolMods) CreatedUser(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) CreatedUserFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetCreatedUser() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.CreatedUser = 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 historyPoolMods) RandomCreatedUser(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.CreatedUser = 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 historyPoolMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.CreatedUser = 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 historyPoolMods) GeometryX(val null.Val[float64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) GeometryXFunc(f func() null.Val[float64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetGeometryX() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.GeometryX = 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 historyPoolMods) RandomGeometryX(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - 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 historyPoolMods) RandomGeometryXNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.GeometryX = 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 historyPoolMods) GeometryY(val null.Val[float64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) GeometryYFunc(f func() null.Val[float64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetGeometryY() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.GeometryY = 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 historyPoolMods) RandomGeometryY(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - 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 historyPoolMods) RandomGeometryYNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.GeometryY = 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 historyPoolMods) LastEditedDate(val null.Val[int64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetLastEditedDate() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.LastEditedDate = 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 historyPoolMods) RandomLastEditedDate(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPoolMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPoolMods) LastEditedUser(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) LastEditedUserFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetLastEditedUser() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.LastEditedUser = 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 historyPoolMods) RandomLastEditedUser(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.LastEditedUser = 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 historyPoolMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.LastEditedUser = 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 historyPoolMods) Vectorsurvcollectionid(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Vectorsurvcollectionid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) VectorsurvcollectionidFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Vectorsurvcollectionid = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetVectorsurvcollectionid() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Vectorsurvcollectionid = 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 historyPoolMods) RandomVectorsurvcollectionid(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Vectorsurvcollectionid = 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 historyPoolMods) RandomVectorsurvcollectionidNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Vectorsurvcollectionid = 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 historyPoolMods) Vectorsurvpoolid(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Vectorsurvpoolid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) VectorsurvpoolidFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Vectorsurvpoolid = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetVectorsurvpoolid() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Vectorsurvpoolid = 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 historyPoolMods) RandomVectorsurvpoolid(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Vectorsurvpoolid = 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 historyPoolMods) RandomVectorsurvpoolidNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Vectorsurvpoolid = 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 historyPoolMods) Vectorsurvtrapdataid(val null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Vectorsurvtrapdataid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) VectorsurvtrapdataidFunc(f func() null.Val[string]) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Vectorsurvtrapdataid = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetVectorsurvtrapdataid() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Vectorsurvtrapdataid = 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 historyPoolMods) RandomVectorsurvtrapdataid(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Vectorsurvtrapdataid = 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 historyPoolMods) RandomVectorsurvtrapdataidNotNull(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Vectorsurvtrapdataid = 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 historyPoolMods) Version(val int32) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyPoolMods) VersionFunc(f func() int32) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyPoolMods) UnsetVersion() HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyPoolMods) RandomVersion(f *faker.Faker) HistoryPoolMod { - return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyPoolMods) WithParentsCascading() HistoryPoolMod { - return HistoryPoolModFunc(func(ctx context.Context, o *HistoryPoolTemplate) { - if isDone, _ := historyPoolWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyPoolWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyPoolMods) WithOrganization(rel *OrganizationTemplate) HistoryPoolMod { - return HistoryPoolModFunc(func(ctx context.Context, o *HistoryPoolTemplate) { - o.r.Organization = &historyPoolROrganizationR{ - o: rel, - } - }) -} - -func (m historyPoolMods) WithNewOrganization(mods ...OrganizationMod) HistoryPoolMod { - return HistoryPoolModFunc(func(ctx context.Context, o *HistoryPoolTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyPoolMods) WithExistingOrganization(em *models.Organization) HistoryPoolMod { - return HistoryPoolModFunc(func(ctx context.Context, o *HistoryPoolTemplate) { - o.r.Organization = &historyPoolROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyPoolMods) WithoutOrganization() HistoryPoolMod { - return HistoryPoolModFunc(func(ctx context.Context, o *HistoryPoolTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_pooldetail.bob.go b/db/factory/history_pooldetail.bob.go deleted file mode 100644 index 84e37b16..00000000 --- a/db/factory/history_pooldetail.bob.go +++ /dev/null @@ -1,1408 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryPooldetailMod interface { - Apply(context.Context, *HistoryPooldetailTemplate) -} - -type HistoryPooldetailModFunc func(context.Context, *HistoryPooldetailTemplate) - -func (f HistoryPooldetailModFunc) Apply(ctx context.Context, n *HistoryPooldetailTemplate) { - f(ctx, n) -} - -type HistoryPooldetailModSlice []HistoryPooldetailMod - -func (mods HistoryPooldetailModSlice) Apply(ctx context.Context, n *HistoryPooldetailTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryPooldetailTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryPooldetailTemplate struct { - OrganizationID func() int32 - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Females func() null.Val[int16] - Globalid func() null.Val[string] - Objectid func() int32 - PoolID func() null.Val[string] - Species func() null.Val[string] - TrapdataID func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Version func() int32 - - r historyPooldetailR - f *Factory - - alreadyPersisted bool -} - -type historyPooldetailR struct { - Organization *historyPooldetailROrganizationR -} - -type historyPooldetailROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryPooldetailTemplate -func (o *HistoryPooldetailTemplate) Apply(ctx context.Context, mods ...HistoryPooldetailMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryPooldetail -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryPooldetailTemplate) setModelRels(o *models.HistoryPooldetail) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryPooldetails = append(rel.R.HistoryPooldetails, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryPooldetailSetter -// this does nothing with the relationship templates -func (o HistoryPooldetailTemplate) BuildSetter() *models.HistoryPooldetailSetter { - m := &models.HistoryPooldetailSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Females != nil { - val := o.Females() - m.Females = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.PoolID != nil { - val := o.PoolID() - m.PoolID = omitnull.FromNull(val) - } - if o.Species != nil { - val := o.Species() - m.Species = omitnull.FromNull(val) - } - if o.TrapdataID != nil { - val := o.TrapdataID() - m.TrapdataID = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryPooldetailSetter -// this does nothing with the relationship templates -func (o HistoryPooldetailTemplate) BuildManySetter(number int) []*models.HistoryPooldetailSetter { - m := make([]*models.HistoryPooldetailSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryPooldetail -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryPooldetailTemplate.Create -func (o HistoryPooldetailTemplate) Build() *models.HistoryPooldetail { - m := &models.HistoryPooldetail{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Females != nil { - m.Females = o.Females() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.PoolID != nil { - m.PoolID = o.PoolID() - } - if o.Species != nil { - m.Species = o.Species() - } - if o.TrapdataID != nil { - m.TrapdataID = o.TrapdataID() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryPooldetailSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryPooldetailTemplate.CreateMany -func (o HistoryPooldetailTemplate) BuildMany(number int) models.HistoryPooldetailSlice { - m := make(models.HistoryPooldetailSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryPooldetail(m *models.HistoryPooldetailSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryPooldetail -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryPooldetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryPooldetail) error { - var err error - - return err -} - -// Create builds a historyPooldetail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryPooldetailTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryPooldetail, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryPooldetail(opt) - - if o.r.Organization == nil { - HistoryPooldetailMods.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.HistoryPooldetails.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 historyPooldetail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryPooldetailTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryPooldetail { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyPooldetail 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 *HistoryPooldetailTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryPooldetail { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyPooldetails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryPooldetailTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryPooldetailSlice, error) { - var err error - m := make(models.HistoryPooldetailSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyPooldetails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryPooldetailTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryPooldetailSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyPooldetails 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 HistoryPooldetailTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryPooldetailSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryPooldetail has methods that act as mods for the HistoryPooldetailTemplate -var HistoryPooldetailMods historyPooldetailMods - -type historyPooldetailMods struct{} - -func (m historyPooldetailMods) RandomizeAllColumns(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModSlice{ - HistoryPooldetailMods.RandomOrganizationID(f), - HistoryPooldetailMods.RandomCreationdate(f), - HistoryPooldetailMods.RandomCreator(f), - HistoryPooldetailMods.RandomEditdate(f), - HistoryPooldetailMods.RandomEditor(f), - HistoryPooldetailMods.RandomFemales(f), - HistoryPooldetailMods.RandomGlobalid(f), - HistoryPooldetailMods.RandomObjectid(f), - HistoryPooldetailMods.RandomPoolID(f), - HistoryPooldetailMods.RandomSpecies(f), - HistoryPooldetailMods.RandomTrapdataID(f), - HistoryPooldetailMods.RandomCreated(f), - HistoryPooldetailMods.RandomCreatedDate(f), - HistoryPooldetailMods.RandomCreatedUser(f), - HistoryPooldetailMods.RandomGeometryX(f), - HistoryPooldetailMods.RandomGeometryY(f), - HistoryPooldetailMods.RandomLastEditedDate(f), - HistoryPooldetailMods.RandomLastEditedUser(f), - HistoryPooldetailMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyPooldetailMods) OrganizationID(val int32) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) OrganizationIDFunc(f func() int32) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetOrganizationID() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - 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 historyPooldetailMods) RandomOrganizationID(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyPooldetailMods) Creationdate(val null.Val[int64]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) CreationdateFunc(f func() null.Val[int64]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetCreationdate() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Creationdate = 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 historyPooldetailMods) RandomCreationdate(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPooldetailMods) RandomCreationdateNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPooldetailMods) Creator(val null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) CreatorFunc(f func() null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetCreator() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Creator = 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 historyPooldetailMods) RandomCreator(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Creator = 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 historyPooldetailMods) RandomCreatorNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Creator = 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 historyPooldetailMods) Editdate(val null.Val[int64]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) EditdateFunc(f func() null.Val[int64]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetEditdate() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Editdate = 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 historyPooldetailMods) RandomEditdate(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPooldetailMods) RandomEditdateNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPooldetailMods) Editor(val null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) EditorFunc(f func() null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetEditor() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Editor = 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 historyPooldetailMods) RandomEditor(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Editor = 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 historyPooldetailMods) RandomEditorNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Editor = 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 historyPooldetailMods) Females(val null.Val[int16]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Females = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) FemalesFunc(f func() null.Val[int16]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Females = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetFemales() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Females = 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 historyPooldetailMods) RandomFemales(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Females = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyPooldetailMods) RandomFemalesNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Females = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPooldetailMods) Globalid(val null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) GlobalidFunc(f func() null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetGlobalid() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Globalid = 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 historyPooldetailMods) RandomGlobalid(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - 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 historyPooldetailMods) RandomGlobalidNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Globalid = 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 historyPooldetailMods) Objectid(val int32) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) ObjectidFunc(f func() int32) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetObjectid() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyPooldetailMods) RandomObjectid(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyPooldetailMods) PoolID(val null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.PoolID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) PoolIDFunc(f func() null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.PoolID = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetPoolID() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.PoolID = 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 historyPooldetailMods) RandomPoolID(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.PoolID = 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 historyPooldetailMods) RandomPoolIDNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.PoolID = 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 historyPooldetailMods) Species(val null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Species = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) SpeciesFunc(f func() null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Species = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetSpecies() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Species = 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 historyPooldetailMods) RandomSpecies(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Species = 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 historyPooldetailMods) RandomSpeciesNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Species = 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 historyPooldetailMods) TrapdataID(val null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.TrapdataID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) TrapdataIDFunc(f func() null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.TrapdataID = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetTrapdataID() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.TrapdataID = 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 historyPooldetailMods) RandomTrapdataID(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.TrapdataID = 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 historyPooldetailMods) RandomTrapdataIDNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.TrapdataID = 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 historyPooldetailMods) Created(val null.Val[time.Time]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) CreatedFunc(f func() null.Val[time.Time]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetCreated() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Created = 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 historyPooldetailMods) RandomCreated(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyPooldetailMods) RandomCreatedNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPooldetailMods) CreatedDate(val null.Val[int64]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) CreatedDateFunc(f func() null.Val[int64]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetCreatedDate() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.CreatedDate = 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 historyPooldetailMods) RandomCreatedDate(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPooldetailMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPooldetailMods) CreatedUser(val null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) CreatedUserFunc(f func() null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetCreatedUser() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.CreatedUser = 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 historyPooldetailMods) RandomCreatedUser(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.CreatedUser = 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 historyPooldetailMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.CreatedUser = 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 historyPooldetailMods) GeometryX(val null.Val[float64]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) GeometryXFunc(f func() null.Val[float64]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetGeometryX() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.GeometryX = 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 historyPooldetailMods) RandomGeometryX(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - 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 historyPooldetailMods) RandomGeometryXNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.GeometryX = 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 historyPooldetailMods) GeometryY(val null.Val[float64]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) GeometryYFunc(f func() null.Val[float64]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetGeometryY() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.GeometryY = 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 historyPooldetailMods) RandomGeometryY(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - 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 historyPooldetailMods) RandomGeometryYNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.GeometryY = 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 historyPooldetailMods) LastEditedDate(val null.Val[int64]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetLastEditedDate() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.LastEditedDate = 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 historyPooldetailMods) RandomLastEditedDate(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyPooldetailMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyPooldetailMods) LastEditedUser(val null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) LastEditedUserFunc(f func() null.Val[string]) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetLastEditedUser() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.LastEditedUser = 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 historyPooldetailMods) RandomLastEditedUser(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.LastEditedUser = 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 historyPooldetailMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.LastEditedUser = 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 historyPooldetailMods) Version(val int32) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyPooldetailMods) VersionFunc(f func() int32) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyPooldetailMods) UnsetVersion() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyPooldetailMods) RandomVersion(f *faker.Faker) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyPooldetailMods) WithParentsCascading() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(ctx context.Context, o *HistoryPooldetailTemplate) { - if isDone, _ := historyPooldetailWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyPooldetailWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyPooldetailMods) WithOrganization(rel *OrganizationTemplate) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(ctx context.Context, o *HistoryPooldetailTemplate) { - o.r.Organization = &historyPooldetailROrganizationR{ - o: rel, - } - }) -} - -func (m historyPooldetailMods) WithNewOrganization(mods ...OrganizationMod) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(ctx context.Context, o *HistoryPooldetailTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyPooldetailMods) WithExistingOrganization(em *models.Organization) HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(ctx context.Context, o *HistoryPooldetailTemplate) { - o.r.Organization = &historyPooldetailROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyPooldetailMods) WithoutOrganization() HistoryPooldetailMod { - return HistoryPooldetailModFunc(func(ctx context.Context, o *HistoryPooldetailTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_proposedtreatmentarea.bob.go b/db/factory/history_proposedtreatmentarea.bob.go deleted file mode 100644 index 7ba5b8c4..00000000 --- a/db/factory/history_proposedtreatmentarea.bob.go +++ /dev/null @@ -1,2586 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryProposedtreatmentareaMod interface { - Apply(context.Context, *HistoryProposedtreatmentareaTemplate) -} - -type HistoryProposedtreatmentareaModFunc func(context.Context, *HistoryProposedtreatmentareaTemplate) - -func (f HistoryProposedtreatmentareaModFunc) Apply(ctx context.Context, n *HistoryProposedtreatmentareaTemplate) { - f(ctx, n) -} - -type HistoryProposedtreatmentareaModSlice []HistoryProposedtreatmentareaMod - -func (mods HistoryProposedtreatmentareaModSlice) Apply(ctx context.Context, n *HistoryProposedtreatmentareaTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryProposedtreatmentareaTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryProposedtreatmentareaTemplate struct { - OrganizationID func() int32 - Acres func() null.Val[float64] - Comments func() null.Val[string] - Completed func() null.Val[int16] - Completedby func() null.Val[string] - Completeddate func() null.Val[int64] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Duedate func() null.Val[int64] - Exported func() null.Val[int16] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() null.Val[string] - Hectares func() null.Val[float64] - Issprayroute func() null.Val[int16] - Lasttreatactivity func() null.Val[string] - Lasttreatdate func() null.Val[int64] - Lasttreatproduct func() null.Val[string] - Lasttreatqty func() null.Val[float64] - Lasttreatqtyunit func() null.Val[string] - Method func() null.Val[string] - Name func() null.Val[string] - Objectid func() int32 - Priority func() null.Val[string] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[int64] - ShapeArea func() null.Val[float64] - ShapeLength func() null.Val[float64] - Targetapprate func() null.Val[float64] - Targetproduct func() null.Val[string] - Targetspecies func() null.Val[string] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - Version func() int32 - Created func() null.Val[time.Time] - - r historyProposedtreatmentareaR - f *Factory - - alreadyPersisted bool -} - -type historyProposedtreatmentareaR struct { - Organization *historyProposedtreatmentareaROrganizationR -} - -type historyProposedtreatmentareaROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryProposedtreatmentareaTemplate -func (o *HistoryProposedtreatmentareaTemplate) Apply(ctx context.Context, mods ...HistoryProposedtreatmentareaMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryProposedtreatmentarea -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryProposedtreatmentareaTemplate) setModelRels(o *models.HistoryProposedtreatmentarea) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryProposedtreatmentareas = append(rel.R.HistoryProposedtreatmentareas, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryProposedtreatmentareaSetter -// this does nothing with the relationship templates -func (o HistoryProposedtreatmentareaTemplate) BuildSetter() *models.HistoryProposedtreatmentareaSetter { - m := &models.HistoryProposedtreatmentareaSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Acres != nil { - val := o.Acres() - m.Acres = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Completed != nil { - val := o.Completed() - m.Completed = omitnull.FromNull(val) - } - if o.Completedby != nil { - val := o.Completedby() - m.Completedby = omitnull.FromNull(val) - } - if o.Completeddate != nil { - val := o.Completeddate() - m.Completeddate = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Duedate != nil { - val := o.Duedate() - m.Duedate = omitnull.FromNull(val) - } - if o.Exported != nil { - val := o.Exported() - m.Exported = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Hectares != nil { - val := o.Hectares() - m.Hectares = omitnull.FromNull(val) - } - if o.Issprayroute != nil { - val := o.Issprayroute() - m.Issprayroute = omitnull.FromNull(val) - } - if o.Lasttreatactivity != nil { - val := o.Lasttreatactivity() - m.Lasttreatactivity = omitnull.FromNull(val) - } - if o.Lasttreatdate != nil { - val := o.Lasttreatdate() - m.Lasttreatdate = omitnull.FromNull(val) - } - if o.Lasttreatproduct != nil { - val := o.Lasttreatproduct() - m.Lasttreatproduct = omitnull.FromNull(val) - } - if o.Lasttreatqty != nil { - val := o.Lasttreatqty() - m.Lasttreatqty = omitnull.FromNull(val) - } - if o.Lasttreatqtyunit != nil { - val := o.Lasttreatqtyunit() - m.Lasttreatqtyunit = omitnull.FromNull(val) - } - if o.Method != nil { - val := o.Method() - m.Method = omitnull.FromNull(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Reviewed != nil { - val := o.Reviewed() - m.Reviewed = omitnull.FromNull(val) - } - if o.Reviewedby != nil { - val := o.Reviewedby() - m.Reviewedby = omitnull.FromNull(val) - } - if o.Revieweddate != nil { - val := o.Revieweddate() - m.Revieweddate = omitnull.FromNull(val) - } - if o.ShapeArea != nil { - val := o.ShapeArea() - m.ShapeArea = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - val := o.ShapeLength() - m.ShapeLength = omitnull.FromNull(val) - } - if o.Targetapprate != nil { - val := o.Targetapprate() - m.Targetapprate = omitnull.FromNull(val) - } - if o.Targetproduct != nil { - val := o.Targetproduct() - m.Targetproduct = omitnull.FromNull(val) - } - if o.Targetspecies != nil { - val := o.Targetspecies() - m.Targetspecies = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryProposedtreatmentareaSetter -// this does nothing with the relationship templates -func (o HistoryProposedtreatmentareaTemplate) BuildManySetter(number int) []*models.HistoryProposedtreatmentareaSetter { - m := make([]*models.HistoryProposedtreatmentareaSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryProposedtreatmentarea -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryProposedtreatmentareaTemplate.Create -func (o HistoryProposedtreatmentareaTemplate) Build() *models.HistoryProposedtreatmentarea { - m := &models.HistoryProposedtreatmentarea{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Acres != nil { - m.Acres = o.Acres() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Completed != nil { - m.Completed = o.Completed() - } - if o.Completedby != nil { - m.Completedby = o.Completedby() - } - if o.Completeddate != nil { - m.Completeddate = o.Completeddate() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Duedate != nil { - m.Duedate = o.Duedate() - } - if o.Exported != nil { - m.Exported = o.Exported() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Hectares != nil { - m.Hectares = o.Hectares() - } - if o.Issprayroute != nil { - m.Issprayroute = o.Issprayroute() - } - if o.Lasttreatactivity != nil { - m.Lasttreatactivity = o.Lasttreatactivity() - } - if o.Lasttreatdate != nil { - m.Lasttreatdate = o.Lasttreatdate() - } - if o.Lasttreatproduct != nil { - m.Lasttreatproduct = o.Lasttreatproduct() - } - if o.Lasttreatqty != nil { - m.Lasttreatqty = o.Lasttreatqty() - } - if o.Lasttreatqtyunit != nil { - m.Lasttreatqtyunit = o.Lasttreatqtyunit() - } - if o.Method != nil { - m.Method = o.Method() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Reviewed != nil { - m.Reviewed = o.Reviewed() - } - if o.Reviewedby != nil { - m.Reviewedby = o.Reviewedby() - } - if o.Revieweddate != nil { - m.Revieweddate = o.Revieweddate() - } - if o.ShapeArea != nil { - m.ShapeArea = o.ShapeArea() - } - if o.ShapeLength != nil { - m.ShapeLength = o.ShapeLength() - } - if o.Targetapprate != nil { - m.Targetapprate = o.Targetapprate() - } - if o.Targetproduct != nil { - m.Targetproduct = o.Targetproduct() - } - if o.Targetspecies != nil { - m.Targetspecies = o.Targetspecies() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.Version != nil { - m.Version = o.Version() - } - if o.Created != nil { - m.Created = o.Created() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryProposedtreatmentareaSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryProposedtreatmentareaTemplate.CreateMany -func (o HistoryProposedtreatmentareaTemplate) BuildMany(number int) models.HistoryProposedtreatmentareaSlice { - m := make(models.HistoryProposedtreatmentareaSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryProposedtreatmentarea(m *models.HistoryProposedtreatmentareaSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryProposedtreatmentarea -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryProposedtreatmentareaTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryProposedtreatmentarea) error { - var err error - - return err -} - -// Create builds a historyProposedtreatmentarea and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryProposedtreatmentareaTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryProposedtreatmentarea, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryProposedtreatmentarea(opt) - - if o.r.Organization == nil { - HistoryProposedtreatmentareaMods.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.HistoryProposedtreatmentareas.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 historyProposedtreatmentarea and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryProposedtreatmentareaTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryProposedtreatmentarea { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyProposedtreatmentarea 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 *HistoryProposedtreatmentareaTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryProposedtreatmentarea { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyProposedtreatmentareas and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryProposedtreatmentareaTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryProposedtreatmentareaSlice, error) { - var err error - m := make(models.HistoryProposedtreatmentareaSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyProposedtreatmentareas and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryProposedtreatmentareaTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryProposedtreatmentareaSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyProposedtreatmentareas 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 HistoryProposedtreatmentareaTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryProposedtreatmentareaSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryProposedtreatmentarea has methods that act as mods for the HistoryProposedtreatmentareaTemplate -var HistoryProposedtreatmentareaMods historyProposedtreatmentareaMods - -type historyProposedtreatmentareaMods struct{} - -func (m historyProposedtreatmentareaMods) RandomizeAllColumns(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModSlice{ - HistoryProposedtreatmentareaMods.RandomOrganizationID(f), - HistoryProposedtreatmentareaMods.RandomAcres(f), - HistoryProposedtreatmentareaMods.RandomComments(f), - HistoryProposedtreatmentareaMods.RandomCompleted(f), - HistoryProposedtreatmentareaMods.RandomCompletedby(f), - HistoryProposedtreatmentareaMods.RandomCompleteddate(f), - HistoryProposedtreatmentareaMods.RandomCreationdate(f), - HistoryProposedtreatmentareaMods.RandomCreator(f), - HistoryProposedtreatmentareaMods.RandomDuedate(f), - HistoryProposedtreatmentareaMods.RandomExported(f), - HistoryProposedtreatmentareaMods.RandomEditdate(f), - HistoryProposedtreatmentareaMods.RandomEditor(f), - HistoryProposedtreatmentareaMods.RandomGlobalid(f), - HistoryProposedtreatmentareaMods.RandomHectares(f), - HistoryProposedtreatmentareaMods.RandomIssprayroute(f), - HistoryProposedtreatmentareaMods.RandomLasttreatactivity(f), - HistoryProposedtreatmentareaMods.RandomLasttreatdate(f), - HistoryProposedtreatmentareaMods.RandomLasttreatproduct(f), - HistoryProposedtreatmentareaMods.RandomLasttreatqty(f), - HistoryProposedtreatmentareaMods.RandomLasttreatqtyunit(f), - HistoryProposedtreatmentareaMods.RandomMethod(f), - HistoryProposedtreatmentareaMods.RandomName(f), - HistoryProposedtreatmentareaMods.RandomObjectid(f), - HistoryProposedtreatmentareaMods.RandomPriority(f), - HistoryProposedtreatmentareaMods.RandomReviewed(f), - HistoryProposedtreatmentareaMods.RandomReviewedby(f), - HistoryProposedtreatmentareaMods.RandomRevieweddate(f), - HistoryProposedtreatmentareaMods.RandomShapeArea(f), - HistoryProposedtreatmentareaMods.RandomShapeLength(f), - HistoryProposedtreatmentareaMods.RandomTargetapprate(f), - HistoryProposedtreatmentareaMods.RandomTargetproduct(f), - HistoryProposedtreatmentareaMods.RandomTargetspecies(f), - HistoryProposedtreatmentareaMods.RandomZone(f), - HistoryProposedtreatmentareaMods.RandomZone2(f), - HistoryProposedtreatmentareaMods.RandomGeometryX(f), - HistoryProposedtreatmentareaMods.RandomGeometryY(f), - HistoryProposedtreatmentareaMods.RandomVersion(f), - HistoryProposedtreatmentareaMods.RandomCreated(f), - } -} - -// Set the model columns to this value -func (m historyProposedtreatmentareaMods) OrganizationID(val int32) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) OrganizationIDFunc(f func() int32) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetOrganizationID() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - 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 historyProposedtreatmentareaMods) RandomOrganizationID(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyProposedtreatmentareaMods) Acres(val null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Acres = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) AcresFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Acres = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetAcres() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Acres = 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 historyProposedtreatmentareaMods) RandomAcres(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Acres = 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 historyProposedtreatmentareaMods) RandomAcresNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Acres = 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 historyProposedtreatmentareaMods) Comments(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) CommentsFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetComments() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Comments = 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 historyProposedtreatmentareaMods) RandomComments(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Comments = 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 historyProposedtreatmentareaMods) RandomCommentsNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Comments = 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 historyProposedtreatmentareaMods) Completed(val null.Val[int16]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Completed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) CompletedFunc(f func() null.Val[int16]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Completed = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetCompleted() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Completed = 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 historyProposedtreatmentareaMods) RandomCompleted(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Completed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyProposedtreatmentareaMods) RandomCompletedNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Completed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyProposedtreatmentareaMods) Completedby(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Completedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) CompletedbyFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Completedby = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetCompletedby() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Completedby = 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 historyProposedtreatmentareaMods) RandomCompletedby(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Completedby = 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 historyProposedtreatmentareaMods) RandomCompletedbyNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Completedby = 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 historyProposedtreatmentareaMods) Completeddate(val null.Val[int64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Completeddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) CompleteddateFunc(f func() null.Val[int64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Completeddate = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetCompleteddate() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Completeddate = 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 historyProposedtreatmentareaMods) RandomCompleteddate(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Completeddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyProposedtreatmentareaMods) RandomCompleteddateNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Completeddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyProposedtreatmentareaMods) Creationdate(val null.Val[int64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) CreationdateFunc(f func() null.Val[int64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetCreationdate() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Creationdate = 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 historyProposedtreatmentareaMods) RandomCreationdate(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyProposedtreatmentareaMods) RandomCreationdateNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyProposedtreatmentareaMods) Creator(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) CreatorFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetCreator() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Creator = 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 historyProposedtreatmentareaMods) RandomCreator(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Creator = 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 historyProposedtreatmentareaMods) RandomCreatorNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Creator = 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 historyProposedtreatmentareaMods) Duedate(val null.Val[int64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Duedate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) DuedateFunc(f func() null.Val[int64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Duedate = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetDuedate() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Duedate = 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 historyProposedtreatmentareaMods) RandomDuedate(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Duedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyProposedtreatmentareaMods) RandomDuedateNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Duedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyProposedtreatmentareaMods) Exported(val null.Val[int16]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Exported = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) ExportedFunc(f func() null.Val[int16]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Exported = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetExported() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Exported = 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 historyProposedtreatmentareaMods) RandomExported(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Exported = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyProposedtreatmentareaMods) RandomExportedNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Exported = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyProposedtreatmentareaMods) Editdate(val null.Val[int64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) EditdateFunc(f func() null.Val[int64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetEditdate() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Editdate = 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 historyProposedtreatmentareaMods) RandomEditdate(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyProposedtreatmentareaMods) RandomEditdateNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyProposedtreatmentareaMods) Editor(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) EditorFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetEditor() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Editor = 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 historyProposedtreatmentareaMods) RandomEditor(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Editor = 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 historyProposedtreatmentareaMods) RandomEditorNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Editor = 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 historyProposedtreatmentareaMods) Globalid(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) GlobalidFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetGlobalid() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Globalid = 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 historyProposedtreatmentareaMods) RandomGlobalid(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - 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 historyProposedtreatmentareaMods) RandomGlobalidNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Globalid = 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 historyProposedtreatmentareaMods) Hectares(val null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Hectares = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) HectaresFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Hectares = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetHectares() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Hectares = 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 historyProposedtreatmentareaMods) RandomHectares(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Hectares = 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 historyProposedtreatmentareaMods) RandomHectaresNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Hectares = 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 historyProposedtreatmentareaMods) Issprayroute(val null.Val[int16]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Issprayroute = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) IssprayrouteFunc(f func() null.Val[int16]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Issprayroute = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetIssprayroute() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Issprayroute = 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 historyProposedtreatmentareaMods) RandomIssprayroute(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Issprayroute = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyProposedtreatmentareaMods) RandomIssprayrouteNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Issprayroute = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyProposedtreatmentareaMods) Lasttreatactivity(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) LasttreatactivityFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatactivity = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetLasttreatactivity() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatactivity = 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 historyProposedtreatmentareaMods) RandomLasttreatactivity(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatactivity = 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 historyProposedtreatmentareaMods) RandomLasttreatactivityNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatactivity = 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 historyProposedtreatmentareaMods) Lasttreatdate(val null.Val[int64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) LasttreatdateFunc(f func() null.Val[int64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatdate = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetLasttreatdate() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatdate = 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 historyProposedtreatmentareaMods) RandomLasttreatdate(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyProposedtreatmentareaMods) RandomLasttreatdateNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyProposedtreatmentareaMods) Lasttreatproduct(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatproduct = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) LasttreatproductFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatproduct = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetLasttreatproduct() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatproduct = 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 historyProposedtreatmentareaMods) RandomLasttreatproduct(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatproduct = 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 historyProposedtreatmentareaMods) RandomLasttreatproductNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatproduct = 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 historyProposedtreatmentareaMods) Lasttreatqty(val null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatqty = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) LasttreatqtyFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatqty = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetLasttreatqty() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatqty = 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 historyProposedtreatmentareaMods) RandomLasttreatqty(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatqty = 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 historyProposedtreatmentareaMods) RandomLasttreatqtyNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatqty = 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 historyProposedtreatmentareaMods) Lasttreatqtyunit(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) LasttreatqtyunitFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatqtyunit = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetLasttreatqtyunit() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatqtyunit = 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 historyProposedtreatmentareaMods) RandomLasttreatqtyunit(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatqtyunit = 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 historyProposedtreatmentareaMods) RandomLasttreatqtyunitNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Lasttreatqtyunit = 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 historyProposedtreatmentareaMods) Method(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Method = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) MethodFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Method = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetMethod() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Method = 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 historyProposedtreatmentareaMods) RandomMethod(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Method = 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 historyProposedtreatmentareaMods) RandomMethodNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Method = 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 historyProposedtreatmentareaMods) Name(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) NameFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetName() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Name = 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 historyProposedtreatmentareaMods) RandomName(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Name = 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 historyProposedtreatmentareaMods) RandomNameNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Name = 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 historyProposedtreatmentareaMods) Objectid(val int32) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) ObjectidFunc(f func() int32) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetObjectid() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyProposedtreatmentareaMods) RandomObjectid(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyProposedtreatmentareaMods) Priority(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) PriorityFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetPriority() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Priority = 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 historyProposedtreatmentareaMods) RandomPriority(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Priority = 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 historyProposedtreatmentareaMods) RandomPriorityNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Priority = 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 historyProposedtreatmentareaMods) Reviewed(val null.Val[int16]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) ReviewedFunc(f func() null.Val[int16]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetReviewed() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Reviewed = 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 historyProposedtreatmentareaMods) RandomReviewed(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyProposedtreatmentareaMods) RandomReviewedNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyProposedtreatmentareaMods) Reviewedby(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) ReviewedbyFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetReviewedby() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Reviewedby = 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 historyProposedtreatmentareaMods) RandomReviewedby(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Reviewedby = 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 historyProposedtreatmentareaMods) RandomReviewedbyNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Reviewedby = 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 historyProposedtreatmentareaMods) Revieweddate(val null.Val[int64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Revieweddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) RevieweddateFunc(f func() null.Val[int64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetRevieweddate() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Revieweddate = 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 historyProposedtreatmentareaMods) RandomRevieweddate(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyProposedtreatmentareaMods) RandomRevieweddateNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyProposedtreatmentareaMods) ShapeArea(val null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.ShapeArea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) ShapeAreaFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.ShapeArea = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetShapeArea() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.ShapeArea = 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 historyProposedtreatmentareaMods) RandomShapeArea(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.ShapeArea = 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 historyProposedtreatmentareaMods) RandomShapeAreaNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.ShapeArea = 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 historyProposedtreatmentareaMods) ShapeLength(val null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) ShapeLengthFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetShapeLength() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.ShapeLength = 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 historyProposedtreatmentareaMods) RandomShapeLength(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.ShapeLength = 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 historyProposedtreatmentareaMods) RandomShapeLengthNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.ShapeLength = 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 historyProposedtreatmentareaMods) Targetapprate(val null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Targetapprate = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) TargetapprateFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Targetapprate = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetTargetapprate() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Targetapprate = 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 historyProposedtreatmentareaMods) RandomTargetapprate(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Targetapprate = 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 historyProposedtreatmentareaMods) RandomTargetapprateNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Targetapprate = 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 historyProposedtreatmentareaMods) Targetproduct(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Targetproduct = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) TargetproductFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Targetproduct = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetTargetproduct() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Targetproduct = 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 historyProposedtreatmentareaMods) RandomTargetproduct(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Targetproduct = 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 historyProposedtreatmentareaMods) RandomTargetproductNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Targetproduct = 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 historyProposedtreatmentareaMods) Targetspecies(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Targetspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) TargetspeciesFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Targetspecies = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetTargetspecies() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Targetspecies = 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 historyProposedtreatmentareaMods) RandomTargetspecies(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Targetspecies = 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 historyProposedtreatmentareaMods) RandomTargetspeciesNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Targetspecies = 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 historyProposedtreatmentareaMods) Zone(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) ZoneFunc(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetZone() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Zone = 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 historyProposedtreatmentareaMods) RandomZone(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Zone = 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 historyProposedtreatmentareaMods) RandomZoneNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Zone = 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 historyProposedtreatmentareaMods) Zone2(val null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) Zone2Func(f func() null.Val[string]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetZone2() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Zone2 = 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 historyProposedtreatmentareaMods) RandomZone2(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Zone2 = 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 historyProposedtreatmentareaMods) RandomZone2NotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Zone2 = 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 historyProposedtreatmentareaMods) GeometryX(val null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) GeometryXFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetGeometryX() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.GeometryX = 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 historyProposedtreatmentareaMods) RandomGeometryX(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - 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 historyProposedtreatmentareaMods) RandomGeometryXNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.GeometryX = 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 historyProposedtreatmentareaMods) GeometryY(val null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) GeometryYFunc(f func() null.Val[float64]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetGeometryY() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.GeometryY = 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 historyProposedtreatmentareaMods) RandomGeometryY(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - 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 historyProposedtreatmentareaMods) RandomGeometryYNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.GeometryY = 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 historyProposedtreatmentareaMods) Version(val int32) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) VersionFunc(f func() int32) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetVersion() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyProposedtreatmentareaMods) RandomVersion(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyProposedtreatmentareaMods) Created(val null.Val[time.Time]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyProposedtreatmentareaMods) CreatedFunc(f func() null.Val[time.Time]) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyProposedtreatmentareaMods) UnsetCreated() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Created = 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 historyProposedtreatmentareaMods) RandomCreated(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyProposedtreatmentareaMods) RandomCreatedNotNull(f *faker.Faker) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(_ context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -func (m historyProposedtreatmentareaMods) WithParentsCascading() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(ctx context.Context, o *HistoryProposedtreatmentareaTemplate) { - if isDone, _ := historyProposedtreatmentareaWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyProposedtreatmentareaWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyProposedtreatmentareaMods) WithOrganization(rel *OrganizationTemplate) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(ctx context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.r.Organization = &historyProposedtreatmentareaROrganizationR{ - o: rel, - } - }) -} - -func (m historyProposedtreatmentareaMods) WithNewOrganization(mods ...OrganizationMod) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(ctx context.Context, o *HistoryProposedtreatmentareaTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyProposedtreatmentareaMods) WithExistingOrganization(em *models.Organization) HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(ctx context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.r.Organization = &historyProposedtreatmentareaROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyProposedtreatmentareaMods) WithoutOrganization() HistoryProposedtreatmentareaMod { - return HistoryProposedtreatmentareaModFunc(func(ctx context.Context, o *HistoryProposedtreatmentareaTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_qamosquitoinspection.bob.go b/db/factory/history_qamosquitoinspection.bob.go deleted file mode 100644 index 3362ea3c..00000000 --- a/db/factory/history_qamosquitoinspection.bob.go +++ /dev/null @@ -1,4384 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryQamosquitoinspectionMod interface { - Apply(context.Context, *HistoryQamosquitoinspectionTemplate) -} - -type HistoryQamosquitoinspectionModFunc func(context.Context, *HistoryQamosquitoinspectionTemplate) - -func (f HistoryQamosquitoinspectionModFunc) Apply(ctx context.Context, n *HistoryQamosquitoinspectionTemplate) { - f(ctx, n) -} - -type HistoryQamosquitoinspectionModSlice []HistoryQamosquitoinspectionMod - -func (mods HistoryQamosquitoinspectionModSlice) Apply(ctx context.Context, n *HistoryQamosquitoinspectionTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryQamosquitoinspectionTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryQamosquitoinspectionTemplate struct { - OrganizationID func() int32 - Acresbreeding func() null.Val[float64] - Actiontaken func() null.Val[string] - Adultactivity func() null.Val[int16] - Aquaticorganisms func() null.Val[string] - Avetemp func() null.Val[float64] - Breedingpotential func() null.Val[string] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Enddatetime func() null.Val[int64] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fieldtech func() null.Val[string] - Fish func() null.Val[int16] - Globalid func() null.Val[string] - Habvalue1 func() null.Val[int16] - Habvalue1percent func() null.Val[int16] - Habvalue2 func() null.Val[int16] - Habvalue2percent func() null.Val[int16] - Larvaeinsidetreatedarea func() null.Val[int16] - Larvaeoutsidetreatedarea func() null.Val[int16] - Larvaepresent func() null.Val[int16] - Larvaereason func() null.Val[string] - Linelocid func() null.Val[string] - Locationname func() null.Val[string] - LR func() null.Val[int16] - Mosquitohabitat func() null.Val[string] - Movingwater func() null.Val[int16] - Negdips func() null.Val[int16] - Nowaterever func() null.Val[int16] - Objectid func() int32 - Pointlocid func() null.Val[string] - Polygonlocid func() null.Val[string] - Posdips func() null.Val[int16] - Potential func() null.Val[int16] - Raingauge func() null.Val[float64] - Recordstatus func() null.Val[int16] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[int64] - Sitetype func() null.Val[string] - Soilconditions func() null.Val[string] - Sourcereduction func() null.Val[string] - Startdatetime func() null.Val[int64] - Totalacres func() null.Val[float64] - Vegetation func() null.Val[string] - Waterconditions func() null.Val[string] - Waterduration func() null.Val[string] - Watermovement1 func() null.Val[string] - Watermovement1percent func() null.Val[int16] - Watermovement2 func() null.Val[string] - Watermovement2percent func() null.Val[int16] - Waterpresent func() null.Val[int16] - Watersource func() null.Val[string] - Winddir func() null.Val[string] - Windspeed func() null.Val[float64] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Version func() int32 - - r historyQamosquitoinspectionR - f *Factory - - alreadyPersisted bool -} - -type historyQamosquitoinspectionR struct { - Organization *historyQamosquitoinspectionROrganizationR -} - -type historyQamosquitoinspectionROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryQamosquitoinspectionTemplate -func (o *HistoryQamosquitoinspectionTemplate) Apply(ctx context.Context, mods ...HistoryQamosquitoinspectionMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryQamosquitoinspection -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryQamosquitoinspectionTemplate) setModelRels(o *models.HistoryQamosquitoinspection) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryQamosquitoinspections = append(rel.R.HistoryQamosquitoinspections, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryQamosquitoinspectionSetter -// this does nothing with the relationship templates -func (o HistoryQamosquitoinspectionTemplate) BuildSetter() *models.HistoryQamosquitoinspectionSetter { - m := &models.HistoryQamosquitoinspectionSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Acresbreeding != nil { - val := o.Acresbreeding() - m.Acresbreeding = omitnull.FromNull(val) - } - if o.Actiontaken != nil { - val := o.Actiontaken() - m.Actiontaken = omitnull.FromNull(val) - } - if o.Adultactivity != nil { - val := o.Adultactivity() - m.Adultactivity = omitnull.FromNull(val) - } - if o.Aquaticorganisms != nil { - val := o.Aquaticorganisms() - m.Aquaticorganisms = omitnull.FromNull(val) - } - if o.Avetemp != nil { - val := o.Avetemp() - m.Avetemp = omitnull.FromNull(val) - } - if o.Breedingpotential != nil { - val := o.Breedingpotential() - m.Breedingpotential = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Fish != nil { - val := o.Fish() - m.Fish = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Habvalue1 != nil { - val := o.Habvalue1() - m.Habvalue1 = omitnull.FromNull(val) - } - if o.Habvalue1percent != nil { - val := o.Habvalue1percent() - m.Habvalue1percent = omitnull.FromNull(val) - } - if o.Habvalue2 != nil { - val := o.Habvalue2() - m.Habvalue2 = omitnull.FromNull(val) - } - if o.Habvalue2percent != nil { - val := o.Habvalue2percent() - m.Habvalue2percent = omitnull.FromNull(val) - } - if o.Larvaeinsidetreatedarea != nil { - val := o.Larvaeinsidetreatedarea() - m.Larvaeinsidetreatedarea = omitnull.FromNull(val) - } - if o.Larvaeoutsidetreatedarea != nil { - val := o.Larvaeoutsidetreatedarea() - m.Larvaeoutsidetreatedarea = omitnull.FromNull(val) - } - if o.Larvaepresent != nil { - val := o.Larvaepresent() - m.Larvaepresent = omitnull.FromNull(val) - } - if o.Larvaereason != nil { - val := o.Larvaereason() - m.Larvaereason = omitnull.FromNull(val) - } - if o.Linelocid != nil { - val := o.Linelocid() - m.Linelocid = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.LR != nil { - val := o.LR() - m.LR = omitnull.FromNull(val) - } - if o.Mosquitohabitat != nil { - val := o.Mosquitohabitat() - m.Mosquitohabitat = omitnull.FromNull(val) - } - if o.Movingwater != nil { - val := o.Movingwater() - m.Movingwater = omitnull.FromNull(val) - } - if o.Negdips != nil { - val := o.Negdips() - m.Negdips = omitnull.FromNull(val) - } - if o.Nowaterever != nil { - val := o.Nowaterever() - m.Nowaterever = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Pointlocid != nil { - val := o.Pointlocid() - m.Pointlocid = omitnull.FromNull(val) - } - if o.Polygonlocid != nil { - val := o.Polygonlocid() - m.Polygonlocid = omitnull.FromNull(val) - } - if o.Posdips != nil { - val := o.Posdips() - m.Posdips = omitnull.FromNull(val) - } - if o.Potential != nil { - val := o.Potential() - m.Potential = omitnull.FromNull(val) - } - if o.Raingauge != nil { - val := o.Raingauge() - m.Raingauge = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Reviewed != nil { - val := o.Reviewed() - m.Reviewed = omitnull.FromNull(val) - } - if o.Reviewedby != nil { - val := o.Reviewedby() - m.Reviewedby = omitnull.FromNull(val) - } - if o.Revieweddate != nil { - val := o.Revieweddate() - m.Revieweddate = omitnull.FromNull(val) - } - if o.Sitetype != nil { - val := o.Sitetype() - m.Sitetype = omitnull.FromNull(val) - } - if o.Soilconditions != nil { - val := o.Soilconditions() - m.Soilconditions = omitnull.FromNull(val) - } - if o.Sourcereduction != nil { - val := o.Sourcereduction() - m.Sourcereduction = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Totalacres != nil { - val := o.Totalacres() - m.Totalacres = omitnull.FromNull(val) - } - if o.Vegetation != nil { - val := o.Vegetation() - m.Vegetation = omitnull.FromNull(val) - } - if o.Waterconditions != nil { - val := o.Waterconditions() - m.Waterconditions = omitnull.FromNull(val) - } - if o.Waterduration != nil { - val := o.Waterduration() - m.Waterduration = omitnull.FromNull(val) - } - if o.Watermovement1 != nil { - val := o.Watermovement1() - m.Watermovement1 = omitnull.FromNull(val) - } - if o.Watermovement1percent != nil { - val := o.Watermovement1percent() - m.Watermovement1percent = omitnull.FromNull(val) - } - if o.Watermovement2 != nil { - val := o.Watermovement2() - m.Watermovement2 = omitnull.FromNull(val) - } - if o.Watermovement2percent != nil { - val := o.Watermovement2percent() - m.Watermovement2percent = omitnull.FromNull(val) - } - if o.Waterpresent != nil { - val := o.Waterpresent() - m.Waterpresent = omitnull.FromNull(val) - } - if o.Watersource != nil { - val := o.Watersource() - m.Watersource = omitnull.FromNull(val) - } - if o.Winddir != nil { - val := o.Winddir() - m.Winddir = omitnull.FromNull(val) - } - if o.Windspeed != nil { - val := o.Windspeed() - m.Windspeed = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryQamosquitoinspectionSetter -// this does nothing with the relationship templates -func (o HistoryQamosquitoinspectionTemplate) BuildManySetter(number int) []*models.HistoryQamosquitoinspectionSetter { - m := make([]*models.HistoryQamosquitoinspectionSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryQamosquitoinspection -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryQamosquitoinspectionTemplate.Create -func (o HistoryQamosquitoinspectionTemplate) Build() *models.HistoryQamosquitoinspection { - m := &models.HistoryQamosquitoinspection{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Acresbreeding != nil { - m.Acresbreeding = o.Acresbreeding() - } - if o.Actiontaken != nil { - m.Actiontaken = o.Actiontaken() - } - if o.Adultactivity != nil { - m.Adultactivity = o.Adultactivity() - } - if o.Aquaticorganisms != nil { - m.Aquaticorganisms = o.Aquaticorganisms() - } - if o.Avetemp != nil { - m.Avetemp = o.Avetemp() - } - if o.Breedingpotential != nil { - m.Breedingpotential = o.Breedingpotential() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Fish != nil { - m.Fish = o.Fish() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habvalue1 != nil { - m.Habvalue1 = o.Habvalue1() - } - if o.Habvalue1percent != nil { - m.Habvalue1percent = o.Habvalue1percent() - } - if o.Habvalue2 != nil { - m.Habvalue2 = o.Habvalue2() - } - if o.Habvalue2percent != nil { - m.Habvalue2percent = o.Habvalue2percent() - } - if o.Larvaeinsidetreatedarea != nil { - m.Larvaeinsidetreatedarea = o.Larvaeinsidetreatedarea() - } - if o.Larvaeoutsidetreatedarea != nil { - m.Larvaeoutsidetreatedarea = o.Larvaeoutsidetreatedarea() - } - if o.Larvaepresent != nil { - m.Larvaepresent = o.Larvaepresent() - } - if o.Larvaereason != nil { - m.Larvaereason = o.Larvaereason() - } - if o.Linelocid != nil { - m.Linelocid = o.Linelocid() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.LR != nil { - m.LR = o.LR() - } - if o.Mosquitohabitat != nil { - m.Mosquitohabitat = o.Mosquitohabitat() - } - if o.Movingwater != nil { - m.Movingwater = o.Movingwater() - } - if o.Negdips != nil { - m.Negdips = o.Negdips() - } - if o.Nowaterever != nil { - m.Nowaterever = o.Nowaterever() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Pointlocid != nil { - m.Pointlocid = o.Pointlocid() - } - if o.Polygonlocid != nil { - m.Polygonlocid = o.Polygonlocid() - } - if o.Posdips != nil { - m.Posdips = o.Posdips() - } - if o.Potential != nil { - m.Potential = o.Potential() - } - if o.Raingauge != nil { - m.Raingauge = o.Raingauge() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Reviewed != nil { - m.Reviewed = o.Reviewed() - } - if o.Reviewedby != nil { - m.Reviewedby = o.Reviewedby() - } - if o.Revieweddate != nil { - m.Revieweddate = o.Revieweddate() - } - if o.Sitetype != nil { - m.Sitetype = o.Sitetype() - } - if o.Soilconditions != nil { - m.Soilconditions = o.Soilconditions() - } - if o.Sourcereduction != nil { - m.Sourcereduction = o.Sourcereduction() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Totalacres != nil { - m.Totalacres = o.Totalacres() - } - if o.Vegetation != nil { - m.Vegetation = o.Vegetation() - } - if o.Waterconditions != nil { - m.Waterconditions = o.Waterconditions() - } - if o.Waterduration != nil { - m.Waterduration = o.Waterduration() - } - if o.Watermovement1 != nil { - m.Watermovement1 = o.Watermovement1() - } - if o.Watermovement1percent != nil { - m.Watermovement1percent = o.Watermovement1percent() - } - if o.Watermovement2 != nil { - m.Watermovement2 = o.Watermovement2() - } - if o.Watermovement2percent != nil { - m.Watermovement2percent = o.Watermovement2percent() - } - if o.Waterpresent != nil { - m.Waterpresent = o.Waterpresent() - } - if o.Watersource != nil { - m.Watersource = o.Watersource() - } - if o.Winddir != nil { - m.Winddir = o.Winddir() - } - if o.Windspeed != nil { - m.Windspeed = o.Windspeed() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryQamosquitoinspectionSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryQamosquitoinspectionTemplate.CreateMany -func (o HistoryQamosquitoinspectionTemplate) BuildMany(number int) models.HistoryQamosquitoinspectionSlice { - m := make(models.HistoryQamosquitoinspectionSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryQamosquitoinspection(m *models.HistoryQamosquitoinspectionSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryQamosquitoinspection -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryQamosquitoinspectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryQamosquitoinspection) error { - var err error - - return err -} - -// Create builds a historyQamosquitoinspection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryQamosquitoinspectionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryQamosquitoinspection, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryQamosquitoinspection(opt) - - if o.r.Organization == nil { - HistoryQamosquitoinspectionMods.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.HistoryQamosquitoinspections.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 historyQamosquitoinspection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryQamosquitoinspectionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryQamosquitoinspection { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyQamosquitoinspection 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 *HistoryQamosquitoinspectionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryQamosquitoinspection { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyQamosquitoinspections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryQamosquitoinspectionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryQamosquitoinspectionSlice, error) { - var err error - m := make(models.HistoryQamosquitoinspectionSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyQamosquitoinspections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryQamosquitoinspectionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryQamosquitoinspectionSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyQamosquitoinspections 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 HistoryQamosquitoinspectionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryQamosquitoinspectionSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryQamosquitoinspection has methods that act as mods for the HistoryQamosquitoinspectionTemplate -var HistoryQamosquitoinspectionMods historyQamosquitoinspectionMods - -type historyQamosquitoinspectionMods struct{} - -func (m historyQamosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModSlice{ - HistoryQamosquitoinspectionMods.RandomOrganizationID(f), - HistoryQamosquitoinspectionMods.RandomAcresbreeding(f), - HistoryQamosquitoinspectionMods.RandomActiontaken(f), - HistoryQamosquitoinspectionMods.RandomAdultactivity(f), - HistoryQamosquitoinspectionMods.RandomAquaticorganisms(f), - HistoryQamosquitoinspectionMods.RandomAvetemp(f), - HistoryQamosquitoinspectionMods.RandomBreedingpotential(f), - HistoryQamosquitoinspectionMods.RandomComments(f), - HistoryQamosquitoinspectionMods.RandomCreationdate(f), - HistoryQamosquitoinspectionMods.RandomCreator(f), - HistoryQamosquitoinspectionMods.RandomEnddatetime(f), - HistoryQamosquitoinspectionMods.RandomEditdate(f), - HistoryQamosquitoinspectionMods.RandomEditor(f), - HistoryQamosquitoinspectionMods.RandomFieldtech(f), - HistoryQamosquitoinspectionMods.RandomFish(f), - HistoryQamosquitoinspectionMods.RandomGlobalid(f), - HistoryQamosquitoinspectionMods.RandomHabvalue1(f), - HistoryQamosquitoinspectionMods.RandomHabvalue1percent(f), - HistoryQamosquitoinspectionMods.RandomHabvalue2(f), - HistoryQamosquitoinspectionMods.RandomHabvalue2percent(f), - HistoryQamosquitoinspectionMods.RandomLarvaeinsidetreatedarea(f), - HistoryQamosquitoinspectionMods.RandomLarvaeoutsidetreatedarea(f), - HistoryQamosquitoinspectionMods.RandomLarvaepresent(f), - HistoryQamosquitoinspectionMods.RandomLarvaereason(f), - HistoryQamosquitoinspectionMods.RandomLinelocid(f), - HistoryQamosquitoinspectionMods.RandomLocationname(f), - HistoryQamosquitoinspectionMods.RandomLR(f), - HistoryQamosquitoinspectionMods.RandomMosquitohabitat(f), - HistoryQamosquitoinspectionMods.RandomMovingwater(f), - HistoryQamosquitoinspectionMods.RandomNegdips(f), - HistoryQamosquitoinspectionMods.RandomNowaterever(f), - HistoryQamosquitoinspectionMods.RandomObjectid(f), - HistoryQamosquitoinspectionMods.RandomPointlocid(f), - HistoryQamosquitoinspectionMods.RandomPolygonlocid(f), - HistoryQamosquitoinspectionMods.RandomPosdips(f), - HistoryQamosquitoinspectionMods.RandomPotential(f), - HistoryQamosquitoinspectionMods.RandomRaingauge(f), - HistoryQamosquitoinspectionMods.RandomRecordstatus(f), - HistoryQamosquitoinspectionMods.RandomReviewed(f), - HistoryQamosquitoinspectionMods.RandomReviewedby(f), - HistoryQamosquitoinspectionMods.RandomRevieweddate(f), - HistoryQamosquitoinspectionMods.RandomSitetype(f), - HistoryQamosquitoinspectionMods.RandomSoilconditions(f), - HistoryQamosquitoinspectionMods.RandomSourcereduction(f), - HistoryQamosquitoinspectionMods.RandomStartdatetime(f), - HistoryQamosquitoinspectionMods.RandomTotalacres(f), - HistoryQamosquitoinspectionMods.RandomVegetation(f), - HistoryQamosquitoinspectionMods.RandomWaterconditions(f), - HistoryQamosquitoinspectionMods.RandomWaterduration(f), - HistoryQamosquitoinspectionMods.RandomWatermovement1(f), - HistoryQamosquitoinspectionMods.RandomWatermovement1percent(f), - HistoryQamosquitoinspectionMods.RandomWatermovement2(f), - HistoryQamosquitoinspectionMods.RandomWatermovement2percent(f), - HistoryQamosquitoinspectionMods.RandomWaterpresent(f), - HistoryQamosquitoinspectionMods.RandomWatersource(f), - HistoryQamosquitoinspectionMods.RandomWinddir(f), - HistoryQamosquitoinspectionMods.RandomWindspeed(f), - HistoryQamosquitoinspectionMods.RandomZone(f), - HistoryQamosquitoinspectionMods.RandomZone2(f), - HistoryQamosquitoinspectionMods.RandomCreated(f), - HistoryQamosquitoinspectionMods.RandomCreatedDate(f), - HistoryQamosquitoinspectionMods.RandomCreatedUser(f), - HistoryQamosquitoinspectionMods.RandomGeometryX(f), - HistoryQamosquitoinspectionMods.RandomGeometryY(f), - HistoryQamosquitoinspectionMods.RandomLastEditedDate(f), - HistoryQamosquitoinspectionMods.RandomLastEditedUser(f), - HistoryQamosquitoinspectionMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) OrganizationID(val int32) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) OrganizationIDFunc(f func() int32) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetOrganizationID() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - 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 historyQamosquitoinspectionMods) RandomOrganizationID(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Acresbreeding(val null.Val[float64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Acresbreeding = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) AcresbreedingFunc(f func() null.Val[float64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Acresbreeding = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetAcresbreeding() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Acresbreeding = 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 historyQamosquitoinspectionMods) RandomAcresbreeding(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Acresbreeding = 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 historyQamosquitoinspectionMods) RandomAcresbreedingNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Acresbreeding = 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 historyQamosquitoinspectionMods) Actiontaken(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) ActiontakenFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Actiontaken = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetActiontaken() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Actiontaken = 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 historyQamosquitoinspectionMods) RandomActiontaken(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Actiontaken = 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 historyQamosquitoinspectionMods) RandomActiontakenNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Actiontaken = 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 historyQamosquitoinspectionMods) Adultactivity(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Adultactivity = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) AdultactivityFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Adultactivity = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetAdultactivity() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Adultactivity = 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 historyQamosquitoinspectionMods) RandomAdultactivity(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Adultactivity = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomAdultactivityNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Adultactivity = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Aquaticorganisms(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Aquaticorganisms = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) AquaticorganismsFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Aquaticorganisms = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetAquaticorganisms() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Aquaticorganisms = 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 historyQamosquitoinspectionMods) RandomAquaticorganisms(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Aquaticorganisms = 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 historyQamosquitoinspectionMods) RandomAquaticorganismsNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Aquaticorganisms = 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 historyQamosquitoinspectionMods) Avetemp(val null.Val[float64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Avetemp = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) AvetempFunc(f func() null.Val[float64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Avetemp = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetAvetemp() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Avetemp = 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 historyQamosquitoinspectionMods) RandomAvetemp(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Avetemp = 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 historyQamosquitoinspectionMods) RandomAvetempNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Avetemp = 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 historyQamosquitoinspectionMods) Breedingpotential(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Breedingpotential = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) BreedingpotentialFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Breedingpotential = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetBreedingpotential() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Breedingpotential = 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 historyQamosquitoinspectionMods) RandomBreedingpotential(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Breedingpotential = 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 historyQamosquitoinspectionMods) RandomBreedingpotentialNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Breedingpotential = 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 historyQamosquitoinspectionMods) Comments(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) CommentsFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetComments() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Comments = 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 historyQamosquitoinspectionMods) RandomComments(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Comments = 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 historyQamosquitoinspectionMods) RandomCommentsNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Comments = 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 historyQamosquitoinspectionMods) Creationdate(val null.Val[int64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) CreationdateFunc(f func() null.Val[int64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetCreationdate() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Creationdate = 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 historyQamosquitoinspectionMods) RandomCreationdate(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyQamosquitoinspectionMods) RandomCreationdateNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Creator(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) CreatorFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetCreator() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Creator = 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 historyQamosquitoinspectionMods) RandomCreator(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Creator = 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 historyQamosquitoinspectionMods) RandomCreatorNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Creator = 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 historyQamosquitoinspectionMods) Enddatetime(val null.Val[int64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Enddatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) EnddatetimeFunc(f func() null.Val[int64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetEnddatetime() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Enddatetime = 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 historyQamosquitoinspectionMods) RandomEnddatetime(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyQamosquitoinspectionMods) RandomEnddatetimeNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Editdate(val null.Val[int64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) EditdateFunc(f func() null.Val[int64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetEditdate() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Editdate = 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 historyQamosquitoinspectionMods) RandomEditdate(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyQamosquitoinspectionMods) RandomEditdateNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Editor(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) EditorFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetEditor() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Editor = 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 historyQamosquitoinspectionMods) RandomEditor(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Editor = 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 historyQamosquitoinspectionMods) RandomEditorNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Editor = 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 historyQamosquitoinspectionMods) Fieldtech(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) FieldtechFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetFieldtech() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Fieldtech = 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 historyQamosquitoinspectionMods) RandomFieldtech(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Fieldtech = 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 historyQamosquitoinspectionMods) RandomFieldtechNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Fieldtech = 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 historyQamosquitoinspectionMods) Fish(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Fish = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) FishFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Fish = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetFish() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Fish = 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 historyQamosquitoinspectionMods) RandomFish(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Fish = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomFishNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Fish = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Globalid(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) GlobalidFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetGlobalid() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Globalid = 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 historyQamosquitoinspectionMods) RandomGlobalid(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - 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 historyQamosquitoinspectionMods) RandomGlobalidNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Globalid = 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 historyQamosquitoinspectionMods) Habvalue1(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue1 = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) Habvalue1Func(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue1 = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetHabvalue1() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue1 = 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 historyQamosquitoinspectionMods) RandomHabvalue1(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue1 = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomHabvalue1NotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue1 = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Habvalue1percent(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue1percent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) Habvalue1percentFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue1percent = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetHabvalue1percent() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue1percent = 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 historyQamosquitoinspectionMods) RandomHabvalue1percent(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue1percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomHabvalue1percentNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue1percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Habvalue2(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue2 = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) Habvalue2Func(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue2 = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetHabvalue2() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue2 = 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 historyQamosquitoinspectionMods) RandomHabvalue2(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue2 = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomHabvalue2NotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue2 = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Habvalue2percent(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue2percent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) Habvalue2percentFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue2percent = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetHabvalue2percent() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue2percent = 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 historyQamosquitoinspectionMods) RandomHabvalue2percent(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue2percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomHabvalue2percentNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Habvalue2percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Larvaeinsidetreatedarea(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaeinsidetreatedarea = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) LarvaeinsidetreatedareaFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaeinsidetreatedarea = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetLarvaeinsidetreatedarea() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaeinsidetreatedarea = 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 historyQamosquitoinspectionMods) RandomLarvaeinsidetreatedarea(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaeinsidetreatedarea = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomLarvaeinsidetreatedareaNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaeinsidetreatedarea = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Larvaeoutsidetreatedarea(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaeoutsidetreatedarea = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) LarvaeoutsidetreatedareaFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaeoutsidetreatedarea = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetLarvaeoutsidetreatedarea() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaeoutsidetreatedarea = 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 historyQamosquitoinspectionMods) RandomLarvaeoutsidetreatedarea(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaeoutsidetreatedarea = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomLarvaeoutsidetreatedareaNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaeoutsidetreatedarea = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Larvaepresent(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) LarvaepresentFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaepresent = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetLarvaepresent() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaepresent = 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 historyQamosquitoinspectionMods) RandomLarvaepresent(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomLarvaepresentNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Larvaereason(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaereason = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) LarvaereasonFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaereason = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetLarvaereason() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaereason = 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 historyQamosquitoinspectionMods) RandomLarvaereason(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaereason = 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 historyQamosquitoinspectionMods) RandomLarvaereasonNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Larvaereason = 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 historyQamosquitoinspectionMods) Linelocid(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Linelocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) LinelocidFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Linelocid = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetLinelocid() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Linelocid = 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 historyQamosquitoinspectionMods) RandomLinelocid(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Linelocid = 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 historyQamosquitoinspectionMods) RandomLinelocidNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Linelocid = 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 historyQamosquitoinspectionMods) Locationname(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) LocationnameFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetLocationname() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Locationname = 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 historyQamosquitoinspectionMods) RandomLocationname(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Locationname = 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 historyQamosquitoinspectionMods) RandomLocationnameNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Locationname = 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 historyQamosquitoinspectionMods) LR(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.LR = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) LRFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.LR = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetLR() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.LR = 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 historyQamosquitoinspectionMods) RandomLR(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.LR = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomLRNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.LR = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Mosquitohabitat(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Mosquitohabitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) MosquitohabitatFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Mosquitohabitat = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetMosquitohabitat() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Mosquitohabitat = 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 historyQamosquitoinspectionMods) RandomMosquitohabitat(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Mosquitohabitat = 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 historyQamosquitoinspectionMods) RandomMosquitohabitatNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Mosquitohabitat = 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 historyQamosquitoinspectionMods) Movingwater(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Movingwater = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) MovingwaterFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Movingwater = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetMovingwater() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Movingwater = 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 historyQamosquitoinspectionMods) RandomMovingwater(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Movingwater = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomMovingwaterNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Movingwater = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Negdips(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Negdips = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) NegdipsFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Negdips = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetNegdips() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Negdips = 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 historyQamosquitoinspectionMods) RandomNegdips(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Negdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomNegdipsNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Negdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Nowaterever(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Nowaterever = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) NowatereverFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Nowaterever = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetNowaterever() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Nowaterever = 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 historyQamosquitoinspectionMods) RandomNowaterever(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Nowaterever = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomNowatereverNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Nowaterever = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Objectid(val int32) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) ObjectidFunc(f func() int32) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetObjectid() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyQamosquitoinspectionMods) RandomObjectid(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Pointlocid(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Pointlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) PointlocidFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Pointlocid = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetPointlocid() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Pointlocid = 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 historyQamosquitoinspectionMods) RandomPointlocid(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Pointlocid = 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 historyQamosquitoinspectionMods) RandomPointlocidNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Pointlocid = 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 historyQamosquitoinspectionMods) Polygonlocid(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Polygonlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) PolygonlocidFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Polygonlocid = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetPolygonlocid() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Polygonlocid = 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 historyQamosquitoinspectionMods) RandomPolygonlocid(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Polygonlocid = 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 historyQamosquitoinspectionMods) RandomPolygonlocidNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Polygonlocid = 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 historyQamosquitoinspectionMods) Posdips(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Posdips = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) PosdipsFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Posdips = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetPosdips() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Posdips = 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 historyQamosquitoinspectionMods) RandomPosdips(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Posdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomPosdipsNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Posdips = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Potential(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Potential = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) PotentialFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Potential = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetPotential() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Potential = 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 historyQamosquitoinspectionMods) RandomPotential(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Potential = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomPotentialNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Potential = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Raingauge(val null.Val[float64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Raingauge = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) RaingaugeFunc(f func() null.Val[float64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Raingauge = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetRaingauge() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Raingauge = 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 historyQamosquitoinspectionMods) RandomRaingauge(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Raingauge = 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 historyQamosquitoinspectionMods) RandomRaingaugeNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Raingauge = 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 historyQamosquitoinspectionMods) Recordstatus(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) RecordstatusFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetRecordstatus() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Recordstatus = 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 historyQamosquitoinspectionMods) RandomRecordstatus(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomRecordstatusNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Reviewed(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) ReviewedFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetReviewed() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Reviewed = 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 historyQamosquitoinspectionMods) RandomReviewed(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomReviewedNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Reviewedby(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) ReviewedbyFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetReviewedby() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Reviewedby = 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 historyQamosquitoinspectionMods) RandomReviewedby(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Reviewedby = 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 historyQamosquitoinspectionMods) RandomReviewedbyNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Reviewedby = 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 historyQamosquitoinspectionMods) Revieweddate(val null.Val[int64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Revieweddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) RevieweddateFunc(f func() null.Val[int64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetRevieweddate() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Revieweddate = 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 historyQamosquitoinspectionMods) RandomRevieweddate(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyQamosquitoinspectionMods) RandomRevieweddateNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Sitetype(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Sitetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) SitetypeFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Sitetype = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetSitetype() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Sitetype = 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 historyQamosquitoinspectionMods) RandomSitetype(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Sitetype = 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 historyQamosquitoinspectionMods) RandomSitetypeNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Sitetype = 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 historyQamosquitoinspectionMods) Soilconditions(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Soilconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) SoilconditionsFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Soilconditions = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetSoilconditions() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Soilconditions = 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 historyQamosquitoinspectionMods) RandomSoilconditions(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Soilconditions = 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 historyQamosquitoinspectionMods) RandomSoilconditionsNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Soilconditions = 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 historyQamosquitoinspectionMods) Sourcereduction(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Sourcereduction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) SourcereductionFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Sourcereduction = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetSourcereduction() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Sourcereduction = 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 historyQamosquitoinspectionMods) RandomSourcereduction(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Sourcereduction = 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 historyQamosquitoinspectionMods) RandomSourcereductionNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Sourcereduction = 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 historyQamosquitoinspectionMods) Startdatetime(val null.Val[int64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Startdatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) StartdatetimeFunc(f func() null.Val[int64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetStartdatetime() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Startdatetime = 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 historyQamosquitoinspectionMods) RandomStartdatetime(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyQamosquitoinspectionMods) RandomStartdatetimeNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Totalacres(val null.Val[float64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Totalacres = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) TotalacresFunc(f func() null.Val[float64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Totalacres = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetTotalacres() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Totalacres = 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 historyQamosquitoinspectionMods) RandomTotalacres(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Totalacres = 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 historyQamosquitoinspectionMods) RandomTotalacresNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Totalacres = 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 historyQamosquitoinspectionMods) Vegetation(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Vegetation = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) VegetationFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Vegetation = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetVegetation() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Vegetation = 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 historyQamosquitoinspectionMods) RandomVegetation(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Vegetation = 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 historyQamosquitoinspectionMods) RandomVegetationNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Vegetation = 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 historyQamosquitoinspectionMods) Waterconditions(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Waterconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) WaterconditionsFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Waterconditions = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetWaterconditions() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Waterconditions = 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 historyQamosquitoinspectionMods) RandomWaterconditions(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Waterconditions = 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 historyQamosquitoinspectionMods) RandomWaterconditionsNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Waterconditions = 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 historyQamosquitoinspectionMods) Waterduration(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Waterduration = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) WaterdurationFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Waterduration = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetWaterduration() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Waterduration = 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 historyQamosquitoinspectionMods) RandomWaterduration(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Waterduration = 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 historyQamosquitoinspectionMods) RandomWaterdurationNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Waterduration = 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 historyQamosquitoinspectionMods) Watermovement1(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement1 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) Watermovement1Func(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement1 = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetWatermovement1() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement1 = 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 historyQamosquitoinspectionMods) RandomWatermovement1(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement1 = 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 historyQamosquitoinspectionMods) RandomWatermovement1NotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement1 = 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 historyQamosquitoinspectionMods) Watermovement1percent(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement1percent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) Watermovement1percentFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement1percent = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetWatermovement1percent() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement1percent = 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 historyQamosquitoinspectionMods) RandomWatermovement1percent(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement1percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomWatermovement1percentNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement1percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Watermovement2(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) Watermovement2Func(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement2 = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetWatermovement2() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement2 = 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 historyQamosquitoinspectionMods) RandomWatermovement2(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement2 = 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 historyQamosquitoinspectionMods) RandomWatermovement2NotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement2 = 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 historyQamosquitoinspectionMods) Watermovement2percent(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement2percent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) Watermovement2percentFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement2percent = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetWatermovement2percent() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement2percent = 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 historyQamosquitoinspectionMods) RandomWatermovement2percent(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement2percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomWatermovement2percentNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watermovement2percent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Waterpresent(val null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Waterpresent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) WaterpresentFunc(f func() null.Val[int16]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Waterpresent = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetWaterpresent() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Waterpresent = 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 historyQamosquitoinspectionMods) RandomWaterpresent(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Waterpresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyQamosquitoinspectionMods) RandomWaterpresentNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Waterpresent = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) Watersource(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watersource = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) WatersourceFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watersource = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetWatersource() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watersource = 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 historyQamosquitoinspectionMods) RandomWatersource(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watersource = 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 historyQamosquitoinspectionMods) RandomWatersourceNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Watersource = 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 historyQamosquitoinspectionMods) Winddir(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Winddir = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) WinddirFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Winddir = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetWinddir() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Winddir = 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 historyQamosquitoinspectionMods) RandomWinddir(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Winddir = 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 historyQamosquitoinspectionMods) RandomWinddirNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Winddir = 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 historyQamosquitoinspectionMods) Windspeed(val null.Val[float64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Windspeed = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) WindspeedFunc(f func() null.Val[float64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Windspeed = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetWindspeed() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Windspeed = 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 historyQamosquitoinspectionMods) RandomWindspeed(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Windspeed = 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 historyQamosquitoinspectionMods) RandomWindspeedNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Windspeed = 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 historyQamosquitoinspectionMods) Zone(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) ZoneFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetZone() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Zone = 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 historyQamosquitoinspectionMods) RandomZone(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Zone = 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 historyQamosquitoinspectionMods) RandomZoneNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Zone = 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 historyQamosquitoinspectionMods) Zone2(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) Zone2Func(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetZone2() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Zone2 = 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 historyQamosquitoinspectionMods) RandomZone2(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Zone2 = 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 historyQamosquitoinspectionMods) RandomZone2NotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Zone2 = 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 historyQamosquitoinspectionMods) Created(val null.Val[time.Time]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) CreatedFunc(f func() null.Val[time.Time]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetCreated() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Created = 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 historyQamosquitoinspectionMods) RandomCreated(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyQamosquitoinspectionMods) RandomCreatedNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) CreatedDate(val null.Val[int64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) CreatedDateFunc(f func() null.Val[int64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetCreatedDate() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.CreatedDate = 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 historyQamosquitoinspectionMods) RandomCreatedDate(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyQamosquitoinspectionMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) CreatedUser(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) CreatedUserFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetCreatedUser() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.CreatedUser = 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 historyQamosquitoinspectionMods) RandomCreatedUser(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.CreatedUser = 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 historyQamosquitoinspectionMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.CreatedUser = 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 historyQamosquitoinspectionMods) GeometryX(val null.Val[float64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) GeometryXFunc(f func() null.Val[float64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetGeometryX() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.GeometryX = 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 historyQamosquitoinspectionMods) RandomGeometryX(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - 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 historyQamosquitoinspectionMods) RandomGeometryXNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.GeometryX = 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 historyQamosquitoinspectionMods) GeometryY(val null.Val[float64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) GeometryYFunc(f func() null.Val[float64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetGeometryY() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.GeometryY = 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 historyQamosquitoinspectionMods) RandomGeometryY(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - 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 historyQamosquitoinspectionMods) RandomGeometryYNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.GeometryY = 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 historyQamosquitoinspectionMods) LastEditedDate(val null.Val[int64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetLastEditedDate() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.LastEditedDate = 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 historyQamosquitoinspectionMods) RandomLastEditedDate(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyQamosquitoinspectionMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyQamosquitoinspectionMods) LastEditedUser(val null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) LastEditedUserFunc(f func() null.Val[string]) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetLastEditedUser() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.LastEditedUser = 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 historyQamosquitoinspectionMods) RandomLastEditedUser(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.LastEditedUser = 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 historyQamosquitoinspectionMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.LastEditedUser = 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 historyQamosquitoinspectionMods) Version(val int32) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyQamosquitoinspectionMods) VersionFunc(f func() int32) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyQamosquitoinspectionMods) UnsetVersion() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyQamosquitoinspectionMods) RandomVersion(f *faker.Faker) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(_ context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyQamosquitoinspectionMods) WithParentsCascading() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(ctx context.Context, o *HistoryQamosquitoinspectionTemplate) { - if isDone, _ := historyQamosquitoinspectionWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyQamosquitoinspectionWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyQamosquitoinspectionMods) WithOrganization(rel *OrganizationTemplate) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(ctx context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.r.Organization = &historyQamosquitoinspectionROrganizationR{ - o: rel, - } - }) -} - -func (m historyQamosquitoinspectionMods) WithNewOrganization(mods ...OrganizationMod) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(ctx context.Context, o *HistoryQamosquitoinspectionTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyQamosquitoinspectionMods) WithExistingOrganization(em *models.Organization) HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(ctx context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.r.Organization = &historyQamosquitoinspectionROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyQamosquitoinspectionMods) WithoutOrganization() HistoryQamosquitoinspectionMod { - return HistoryQamosquitoinspectionModFunc(func(ctx context.Context, o *HistoryQamosquitoinspectionTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_rodentlocation.bob.go b/db/factory/history_rodentlocation.bob.go deleted file mode 100644 index 2edebd48..00000000 --- a/db/factory/history_rodentlocation.bob.go +++ /dev/null @@ -1,2400 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryRodentlocationMod interface { - Apply(context.Context, *HistoryRodentlocationTemplate) -} - -type HistoryRodentlocationModFunc func(context.Context, *HistoryRodentlocationTemplate) - -func (f HistoryRodentlocationModFunc) Apply(ctx context.Context, n *HistoryRodentlocationTemplate) { - f(ctx, n) -} - -type HistoryRodentlocationModSlice []HistoryRodentlocationMod - -func (mods HistoryRodentlocationModSlice) Apply(ctx context.Context, n *HistoryRodentlocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryRodentlocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryRodentlocationTemplate struct { - OrganizationID func() int32 - Accessdesc func() null.Val[string] - Active func() null.Val[int16] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Description func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() null.Val[string] - Habitat func() null.Val[string] - Lastinspectaction func() null.Val[string] - Lastinspectconditions func() null.Val[string] - Lastinspectdate func() null.Val[int64] - Lastinspectrodentevidence func() null.Val[string] - Lastinspectspecies func() null.Val[string] - Locationname func() null.Val[string] - Locationnumber func() null.Val[int64] - Nextactiondatescheduled func() null.Val[int64] - Objectid func() int32 - Priority func() null.Val[string] - Symbology func() null.Val[string] - Usetype func() null.Val[string] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Jurisdiction func() null.Val[string] - Version func() int32 - - r historyRodentlocationR - f *Factory - - alreadyPersisted bool -} - -type historyRodentlocationR struct { - Organization *historyRodentlocationROrganizationR -} - -type historyRodentlocationROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryRodentlocationTemplate -func (o *HistoryRodentlocationTemplate) Apply(ctx context.Context, mods ...HistoryRodentlocationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryRodentlocation -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryRodentlocationTemplate) setModelRels(o *models.HistoryRodentlocation) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryRodentlocations = append(rel.R.HistoryRodentlocations, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryRodentlocationSetter -// this does nothing with the relationship templates -func (o HistoryRodentlocationTemplate) BuildSetter() *models.HistoryRodentlocationSetter { - m := &models.HistoryRodentlocationSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(val) - } - if o.Lastinspectaction != nil { - val := o.Lastinspectaction() - m.Lastinspectaction = omitnull.FromNull(val) - } - if o.Lastinspectconditions != nil { - val := o.Lastinspectconditions() - m.Lastinspectconditions = omitnull.FromNull(val) - } - if o.Lastinspectdate != nil { - val := o.Lastinspectdate() - m.Lastinspectdate = omitnull.FromNull(val) - } - if o.Lastinspectrodentevidence != nil { - val := o.Lastinspectrodentevidence() - m.Lastinspectrodentevidence = omitnull.FromNull(val) - } - if o.Lastinspectspecies != nil { - val := o.Lastinspectspecies() - m.Lastinspectspecies = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Symbology != nil { - val := o.Symbology() - m.Symbology = omitnull.FromNull(val) - } - if o.Usetype != nil { - val := o.Usetype() - m.Usetype = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryRodentlocationSetter -// this does nothing with the relationship templates -func (o HistoryRodentlocationTemplate) BuildManySetter(number int) []*models.HistoryRodentlocationSetter { - m := make([]*models.HistoryRodentlocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryRodentlocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryRodentlocationTemplate.Create -func (o HistoryRodentlocationTemplate) Build() *models.HistoryRodentlocation { - m := &models.HistoryRodentlocation{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Lastinspectaction != nil { - m.Lastinspectaction = o.Lastinspectaction() - } - if o.Lastinspectconditions != nil { - m.Lastinspectconditions = o.Lastinspectconditions() - } - if o.Lastinspectdate != nil { - m.Lastinspectdate = o.Lastinspectdate() - } - if o.Lastinspectrodentevidence != nil { - m.Lastinspectrodentevidence = o.Lastinspectrodentevidence() - } - if o.Lastinspectspecies != nil { - m.Lastinspectspecies = o.Lastinspectspecies() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Symbology != nil { - m.Symbology = o.Symbology() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryRodentlocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryRodentlocationTemplate.CreateMany -func (o HistoryRodentlocationTemplate) BuildMany(number int) models.HistoryRodentlocationSlice { - m := make(models.HistoryRodentlocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryRodentlocation(m *models.HistoryRodentlocationSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryRodentlocation -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryRodentlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryRodentlocation) error { - var err error - - return err -} - -// Create builds a historyRodentlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryRodentlocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryRodentlocation, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryRodentlocation(opt) - - if o.r.Organization == nil { - HistoryRodentlocationMods.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.HistoryRodentlocations.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 historyRodentlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryRodentlocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryRodentlocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyRodentlocation 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 *HistoryRodentlocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryRodentlocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyRodentlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryRodentlocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryRodentlocationSlice, error) { - var err error - m := make(models.HistoryRodentlocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyRodentlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryRodentlocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryRodentlocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyRodentlocations 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 HistoryRodentlocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryRodentlocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryRodentlocation has methods that act as mods for the HistoryRodentlocationTemplate -var HistoryRodentlocationMods historyRodentlocationMods - -type historyRodentlocationMods struct{} - -func (m historyRodentlocationMods) RandomizeAllColumns(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModSlice{ - HistoryRodentlocationMods.RandomOrganizationID(f), - HistoryRodentlocationMods.RandomAccessdesc(f), - HistoryRodentlocationMods.RandomActive(f), - HistoryRodentlocationMods.RandomComments(f), - HistoryRodentlocationMods.RandomCreationdate(f), - HistoryRodentlocationMods.RandomCreator(f), - HistoryRodentlocationMods.RandomDescription(f), - HistoryRodentlocationMods.RandomExternalid(f), - HistoryRodentlocationMods.RandomEditdate(f), - HistoryRodentlocationMods.RandomEditor(f), - HistoryRodentlocationMods.RandomGlobalid(f), - HistoryRodentlocationMods.RandomHabitat(f), - HistoryRodentlocationMods.RandomLastinspectaction(f), - HistoryRodentlocationMods.RandomLastinspectconditions(f), - HistoryRodentlocationMods.RandomLastinspectdate(f), - HistoryRodentlocationMods.RandomLastinspectrodentevidence(f), - HistoryRodentlocationMods.RandomLastinspectspecies(f), - HistoryRodentlocationMods.RandomLocationname(f), - HistoryRodentlocationMods.RandomLocationnumber(f), - HistoryRodentlocationMods.RandomNextactiondatescheduled(f), - HistoryRodentlocationMods.RandomObjectid(f), - HistoryRodentlocationMods.RandomPriority(f), - HistoryRodentlocationMods.RandomSymbology(f), - HistoryRodentlocationMods.RandomUsetype(f), - HistoryRodentlocationMods.RandomZone(f), - HistoryRodentlocationMods.RandomZone2(f), - HistoryRodentlocationMods.RandomCreated(f), - HistoryRodentlocationMods.RandomCreatedDate(f), - HistoryRodentlocationMods.RandomCreatedUser(f), - HistoryRodentlocationMods.RandomGeometryX(f), - HistoryRodentlocationMods.RandomGeometryY(f), - HistoryRodentlocationMods.RandomLastEditedDate(f), - HistoryRodentlocationMods.RandomLastEditedUser(f), - HistoryRodentlocationMods.RandomJurisdiction(f), - HistoryRodentlocationMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyRodentlocationMods) OrganizationID(val int32) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) OrganizationIDFunc(f func() int32) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetOrganizationID() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - 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 historyRodentlocationMods) RandomOrganizationID(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyRodentlocationMods) Accessdesc(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) AccessdescFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetAccessdesc() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Accessdesc = 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 historyRodentlocationMods) RandomAccessdesc(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Accessdesc = 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 historyRodentlocationMods) RandomAccessdescNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Accessdesc = 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 historyRodentlocationMods) Active(val null.Val[int16]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) ActiveFunc(f func() null.Val[int16]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetActive() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Active = 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 historyRodentlocationMods) RandomActive(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyRodentlocationMods) RandomActiveNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyRodentlocationMods) Comments(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) CommentsFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetComments() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Comments = 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 historyRodentlocationMods) RandomComments(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Comments = 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 historyRodentlocationMods) RandomCommentsNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Comments = 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 historyRodentlocationMods) Creationdate(val null.Val[int64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) CreationdateFunc(f func() null.Val[int64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetCreationdate() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Creationdate = 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 historyRodentlocationMods) RandomCreationdate(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyRodentlocationMods) RandomCreationdateNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyRodentlocationMods) Creator(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) CreatorFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetCreator() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Creator = 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 historyRodentlocationMods) RandomCreator(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Creator = 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 historyRodentlocationMods) RandomCreatorNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Creator = 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 historyRodentlocationMods) Description(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) DescriptionFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetDescription() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Description = 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 historyRodentlocationMods) RandomDescription(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Description = 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 historyRodentlocationMods) RandomDescriptionNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Description = 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 historyRodentlocationMods) Externalid(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) ExternalidFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetExternalid() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Externalid = 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 historyRodentlocationMods) RandomExternalid(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Externalid = 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 historyRodentlocationMods) RandomExternalidNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Externalid = 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 historyRodentlocationMods) Editdate(val null.Val[int64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) EditdateFunc(f func() null.Val[int64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetEditdate() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Editdate = 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 historyRodentlocationMods) RandomEditdate(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyRodentlocationMods) RandomEditdateNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyRodentlocationMods) Editor(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) EditorFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetEditor() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Editor = 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 historyRodentlocationMods) RandomEditor(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Editor = 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 historyRodentlocationMods) RandomEditorNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Editor = 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 historyRodentlocationMods) Globalid(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) GlobalidFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetGlobalid() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Globalid = 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 historyRodentlocationMods) RandomGlobalid(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - 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 historyRodentlocationMods) RandomGlobalidNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Globalid = 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 historyRodentlocationMods) Habitat(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) HabitatFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetHabitat() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Habitat = 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 historyRodentlocationMods) RandomHabitat(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Habitat = 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 historyRodentlocationMods) RandomHabitatNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Habitat = 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 historyRodentlocationMods) Lastinspectaction(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectaction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) LastinspectactionFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectaction = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetLastinspectaction() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectaction = 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 historyRodentlocationMods) RandomLastinspectaction(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectaction = 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 historyRodentlocationMods) RandomLastinspectactionNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectaction = 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 historyRodentlocationMods) Lastinspectconditions(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) LastinspectconditionsFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectconditions = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetLastinspectconditions() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectconditions = 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 historyRodentlocationMods) RandomLastinspectconditions(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectconditions = 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 historyRodentlocationMods) RandomLastinspectconditionsNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectconditions = 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 historyRodentlocationMods) Lastinspectdate(val null.Val[int64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) LastinspectdateFunc(f func() null.Val[int64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectdate = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetLastinspectdate() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectdate = 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 historyRodentlocationMods) RandomLastinspectdate(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyRodentlocationMods) RandomLastinspectdateNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyRodentlocationMods) Lastinspectrodentevidence(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectrodentevidence = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) LastinspectrodentevidenceFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectrodentevidence = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetLastinspectrodentevidence() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectrodentevidence = 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 historyRodentlocationMods) RandomLastinspectrodentevidence(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectrodentevidence = 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 historyRodentlocationMods) RandomLastinspectrodentevidenceNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectrodentevidence = 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 historyRodentlocationMods) Lastinspectspecies(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) LastinspectspeciesFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectspecies = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetLastinspectspecies() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectspecies = 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 historyRodentlocationMods) RandomLastinspectspecies(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectspecies = 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 historyRodentlocationMods) RandomLastinspectspeciesNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Lastinspectspecies = 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 historyRodentlocationMods) Locationname(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) LocationnameFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetLocationname() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Locationname = 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 historyRodentlocationMods) RandomLocationname(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Locationname = 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 historyRodentlocationMods) RandomLocationnameNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Locationname = 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 historyRodentlocationMods) Locationnumber(val null.Val[int64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) LocationnumberFunc(f func() null.Val[int64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetLocationnumber() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Locationnumber = 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 historyRodentlocationMods) RandomLocationnumber(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyRodentlocationMods) RandomLocationnumberNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyRodentlocationMods) Nextactiondatescheduled(val null.Val[int64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetNextactiondatescheduled() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Nextactiondatescheduled = 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 historyRodentlocationMods) RandomNextactiondatescheduled(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyRodentlocationMods) RandomNextactiondatescheduledNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyRodentlocationMods) Objectid(val int32) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) ObjectidFunc(f func() int32) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetObjectid() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyRodentlocationMods) RandomObjectid(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyRodentlocationMods) Priority(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) PriorityFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetPriority() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Priority = 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 historyRodentlocationMods) RandomPriority(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Priority = 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 historyRodentlocationMods) RandomPriorityNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Priority = 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 historyRodentlocationMods) Symbology(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Symbology = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) SymbologyFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Symbology = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetSymbology() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Symbology = 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 historyRodentlocationMods) RandomSymbology(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Symbology = 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 historyRodentlocationMods) RandomSymbologyNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Symbology = 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 historyRodentlocationMods) Usetype(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) UsetypeFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetUsetype() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Usetype = 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 historyRodentlocationMods) RandomUsetype(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Usetype = 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 historyRodentlocationMods) RandomUsetypeNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Usetype = 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 historyRodentlocationMods) Zone(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) ZoneFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetZone() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Zone = 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 historyRodentlocationMods) RandomZone(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Zone = 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 historyRodentlocationMods) RandomZoneNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Zone = 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 historyRodentlocationMods) Zone2(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) Zone2Func(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetZone2() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Zone2 = 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 historyRodentlocationMods) RandomZone2(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Zone2 = 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 historyRodentlocationMods) RandomZone2NotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Zone2 = 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 historyRodentlocationMods) Created(val null.Val[time.Time]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) CreatedFunc(f func() null.Val[time.Time]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetCreated() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Created = 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 historyRodentlocationMods) RandomCreated(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyRodentlocationMods) RandomCreatedNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyRodentlocationMods) CreatedDate(val null.Val[int64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) CreatedDateFunc(f func() null.Val[int64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetCreatedDate() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.CreatedDate = 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 historyRodentlocationMods) RandomCreatedDate(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyRodentlocationMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyRodentlocationMods) CreatedUser(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) CreatedUserFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetCreatedUser() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.CreatedUser = 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 historyRodentlocationMods) RandomCreatedUser(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.CreatedUser = 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 historyRodentlocationMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.CreatedUser = 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 historyRodentlocationMods) GeometryX(val null.Val[float64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) GeometryXFunc(f func() null.Val[float64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetGeometryX() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.GeometryX = 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 historyRodentlocationMods) RandomGeometryX(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - 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 historyRodentlocationMods) RandomGeometryXNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.GeometryX = 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 historyRodentlocationMods) GeometryY(val null.Val[float64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) GeometryYFunc(f func() null.Val[float64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetGeometryY() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.GeometryY = 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 historyRodentlocationMods) RandomGeometryY(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - 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 historyRodentlocationMods) RandomGeometryYNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.GeometryY = 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 historyRodentlocationMods) LastEditedDate(val null.Val[int64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetLastEditedDate() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.LastEditedDate = 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 historyRodentlocationMods) RandomLastEditedDate(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyRodentlocationMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyRodentlocationMods) LastEditedUser(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) LastEditedUserFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetLastEditedUser() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.LastEditedUser = 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 historyRodentlocationMods) RandomLastEditedUser(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.LastEditedUser = 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 historyRodentlocationMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.LastEditedUser = 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 historyRodentlocationMods) Jurisdiction(val null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) JurisdictionFunc(f func() null.Val[string]) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetJurisdiction() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Jurisdiction = 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 historyRodentlocationMods) RandomJurisdiction(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Jurisdiction = 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 historyRodentlocationMods) RandomJurisdictionNotNull(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Jurisdiction = 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 historyRodentlocationMods) Version(val int32) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyRodentlocationMods) VersionFunc(f func() int32) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyRodentlocationMods) UnsetVersion() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyRodentlocationMods) RandomVersion(f *faker.Faker) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(_ context.Context, o *HistoryRodentlocationTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyRodentlocationMods) WithParentsCascading() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(ctx context.Context, o *HistoryRodentlocationTemplate) { - if isDone, _ := historyRodentlocationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyRodentlocationWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyRodentlocationMods) WithOrganization(rel *OrganizationTemplate) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(ctx context.Context, o *HistoryRodentlocationTemplate) { - o.r.Organization = &historyRodentlocationROrganizationR{ - o: rel, - } - }) -} - -func (m historyRodentlocationMods) WithNewOrganization(mods ...OrganizationMod) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(ctx context.Context, o *HistoryRodentlocationTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyRodentlocationMods) WithExistingOrganization(em *models.Organization) HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(ctx context.Context, o *HistoryRodentlocationTemplate) { - o.r.Organization = &historyRodentlocationROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyRodentlocationMods) WithoutOrganization() HistoryRodentlocationMod { - return HistoryRodentlocationModFunc(func(ctx context.Context, o *HistoryRodentlocationTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_samplecollection.bob.go b/db/factory/history_samplecollection.bob.go deleted file mode 100644 index 4de79ef3..00000000 --- a/db/factory/history_samplecollection.bob.go +++ /dev/null @@ -1,3392 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistorySamplecollectionMod interface { - Apply(context.Context, *HistorySamplecollectionTemplate) -} - -type HistorySamplecollectionModFunc func(context.Context, *HistorySamplecollectionTemplate) - -func (f HistorySamplecollectionModFunc) Apply(ctx context.Context, n *HistorySamplecollectionTemplate) { - f(ctx, n) -} - -type HistorySamplecollectionModSlice []HistorySamplecollectionMod - -func (mods HistorySamplecollectionModSlice) Apply(ctx context.Context, n *HistorySamplecollectionTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistorySamplecollectionTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistorySamplecollectionTemplate struct { - OrganizationID func() int32 - Activity func() null.Val[string] - Avetemp func() null.Val[float64] - Chickenid func() null.Val[string] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Datesent func() null.Val[int64] - Datetested func() null.Val[int64] - Diseasepos func() null.Val[string] - Diseasetested func() null.Val[string] - Enddatetime func() null.Val[int64] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fieldtech func() null.Val[string] - Flockid func() null.Val[string] - Gatewaysync func() null.Val[int16] - Globalid func() null.Val[string] - Lab func() null.Val[string] - Locationname func() null.Val[string] - LocID func() null.Val[string] - Objectid func() int32 - Processed func() null.Val[int16] - Raingauge func() null.Val[float64] - Recordstatus func() null.Val[int16] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[int64] - Samplecond func() null.Val[string] - Samplecount func() null.Val[int16] - Sampleid func() null.Val[string] - Sampletype func() null.Val[string] - Sex func() null.Val[string] - Sitecond func() null.Val[string] - Species func() null.Val[string] - Startdatetime func() null.Val[int64] - Survtech func() null.Val[string] - Testmethod func() null.Val[string] - Testtech func() null.Val[string] - Winddir func() null.Val[string] - Windspeed func() null.Val[float64] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Version func() int32 - - r historySamplecollectionR - f *Factory - - alreadyPersisted bool -} - -type historySamplecollectionR struct { - Organization *historySamplecollectionROrganizationR -} - -type historySamplecollectionROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistorySamplecollectionTemplate -func (o *HistorySamplecollectionTemplate) Apply(ctx context.Context, mods ...HistorySamplecollectionMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistorySamplecollection -// according to the relationships in the template. Nothing is inserted into the db -func (t HistorySamplecollectionTemplate) setModelRels(o *models.HistorySamplecollection) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistorySamplecollections = append(rel.R.HistorySamplecollections, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistorySamplecollectionSetter -// this does nothing with the relationship templates -func (o HistorySamplecollectionTemplate) BuildSetter() *models.HistorySamplecollectionSetter { - m := &models.HistorySamplecollectionSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Activity != nil { - val := o.Activity() - m.Activity = omitnull.FromNull(val) - } - if o.Avetemp != nil { - val := o.Avetemp() - m.Avetemp = omitnull.FromNull(val) - } - if o.Chickenid != nil { - val := o.Chickenid() - m.Chickenid = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Datesent != nil { - val := o.Datesent() - m.Datesent = omitnull.FromNull(val) - } - if o.Datetested != nil { - val := o.Datetested() - m.Datetested = omitnull.FromNull(val) - } - if o.Diseasepos != nil { - val := o.Diseasepos() - m.Diseasepos = omitnull.FromNull(val) - } - if o.Diseasetested != nil { - val := o.Diseasetested() - m.Diseasetested = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Flockid != nil { - val := o.Flockid() - m.Flockid = omitnull.FromNull(val) - } - if o.Gatewaysync != nil { - val := o.Gatewaysync() - m.Gatewaysync = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Lab != nil { - val := o.Lab() - m.Lab = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.LocID != nil { - val := o.LocID() - m.LocID = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.Raingauge != nil { - val := o.Raingauge() - m.Raingauge = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Reviewed != nil { - val := o.Reviewed() - m.Reviewed = omitnull.FromNull(val) - } - if o.Reviewedby != nil { - val := o.Reviewedby() - m.Reviewedby = omitnull.FromNull(val) - } - if o.Revieweddate != nil { - val := o.Revieweddate() - m.Revieweddate = omitnull.FromNull(val) - } - if o.Samplecond != nil { - val := o.Samplecond() - m.Samplecond = omitnull.FromNull(val) - } - if o.Samplecount != nil { - val := o.Samplecount() - m.Samplecount = omitnull.FromNull(val) - } - if o.Sampleid != nil { - val := o.Sampleid() - m.Sampleid = omitnull.FromNull(val) - } - if o.Sampletype != nil { - val := o.Sampletype() - m.Sampletype = omitnull.FromNull(val) - } - if o.Sex != nil { - val := o.Sex() - m.Sex = omitnull.FromNull(val) - } - if o.Sitecond != nil { - val := o.Sitecond() - m.Sitecond = omitnull.FromNull(val) - } - if o.Species != nil { - val := o.Species() - m.Species = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Survtech != nil { - val := o.Survtech() - m.Survtech = omitnull.FromNull(val) - } - if o.Testmethod != nil { - val := o.Testmethod() - m.Testmethod = omitnull.FromNull(val) - } - if o.Testtech != nil { - val := o.Testtech() - m.Testtech = omitnull.FromNull(val) - } - if o.Winddir != nil { - val := o.Winddir() - m.Winddir = omitnull.FromNull(val) - } - if o.Windspeed != nil { - val := o.Windspeed() - m.Windspeed = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistorySamplecollectionSetter -// this does nothing with the relationship templates -func (o HistorySamplecollectionTemplate) BuildManySetter(number int) []*models.HistorySamplecollectionSetter { - m := make([]*models.HistorySamplecollectionSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistorySamplecollection -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistorySamplecollectionTemplate.Create -func (o HistorySamplecollectionTemplate) Build() *models.HistorySamplecollection { - m := &models.HistorySamplecollection{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Activity != nil { - m.Activity = o.Activity() - } - if o.Avetemp != nil { - m.Avetemp = o.Avetemp() - } - if o.Chickenid != nil { - m.Chickenid = o.Chickenid() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Datesent != nil { - m.Datesent = o.Datesent() - } - if o.Datetested != nil { - m.Datetested = o.Datetested() - } - if o.Diseasepos != nil { - m.Diseasepos = o.Diseasepos() - } - if o.Diseasetested != nil { - m.Diseasetested = o.Diseasetested() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Flockid != nil { - m.Flockid = o.Flockid() - } - if o.Gatewaysync != nil { - m.Gatewaysync = o.Gatewaysync() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Lab != nil { - m.Lab = o.Lab() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.LocID != nil { - m.LocID = o.LocID() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.Raingauge != nil { - m.Raingauge = o.Raingauge() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Reviewed != nil { - m.Reviewed = o.Reviewed() - } - if o.Reviewedby != nil { - m.Reviewedby = o.Reviewedby() - } - if o.Revieweddate != nil { - m.Revieweddate = o.Revieweddate() - } - if o.Samplecond != nil { - m.Samplecond = o.Samplecond() - } - if o.Samplecount != nil { - m.Samplecount = o.Samplecount() - } - if o.Sampleid != nil { - m.Sampleid = o.Sampleid() - } - if o.Sampletype != nil { - m.Sampletype = o.Sampletype() - } - if o.Sex != nil { - m.Sex = o.Sex() - } - if o.Sitecond != nil { - m.Sitecond = o.Sitecond() - } - if o.Species != nil { - m.Species = o.Species() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Survtech != nil { - m.Survtech = o.Survtech() - } - if o.Testmethod != nil { - m.Testmethod = o.Testmethod() - } - if o.Testtech != nil { - m.Testtech = o.Testtech() - } - if o.Winddir != nil { - m.Winddir = o.Winddir() - } - if o.Windspeed != nil { - m.Windspeed = o.Windspeed() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistorySamplecollectionSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistorySamplecollectionTemplate.CreateMany -func (o HistorySamplecollectionTemplate) BuildMany(number int) models.HistorySamplecollectionSlice { - m := make(models.HistorySamplecollectionSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistorySamplecollection(m *models.HistorySamplecollectionSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistorySamplecollection -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistorySamplecollectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistorySamplecollection) error { - var err error - - return err -} - -// Create builds a historySamplecollection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistorySamplecollectionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistorySamplecollection, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistorySamplecollection(opt) - - if o.r.Organization == nil { - HistorySamplecollectionMods.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.HistorySamplecollections.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 historySamplecollection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistorySamplecollectionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistorySamplecollection { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historySamplecollection 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 *HistorySamplecollectionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistorySamplecollection { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historySamplecollections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistorySamplecollectionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistorySamplecollectionSlice, error) { - var err error - m := make(models.HistorySamplecollectionSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historySamplecollections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistorySamplecollectionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistorySamplecollectionSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historySamplecollections 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 HistorySamplecollectionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistorySamplecollectionSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistorySamplecollection has methods that act as mods for the HistorySamplecollectionTemplate -var HistorySamplecollectionMods historySamplecollectionMods - -type historySamplecollectionMods struct{} - -func (m historySamplecollectionMods) RandomizeAllColumns(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModSlice{ - HistorySamplecollectionMods.RandomOrganizationID(f), - HistorySamplecollectionMods.RandomActivity(f), - HistorySamplecollectionMods.RandomAvetemp(f), - HistorySamplecollectionMods.RandomChickenid(f), - HistorySamplecollectionMods.RandomComments(f), - HistorySamplecollectionMods.RandomCreationdate(f), - HistorySamplecollectionMods.RandomCreator(f), - HistorySamplecollectionMods.RandomDatesent(f), - HistorySamplecollectionMods.RandomDatetested(f), - HistorySamplecollectionMods.RandomDiseasepos(f), - HistorySamplecollectionMods.RandomDiseasetested(f), - HistorySamplecollectionMods.RandomEnddatetime(f), - HistorySamplecollectionMods.RandomEditdate(f), - HistorySamplecollectionMods.RandomEditor(f), - HistorySamplecollectionMods.RandomFieldtech(f), - HistorySamplecollectionMods.RandomFlockid(f), - HistorySamplecollectionMods.RandomGatewaysync(f), - HistorySamplecollectionMods.RandomGlobalid(f), - HistorySamplecollectionMods.RandomLab(f), - HistorySamplecollectionMods.RandomLocationname(f), - HistorySamplecollectionMods.RandomLocID(f), - HistorySamplecollectionMods.RandomObjectid(f), - HistorySamplecollectionMods.RandomProcessed(f), - HistorySamplecollectionMods.RandomRaingauge(f), - HistorySamplecollectionMods.RandomRecordstatus(f), - HistorySamplecollectionMods.RandomReviewed(f), - HistorySamplecollectionMods.RandomReviewedby(f), - HistorySamplecollectionMods.RandomRevieweddate(f), - HistorySamplecollectionMods.RandomSamplecond(f), - HistorySamplecollectionMods.RandomSamplecount(f), - HistorySamplecollectionMods.RandomSampleid(f), - HistorySamplecollectionMods.RandomSampletype(f), - HistorySamplecollectionMods.RandomSex(f), - HistorySamplecollectionMods.RandomSitecond(f), - HistorySamplecollectionMods.RandomSpecies(f), - HistorySamplecollectionMods.RandomStartdatetime(f), - HistorySamplecollectionMods.RandomSurvtech(f), - HistorySamplecollectionMods.RandomTestmethod(f), - HistorySamplecollectionMods.RandomTesttech(f), - HistorySamplecollectionMods.RandomWinddir(f), - HistorySamplecollectionMods.RandomWindspeed(f), - HistorySamplecollectionMods.RandomZone(f), - HistorySamplecollectionMods.RandomZone2(f), - HistorySamplecollectionMods.RandomCreated(f), - HistorySamplecollectionMods.RandomCreatedDate(f), - HistorySamplecollectionMods.RandomCreatedUser(f), - HistorySamplecollectionMods.RandomGeometryX(f), - HistorySamplecollectionMods.RandomGeometryY(f), - HistorySamplecollectionMods.RandomLastEditedDate(f), - HistorySamplecollectionMods.RandomLastEditedUser(f), - HistorySamplecollectionMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historySamplecollectionMods) OrganizationID(val int32) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) OrganizationIDFunc(f func() int32) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetOrganizationID() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - 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 historySamplecollectionMods) RandomOrganizationID(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) Activity(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Activity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) ActivityFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Activity = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetActivity() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Activity = 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 historySamplecollectionMods) RandomActivity(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Activity = 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 historySamplecollectionMods) RandomActivityNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Activity = 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 historySamplecollectionMods) Avetemp(val null.Val[float64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Avetemp = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) AvetempFunc(f func() null.Val[float64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Avetemp = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetAvetemp() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Avetemp = 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 historySamplecollectionMods) RandomAvetemp(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Avetemp = 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 historySamplecollectionMods) RandomAvetempNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Avetemp = 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 historySamplecollectionMods) Chickenid(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Chickenid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) ChickenidFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Chickenid = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetChickenid() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Chickenid = 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 historySamplecollectionMods) RandomChickenid(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Chickenid = 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 historySamplecollectionMods) RandomChickenidNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Chickenid = 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 historySamplecollectionMods) Comments(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) CommentsFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetComments() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Comments = 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 historySamplecollectionMods) RandomComments(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Comments = 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 historySamplecollectionMods) RandomCommentsNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Comments = 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 historySamplecollectionMods) Creationdate(val null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) CreationdateFunc(f func() null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetCreationdate() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Creationdate = 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 historySamplecollectionMods) RandomCreationdate(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySamplecollectionMods) RandomCreationdateNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) Creator(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) CreatorFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetCreator() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Creator = 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 historySamplecollectionMods) RandomCreator(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Creator = 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 historySamplecollectionMods) RandomCreatorNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Creator = 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 historySamplecollectionMods) Datesent(val null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Datesent = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) DatesentFunc(f func() null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Datesent = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetDatesent() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Datesent = 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 historySamplecollectionMods) RandomDatesent(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Datesent = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySamplecollectionMods) RandomDatesentNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Datesent = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) Datetested(val null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Datetested = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) DatetestedFunc(f func() null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Datetested = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetDatetested() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Datetested = 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 historySamplecollectionMods) RandomDatetested(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Datetested = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySamplecollectionMods) RandomDatetestedNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Datetested = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) Diseasepos(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Diseasepos = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) DiseaseposFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Diseasepos = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetDiseasepos() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Diseasepos = 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 historySamplecollectionMods) RandomDiseasepos(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Diseasepos = 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 historySamplecollectionMods) RandomDiseaseposNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Diseasepos = 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 historySamplecollectionMods) Diseasetested(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Diseasetested = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) DiseasetestedFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Diseasetested = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetDiseasetested() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Diseasetested = 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 historySamplecollectionMods) RandomDiseasetested(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Diseasetested = 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 historySamplecollectionMods) RandomDiseasetestedNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Diseasetested = 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 historySamplecollectionMods) Enddatetime(val null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Enddatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) EnddatetimeFunc(f func() null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetEnddatetime() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Enddatetime = 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 historySamplecollectionMods) RandomEnddatetime(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySamplecollectionMods) RandomEnddatetimeNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) Editdate(val null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) EditdateFunc(f func() null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetEditdate() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Editdate = 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 historySamplecollectionMods) RandomEditdate(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySamplecollectionMods) RandomEditdateNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) Editor(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) EditorFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetEditor() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Editor = 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 historySamplecollectionMods) RandomEditor(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Editor = 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 historySamplecollectionMods) RandomEditorNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Editor = 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 historySamplecollectionMods) Fieldtech(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) FieldtechFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetFieldtech() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Fieldtech = 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 historySamplecollectionMods) RandomFieldtech(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Fieldtech = 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 historySamplecollectionMods) RandomFieldtechNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Fieldtech = 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 historySamplecollectionMods) Flockid(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Flockid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) FlockidFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Flockid = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetFlockid() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Flockid = 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 historySamplecollectionMods) RandomFlockid(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Flockid = 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 historySamplecollectionMods) RandomFlockidNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Flockid = 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 historySamplecollectionMods) Gatewaysync(val null.Val[int16]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Gatewaysync = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) GatewaysyncFunc(f func() null.Val[int16]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Gatewaysync = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetGatewaysync() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Gatewaysync = 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 historySamplecollectionMods) RandomGatewaysync(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySamplecollectionMods) RandomGatewaysyncNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) Globalid(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) GlobalidFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetGlobalid() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Globalid = 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 historySamplecollectionMods) RandomGlobalid(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - 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 historySamplecollectionMods) RandomGlobalidNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Globalid = 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 historySamplecollectionMods) Lab(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Lab = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) LabFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Lab = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetLab() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Lab = 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 historySamplecollectionMods) RandomLab(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Lab = 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 historySamplecollectionMods) RandomLabNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Lab = 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 historySamplecollectionMods) Locationname(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) LocationnameFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetLocationname() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Locationname = 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 historySamplecollectionMods) RandomLocationname(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Locationname = 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 historySamplecollectionMods) RandomLocationnameNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Locationname = 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 historySamplecollectionMods) LocID(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.LocID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) LocIDFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.LocID = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetLocID() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.LocID = 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 historySamplecollectionMods) RandomLocID(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.LocID = 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 historySamplecollectionMods) RandomLocIDNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.LocID = 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 historySamplecollectionMods) Objectid(val int32) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) ObjectidFunc(f func() int32) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetObjectid() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historySamplecollectionMods) RandomObjectid(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) Processed(val null.Val[int16]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) ProcessedFunc(f func() null.Val[int16]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetProcessed() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Processed = 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 historySamplecollectionMods) RandomProcessed(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySamplecollectionMods) RandomProcessedNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) Raingauge(val null.Val[float64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Raingauge = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) RaingaugeFunc(f func() null.Val[float64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Raingauge = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetRaingauge() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Raingauge = 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 historySamplecollectionMods) RandomRaingauge(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Raingauge = 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 historySamplecollectionMods) RandomRaingaugeNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Raingauge = 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 historySamplecollectionMods) Recordstatus(val null.Val[int16]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) RecordstatusFunc(f func() null.Val[int16]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetRecordstatus() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Recordstatus = 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 historySamplecollectionMods) RandomRecordstatus(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySamplecollectionMods) RandomRecordstatusNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) Reviewed(val null.Val[int16]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) ReviewedFunc(f func() null.Val[int16]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetReviewed() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Reviewed = 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 historySamplecollectionMods) RandomReviewed(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySamplecollectionMods) RandomReviewedNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) Reviewedby(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) ReviewedbyFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetReviewedby() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Reviewedby = 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 historySamplecollectionMods) RandomReviewedby(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Reviewedby = 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 historySamplecollectionMods) RandomReviewedbyNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Reviewedby = 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 historySamplecollectionMods) Revieweddate(val null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Revieweddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) RevieweddateFunc(f func() null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetRevieweddate() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Revieweddate = 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 historySamplecollectionMods) RandomRevieweddate(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySamplecollectionMods) RandomRevieweddateNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) Samplecond(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Samplecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) SamplecondFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Samplecond = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetSamplecond() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Samplecond = 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 historySamplecollectionMods) RandomSamplecond(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Samplecond = 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 historySamplecollectionMods) RandomSamplecondNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Samplecond = 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 historySamplecollectionMods) Samplecount(val null.Val[int16]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Samplecount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) SamplecountFunc(f func() null.Val[int16]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Samplecount = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetSamplecount() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Samplecount = 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 historySamplecollectionMods) RandomSamplecount(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Samplecount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySamplecollectionMods) RandomSamplecountNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Samplecount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) Sampleid(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sampleid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) SampleidFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sampleid = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetSampleid() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sampleid = 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 historySamplecollectionMods) RandomSampleid(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sampleid = 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 historySamplecollectionMods) RandomSampleidNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sampleid = 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 historySamplecollectionMods) Sampletype(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sampletype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) SampletypeFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sampletype = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetSampletype() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sampletype = 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 historySamplecollectionMods) RandomSampletype(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sampletype = 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 historySamplecollectionMods) RandomSampletypeNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sampletype = 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 historySamplecollectionMods) Sex(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sex = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) SexFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sex = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetSex() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sex = 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 historySamplecollectionMods) RandomSex(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sex = 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 historySamplecollectionMods) RandomSexNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sex = 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 historySamplecollectionMods) Sitecond(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sitecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) SitecondFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sitecond = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetSitecond() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sitecond = 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 historySamplecollectionMods) RandomSitecond(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sitecond = 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 historySamplecollectionMods) RandomSitecondNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Sitecond = 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 historySamplecollectionMods) Species(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Species = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) SpeciesFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Species = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetSpecies() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Species = 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 historySamplecollectionMods) RandomSpecies(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Species = 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 historySamplecollectionMods) RandomSpeciesNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Species = 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 historySamplecollectionMods) Startdatetime(val null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Startdatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) StartdatetimeFunc(f func() null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetStartdatetime() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Startdatetime = 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 historySamplecollectionMods) RandomStartdatetime(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySamplecollectionMods) RandomStartdatetimeNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) Survtech(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Survtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) SurvtechFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Survtech = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetSurvtech() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Survtech = 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 historySamplecollectionMods) RandomSurvtech(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Survtech = 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 historySamplecollectionMods) RandomSurvtechNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Survtech = 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 historySamplecollectionMods) Testmethod(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Testmethod = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) TestmethodFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Testmethod = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetTestmethod() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Testmethod = 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 historySamplecollectionMods) RandomTestmethod(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Testmethod = 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 historySamplecollectionMods) RandomTestmethodNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Testmethod = 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 historySamplecollectionMods) Testtech(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Testtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) TesttechFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Testtech = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetTesttech() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Testtech = 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 historySamplecollectionMods) RandomTesttech(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Testtech = 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 historySamplecollectionMods) RandomTesttechNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Testtech = 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 historySamplecollectionMods) Winddir(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Winddir = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) WinddirFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Winddir = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetWinddir() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Winddir = 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 historySamplecollectionMods) RandomWinddir(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Winddir = 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 historySamplecollectionMods) RandomWinddirNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Winddir = 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 historySamplecollectionMods) Windspeed(val null.Val[float64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Windspeed = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) WindspeedFunc(f func() null.Val[float64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Windspeed = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetWindspeed() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Windspeed = 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 historySamplecollectionMods) RandomWindspeed(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Windspeed = 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 historySamplecollectionMods) RandomWindspeedNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Windspeed = 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 historySamplecollectionMods) Zone(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) ZoneFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetZone() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Zone = 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 historySamplecollectionMods) RandomZone(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Zone = 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 historySamplecollectionMods) RandomZoneNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Zone = 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 historySamplecollectionMods) Zone2(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) Zone2Func(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetZone2() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Zone2 = 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 historySamplecollectionMods) RandomZone2(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Zone2 = 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 historySamplecollectionMods) RandomZone2NotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Zone2 = 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 historySamplecollectionMods) Created(val null.Val[time.Time]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) CreatedFunc(f func() null.Val[time.Time]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetCreated() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Created = 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 historySamplecollectionMods) RandomCreated(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historySamplecollectionMods) RandomCreatedNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) CreatedDate(val null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) CreatedDateFunc(f func() null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetCreatedDate() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.CreatedDate = 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 historySamplecollectionMods) RandomCreatedDate(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySamplecollectionMods) RandomCreatedDateNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) CreatedUser(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) CreatedUserFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetCreatedUser() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.CreatedUser = 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 historySamplecollectionMods) RandomCreatedUser(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.CreatedUser = 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 historySamplecollectionMods) RandomCreatedUserNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.CreatedUser = 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 historySamplecollectionMods) GeometryX(val null.Val[float64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) GeometryXFunc(f func() null.Val[float64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetGeometryX() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.GeometryX = 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 historySamplecollectionMods) RandomGeometryX(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - 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 historySamplecollectionMods) RandomGeometryXNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.GeometryX = 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 historySamplecollectionMods) GeometryY(val null.Val[float64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) GeometryYFunc(f func() null.Val[float64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetGeometryY() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.GeometryY = 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 historySamplecollectionMods) RandomGeometryY(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - 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 historySamplecollectionMods) RandomGeometryYNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.GeometryY = 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 historySamplecollectionMods) LastEditedDate(val null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) LastEditedDateFunc(f func() null.Val[int64]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetLastEditedDate() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.LastEditedDate = 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 historySamplecollectionMods) RandomLastEditedDate(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySamplecollectionMods) RandomLastEditedDateNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplecollectionMods) LastEditedUser(val null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) LastEditedUserFunc(f func() null.Val[string]) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetLastEditedUser() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.LastEditedUser = 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 historySamplecollectionMods) RandomLastEditedUser(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.LastEditedUser = 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 historySamplecollectionMods) RandomLastEditedUserNotNull(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.LastEditedUser = 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 historySamplecollectionMods) Version(val int32) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historySamplecollectionMods) VersionFunc(f func() int32) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historySamplecollectionMods) UnsetVersion() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historySamplecollectionMods) RandomVersion(f *faker.Faker) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(_ context.Context, o *HistorySamplecollectionTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historySamplecollectionMods) WithParentsCascading() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(ctx context.Context, o *HistorySamplecollectionTemplate) { - if isDone, _ := historySamplecollectionWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historySamplecollectionWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historySamplecollectionMods) WithOrganization(rel *OrganizationTemplate) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(ctx context.Context, o *HistorySamplecollectionTemplate) { - o.r.Organization = &historySamplecollectionROrganizationR{ - o: rel, - } - }) -} - -func (m historySamplecollectionMods) WithNewOrganization(mods ...OrganizationMod) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(ctx context.Context, o *HistorySamplecollectionTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historySamplecollectionMods) WithExistingOrganization(em *models.Organization) HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(ctx context.Context, o *HistorySamplecollectionTemplate) { - o.r.Organization = &historySamplecollectionROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historySamplecollectionMods) WithoutOrganization() HistorySamplecollectionMod { - return HistorySamplecollectionModFunc(func(ctx context.Context, o *HistorySamplecollectionTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_samplelocation.bob.go b/db/factory/history_samplelocation.bob.go deleted file mode 100644 index 7b07f2b8..00000000 --- a/db/factory/history_samplelocation.bob.go +++ /dev/null @@ -1,2028 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistorySamplelocationMod interface { - Apply(context.Context, *HistorySamplelocationTemplate) -} - -type HistorySamplelocationModFunc func(context.Context, *HistorySamplelocationTemplate) - -func (f HistorySamplelocationModFunc) Apply(ctx context.Context, n *HistorySamplelocationTemplate) { - f(ctx, n) -} - -type HistorySamplelocationModSlice []HistorySamplelocationMod - -func (mods HistorySamplelocationModSlice) Apply(ctx context.Context, n *HistorySamplelocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistorySamplelocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistorySamplelocationTemplate struct { - OrganizationID func() int32 - Accessdesc func() null.Val[string] - Active func() null.Val[int16] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Description func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Gatewaysync func() null.Val[int16] - Globalid func() null.Val[string] - Habitat func() null.Val[string] - Locationnumber func() null.Val[int64] - Name func() null.Val[string] - Nextactiondatescheduled func() null.Val[int64] - Objectid func() int32 - Priority func() null.Val[string] - Usetype func() null.Val[string] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Version func() int32 - - r historySamplelocationR - f *Factory - - alreadyPersisted bool -} - -type historySamplelocationR struct { - Organization *historySamplelocationROrganizationR -} - -type historySamplelocationROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistorySamplelocationTemplate -func (o *HistorySamplelocationTemplate) Apply(ctx context.Context, mods ...HistorySamplelocationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistorySamplelocation -// according to the relationships in the template. Nothing is inserted into the db -func (t HistorySamplelocationTemplate) setModelRels(o *models.HistorySamplelocation) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistorySamplelocations = append(rel.R.HistorySamplelocations, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistorySamplelocationSetter -// this does nothing with the relationship templates -func (o HistorySamplelocationTemplate) BuildSetter() *models.HistorySamplelocationSetter { - m := &models.HistorySamplelocationSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Gatewaysync != nil { - val := o.Gatewaysync() - m.Gatewaysync = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Usetype != nil { - val := o.Usetype() - m.Usetype = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistorySamplelocationSetter -// this does nothing with the relationship templates -func (o HistorySamplelocationTemplate) BuildManySetter(number int) []*models.HistorySamplelocationSetter { - m := make([]*models.HistorySamplelocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistorySamplelocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistorySamplelocationTemplate.Create -func (o HistorySamplelocationTemplate) Build() *models.HistorySamplelocation { - m := &models.HistorySamplelocation{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Gatewaysync != nil { - m.Gatewaysync = o.Gatewaysync() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistorySamplelocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistorySamplelocationTemplate.CreateMany -func (o HistorySamplelocationTemplate) BuildMany(number int) models.HistorySamplelocationSlice { - m := make(models.HistorySamplelocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistorySamplelocation(m *models.HistorySamplelocationSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistorySamplelocation -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistorySamplelocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistorySamplelocation) error { - var err error - - return err -} - -// Create builds a historySamplelocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistorySamplelocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistorySamplelocation, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistorySamplelocation(opt) - - if o.r.Organization == nil { - HistorySamplelocationMods.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.HistorySamplelocations.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 historySamplelocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistorySamplelocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistorySamplelocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historySamplelocation 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 *HistorySamplelocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistorySamplelocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historySamplelocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistorySamplelocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistorySamplelocationSlice, error) { - var err error - m := make(models.HistorySamplelocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historySamplelocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistorySamplelocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistorySamplelocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historySamplelocations 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 HistorySamplelocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistorySamplelocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistorySamplelocation has methods that act as mods for the HistorySamplelocationTemplate -var HistorySamplelocationMods historySamplelocationMods - -type historySamplelocationMods struct{} - -func (m historySamplelocationMods) RandomizeAllColumns(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModSlice{ - HistorySamplelocationMods.RandomOrganizationID(f), - HistorySamplelocationMods.RandomAccessdesc(f), - HistorySamplelocationMods.RandomActive(f), - HistorySamplelocationMods.RandomComments(f), - HistorySamplelocationMods.RandomCreationdate(f), - HistorySamplelocationMods.RandomCreator(f), - HistorySamplelocationMods.RandomDescription(f), - HistorySamplelocationMods.RandomExternalid(f), - HistorySamplelocationMods.RandomEditdate(f), - HistorySamplelocationMods.RandomEditor(f), - HistorySamplelocationMods.RandomGatewaysync(f), - HistorySamplelocationMods.RandomGlobalid(f), - HistorySamplelocationMods.RandomHabitat(f), - HistorySamplelocationMods.RandomLocationnumber(f), - HistorySamplelocationMods.RandomName(f), - HistorySamplelocationMods.RandomNextactiondatescheduled(f), - HistorySamplelocationMods.RandomObjectid(f), - HistorySamplelocationMods.RandomPriority(f), - HistorySamplelocationMods.RandomUsetype(f), - HistorySamplelocationMods.RandomZone(f), - HistorySamplelocationMods.RandomZone2(f), - HistorySamplelocationMods.RandomCreated(f), - HistorySamplelocationMods.RandomCreatedDate(f), - HistorySamplelocationMods.RandomCreatedUser(f), - HistorySamplelocationMods.RandomGeometryX(f), - HistorySamplelocationMods.RandomGeometryY(f), - HistorySamplelocationMods.RandomLastEditedDate(f), - HistorySamplelocationMods.RandomLastEditedUser(f), - HistorySamplelocationMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historySamplelocationMods) OrganizationID(val int32) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) OrganizationIDFunc(f func() int32) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetOrganizationID() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - 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 historySamplelocationMods) RandomOrganizationID(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historySamplelocationMods) Accessdesc(val null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) AccessdescFunc(f func() null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetAccessdesc() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Accessdesc = 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 historySamplelocationMods) RandomAccessdesc(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Accessdesc = 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 historySamplelocationMods) RandomAccessdescNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Accessdesc = 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 historySamplelocationMods) Active(val null.Val[int16]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) ActiveFunc(f func() null.Val[int16]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetActive() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Active = 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 historySamplelocationMods) RandomActive(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySamplelocationMods) RandomActiveNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplelocationMods) Comments(val null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) CommentsFunc(f func() null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetComments() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Comments = 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 historySamplelocationMods) RandomComments(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Comments = 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 historySamplelocationMods) RandomCommentsNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Comments = 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 historySamplelocationMods) Creationdate(val null.Val[int64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) CreationdateFunc(f func() null.Val[int64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetCreationdate() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Creationdate = 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 historySamplelocationMods) RandomCreationdate(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySamplelocationMods) RandomCreationdateNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplelocationMods) Creator(val null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) CreatorFunc(f func() null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetCreator() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Creator = 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 historySamplelocationMods) RandomCreator(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Creator = 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 historySamplelocationMods) RandomCreatorNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Creator = 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 historySamplelocationMods) Description(val null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) DescriptionFunc(f func() null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetDescription() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Description = 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 historySamplelocationMods) RandomDescription(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Description = 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 historySamplelocationMods) RandomDescriptionNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Description = 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 historySamplelocationMods) Externalid(val null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) ExternalidFunc(f func() null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetExternalid() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Externalid = 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 historySamplelocationMods) RandomExternalid(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Externalid = 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 historySamplelocationMods) RandomExternalidNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Externalid = 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 historySamplelocationMods) Editdate(val null.Val[int64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) EditdateFunc(f func() null.Val[int64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetEditdate() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Editdate = 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 historySamplelocationMods) RandomEditdate(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySamplelocationMods) RandomEditdateNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplelocationMods) Editor(val null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) EditorFunc(f func() null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetEditor() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Editor = 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 historySamplelocationMods) RandomEditor(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Editor = 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 historySamplelocationMods) RandomEditorNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Editor = 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 historySamplelocationMods) Gatewaysync(val null.Val[int16]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Gatewaysync = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) GatewaysyncFunc(f func() null.Val[int16]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Gatewaysync = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetGatewaysync() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Gatewaysync = 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 historySamplelocationMods) RandomGatewaysync(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySamplelocationMods) RandomGatewaysyncNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplelocationMods) Globalid(val null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) GlobalidFunc(f func() null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetGlobalid() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Globalid = 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 historySamplelocationMods) RandomGlobalid(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - 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 historySamplelocationMods) RandomGlobalidNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Globalid = 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 historySamplelocationMods) Habitat(val null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) HabitatFunc(f func() null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetHabitat() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Habitat = 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 historySamplelocationMods) RandomHabitat(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Habitat = 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 historySamplelocationMods) RandomHabitatNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Habitat = 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 historySamplelocationMods) Locationnumber(val null.Val[int64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Locationnumber = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) LocationnumberFunc(f func() null.Val[int64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetLocationnumber() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Locationnumber = 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 historySamplelocationMods) RandomLocationnumber(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySamplelocationMods) RandomLocationnumberNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplelocationMods) Name(val null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) NameFunc(f func() null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetName() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Name = 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 historySamplelocationMods) RandomName(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Name = 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 historySamplelocationMods) RandomNameNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Name = 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 historySamplelocationMods) Nextactiondatescheduled(val null.Val[int64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetNextactiondatescheduled() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Nextactiondatescheduled = 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 historySamplelocationMods) RandomNextactiondatescheduled(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySamplelocationMods) RandomNextactiondatescheduledNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplelocationMods) Objectid(val int32) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) ObjectidFunc(f func() int32) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetObjectid() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historySamplelocationMods) RandomObjectid(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historySamplelocationMods) Priority(val null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) PriorityFunc(f func() null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetPriority() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Priority = 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 historySamplelocationMods) RandomPriority(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Priority = 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 historySamplelocationMods) RandomPriorityNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Priority = 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 historySamplelocationMods) Usetype(val null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) UsetypeFunc(f func() null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetUsetype() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Usetype = 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 historySamplelocationMods) RandomUsetype(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Usetype = 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 historySamplelocationMods) RandomUsetypeNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Usetype = 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 historySamplelocationMods) Zone(val null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) ZoneFunc(f func() null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetZone() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Zone = 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 historySamplelocationMods) RandomZone(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Zone = 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 historySamplelocationMods) RandomZoneNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Zone = 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 historySamplelocationMods) Zone2(val null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) Zone2Func(f func() null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetZone2() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Zone2 = 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 historySamplelocationMods) RandomZone2(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Zone2 = 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 historySamplelocationMods) RandomZone2NotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Zone2 = 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 historySamplelocationMods) Created(val null.Val[time.Time]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) CreatedFunc(f func() null.Val[time.Time]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetCreated() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Created = 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 historySamplelocationMods) RandomCreated(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historySamplelocationMods) RandomCreatedNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplelocationMods) CreatedDate(val null.Val[int64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) CreatedDateFunc(f func() null.Val[int64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetCreatedDate() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.CreatedDate = 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 historySamplelocationMods) RandomCreatedDate(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySamplelocationMods) RandomCreatedDateNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplelocationMods) CreatedUser(val null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) CreatedUserFunc(f func() null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetCreatedUser() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.CreatedUser = 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 historySamplelocationMods) RandomCreatedUser(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.CreatedUser = 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 historySamplelocationMods) RandomCreatedUserNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.CreatedUser = 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 historySamplelocationMods) GeometryX(val null.Val[float64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) GeometryXFunc(f func() null.Val[float64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetGeometryX() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.GeometryX = 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 historySamplelocationMods) RandomGeometryX(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - 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 historySamplelocationMods) RandomGeometryXNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.GeometryX = 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 historySamplelocationMods) GeometryY(val null.Val[float64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) GeometryYFunc(f func() null.Val[float64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetGeometryY() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.GeometryY = 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 historySamplelocationMods) RandomGeometryY(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - 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 historySamplelocationMods) RandomGeometryYNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.GeometryY = 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 historySamplelocationMods) LastEditedDate(val null.Val[int64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) LastEditedDateFunc(f func() null.Val[int64]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetLastEditedDate() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.LastEditedDate = 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 historySamplelocationMods) RandomLastEditedDate(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySamplelocationMods) RandomLastEditedDateNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySamplelocationMods) LastEditedUser(val null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) LastEditedUserFunc(f func() null.Val[string]) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetLastEditedUser() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.LastEditedUser = 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 historySamplelocationMods) RandomLastEditedUser(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.LastEditedUser = 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 historySamplelocationMods) RandomLastEditedUserNotNull(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.LastEditedUser = 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 historySamplelocationMods) Version(val int32) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historySamplelocationMods) VersionFunc(f func() int32) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historySamplelocationMods) UnsetVersion() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historySamplelocationMods) RandomVersion(f *faker.Faker) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(_ context.Context, o *HistorySamplelocationTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historySamplelocationMods) WithParentsCascading() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(ctx context.Context, o *HistorySamplelocationTemplate) { - if isDone, _ := historySamplelocationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historySamplelocationWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historySamplelocationMods) WithOrganization(rel *OrganizationTemplate) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(ctx context.Context, o *HistorySamplelocationTemplate) { - o.r.Organization = &historySamplelocationROrganizationR{ - o: rel, - } - }) -} - -func (m historySamplelocationMods) WithNewOrganization(mods ...OrganizationMod) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(ctx context.Context, o *HistorySamplelocationTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historySamplelocationMods) WithExistingOrganization(em *models.Organization) HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(ctx context.Context, o *HistorySamplelocationTemplate) { - o.r.Organization = &historySamplelocationROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historySamplelocationMods) WithoutOrganization() HistorySamplelocationMod { - return HistorySamplelocationModFunc(func(ctx context.Context, o *HistorySamplelocationTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_servicerequest.bob.go b/db/factory/history_servicerequest.bob.go deleted file mode 100644 index 11e3b85f..00000000 --- a/db/factory/history_servicerequest.bob.go +++ /dev/null @@ -1,5872 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryServicerequestMod interface { - Apply(context.Context, *HistoryServicerequestTemplate) -} - -type HistoryServicerequestModFunc func(context.Context, *HistoryServicerequestTemplate) - -func (f HistoryServicerequestModFunc) Apply(ctx context.Context, n *HistoryServicerequestTemplate) { - f(ctx, n) -} - -type HistoryServicerequestModSlice []HistoryServicerequestMod - -func (mods HistoryServicerequestModSlice) Apply(ctx context.Context, n *HistoryServicerequestTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryServicerequestTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryServicerequestTemplate struct { - OrganizationID func() int32 - Accepted func() null.Val[int16] - Acceptedby func() null.Val[string] - Accepteddate func() null.Val[int64] - Allowed func() null.Val[string] - Assignedtech func() null.Val[string] - Clraddr1 func() null.Val[string] - Clraddr2 func() null.Val[string] - Clranon func() null.Val[int16] - Clrcity func() null.Val[string] - Clrcompany func() null.Val[string] - Clrcontpref func() null.Val[string] - Clremail func() null.Val[string] - Clrfname func() null.Val[string] - Clrother func() null.Val[string] - Clrphone1 func() null.Val[string] - Clrphone2 func() null.Val[string] - Clrstate func() null.Val[string] - Clrzip func() null.Val[string] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Datetimeclosed func() null.Val[int64] - Duedate func() null.Val[int64] - Entrytech func() null.Val[string] - Estcompletedate func() null.Val[int64] - Externalerror func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Firstresponsedate func() null.Val[int64] - Globalid func() null.Val[string] - Issuesreported func() null.Val[string] - Jurisdiction func() null.Val[string] - Nextaction func() null.Val[string] - Notificationtimestamp func() null.Val[string] - Notified func() null.Val[int16] - Notifieddate func() null.Val[int64] - Objectid func() int32 - Pointlocid func() null.Val[string] - Priority func() null.Val[string] - Recdatetime func() null.Val[int64] - Recordstatus func() null.Val[int16] - Rejectedby func() null.Val[string] - Rejecteddate func() null.Val[int64] - Rejectedreason func() null.Val[string] - Reqaddr1 func() null.Val[string] - Reqaddr2 func() null.Val[string] - Reqcity func() null.Val[string] - Reqcompany func() null.Val[string] - Reqcrossst func() null.Val[string] - Reqdescr func() null.Val[string] - Reqfldnotes func() null.Val[string] - Reqmapgrid func() null.Val[string] - Reqnotesforcust func() null.Val[string] - Reqnotesfortech func() null.Val[string] - Reqpermission func() null.Val[int16] - Reqprogramactions func() null.Val[string] - Reqstate func() null.Val[string] - Reqsubdiv func() null.Val[string] - Reqtarget func() null.Val[string] - Reqzip func() null.Val[string] - Responsedaycount func() null.Val[int16] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[int64] - Scheduled func() null.Val[int16] - Scheduleddate func() null.Val[int64] - Source func() null.Val[string] - SRNumber func() null.Val[int64] - Status func() null.Val[string] - Supervisor func() null.Val[string] - Techclosed func() null.Val[string] - Validx func() null.Val[string] - Validy func() null.Val[string] - Xvalue func() null.Val[string] - Yvalue func() null.Val[string] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Dog func() null.Val[int64] - Spanish func() null.Val[int64] - ScheduleNotes func() null.Val[string] - SchedulePeriod func() null.Val[string] - Version func() int32 - - r historyServicerequestR - f *Factory - - alreadyPersisted bool -} - -type historyServicerequestR struct { - Organization *historyServicerequestROrganizationR -} - -type historyServicerequestROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryServicerequestTemplate -func (o *HistoryServicerequestTemplate) Apply(ctx context.Context, mods ...HistoryServicerequestMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryServicerequest -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryServicerequestTemplate) setModelRels(o *models.HistoryServicerequest) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryServicerequests = append(rel.R.HistoryServicerequests, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryServicerequestSetter -// this does nothing with the relationship templates -func (o HistoryServicerequestTemplate) BuildSetter() *models.HistoryServicerequestSetter { - m := &models.HistoryServicerequestSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accepted != nil { - val := o.Accepted() - m.Accepted = omitnull.FromNull(val) - } - if o.Acceptedby != nil { - val := o.Acceptedby() - m.Acceptedby = omitnull.FromNull(val) - } - if o.Accepteddate != nil { - val := o.Accepteddate() - m.Accepteddate = omitnull.FromNull(val) - } - if o.Allowed != nil { - val := o.Allowed() - m.Allowed = omitnull.FromNull(val) - } - if o.Assignedtech != nil { - val := o.Assignedtech() - m.Assignedtech = omitnull.FromNull(val) - } - if o.Clraddr1 != nil { - val := o.Clraddr1() - m.Clraddr1 = omitnull.FromNull(val) - } - if o.Clraddr2 != nil { - val := o.Clraddr2() - m.Clraddr2 = omitnull.FromNull(val) - } - if o.Clranon != nil { - val := o.Clranon() - m.Clranon = omitnull.FromNull(val) - } - if o.Clrcity != nil { - val := o.Clrcity() - m.Clrcity = omitnull.FromNull(val) - } - if o.Clrcompany != nil { - val := o.Clrcompany() - m.Clrcompany = omitnull.FromNull(val) - } - if o.Clrcontpref != nil { - val := o.Clrcontpref() - m.Clrcontpref = omitnull.FromNull(val) - } - if o.Clremail != nil { - val := o.Clremail() - m.Clremail = omitnull.FromNull(val) - } - if o.Clrfname != nil { - val := o.Clrfname() - m.Clrfname = omitnull.FromNull(val) - } - if o.Clrother != nil { - val := o.Clrother() - m.Clrother = omitnull.FromNull(val) - } - if o.Clrphone1 != nil { - val := o.Clrphone1() - m.Clrphone1 = omitnull.FromNull(val) - } - if o.Clrphone2 != nil { - val := o.Clrphone2() - m.Clrphone2 = omitnull.FromNull(val) - } - if o.Clrstate != nil { - val := o.Clrstate() - m.Clrstate = omitnull.FromNull(val) - } - if o.Clrzip != nil { - val := o.Clrzip() - m.Clrzip = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Datetimeclosed != nil { - val := o.Datetimeclosed() - m.Datetimeclosed = omitnull.FromNull(val) - } - if o.Duedate != nil { - val := o.Duedate() - m.Duedate = omitnull.FromNull(val) - } - if o.Entrytech != nil { - val := o.Entrytech() - m.Entrytech = omitnull.FromNull(val) - } - if o.Estcompletedate != nil { - val := o.Estcompletedate() - m.Estcompletedate = omitnull.FromNull(val) - } - if o.Externalerror != nil { - val := o.Externalerror() - m.Externalerror = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Firstresponsedate != nil { - val := o.Firstresponsedate() - m.Firstresponsedate = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Issuesreported != nil { - val := o.Issuesreported() - m.Issuesreported = omitnull.FromNull(val) - } - if o.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.Nextaction != nil { - val := o.Nextaction() - m.Nextaction = omitnull.FromNull(val) - } - if o.Notificationtimestamp != nil { - val := o.Notificationtimestamp() - m.Notificationtimestamp = omitnull.FromNull(val) - } - if o.Notified != nil { - val := o.Notified() - m.Notified = omitnull.FromNull(val) - } - if o.Notifieddate != nil { - val := o.Notifieddate() - m.Notifieddate = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Pointlocid != nil { - val := o.Pointlocid() - m.Pointlocid = omitnull.FromNull(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Recdatetime != nil { - val := o.Recdatetime() - m.Recdatetime = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Rejectedby != nil { - val := o.Rejectedby() - m.Rejectedby = omitnull.FromNull(val) - } - if o.Rejecteddate != nil { - val := o.Rejecteddate() - m.Rejecteddate = omitnull.FromNull(val) - } - if o.Rejectedreason != nil { - val := o.Rejectedreason() - m.Rejectedreason = omitnull.FromNull(val) - } - if o.Reqaddr1 != nil { - val := o.Reqaddr1() - m.Reqaddr1 = omitnull.FromNull(val) - } - if o.Reqaddr2 != nil { - val := o.Reqaddr2() - m.Reqaddr2 = omitnull.FromNull(val) - } - if o.Reqcity != nil { - val := o.Reqcity() - m.Reqcity = omitnull.FromNull(val) - } - if o.Reqcompany != nil { - val := o.Reqcompany() - m.Reqcompany = omitnull.FromNull(val) - } - if o.Reqcrossst != nil { - val := o.Reqcrossst() - m.Reqcrossst = omitnull.FromNull(val) - } - if o.Reqdescr != nil { - val := o.Reqdescr() - m.Reqdescr = omitnull.FromNull(val) - } - if o.Reqfldnotes != nil { - val := o.Reqfldnotes() - m.Reqfldnotes = omitnull.FromNull(val) - } - if o.Reqmapgrid != nil { - val := o.Reqmapgrid() - m.Reqmapgrid = omitnull.FromNull(val) - } - if o.Reqnotesforcust != nil { - val := o.Reqnotesforcust() - m.Reqnotesforcust = omitnull.FromNull(val) - } - if o.Reqnotesfortech != nil { - val := o.Reqnotesfortech() - m.Reqnotesfortech = omitnull.FromNull(val) - } - if o.Reqpermission != nil { - val := o.Reqpermission() - m.Reqpermission = omitnull.FromNull(val) - } - if o.Reqprogramactions != nil { - val := o.Reqprogramactions() - m.Reqprogramactions = omitnull.FromNull(val) - } - if o.Reqstate != nil { - val := o.Reqstate() - m.Reqstate = omitnull.FromNull(val) - } - if o.Reqsubdiv != nil { - val := o.Reqsubdiv() - m.Reqsubdiv = omitnull.FromNull(val) - } - if o.Reqtarget != nil { - val := o.Reqtarget() - m.Reqtarget = omitnull.FromNull(val) - } - if o.Reqzip != nil { - val := o.Reqzip() - m.Reqzip = omitnull.FromNull(val) - } - if o.Responsedaycount != nil { - val := o.Responsedaycount() - m.Responsedaycount = omitnull.FromNull(val) - } - if o.Reviewed != nil { - val := o.Reviewed() - m.Reviewed = omitnull.FromNull(val) - } - if o.Reviewedby != nil { - val := o.Reviewedby() - m.Reviewedby = omitnull.FromNull(val) - } - if o.Revieweddate != nil { - val := o.Revieweddate() - m.Revieweddate = omitnull.FromNull(val) - } - if o.Scheduled != nil { - val := o.Scheduled() - m.Scheduled = omitnull.FromNull(val) - } - if o.Scheduleddate != nil { - val := o.Scheduleddate() - m.Scheduleddate = omitnull.FromNull(val) - } - if o.Source != nil { - val := o.Source() - m.Source = omitnull.FromNull(val) - } - if o.SRNumber != nil { - val := o.SRNumber() - m.SRNumber = omitnull.FromNull(val) - } - if o.Status != nil { - val := o.Status() - m.Status = omitnull.FromNull(val) - } - if o.Supervisor != nil { - val := o.Supervisor() - m.Supervisor = omitnull.FromNull(val) - } - if o.Techclosed != nil { - val := o.Techclosed() - m.Techclosed = omitnull.FromNull(val) - } - if o.Validx != nil { - val := o.Validx() - m.Validx = omitnull.FromNull(val) - } - if o.Validy != nil { - val := o.Validy() - m.Validy = omitnull.FromNull(val) - } - if o.Xvalue != nil { - val := o.Xvalue() - m.Xvalue = omitnull.FromNull(val) - } - if o.Yvalue != nil { - val := o.Yvalue() - m.Yvalue = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Dog != nil { - val := o.Dog() - m.Dog = omitnull.FromNull(val) - } - if o.Spanish != nil { - val := o.Spanish() - m.Spanish = omitnull.FromNull(val) - } - if o.ScheduleNotes != nil { - val := o.ScheduleNotes() - m.ScheduleNotes = omitnull.FromNull(val) - } - if o.SchedulePeriod != nil { - val := o.SchedulePeriod() - m.SchedulePeriod = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryServicerequestSetter -// this does nothing with the relationship templates -func (o HistoryServicerequestTemplate) BuildManySetter(number int) []*models.HistoryServicerequestSetter { - m := make([]*models.HistoryServicerequestSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryServicerequest -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryServicerequestTemplate.Create -func (o HistoryServicerequestTemplate) Build() *models.HistoryServicerequest { - m := &models.HistoryServicerequest{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accepted != nil { - m.Accepted = o.Accepted() - } - if o.Acceptedby != nil { - m.Acceptedby = o.Acceptedby() - } - if o.Accepteddate != nil { - m.Accepteddate = o.Accepteddate() - } - if o.Allowed != nil { - m.Allowed = o.Allowed() - } - if o.Assignedtech != nil { - m.Assignedtech = o.Assignedtech() - } - if o.Clraddr1 != nil { - m.Clraddr1 = o.Clraddr1() - } - if o.Clraddr2 != nil { - m.Clraddr2 = o.Clraddr2() - } - if o.Clranon != nil { - m.Clranon = o.Clranon() - } - if o.Clrcity != nil { - m.Clrcity = o.Clrcity() - } - if o.Clrcompany != nil { - m.Clrcompany = o.Clrcompany() - } - if o.Clrcontpref != nil { - m.Clrcontpref = o.Clrcontpref() - } - if o.Clremail != nil { - m.Clremail = o.Clremail() - } - if o.Clrfname != nil { - m.Clrfname = o.Clrfname() - } - if o.Clrother != nil { - m.Clrother = o.Clrother() - } - if o.Clrphone1 != nil { - m.Clrphone1 = o.Clrphone1() - } - if o.Clrphone2 != nil { - m.Clrphone2 = o.Clrphone2() - } - if o.Clrstate != nil { - m.Clrstate = o.Clrstate() - } - if o.Clrzip != nil { - m.Clrzip = o.Clrzip() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Datetimeclosed != nil { - m.Datetimeclosed = o.Datetimeclosed() - } - if o.Duedate != nil { - m.Duedate = o.Duedate() - } - if o.Entrytech != nil { - m.Entrytech = o.Entrytech() - } - if o.Estcompletedate != nil { - m.Estcompletedate = o.Estcompletedate() - } - if o.Externalerror != nil { - m.Externalerror = o.Externalerror() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Firstresponsedate != nil { - m.Firstresponsedate = o.Firstresponsedate() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Issuesreported != nil { - m.Issuesreported = o.Issuesreported() - } - if o.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Nextaction != nil { - m.Nextaction = o.Nextaction() - } - if o.Notificationtimestamp != nil { - m.Notificationtimestamp = o.Notificationtimestamp() - } - if o.Notified != nil { - m.Notified = o.Notified() - } - if o.Notifieddate != nil { - m.Notifieddate = o.Notifieddate() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Pointlocid != nil { - m.Pointlocid = o.Pointlocid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Recdatetime != nil { - m.Recdatetime = o.Recdatetime() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Rejectedby != nil { - m.Rejectedby = o.Rejectedby() - } - if o.Rejecteddate != nil { - m.Rejecteddate = o.Rejecteddate() - } - if o.Rejectedreason != nil { - m.Rejectedreason = o.Rejectedreason() - } - if o.Reqaddr1 != nil { - m.Reqaddr1 = o.Reqaddr1() - } - if o.Reqaddr2 != nil { - m.Reqaddr2 = o.Reqaddr2() - } - if o.Reqcity != nil { - m.Reqcity = o.Reqcity() - } - if o.Reqcompany != nil { - m.Reqcompany = o.Reqcompany() - } - if o.Reqcrossst != nil { - m.Reqcrossst = o.Reqcrossst() - } - if o.Reqdescr != nil { - m.Reqdescr = o.Reqdescr() - } - if o.Reqfldnotes != nil { - m.Reqfldnotes = o.Reqfldnotes() - } - if o.Reqmapgrid != nil { - m.Reqmapgrid = o.Reqmapgrid() - } - if o.Reqnotesforcust != nil { - m.Reqnotesforcust = o.Reqnotesforcust() - } - if o.Reqnotesfortech != nil { - m.Reqnotesfortech = o.Reqnotesfortech() - } - if o.Reqpermission != nil { - m.Reqpermission = o.Reqpermission() - } - if o.Reqprogramactions != nil { - m.Reqprogramactions = o.Reqprogramactions() - } - if o.Reqstate != nil { - m.Reqstate = o.Reqstate() - } - if o.Reqsubdiv != nil { - m.Reqsubdiv = o.Reqsubdiv() - } - if o.Reqtarget != nil { - m.Reqtarget = o.Reqtarget() - } - if o.Reqzip != nil { - m.Reqzip = o.Reqzip() - } - if o.Responsedaycount != nil { - m.Responsedaycount = o.Responsedaycount() - } - if o.Reviewed != nil { - m.Reviewed = o.Reviewed() - } - if o.Reviewedby != nil { - m.Reviewedby = o.Reviewedby() - } - if o.Revieweddate != nil { - m.Revieweddate = o.Revieweddate() - } - if o.Scheduled != nil { - m.Scheduled = o.Scheduled() - } - if o.Scheduleddate != nil { - m.Scheduleddate = o.Scheduleddate() - } - if o.Source != nil { - m.Source = o.Source() - } - if o.SRNumber != nil { - m.SRNumber = o.SRNumber() - } - if o.Status != nil { - m.Status = o.Status() - } - if o.Supervisor != nil { - m.Supervisor = o.Supervisor() - } - if o.Techclosed != nil { - m.Techclosed = o.Techclosed() - } - if o.Validx != nil { - m.Validx = o.Validx() - } - if o.Validy != nil { - m.Validy = o.Validy() - } - if o.Xvalue != nil { - m.Xvalue = o.Xvalue() - } - if o.Yvalue != nil { - m.Yvalue = o.Yvalue() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Dog != nil { - m.Dog = o.Dog() - } - if o.Spanish != nil { - m.Spanish = o.Spanish() - } - if o.ScheduleNotes != nil { - m.ScheduleNotes = o.ScheduleNotes() - } - if o.SchedulePeriod != nil { - m.SchedulePeriod = o.SchedulePeriod() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryServicerequestSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryServicerequestTemplate.CreateMany -func (o HistoryServicerequestTemplate) BuildMany(number int) models.HistoryServicerequestSlice { - m := make(models.HistoryServicerequestSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryServicerequest(m *models.HistoryServicerequestSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryServicerequest -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryServicerequestTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryServicerequest) error { - var err error - - return err -} - -// Create builds a historyServicerequest and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryServicerequestTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryServicerequest, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryServicerequest(opt) - - if o.r.Organization == nil { - HistoryServicerequestMods.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.HistoryServicerequests.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 historyServicerequest and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryServicerequestTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryServicerequest { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyServicerequest 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 *HistoryServicerequestTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryServicerequest { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyServicerequests and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryServicerequestTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryServicerequestSlice, error) { - var err error - m := make(models.HistoryServicerequestSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyServicerequests and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryServicerequestTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryServicerequestSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyServicerequests 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 HistoryServicerequestTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryServicerequestSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryServicerequest has methods that act as mods for the HistoryServicerequestTemplate -var HistoryServicerequestMods historyServicerequestMods - -type historyServicerequestMods struct{} - -func (m historyServicerequestMods) RandomizeAllColumns(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModSlice{ - HistoryServicerequestMods.RandomOrganizationID(f), - HistoryServicerequestMods.RandomAccepted(f), - HistoryServicerequestMods.RandomAcceptedby(f), - HistoryServicerequestMods.RandomAccepteddate(f), - HistoryServicerequestMods.RandomAllowed(f), - HistoryServicerequestMods.RandomAssignedtech(f), - HistoryServicerequestMods.RandomClraddr1(f), - HistoryServicerequestMods.RandomClraddr2(f), - HistoryServicerequestMods.RandomClranon(f), - HistoryServicerequestMods.RandomClrcity(f), - HistoryServicerequestMods.RandomClrcompany(f), - HistoryServicerequestMods.RandomClrcontpref(f), - HistoryServicerequestMods.RandomClremail(f), - HistoryServicerequestMods.RandomClrfname(f), - HistoryServicerequestMods.RandomClrother(f), - HistoryServicerequestMods.RandomClrphone1(f), - HistoryServicerequestMods.RandomClrphone2(f), - HistoryServicerequestMods.RandomClrstate(f), - HistoryServicerequestMods.RandomClrzip(f), - HistoryServicerequestMods.RandomComments(f), - HistoryServicerequestMods.RandomCreationdate(f), - HistoryServicerequestMods.RandomCreator(f), - HistoryServicerequestMods.RandomDatetimeclosed(f), - HistoryServicerequestMods.RandomDuedate(f), - HistoryServicerequestMods.RandomEntrytech(f), - HistoryServicerequestMods.RandomEstcompletedate(f), - HistoryServicerequestMods.RandomExternalerror(f), - HistoryServicerequestMods.RandomExternalid(f), - HistoryServicerequestMods.RandomEditdate(f), - HistoryServicerequestMods.RandomEditor(f), - HistoryServicerequestMods.RandomFirstresponsedate(f), - HistoryServicerequestMods.RandomGlobalid(f), - HistoryServicerequestMods.RandomIssuesreported(f), - HistoryServicerequestMods.RandomJurisdiction(f), - HistoryServicerequestMods.RandomNextaction(f), - HistoryServicerequestMods.RandomNotificationtimestamp(f), - HistoryServicerequestMods.RandomNotified(f), - HistoryServicerequestMods.RandomNotifieddate(f), - HistoryServicerequestMods.RandomObjectid(f), - HistoryServicerequestMods.RandomPointlocid(f), - HistoryServicerequestMods.RandomPriority(f), - HistoryServicerequestMods.RandomRecdatetime(f), - HistoryServicerequestMods.RandomRecordstatus(f), - HistoryServicerequestMods.RandomRejectedby(f), - HistoryServicerequestMods.RandomRejecteddate(f), - HistoryServicerequestMods.RandomRejectedreason(f), - HistoryServicerequestMods.RandomReqaddr1(f), - HistoryServicerequestMods.RandomReqaddr2(f), - HistoryServicerequestMods.RandomReqcity(f), - HistoryServicerequestMods.RandomReqcompany(f), - HistoryServicerequestMods.RandomReqcrossst(f), - HistoryServicerequestMods.RandomReqdescr(f), - HistoryServicerequestMods.RandomReqfldnotes(f), - HistoryServicerequestMods.RandomReqmapgrid(f), - HistoryServicerequestMods.RandomReqnotesforcust(f), - HistoryServicerequestMods.RandomReqnotesfortech(f), - HistoryServicerequestMods.RandomReqpermission(f), - HistoryServicerequestMods.RandomReqprogramactions(f), - HistoryServicerequestMods.RandomReqstate(f), - HistoryServicerequestMods.RandomReqsubdiv(f), - HistoryServicerequestMods.RandomReqtarget(f), - HistoryServicerequestMods.RandomReqzip(f), - HistoryServicerequestMods.RandomResponsedaycount(f), - HistoryServicerequestMods.RandomReviewed(f), - HistoryServicerequestMods.RandomReviewedby(f), - HistoryServicerequestMods.RandomRevieweddate(f), - HistoryServicerequestMods.RandomScheduled(f), - HistoryServicerequestMods.RandomScheduleddate(f), - HistoryServicerequestMods.RandomSource(f), - HistoryServicerequestMods.RandomSRNumber(f), - HistoryServicerequestMods.RandomStatus(f), - HistoryServicerequestMods.RandomSupervisor(f), - HistoryServicerequestMods.RandomTechclosed(f), - HistoryServicerequestMods.RandomValidx(f), - HistoryServicerequestMods.RandomValidy(f), - HistoryServicerequestMods.RandomXvalue(f), - HistoryServicerequestMods.RandomYvalue(f), - HistoryServicerequestMods.RandomZone(f), - HistoryServicerequestMods.RandomZone2(f), - HistoryServicerequestMods.RandomCreated(f), - HistoryServicerequestMods.RandomCreatedDate(f), - HistoryServicerequestMods.RandomCreatedUser(f), - HistoryServicerequestMods.RandomGeometryX(f), - HistoryServicerequestMods.RandomGeometryY(f), - HistoryServicerequestMods.RandomLastEditedDate(f), - HistoryServicerequestMods.RandomLastEditedUser(f), - HistoryServicerequestMods.RandomDog(f), - HistoryServicerequestMods.RandomSpanish(f), - HistoryServicerequestMods.RandomScheduleNotes(f), - HistoryServicerequestMods.RandomSchedulePeriod(f), - HistoryServicerequestMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyServicerequestMods) OrganizationID(val int32) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) OrganizationIDFunc(f func() int32) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetOrganizationID() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - 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 historyServicerequestMods) RandomOrganizationID(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Accepted(val null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Accepted = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) AcceptedFunc(f func() null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Accepted = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetAccepted() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Accepted = 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 historyServicerequestMods) RandomAccepted(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Accepted = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyServicerequestMods) RandomAcceptedNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Accepted = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Acceptedby(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Acceptedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) AcceptedbyFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Acceptedby = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetAcceptedby() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Acceptedby = 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 historyServicerequestMods) RandomAcceptedby(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Acceptedby = 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 historyServicerequestMods) RandomAcceptedbyNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Acceptedby = 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 historyServicerequestMods) Accepteddate(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Accepteddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) AccepteddateFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Accepteddate = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetAccepteddate() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Accepteddate = 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 historyServicerequestMods) RandomAccepteddate(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Accepteddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomAccepteddateNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Accepteddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Allowed(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Allowed = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) AllowedFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Allowed = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetAllowed() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Allowed = 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 historyServicerequestMods) RandomAllowed(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Allowed = 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 historyServicerequestMods) RandomAllowedNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Allowed = 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 historyServicerequestMods) Assignedtech(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Assignedtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) AssignedtechFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Assignedtech = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetAssignedtech() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Assignedtech = 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 historyServicerequestMods) RandomAssignedtech(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Assignedtech = 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 historyServicerequestMods) RandomAssignedtechNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Assignedtech = 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 historyServicerequestMods) Clraddr1(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clraddr1 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) Clraddr1Func(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clraddr1 = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetClraddr1() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clraddr1 = 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 historyServicerequestMods) RandomClraddr1(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clraddr1 = 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 historyServicerequestMods) RandomClraddr1NotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clraddr1 = 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 historyServicerequestMods) Clraddr2(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clraddr2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) Clraddr2Func(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clraddr2 = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetClraddr2() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clraddr2 = 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 historyServicerequestMods) RandomClraddr2(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clraddr2 = 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 historyServicerequestMods) RandomClraddr2NotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clraddr2 = 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 historyServicerequestMods) Clranon(val null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clranon = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ClranonFunc(f func() null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clranon = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetClranon() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clranon = 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 historyServicerequestMods) RandomClranon(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clranon = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyServicerequestMods) RandomClranonNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clranon = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Clrcity(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrcity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ClrcityFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrcity = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetClrcity() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrcity = 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 historyServicerequestMods) RandomClrcity(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrcity = 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 historyServicerequestMods) RandomClrcityNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrcity = 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 historyServicerequestMods) Clrcompany(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrcompany = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ClrcompanyFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrcompany = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetClrcompany() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrcompany = 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 historyServicerequestMods) RandomClrcompany(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrcompany = 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 historyServicerequestMods) RandomClrcompanyNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrcompany = 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 historyServicerequestMods) Clrcontpref(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrcontpref = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ClrcontprefFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrcontpref = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetClrcontpref() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrcontpref = 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 historyServicerequestMods) RandomClrcontpref(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrcontpref = 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 historyServicerequestMods) RandomClrcontprefNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrcontpref = 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 historyServicerequestMods) Clremail(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clremail = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ClremailFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clremail = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetClremail() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clremail = 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 historyServicerequestMods) RandomClremail(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clremail = 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 historyServicerequestMods) RandomClremailNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clremail = 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 historyServicerequestMods) Clrfname(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrfname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ClrfnameFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrfname = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetClrfname() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrfname = 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 historyServicerequestMods) RandomClrfname(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrfname = 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 historyServicerequestMods) RandomClrfnameNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrfname = 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 historyServicerequestMods) Clrother(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrother = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ClrotherFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrother = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetClrother() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrother = 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 historyServicerequestMods) RandomClrother(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrother = 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 historyServicerequestMods) RandomClrotherNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrother = 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 historyServicerequestMods) Clrphone1(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrphone1 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) Clrphone1Func(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrphone1 = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetClrphone1() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrphone1 = 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 historyServicerequestMods) RandomClrphone1(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrphone1 = 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 historyServicerequestMods) RandomClrphone1NotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrphone1 = 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 historyServicerequestMods) Clrphone2(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrphone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) Clrphone2Func(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrphone2 = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetClrphone2() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrphone2 = 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 historyServicerequestMods) RandomClrphone2(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrphone2 = 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 historyServicerequestMods) RandomClrphone2NotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrphone2 = 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 historyServicerequestMods) Clrstate(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrstate = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ClrstateFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrstate = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetClrstate() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrstate = 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 historyServicerequestMods) RandomClrstate(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrstate = 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 historyServicerequestMods) RandomClrstateNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrstate = 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 historyServicerequestMods) Clrzip(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrzip = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ClrzipFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrzip = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetClrzip() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrzip = 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 historyServicerequestMods) RandomClrzip(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrzip = 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 historyServicerequestMods) RandomClrzipNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Clrzip = 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 historyServicerequestMods) Comments(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) CommentsFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetComments() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Comments = 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 historyServicerequestMods) RandomComments(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Comments = 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 historyServicerequestMods) RandomCommentsNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Comments = 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 historyServicerequestMods) Creationdate(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) CreationdateFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetCreationdate() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Creationdate = 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 historyServicerequestMods) RandomCreationdate(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomCreationdateNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Creator(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) CreatorFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetCreator() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Creator = 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 historyServicerequestMods) RandomCreator(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Creator = 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 historyServicerequestMods) RandomCreatorNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Creator = 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 historyServicerequestMods) Datetimeclosed(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Datetimeclosed = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) DatetimeclosedFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Datetimeclosed = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetDatetimeclosed() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Datetimeclosed = 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 historyServicerequestMods) RandomDatetimeclosed(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Datetimeclosed = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomDatetimeclosedNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Datetimeclosed = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Duedate(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Duedate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) DuedateFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Duedate = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetDuedate() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Duedate = 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 historyServicerequestMods) RandomDuedate(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Duedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomDuedateNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Duedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Entrytech(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Entrytech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) EntrytechFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Entrytech = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetEntrytech() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Entrytech = 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 historyServicerequestMods) RandomEntrytech(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Entrytech = 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 historyServicerequestMods) RandomEntrytechNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Entrytech = 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 historyServicerequestMods) Estcompletedate(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Estcompletedate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) EstcompletedateFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Estcompletedate = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetEstcompletedate() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Estcompletedate = 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 historyServicerequestMods) RandomEstcompletedate(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Estcompletedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomEstcompletedateNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Estcompletedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Externalerror(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Externalerror = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ExternalerrorFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Externalerror = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetExternalerror() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Externalerror = 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 historyServicerequestMods) RandomExternalerror(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Externalerror = 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 historyServicerequestMods) RandomExternalerrorNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Externalerror = 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 historyServicerequestMods) Externalid(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ExternalidFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetExternalid() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Externalid = 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 historyServicerequestMods) RandomExternalid(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Externalid = 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 historyServicerequestMods) RandomExternalidNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Externalid = 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 historyServicerequestMods) Editdate(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) EditdateFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetEditdate() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Editdate = 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 historyServicerequestMods) RandomEditdate(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomEditdateNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Editor(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) EditorFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetEditor() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Editor = 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 historyServicerequestMods) RandomEditor(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Editor = 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 historyServicerequestMods) RandomEditorNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Editor = 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 historyServicerequestMods) Firstresponsedate(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Firstresponsedate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) FirstresponsedateFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Firstresponsedate = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetFirstresponsedate() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Firstresponsedate = 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 historyServicerequestMods) RandomFirstresponsedate(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Firstresponsedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomFirstresponsedateNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Firstresponsedate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Globalid(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) GlobalidFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetGlobalid() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Globalid = 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 historyServicerequestMods) RandomGlobalid(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - 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 historyServicerequestMods) RandomGlobalidNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Globalid = 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 historyServicerequestMods) Issuesreported(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Issuesreported = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) IssuesreportedFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Issuesreported = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetIssuesreported() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Issuesreported = 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 historyServicerequestMods) RandomIssuesreported(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Issuesreported = 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 historyServicerequestMods) RandomIssuesreportedNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Issuesreported = 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 historyServicerequestMods) Jurisdiction(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) JurisdictionFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetJurisdiction() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Jurisdiction = 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 historyServicerequestMods) RandomJurisdiction(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Jurisdiction = 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 historyServicerequestMods) RandomJurisdictionNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Jurisdiction = 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 historyServicerequestMods) Nextaction(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Nextaction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) NextactionFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Nextaction = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetNextaction() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Nextaction = 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 historyServicerequestMods) RandomNextaction(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Nextaction = 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 historyServicerequestMods) RandomNextactionNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Nextaction = 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 historyServicerequestMods) Notificationtimestamp(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Notificationtimestamp = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) NotificationtimestampFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Notificationtimestamp = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetNotificationtimestamp() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Notificationtimestamp = 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 historyServicerequestMods) RandomNotificationtimestamp(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Notificationtimestamp = 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 historyServicerequestMods) RandomNotificationtimestampNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Notificationtimestamp = 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 historyServicerequestMods) Notified(val null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Notified = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) NotifiedFunc(f func() null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Notified = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetNotified() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Notified = 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 historyServicerequestMods) RandomNotified(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Notified = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyServicerequestMods) RandomNotifiedNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Notified = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Notifieddate(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Notifieddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) NotifieddateFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Notifieddate = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetNotifieddate() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Notifieddate = 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 historyServicerequestMods) RandomNotifieddate(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Notifieddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomNotifieddateNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Notifieddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Objectid(val int32) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ObjectidFunc(f func() int32) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetObjectid() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyServicerequestMods) RandomObjectid(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Pointlocid(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Pointlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) PointlocidFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Pointlocid = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetPointlocid() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Pointlocid = 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 historyServicerequestMods) RandomPointlocid(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Pointlocid = 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 historyServicerequestMods) RandomPointlocidNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Pointlocid = 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 historyServicerequestMods) Priority(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) PriorityFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetPriority() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Priority = 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 historyServicerequestMods) RandomPriority(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Priority = 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 historyServicerequestMods) RandomPriorityNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Priority = 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 historyServicerequestMods) Recdatetime(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Recdatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) RecdatetimeFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Recdatetime = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetRecdatetime() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Recdatetime = 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 historyServicerequestMods) RandomRecdatetime(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Recdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomRecdatetimeNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Recdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Recordstatus(val null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) RecordstatusFunc(f func() null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetRecordstatus() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Recordstatus = 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 historyServicerequestMods) RandomRecordstatus(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyServicerequestMods) RandomRecordstatusNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Rejectedby(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Rejectedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) RejectedbyFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Rejectedby = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetRejectedby() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Rejectedby = 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 historyServicerequestMods) RandomRejectedby(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Rejectedby = 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 historyServicerequestMods) RandomRejectedbyNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Rejectedby = 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 historyServicerequestMods) Rejecteddate(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Rejecteddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) RejecteddateFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Rejecteddate = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetRejecteddate() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Rejecteddate = 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 historyServicerequestMods) RandomRejecteddate(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Rejecteddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomRejecteddateNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Rejecteddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Rejectedreason(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Rejectedreason = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) RejectedreasonFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Rejectedreason = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetRejectedreason() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Rejectedreason = 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 historyServicerequestMods) RandomRejectedreason(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Rejectedreason = 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 historyServicerequestMods) RandomRejectedreasonNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Rejectedreason = 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 historyServicerequestMods) Reqaddr1(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqaddr1 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) Reqaddr1Func(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqaddr1 = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqaddr1() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqaddr1 = 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 historyServicerequestMods) RandomReqaddr1(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqaddr1 = 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 historyServicerequestMods) RandomReqaddr1NotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqaddr1 = 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 historyServicerequestMods) Reqaddr2(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqaddr2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) Reqaddr2Func(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqaddr2 = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqaddr2() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqaddr2 = 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 historyServicerequestMods) RandomReqaddr2(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqaddr2 = 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 historyServicerequestMods) RandomReqaddr2NotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqaddr2 = 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 historyServicerequestMods) Reqcity(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqcity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReqcityFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqcity = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqcity() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqcity = 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 historyServicerequestMods) RandomReqcity(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqcity = 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 historyServicerequestMods) RandomReqcityNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqcity = 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 historyServicerequestMods) Reqcompany(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqcompany = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReqcompanyFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqcompany = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqcompany() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqcompany = 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 historyServicerequestMods) RandomReqcompany(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqcompany = 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 historyServicerequestMods) RandomReqcompanyNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqcompany = 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 historyServicerequestMods) Reqcrossst(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqcrossst = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReqcrossstFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqcrossst = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqcrossst() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqcrossst = 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 historyServicerequestMods) RandomReqcrossst(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqcrossst = 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 historyServicerequestMods) RandomReqcrossstNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqcrossst = 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 historyServicerequestMods) Reqdescr(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqdescr = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReqdescrFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqdescr = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqdescr() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqdescr = 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 historyServicerequestMods) RandomReqdescr(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqdescr = 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 historyServicerequestMods) RandomReqdescrNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqdescr = 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 historyServicerequestMods) Reqfldnotes(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqfldnotes = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReqfldnotesFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqfldnotes = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqfldnotes() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqfldnotes = 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 historyServicerequestMods) RandomReqfldnotes(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqfldnotes = 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 historyServicerequestMods) RandomReqfldnotesNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqfldnotes = 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 historyServicerequestMods) Reqmapgrid(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqmapgrid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReqmapgridFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqmapgrid = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqmapgrid() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqmapgrid = 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 historyServicerequestMods) RandomReqmapgrid(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqmapgrid = 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 historyServicerequestMods) RandomReqmapgridNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqmapgrid = 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 historyServicerequestMods) Reqnotesforcust(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqnotesforcust = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReqnotesforcustFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqnotesforcust = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqnotesforcust() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqnotesforcust = 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 historyServicerequestMods) RandomReqnotesforcust(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqnotesforcust = 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 historyServicerequestMods) RandomReqnotesforcustNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqnotesforcust = 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 historyServicerequestMods) Reqnotesfortech(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqnotesfortech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReqnotesfortechFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqnotesfortech = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqnotesfortech() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqnotesfortech = 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 historyServicerequestMods) RandomReqnotesfortech(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqnotesfortech = 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 historyServicerequestMods) RandomReqnotesfortechNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqnotesfortech = 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 historyServicerequestMods) Reqpermission(val null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqpermission = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReqpermissionFunc(f func() null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqpermission = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqpermission() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqpermission = 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 historyServicerequestMods) RandomReqpermission(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqpermission = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyServicerequestMods) RandomReqpermissionNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqpermission = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Reqprogramactions(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqprogramactions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReqprogramactionsFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqprogramactions = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqprogramactions() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqprogramactions = 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 historyServicerequestMods) RandomReqprogramactions(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqprogramactions = 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 historyServicerequestMods) RandomReqprogramactionsNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqprogramactions = 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 historyServicerequestMods) Reqstate(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqstate = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReqstateFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqstate = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqstate() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqstate = 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 historyServicerequestMods) RandomReqstate(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqstate = 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 historyServicerequestMods) RandomReqstateNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqstate = 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 historyServicerequestMods) Reqsubdiv(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqsubdiv = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReqsubdivFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqsubdiv = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqsubdiv() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqsubdiv = 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 historyServicerequestMods) RandomReqsubdiv(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqsubdiv = 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 historyServicerequestMods) RandomReqsubdivNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqsubdiv = 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 historyServicerequestMods) Reqtarget(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqtarget = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReqtargetFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqtarget = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqtarget() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqtarget = 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 historyServicerequestMods) RandomReqtarget(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqtarget = 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 historyServicerequestMods) RandomReqtargetNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqtarget = 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 historyServicerequestMods) Reqzip(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqzip = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReqzipFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqzip = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReqzip() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqzip = 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 historyServicerequestMods) RandomReqzip(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqzip = 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 historyServicerequestMods) RandomReqzipNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reqzip = 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 historyServicerequestMods) Responsedaycount(val null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Responsedaycount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ResponsedaycountFunc(f func() null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Responsedaycount = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetResponsedaycount() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Responsedaycount = 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 historyServicerequestMods) RandomResponsedaycount(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Responsedaycount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyServicerequestMods) RandomResponsedaycountNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Responsedaycount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Reviewed(val null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReviewedFunc(f func() null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReviewed() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reviewed = 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 historyServicerequestMods) RandomReviewed(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyServicerequestMods) RandomReviewedNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Reviewedby(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ReviewedbyFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetReviewedby() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reviewedby = 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 historyServicerequestMods) RandomReviewedby(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reviewedby = 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 historyServicerequestMods) RandomReviewedbyNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Reviewedby = 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 historyServicerequestMods) Revieweddate(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Revieweddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) RevieweddateFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetRevieweddate() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Revieweddate = 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 historyServicerequestMods) RandomRevieweddate(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomRevieweddateNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Scheduled(val null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Scheduled = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ScheduledFunc(f func() null.Val[int16]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Scheduled = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetScheduled() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Scheduled = 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 historyServicerequestMods) RandomScheduled(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Scheduled = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyServicerequestMods) RandomScheduledNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Scheduled = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Scheduleddate(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Scheduleddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ScheduleddateFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Scheduleddate = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetScheduleddate() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Scheduleddate = 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 historyServicerequestMods) RandomScheduleddate(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Scheduleddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomScheduleddateNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Scheduleddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Source(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Source = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) SourceFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Source = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetSource() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Source = 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 historyServicerequestMods) RandomSource(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Source = 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 historyServicerequestMods) RandomSourceNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Source = 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 historyServicerequestMods) SRNumber(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.SRNumber = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) SRNumberFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.SRNumber = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetSRNumber() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.SRNumber = 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 historyServicerequestMods) RandomSRNumber(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.SRNumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomSRNumberNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.SRNumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Status(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Status = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) StatusFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Status = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetStatus() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Status = 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 historyServicerequestMods) RandomStatus(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Status = 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 historyServicerequestMods) RandomStatusNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Status = 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 historyServicerequestMods) Supervisor(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Supervisor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) SupervisorFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Supervisor = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetSupervisor() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Supervisor = 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 historyServicerequestMods) RandomSupervisor(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Supervisor = 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 historyServicerequestMods) RandomSupervisorNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Supervisor = 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 historyServicerequestMods) Techclosed(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Techclosed = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) TechclosedFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Techclosed = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetTechclosed() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Techclosed = 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 historyServicerequestMods) RandomTechclosed(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Techclosed = 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 historyServicerequestMods) RandomTechclosedNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Techclosed = 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 historyServicerequestMods) Validx(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Validx = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ValidxFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Validx = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetValidx() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Validx = 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 historyServicerequestMods) RandomValidx(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Validx = 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 historyServicerequestMods) RandomValidxNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Validx = 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 historyServicerequestMods) Validy(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Validy = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ValidyFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Validy = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetValidy() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Validy = 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 historyServicerequestMods) RandomValidy(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Validy = 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 historyServicerequestMods) RandomValidyNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Validy = 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 historyServicerequestMods) Xvalue(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Xvalue = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) XvalueFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Xvalue = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetXvalue() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Xvalue = 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 historyServicerequestMods) RandomXvalue(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Xvalue = 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 historyServicerequestMods) RandomXvalueNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Xvalue = 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 historyServicerequestMods) Yvalue(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Yvalue = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) YvalueFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Yvalue = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetYvalue() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Yvalue = 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 historyServicerequestMods) RandomYvalue(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Yvalue = 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 historyServicerequestMods) RandomYvalueNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Yvalue = 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 historyServicerequestMods) Zone(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ZoneFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetZone() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Zone = 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 historyServicerequestMods) RandomZone(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Zone = 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 historyServicerequestMods) RandomZoneNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Zone = 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 historyServicerequestMods) Zone2(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) Zone2Func(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetZone2() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Zone2 = 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 historyServicerequestMods) RandomZone2(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Zone2 = 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 historyServicerequestMods) RandomZone2NotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Zone2 = 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 historyServicerequestMods) Created(val null.Val[time.Time]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) CreatedFunc(f func() null.Val[time.Time]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetCreated() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Created = 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 historyServicerequestMods) RandomCreated(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyServicerequestMods) RandomCreatedNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) CreatedDate(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) CreatedDateFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetCreatedDate() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.CreatedDate = 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 historyServicerequestMods) RandomCreatedDate(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) CreatedUser(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) CreatedUserFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetCreatedUser() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.CreatedUser = 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 historyServicerequestMods) RandomCreatedUser(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.CreatedUser = 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 historyServicerequestMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.CreatedUser = 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 historyServicerequestMods) GeometryX(val null.Val[float64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) GeometryXFunc(f func() null.Val[float64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetGeometryX() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.GeometryX = 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 historyServicerequestMods) RandomGeometryX(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - 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 historyServicerequestMods) RandomGeometryXNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.GeometryX = 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 historyServicerequestMods) GeometryY(val null.Val[float64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) GeometryYFunc(f func() null.Val[float64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetGeometryY() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.GeometryY = 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 historyServicerequestMods) RandomGeometryY(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - 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 historyServicerequestMods) RandomGeometryYNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.GeometryY = 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 historyServicerequestMods) LastEditedDate(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetLastEditedDate() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.LastEditedDate = 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 historyServicerequestMods) RandomLastEditedDate(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) LastEditedUser(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) LastEditedUserFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetLastEditedUser() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.LastEditedUser = 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 historyServicerequestMods) RandomLastEditedUser(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.LastEditedUser = 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 historyServicerequestMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.LastEditedUser = 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 historyServicerequestMods) Dog(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Dog = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) DogFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Dog = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetDog() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Dog = 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 historyServicerequestMods) RandomDog(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Dog = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomDogNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Dog = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) Spanish(val null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Spanish = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) SpanishFunc(f func() null.Val[int64]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Spanish = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetSpanish() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Spanish = 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 historyServicerequestMods) RandomSpanish(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Spanish = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyServicerequestMods) RandomSpanishNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Spanish = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyServicerequestMods) ScheduleNotes(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.ScheduleNotes = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) ScheduleNotesFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.ScheduleNotes = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetScheduleNotes() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.ScheduleNotes = 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 historyServicerequestMods) RandomScheduleNotes(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.ScheduleNotes = 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 historyServicerequestMods) RandomScheduleNotesNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.ScheduleNotes = 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 historyServicerequestMods) SchedulePeriod(val null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.SchedulePeriod = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) SchedulePeriodFunc(f func() null.Val[string]) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.SchedulePeriod = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetSchedulePeriod() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.SchedulePeriod = 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 historyServicerequestMods) RandomSchedulePeriod(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.SchedulePeriod = 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 historyServicerequestMods) RandomSchedulePeriodNotNull(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.SchedulePeriod = 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 historyServicerequestMods) Version(val int32) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyServicerequestMods) VersionFunc(f func() int32) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyServicerequestMods) UnsetVersion() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyServicerequestMods) RandomVersion(f *faker.Faker) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(_ context.Context, o *HistoryServicerequestTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyServicerequestMods) WithParentsCascading() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(ctx context.Context, o *HistoryServicerequestTemplate) { - if isDone, _ := historyServicerequestWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyServicerequestWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyServicerequestMods) WithOrganization(rel *OrganizationTemplate) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(ctx context.Context, o *HistoryServicerequestTemplate) { - o.r.Organization = &historyServicerequestROrganizationR{ - o: rel, - } - }) -} - -func (m historyServicerequestMods) WithNewOrganization(mods ...OrganizationMod) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(ctx context.Context, o *HistoryServicerequestTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyServicerequestMods) WithExistingOrganization(em *models.Organization) HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(ctx context.Context, o *HistoryServicerequestTemplate) { - o.r.Organization = &historyServicerequestROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyServicerequestMods) WithoutOrganization() HistoryServicerequestMod { - return HistoryServicerequestModFunc(func(ctx context.Context, o *HistoryServicerequestTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_speciesabundance.bob.go b/db/factory/history_speciesabundance.bob.go deleted file mode 100644 index 9d0d5951..00000000 --- a/db/factory/history_speciesabundance.bob.go +++ /dev/null @@ -1,2338 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistorySpeciesabundanceMod interface { - Apply(context.Context, *HistorySpeciesabundanceTemplate) -} - -type HistorySpeciesabundanceModFunc func(context.Context, *HistorySpeciesabundanceTemplate) - -func (f HistorySpeciesabundanceModFunc) Apply(ctx context.Context, n *HistorySpeciesabundanceTemplate) { - f(ctx, n) -} - -type HistorySpeciesabundanceModSlice []HistorySpeciesabundanceMod - -func (mods HistorySpeciesabundanceModSlice) Apply(ctx context.Context, n *HistorySpeciesabundanceTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistorySpeciesabundanceTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistorySpeciesabundanceTemplate struct { - OrganizationID func() int32 - Bloodedfem func() null.Val[int16] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Eggs func() null.Val[int16] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Females func() null.Val[int64] - Gravidfem func() null.Val[int16] - Globalid func() null.Val[string] - Larvae func() null.Val[int16] - Males func() null.Val[int16] - Objectid func() int32 - Poolstogen func() null.Val[int16] - Processed func() null.Val[int16] - Pupae func() null.Val[int16] - Species func() null.Val[string] - Total func() null.Val[int64] - TrapdataID func() null.Val[string] - Unknown func() null.Val[int16] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Globalzscore func() null.Val[float64] - H3R7 func() null.Val[string] - H3R8 func() null.Val[string] - R7score func() null.Val[float64] - R8score func() null.Val[float64] - Yearweek func() null.Val[int64] - Version func() int32 - - r historySpeciesabundanceR - f *Factory - - alreadyPersisted bool -} - -type historySpeciesabundanceR struct { - Organization *historySpeciesabundanceROrganizationR -} - -type historySpeciesabundanceROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistorySpeciesabundanceTemplate -func (o *HistorySpeciesabundanceTemplate) Apply(ctx context.Context, mods ...HistorySpeciesabundanceMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistorySpeciesabundance -// according to the relationships in the template. Nothing is inserted into the db -func (t HistorySpeciesabundanceTemplate) setModelRels(o *models.HistorySpeciesabundance) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistorySpeciesabundances = append(rel.R.HistorySpeciesabundances, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistorySpeciesabundanceSetter -// this does nothing with the relationship templates -func (o HistorySpeciesabundanceTemplate) BuildSetter() *models.HistorySpeciesabundanceSetter { - m := &models.HistorySpeciesabundanceSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Bloodedfem != nil { - val := o.Bloodedfem() - m.Bloodedfem = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Eggs != nil { - val := o.Eggs() - m.Eggs = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Females != nil { - val := o.Females() - m.Females = omitnull.FromNull(val) - } - if o.Gravidfem != nil { - val := o.Gravidfem() - m.Gravidfem = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Larvae != nil { - val := o.Larvae() - m.Larvae = omitnull.FromNull(val) - } - if o.Males != nil { - val := o.Males() - m.Males = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Poolstogen != nil { - val := o.Poolstogen() - m.Poolstogen = omitnull.FromNull(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.Pupae != nil { - val := o.Pupae() - m.Pupae = omitnull.FromNull(val) - } - if o.Species != nil { - val := o.Species() - m.Species = omitnull.FromNull(val) - } - if o.Total != nil { - val := o.Total() - m.Total = omitnull.FromNull(val) - } - if o.TrapdataID != nil { - val := o.TrapdataID() - m.TrapdataID = omitnull.FromNull(val) - } - if o.Unknown != nil { - val := o.Unknown() - m.Unknown = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Globalzscore != nil { - val := o.Globalzscore() - m.Globalzscore = omitnull.FromNull(val) - } - if o.H3R7 != nil { - val := o.H3R7() - m.H3R7 = omitnull.FromNull(val) - } - if o.H3R8 != nil { - val := o.H3R8() - m.H3R8 = omitnull.FromNull(val) - } - if o.R7score != nil { - val := o.R7score() - m.R7score = omitnull.FromNull(val) - } - if o.R8score != nil { - val := o.R8score() - m.R8score = omitnull.FromNull(val) - } - if o.Yearweek != nil { - val := o.Yearweek() - m.Yearweek = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistorySpeciesabundanceSetter -// this does nothing with the relationship templates -func (o HistorySpeciesabundanceTemplate) BuildManySetter(number int) []*models.HistorySpeciesabundanceSetter { - m := make([]*models.HistorySpeciesabundanceSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistorySpeciesabundance -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistorySpeciesabundanceTemplate.Create -func (o HistorySpeciesabundanceTemplate) Build() *models.HistorySpeciesabundance { - m := &models.HistorySpeciesabundance{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Bloodedfem != nil { - m.Bloodedfem = o.Bloodedfem() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Eggs != nil { - m.Eggs = o.Eggs() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Females != nil { - m.Females = o.Females() - } - if o.Gravidfem != nil { - m.Gravidfem = o.Gravidfem() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Larvae != nil { - m.Larvae = o.Larvae() - } - if o.Males != nil { - m.Males = o.Males() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Poolstogen != nil { - m.Poolstogen = o.Poolstogen() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.Pupae != nil { - m.Pupae = o.Pupae() - } - if o.Species != nil { - m.Species = o.Species() - } - if o.Total != nil { - m.Total = o.Total() - } - if o.TrapdataID != nil { - m.TrapdataID = o.TrapdataID() - } - if o.Unknown != nil { - m.Unknown = o.Unknown() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Globalzscore != nil { - m.Globalzscore = o.Globalzscore() - } - if o.H3R7 != nil { - m.H3R7 = o.H3R7() - } - if o.H3R8 != nil { - m.H3R8 = o.H3R8() - } - if o.R7score != nil { - m.R7score = o.R7score() - } - if o.R8score != nil { - m.R8score = o.R8score() - } - if o.Yearweek != nil { - m.Yearweek = o.Yearweek() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistorySpeciesabundanceSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistorySpeciesabundanceTemplate.CreateMany -func (o HistorySpeciesabundanceTemplate) BuildMany(number int) models.HistorySpeciesabundanceSlice { - m := make(models.HistorySpeciesabundanceSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistorySpeciesabundance(m *models.HistorySpeciesabundanceSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistorySpeciesabundance -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistorySpeciesabundanceTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistorySpeciesabundance) error { - var err error - - return err -} - -// Create builds a historySpeciesabundance and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistorySpeciesabundanceTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistorySpeciesabundance, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistorySpeciesabundance(opt) - - if o.r.Organization == nil { - HistorySpeciesabundanceMods.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.HistorySpeciesabundances.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 historySpeciesabundance and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistorySpeciesabundanceTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistorySpeciesabundance { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historySpeciesabundance 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 *HistorySpeciesabundanceTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistorySpeciesabundance { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historySpeciesabundances and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistorySpeciesabundanceTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistorySpeciesabundanceSlice, error) { - var err error - m := make(models.HistorySpeciesabundanceSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historySpeciesabundances and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistorySpeciesabundanceTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistorySpeciesabundanceSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historySpeciesabundances 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 HistorySpeciesabundanceTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistorySpeciesabundanceSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistorySpeciesabundance has methods that act as mods for the HistorySpeciesabundanceTemplate -var HistorySpeciesabundanceMods historySpeciesabundanceMods - -type historySpeciesabundanceMods struct{} - -func (m historySpeciesabundanceMods) RandomizeAllColumns(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModSlice{ - HistorySpeciesabundanceMods.RandomOrganizationID(f), - HistorySpeciesabundanceMods.RandomBloodedfem(f), - HistorySpeciesabundanceMods.RandomCreationdate(f), - HistorySpeciesabundanceMods.RandomCreator(f), - HistorySpeciesabundanceMods.RandomEggs(f), - HistorySpeciesabundanceMods.RandomEditdate(f), - HistorySpeciesabundanceMods.RandomEditor(f), - HistorySpeciesabundanceMods.RandomFemales(f), - HistorySpeciesabundanceMods.RandomGravidfem(f), - HistorySpeciesabundanceMods.RandomGlobalid(f), - HistorySpeciesabundanceMods.RandomLarvae(f), - HistorySpeciesabundanceMods.RandomMales(f), - HistorySpeciesabundanceMods.RandomObjectid(f), - HistorySpeciesabundanceMods.RandomPoolstogen(f), - HistorySpeciesabundanceMods.RandomProcessed(f), - HistorySpeciesabundanceMods.RandomPupae(f), - HistorySpeciesabundanceMods.RandomSpecies(f), - HistorySpeciesabundanceMods.RandomTotal(f), - HistorySpeciesabundanceMods.RandomTrapdataID(f), - HistorySpeciesabundanceMods.RandomUnknown(f), - HistorySpeciesabundanceMods.RandomCreated(f), - HistorySpeciesabundanceMods.RandomCreatedDate(f), - HistorySpeciesabundanceMods.RandomCreatedUser(f), - HistorySpeciesabundanceMods.RandomGeometryX(f), - HistorySpeciesabundanceMods.RandomGeometryY(f), - HistorySpeciesabundanceMods.RandomLastEditedDate(f), - HistorySpeciesabundanceMods.RandomLastEditedUser(f), - HistorySpeciesabundanceMods.RandomGlobalzscore(f), - HistorySpeciesabundanceMods.RandomH3R7(f), - HistorySpeciesabundanceMods.RandomH3R8(f), - HistorySpeciesabundanceMods.RandomR7score(f), - HistorySpeciesabundanceMods.RandomR8score(f), - HistorySpeciesabundanceMods.RandomYearweek(f), - HistorySpeciesabundanceMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) OrganizationID(val int32) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) OrganizationIDFunc(f func() int32) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetOrganizationID() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - 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 historySpeciesabundanceMods) RandomOrganizationID(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) Bloodedfem(val null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Bloodedfem = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) BloodedfemFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Bloodedfem = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetBloodedfem() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Bloodedfem = 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 historySpeciesabundanceMods) RandomBloodedfem(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Bloodedfem = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySpeciesabundanceMods) RandomBloodedfemNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Bloodedfem = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) Creationdate(val null.Val[int64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) CreationdateFunc(f func() null.Val[int64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetCreationdate() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Creationdate = 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 historySpeciesabundanceMods) RandomCreationdate(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySpeciesabundanceMods) RandomCreationdateNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) Creator(val null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) CreatorFunc(f func() null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetCreator() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Creator = 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 historySpeciesabundanceMods) RandomCreator(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Creator = 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 historySpeciesabundanceMods) RandomCreatorNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Creator = 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 historySpeciesabundanceMods) Eggs(val null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Eggs = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) EggsFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Eggs = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetEggs() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Eggs = 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 historySpeciesabundanceMods) RandomEggs(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Eggs = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySpeciesabundanceMods) RandomEggsNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Eggs = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) Editdate(val null.Val[int64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) EditdateFunc(f func() null.Val[int64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetEditdate() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Editdate = 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 historySpeciesabundanceMods) RandomEditdate(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySpeciesabundanceMods) RandomEditdateNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) Editor(val null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) EditorFunc(f func() null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetEditor() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Editor = 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 historySpeciesabundanceMods) RandomEditor(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Editor = 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 historySpeciesabundanceMods) RandomEditorNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Editor = 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 historySpeciesabundanceMods) Females(val null.Val[int64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Females = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) FemalesFunc(f func() null.Val[int64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Females = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetFemales() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Females = 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 historySpeciesabundanceMods) RandomFemales(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Females = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySpeciesabundanceMods) RandomFemalesNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Females = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) Gravidfem(val null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Gravidfem = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) GravidfemFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Gravidfem = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetGravidfem() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Gravidfem = 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 historySpeciesabundanceMods) RandomGravidfem(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Gravidfem = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySpeciesabundanceMods) RandomGravidfemNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Gravidfem = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) Globalid(val null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) GlobalidFunc(f func() null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetGlobalid() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Globalid = 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 historySpeciesabundanceMods) RandomGlobalid(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - 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 historySpeciesabundanceMods) RandomGlobalidNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Globalid = 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 historySpeciesabundanceMods) Larvae(val null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Larvae = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) LarvaeFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Larvae = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetLarvae() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Larvae = 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 historySpeciesabundanceMods) RandomLarvae(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Larvae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySpeciesabundanceMods) RandomLarvaeNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Larvae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) Males(val null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Males = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) MalesFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Males = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetMales() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Males = 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 historySpeciesabundanceMods) RandomMales(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Males = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySpeciesabundanceMods) RandomMalesNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Males = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) Objectid(val int32) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) ObjectidFunc(f func() int32) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetObjectid() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historySpeciesabundanceMods) RandomObjectid(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) Poolstogen(val null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Poolstogen = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) PoolstogenFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Poolstogen = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetPoolstogen() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Poolstogen = 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 historySpeciesabundanceMods) RandomPoolstogen(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Poolstogen = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySpeciesabundanceMods) RandomPoolstogenNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Poolstogen = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) Processed(val null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) ProcessedFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetProcessed() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Processed = 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 historySpeciesabundanceMods) RandomProcessed(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySpeciesabundanceMods) RandomProcessedNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) Pupae(val null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Pupae = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) PupaeFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Pupae = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetPupae() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Pupae = 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 historySpeciesabundanceMods) RandomPupae(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Pupae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySpeciesabundanceMods) RandomPupaeNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Pupae = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) Species(val null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Species = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) SpeciesFunc(f func() null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Species = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetSpecies() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Species = 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 historySpeciesabundanceMods) RandomSpecies(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Species = 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 historySpeciesabundanceMods) RandomSpeciesNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Species = 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 historySpeciesabundanceMods) Total(val null.Val[int64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Total = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) TotalFunc(f func() null.Val[int64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Total = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetTotal() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Total = 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 historySpeciesabundanceMods) RandomTotal(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Total = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySpeciesabundanceMods) RandomTotalNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Total = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) TrapdataID(val null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.TrapdataID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) TrapdataIDFunc(f func() null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.TrapdataID = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetTrapdataID() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.TrapdataID = 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 historySpeciesabundanceMods) RandomTrapdataID(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.TrapdataID = 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 historySpeciesabundanceMods) RandomTrapdataIDNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.TrapdataID = 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 historySpeciesabundanceMods) Unknown(val null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Unknown = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) UnknownFunc(f func() null.Val[int16]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Unknown = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetUnknown() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Unknown = 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 historySpeciesabundanceMods) RandomUnknown(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Unknown = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historySpeciesabundanceMods) RandomUnknownNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Unknown = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) Created(val null.Val[time.Time]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) CreatedFunc(f func() null.Val[time.Time]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetCreated() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Created = 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 historySpeciesabundanceMods) RandomCreated(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historySpeciesabundanceMods) RandomCreatedNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) CreatedDate(val null.Val[int64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) CreatedDateFunc(f func() null.Val[int64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetCreatedDate() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.CreatedDate = 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 historySpeciesabundanceMods) RandomCreatedDate(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySpeciesabundanceMods) RandomCreatedDateNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) CreatedUser(val null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) CreatedUserFunc(f func() null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetCreatedUser() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.CreatedUser = 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 historySpeciesabundanceMods) RandomCreatedUser(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.CreatedUser = 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 historySpeciesabundanceMods) RandomCreatedUserNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.CreatedUser = 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 historySpeciesabundanceMods) GeometryX(val null.Val[float64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) GeometryXFunc(f func() null.Val[float64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetGeometryX() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.GeometryX = 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 historySpeciesabundanceMods) RandomGeometryX(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - 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 historySpeciesabundanceMods) RandomGeometryXNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.GeometryX = 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 historySpeciesabundanceMods) GeometryY(val null.Val[float64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) GeometryYFunc(f func() null.Val[float64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetGeometryY() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.GeometryY = 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 historySpeciesabundanceMods) RandomGeometryY(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - 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 historySpeciesabundanceMods) RandomGeometryYNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.GeometryY = 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 historySpeciesabundanceMods) LastEditedDate(val null.Val[int64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) LastEditedDateFunc(f func() null.Val[int64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetLastEditedDate() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.LastEditedDate = 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 historySpeciesabundanceMods) RandomLastEditedDate(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySpeciesabundanceMods) RandomLastEditedDateNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) LastEditedUser(val null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) LastEditedUserFunc(f func() null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetLastEditedUser() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.LastEditedUser = 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 historySpeciesabundanceMods) RandomLastEditedUser(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.LastEditedUser = 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 historySpeciesabundanceMods) RandomLastEditedUserNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.LastEditedUser = 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 historySpeciesabundanceMods) Globalzscore(val null.Val[float64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Globalzscore = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) GlobalzscoreFunc(f func() null.Val[float64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Globalzscore = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetGlobalzscore() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Globalzscore = 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 historySpeciesabundanceMods) RandomGlobalzscore(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Globalzscore = 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 historySpeciesabundanceMods) RandomGlobalzscoreNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Globalzscore = 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 historySpeciesabundanceMods) H3R7(val null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.H3R7 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) H3R7Func(f func() null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.H3R7 = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetH3R7() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.H3R7 = 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 historySpeciesabundanceMods) RandomH3R7(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.H3R7 = 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 historySpeciesabundanceMods) RandomH3R7NotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.H3R7 = 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 historySpeciesabundanceMods) H3R8(val null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.H3R8 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) H3R8Func(f func() null.Val[string]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.H3R8 = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetH3R8() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.H3R8 = 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 historySpeciesabundanceMods) RandomH3R8(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.H3R8 = 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 historySpeciesabundanceMods) RandomH3R8NotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.H3R8 = 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 historySpeciesabundanceMods) R7score(val null.Val[float64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.R7score = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) R7scoreFunc(f func() null.Val[float64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.R7score = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetR7score() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.R7score = 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 historySpeciesabundanceMods) RandomR7score(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.R7score = 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 historySpeciesabundanceMods) RandomR7scoreNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.R7score = 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 historySpeciesabundanceMods) R8score(val null.Val[float64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.R8score = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) R8scoreFunc(f func() null.Val[float64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.R8score = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetR8score() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.R8score = 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 historySpeciesabundanceMods) RandomR8score(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.R8score = 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 historySpeciesabundanceMods) RandomR8scoreNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.R8score = 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 historySpeciesabundanceMods) Yearweek(val null.Val[int64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Yearweek = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) YearweekFunc(f func() null.Val[int64]) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Yearweek = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetYearweek() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Yearweek = 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 historySpeciesabundanceMods) RandomYearweek(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Yearweek = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historySpeciesabundanceMods) RandomYearweekNotNull(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Yearweek = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historySpeciesabundanceMods) Version(val int32) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historySpeciesabundanceMods) VersionFunc(f func() int32) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historySpeciesabundanceMods) UnsetVersion() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historySpeciesabundanceMods) RandomVersion(f *faker.Faker) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(_ context.Context, o *HistorySpeciesabundanceTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historySpeciesabundanceMods) WithParentsCascading() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(ctx context.Context, o *HistorySpeciesabundanceTemplate) { - if isDone, _ := historySpeciesabundanceWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historySpeciesabundanceWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historySpeciesabundanceMods) WithOrganization(rel *OrganizationTemplate) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(ctx context.Context, o *HistorySpeciesabundanceTemplate) { - o.r.Organization = &historySpeciesabundanceROrganizationR{ - o: rel, - } - }) -} - -func (m historySpeciesabundanceMods) WithNewOrganization(mods ...OrganizationMod) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(ctx context.Context, o *HistorySpeciesabundanceTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historySpeciesabundanceMods) WithExistingOrganization(em *models.Organization) HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(ctx context.Context, o *HistorySpeciesabundanceTemplate) { - o.r.Organization = &historySpeciesabundanceROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historySpeciesabundanceMods) WithoutOrganization() HistorySpeciesabundanceMod { - return HistorySpeciesabundanceModFunc(func(ctx context.Context, o *HistorySpeciesabundanceTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_stormdrain.bob.go b/db/factory/history_stormdrain.bob.go deleted file mode 100644 index b9674369..00000000 --- a/db/factory/history_stormdrain.bob.go +++ /dev/null @@ -1,1718 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryStormdrainMod interface { - Apply(context.Context, *HistoryStormdrainTemplate) -} - -type HistoryStormdrainModFunc func(context.Context, *HistoryStormdrainTemplate) - -func (f HistoryStormdrainModFunc) Apply(ctx context.Context, n *HistoryStormdrainTemplate) { - f(ctx, n) -} - -type HistoryStormdrainModSlice []HistoryStormdrainMod - -func (mods HistoryStormdrainModSlice) Apply(ctx context.Context, n *HistoryStormdrainTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryStormdrainTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryStormdrainTemplate struct { - OrganizationID func() int32 - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() null.Val[string] - Jurisdiction func() null.Val[string] - Lastaction func() null.Val[string] - Laststatus func() null.Val[string] - Lasttreatdate func() null.Val[int64] - Nexttreatmentdate func() null.Val[int64] - Objectid func() int32 - Symbology func() null.Val[string] - Type func() null.Val[string] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Version func() int32 - - r historyStormdrainR - f *Factory - - alreadyPersisted bool -} - -type historyStormdrainR struct { - Organization *historyStormdrainROrganizationR -} - -type historyStormdrainROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryStormdrainTemplate -func (o *HistoryStormdrainTemplate) Apply(ctx context.Context, mods ...HistoryStormdrainMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryStormdrain -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryStormdrainTemplate) setModelRels(o *models.HistoryStormdrain) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryStormdrains = append(rel.R.HistoryStormdrains, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryStormdrainSetter -// this does nothing with the relationship templates -func (o HistoryStormdrainTemplate) BuildSetter() *models.HistoryStormdrainSetter { - m := &models.HistoryStormdrainSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.Lastaction != nil { - val := o.Lastaction() - m.Lastaction = omitnull.FromNull(val) - } - if o.Laststatus != nil { - val := o.Laststatus() - m.Laststatus = omitnull.FromNull(val) - } - if o.Lasttreatdate != nil { - val := o.Lasttreatdate() - m.Lasttreatdate = omitnull.FromNull(val) - } - if o.Nexttreatmentdate != nil { - val := o.Nexttreatmentdate() - m.Nexttreatmentdate = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Symbology != nil { - val := o.Symbology() - m.Symbology = omitnull.FromNull(val) - } - if o.Type != nil { - val := o.Type() - m.Type = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryStormdrainSetter -// this does nothing with the relationship templates -func (o HistoryStormdrainTemplate) BuildManySetter(number int) []*models.HistoryStormdrainSetter { - m := make([]*models.HistoryStormdrainSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryStormdrain -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryStormdrainTemplate.Create -func (o HistoryStormdrainTemplate) Build() *models.HistoryStormdrain { - m := &models.HistoryStormdrain{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Lastaction != nil { - m.Lastaction = o.Lastaction() - } - if o.Laststatus != nil { - m.Laststatus = o.Laststatus() - } - if o.Lasttreatdate != nil { - m.Lasttreatdate = o.Lasttreatdate() - } - if o.Nexttreatmentdate != nil { - m.Nexttreatmentdate = o.Nexttreatmentdate() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Symbology != nil { - m.Symbology = o.Symbology() - } - if o.Type != nil { - m.Type = o.Type() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryStormdrainSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryStormdrainTemplate.CreateMany -func (o HistoryStormdrainTemplate) BuildMany(number int) models.HistoryStormdrainSlice { - m := make(models.HistoryStormdrainSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryStormdrain(m *models.HistoryStormdrainSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryStormdrain -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryStormdrainTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryStormdrain) error { - var err error - - return err -} - -// Create builds a historyStormdrain and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryStormdrainTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryStormdrain, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryStormdrain(opt) - - if o.r.Organization == nil { - HistoryStormdrainMods.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.HistoryStormdrains.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 historyStormdrain and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryStormdrainTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryStormdrain { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyStormdrain 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 *HistoryStormdrainTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryStormdrain { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyStormdrains and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryStormdrainTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryStormdrainSlice, error) { - var err error - m := make(models.HistoryStormdrainSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyStormdrains and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryStormdrainTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryStormdrainSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyStormdrains 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 HistoryStormdrainTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryStormdrainSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryStormdrain has methods that act as mods for the HistoryStormdrainTemplate -var HistoryStormdrainMods historyStormdrainMods - -type historyStormdrainMods struct{} - -func (m historyStormdrainMods) RandomizeAllColumns(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModSlice{ - HistoryStormdrainMods.RandomOrganizationID(f), - HistoryStormdrainMods.RandomCreationdate(f), - HistoryStormdrainMods.RandomCreator(f), - HistoryStormdrainMods.RandomEditdate(f), - HistoryStormdrainMods.RandomEditor(f), - HistoryStormdrainMods.RandomGlobalid(f), - HistoryStormdrainMods.RandomJurisdiction(f), - HistoryStormdrainMods.RandomLastaction(f), - HistoryStormdrainMods.RandomLaststatus(f), - HistoryStormdrainMods.RandomLasttreatdate(f), - HistoryStormdrainMods.RandomNexttreatmentdate(f), - HistoryStormdrainMods.RandomObjectid(f), - HistoryStormdrainMods.RandomSymbology(f), - HistoryStormdrainMods.RandomType(f), - HistoryStormdrainMods.RandomZone(f), - HistoryStormdrainMods.RandomZone2(f), - HistoryStormdrainMods.RandomCreated(f), - HistoryStormdrainMods.RandomCreatedDate(f), - HistoryStormdrainMods.RandomCreatedUser(f), - HistoryStormdrainMods.RandomGeometryX(f), - HistoryStormdrainMods.RandomGeometryY(f), - HistoryStormdrainMods.RandomLastEditedDate(f), - HistoryStormdrainMods.RandomLastEditedUser(f), - HistoryStormdrainMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyStormdrainMods) OrganizationID(val int32) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) OrganizationIDFunc(f func() int32) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetOrganizationID() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - 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 historyStormdrainMods) RandomOrganizationID(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyStormdrainMods) Creationdate(val null.Val[int64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) CreationdateFunc(f func() null.Val[int64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetCreationdate() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Creationdate = 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 historyStormdrainMods) RandomCreationdate(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyStormdrainMods) RandomCreationdateNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyStormdrainMods) Creator(val null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) CreatorFunc(f func() null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetCreator() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Creator = 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 historyStormdrainMods) RandomCreator(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Creator = 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 historyStormdrainMods) RandomCreatorNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Creator = 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 historyStormdrainMods) Editdate(val null.Val[int64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) EditdateFunc(f func() null.Val[int64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetEditdate() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Editdate = 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 historyStormdrainMods) RandomEditdate(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyStormdrainMods) RandomEditdateNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyStormdrainMods) Editor(val null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) EditorFunc(f func() null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetEditor() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Editor = 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 historyStormdrainMods) RandomEditor(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Editor = 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 historyStormdrainMods) RandomEditorNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Editor = 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 historyStormdrainMods) Globalid(val null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) GlobalidFunc(f func() null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetGlobalid() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Globalid = 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 historyStormdrainMods) RandomGlobalid(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - 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 historyStormdrainMods) RandomGlobalidNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Globalid = 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 historyStormdrainMods) Jurisdiction(val null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) JurisdictionFunc(f func() null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetJurisdiction() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Jurisdiction = 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 historyStormdrainMods) RandomJurisdiction(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Jurisdiction = 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 historyStormdrainMods) RandomJurisdictionNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Jurisdiction = 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 historyStormdrainMods) Lastaction(val null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Lastaction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) LastactionFunc(f func() null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Lastaction = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetLastaction() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Lastaction = 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 historyStormdrainMods) RandomLastaction(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Lastaction = 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 historyStormdrainMods) RandomLastactionNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Lastaction = 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 historyStormdrainMods) Laststatus(val null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Laststatus = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) LaststatusFunc(f func() null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Laststatus = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetLaststatus() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Laststatus = 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 historyStormdrainMods) RandomLaststatus(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Laststatus = 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 historyStormdrainMods) RandomLaststatusNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Laststatus = 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 historyStormdrainMods) Lasttreatdate(val null.Val[int64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Lasttreatdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) LasttreatdateFunc(f func() null.Val[int64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Lasttreatdate = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetLasttreatdate() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Lasttreatdate = 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 historyStormdrainMods) RandomLasttreatdate(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyStormdrainMods) RandomLasttreatdateNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Lasttreatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyStormdrainMods) Nexttreatmentdate(val null.Val[int64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Nexttreatmentdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) NexttreatmentdateFunc(f func() null.Val[int64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Nexttreatmentdate = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetNexttreatmentdate() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Nexttreatmentdate = 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 historyStormdrainMods) RandomNexttreatmentdate(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Nexttreatmentdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyStormdrainMods) RandomNexttreatmentdateNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Nexttreatmentdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyStormdrainMods) Objectid(val int32) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) ObjectidFunc(f func() int32) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetObjectid() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyStormdrainMods) RandomObjectid(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyStormdrainMods) Symbology(val null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Symbology = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) SymbologyFunc(f func() null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Symbology = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetSymbology() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Symbology = 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 historyStormdrainMods) RandomSymbology(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Symbology = 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 historyStormdrainMods) RandomSymbologyNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Symbology = 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 historyStormdrainMods) Type(val null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Type = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) TypeFunc(f func() null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetType() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - 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 historyStormdrainMods) RandomType(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - 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 historyStormdrainMods) RandomTypeNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Type = 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 historyStormdrainMods) Zone(val null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) ZoneFunc(f func() null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetZone() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Zone = 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 historyStormdrainMods) RandomZone(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Zone = 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 historyStormdrainMods) RandomZoneNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Zone = 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 historyStormdrainMods) Zone2(val null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) Zone2Func(f func() null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetZone2() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Zone2 = 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 historyStormdrainMods) RandomZone2(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Zone2 = 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 historyStormdrainMods) RandomZone2NotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Zone2 = 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 historyStormdrainMods) Created(val null.Val[time.Time]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) CreatedFunc(f func() null.Val[time.Time]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetCreated() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Created = 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 historyStormdrainMods) RandomCreated(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyStormdrainMods) RandomCreatedNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyStormdrainMods) CreatedDate(val null.Val[int64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) CreatedDateFunc(f func() null.Val[int64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetCreatedDate() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.CreatedDate = 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 historyStormdrainMods) RandomCreatedDate(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyStormdrainMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyStormdrainMods) CreatedUser(val null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) CreatedUserFunc(f func() null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetCreatedUser() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.CreatedUser = 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 historyStormdrainMods) RandomCreatedUser(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.CreatedUser = 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 historyStormdrainMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.CreatedUser = 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 historyStormdrainMods) GeometryX(val null.Val[float64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) GeometryXFunc(f func() null.Val[float64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetGeometryX() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.GeometryX = 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 historyStormdrainMods) RandomGeometryX(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - 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 historyStormdrainMods) RandomGeometryXNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.GeometryX = 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 historyStormdrainMods) GeometryY(val null.Val[float64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) GeometryYFunc(f func() null.Val[float64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetGeometryY() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.GeometryY = 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 historyStormdrainMods) RandomGeometryY(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - 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 historyStormdrainMods) RandomGeometryYNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.GeometryY = 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 historyStormdrainMods) LastEditedDate(val null.Val[int64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetLastEditedDate() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.LastEditedDate = 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 historyStormdrainMods) RandomLastEditedDate(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyStormdrainMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyStormdrainMods) LastEditedUser(val null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) LastEditedUserFunc(f func() null.Val[string]) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetLastEditedUser() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.LastEditedUser = 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 historyStormdrainMods) RandomLastEditedUser(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.LastEditedUser = 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 historyStormdrainMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.LastEditedUser = 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 historyStormdrainMods) Version(val int32) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyStormdrainMods) VersionFunc(f func() int32) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyStormdrainMods) UnsetVersion() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyStormdrainMods) RandomVersion(f *faker.Faker) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(_ context.Context, o *HistoryStormdrainTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyStormdrainMods) WithParentsCascading() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(ctx context.Context, o *HistoryStormdrainTemplate) { - if isDone, _ := historyStormdrainWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyStormdrainWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyStormdrainMods) WithOrganization(rel *OrganizationTemplate) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(ctx context.Context, o *HistoryStormdrainTemplate) { - o.r.Organization = &historyStormdrainROrganizationR{ - o: rel, - } - }) -} - -func (m historyStormdrainMods) WithNewOrganization(mods ...OrganizationMod) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(ctx context.Context, o *HistoryStormdrainTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyStormdrainMods) WithExistingOrganization(em *models.Organization) HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(ctx context.Context, o *HistoryStormdrainTemplate) { - o.r.Organization = &historyStormdrainROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyStormdrainMods) WithoutOrganization() HistoryStormdrainMod { - return HistoryStormdrainModFunc(func(ctx context.Context, o *HistoryStormdrainTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_timecard.bob.go b/db/factory/history_timecard.bob.go deleted file mode 100644 index 93f6ca54..00000000 --- a/db/factory/history_timecard.bob.go +++ /dev/null @@ -1,2276 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryTimecardMod interface { - Apply(context.Context, *HistoryTimecardTemplate) -} - -type HistoryTimecardModFunc func(context.Context, *HistoryTimecardTemplate) - -func (f HistoryTimecardModFunc) Apply(ctx context.Context, n *HistoryTimecardTemplate) { - f(ctx, n) -} - -type HistoryTimecardModSlice []HistoryTimecardMod - -func (mods HistoryTimecardModSlice) Apply(ctx context.Context, n *HistoryTimecardTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryTimecardTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryTimecardTemplate struct { - OrganizationID func() int32 - Activity func() null.Val[string] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Enddatetime func() null.Val[int64] - Equiptype func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fieldtech func() null.Val[string] - Globalid func() null.Val[string] - Lclocid func() null.Val[string] - Linelocid func() null.Val[string] - Locationname func() null.Val[string] - Objectid func() int32 - Pointlocid func() null.Val[string] - Polygonlocid func() null.Val[string] - Samplelocid func() null.Val[string] - Srid func() null.Val[string] - Startdatetime func() null.Val[int64] - Traplocid func() null.Val[string] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Rodentlocid func() null.Val[string] - Version func() int32 - - r historyTimecardR - f *Factory - - alreadyPersisted bool -} - -type historyTimecardR struct { - Organization *historyTimecardROrganizationR -} - -type historyTimecardROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryTimecardTemplate -func (o *HistoryTimecardTemplate) Apply(ctx context.Context, mods ...HistoryTimecardMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryTimecard -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryTimecardTemplate) setModelRels(o *models.HistoryTimecard) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryTimecards = append(rel.R.HistoryTimecards, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryTimecardSetter -// this does nothing with the relationship templates -func (o HistoryTimecardTemplate) BuildSetter() *models.HistoryTimecardSetter { - m := &models.HistoryTimecardSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Activity != nil { - val := o.Activity() - m.Activity = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Equiptype != nil { - val := o.Equiptype() - m.Equiptype = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Lclocid != nil { - val := o.Lclocid() - m.Lclocid = omitnull.FromNull(val) - } - if o.Linelocid != nil { - val := o.Linelocid() - m.Linelocid = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Pointlocid != nil { - val := o.Pointlocid() - m.Pointlocid = omitnull.FromNull(val) - } - if o.Polygonlocid != nil { - val := o.Polygonlocid() - m.Polygonlocid = omitnull.FromNull(val) - } - if o.Samplelocid != nil { - val := o.Samplelocid() - m.Samplelocid = omitnull.FromNull(val) - } - if o.Srid != nil { - val := o.Srid() - m.Srid = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Traplocid != nil { - val := o.Traplocid() - m.Traplocid = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Rodentlocid != nil { - val := o.Rodentlocid() - m.Rodentlocid = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryTimecardSetter -// this does nothing with the relationship templates -func (o HistoryTimecardTemplate) BuildManySetter(number int) []*models.HistoryTimecardSetter { - m := make([]*models.HistoryTimecardSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryTimecard -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryTimecardTemplate.Create -func (o HistoryTimecardTemplate) Build() *models.HistoryTimecard { - m := &models.HistoryTimecard{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Activity != nil { - m.Activity = o.Activity() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Equiptype != nil { - m.Equiptype = o.Equiptype() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Lclocid != nil { - m.Lclocid = o.Lclocid() - } - if o.Linelocid != nil { - m.Linelocid = o.Linelocid() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Pointlocid != nil { - m.Pointlocid = o.Pointlocid() - } - if o.Polygonlocid != nil { - m.Polygonlocid = o.Polygonlocid() - } - if o.Samplelocid != nil { - m.Samplelocid = o.Samplelocid() - } - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Traplocid != nil { - m.Traplocid = o.Traplocid() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Rodentlocid != nil { - m.Rodentlocid = o.Rodentlocid() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryTimecardSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryTimecardTemplate.CreateMany -func (o HistoryTimecardTemplate) BuildMany(number int) models.HistoryTimecardSlice { - m := make(models.HistoryTimecardSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryTimecard(m *models.HistoryTimecardSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryTimecard -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryTimecardTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryTimecard) error { - var err error - - return err -} - -// Create builds a historyTimecard and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryTimecardTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryTimecard, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryTimecard(opt) - - if o.r.Organization == nil { - HistoryTimecardMods.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.HistoryTimecards.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 historyTimecard and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryTimecardTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryTimecard { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyTimecard 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 *HistoryTimecardTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryTimecard { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyTimecards and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryTimecardTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryTimecardSlice, error) { - var err error - m := make(models.HistoryTimecardSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyTimecards and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryTimecardTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryTimecardSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyTimecards 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 HistoryTimecardTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryTimecardSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryTimecard has methods that act as mods for the HistoryTimecardTemplate -var HistoryTimecardMods historyTimecardMods - -type historyTimecardMods struct{} - -func (m historyTimecardMods) RandomizeAllColumns(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModSlice{ - HistoryTimecardMods.RandomOrganizationID(f), - HistoryTimecardMods.RandomActivity(f), - HistoryTimecardMods.RandomComments(f), - HistoryTimecardMods.RandomCreationdate(f), - HistoryTimecardMods.RandomCreator(f), - HistoryTimecardMods.RandomEnddatetime(f), - HistoryTimecardMods.RandomEquiptype(f), - HistoryTimecardMods.RandomExternalid(f), - HistoryTimecardMods.RandomEditdate(f), - HistoryTimecardMods.RandomEditor(f), - HistoryTimecardMods.RandomFieldtech(f), - HistoryTimecardMods.RandomGlobalid(f), - HistoryTimecardMods.RandomLclocid(f), - HistoryTimecardMods.RandomLinelocid(f), - HistoryTimecardMods.RandomLocationname(f), - HistoryTimecardMods.RandomObjectid(f), - HistoryTimecardMods.RandomPointlocid(f), - HistoryTimecardMods.RandomPolygonlocid(f), - HistoryTimecardMods.RandomSamplelocid(f), - HistoryTimecardMods.RandomSrid(f), - HistoryTimecardMods.RandomStartdatetime(f), - HistoryTimecardMods.RandomTraplocid(f), - HistoryTimecardMods.RandomZone(f), - HistoryTimecardMods.RandomZone2(f), - HistoryTimecardMods.RandomCreated(f), - HistoryTimecardMods.RandomCreatedDate(f), - HistoryTimecardMods.RandomCreatedUser(f), - HistoryTimecardMods.RandomGeometryX(f), - HistoryTimecardMods.RandomGeometryY(f), - HistoryTimecardMods.RandomLastEditedDate(f), - HistoryTimecardMods.RandomLastEditedUser(f), - HistoryTimecardMods.RandomRodentlocid(f), - HistoryTimecardMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyTimecardMods) OrganizationID(val int32) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) OrganizationIDFunc(f func() int32) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetOrganizationID() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - 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 historyTimecardMods) RandomOrganizationID(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyTimecardMods) Activity(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Activity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) ActivityFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Activity = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetActivity() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Activity = 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 historyTimecardMods) RandomActivity(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Activity = 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 historyTimecardMods) RandomActivityNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Activity = 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 historyTimecardMods) Comments(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) CommentsFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetComments() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Comments = 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 historyTimecardMods) RandomComments(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Comments = 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 historyTimecardMods) RandomCommentsNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Comments = 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 historyTimecardMods) Creationdate(val null.Val[int64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) CreationdateFunc(f func() null.Val[int64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetCreationdate() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Creationdate = 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 historyTimecardMods) RandomCreationdate(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTimecardMods) RandomCreationdateNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTimecardMods) Creator(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) CreatorFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetCreator() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Creator = 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 historyTimecardMods) RandomCreator(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Creator = 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 historyTimecardMods) RandomCreatorNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Creator = 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 historyTimecardMods) Enddatetime(val null.Val[int64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Enddatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) EnddatetimeFunc(f func() null.Val[int64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetEnddatetime() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Enddatetime = 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 historyTimecardMods) RandomEnddatetime(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTimecardMods) RandomEnddatetimeNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTimecardMods) Equiptype(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Equiptype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) EquiptypeFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Equiptype = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetEquiptype() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Equiptype = 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 historyTimecardMods) RandomEquiptype(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Equiptype = 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 historyTimecardMods) RandomEquiptypeNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Equiptype = 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 historyTimecardMods) Externalid(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) ExternalidFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetExternalid() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Externalid = 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 historyTimecardMods) RandomExternalid(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Externalid = 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 historyTimecardMods) RandomExternalidNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Externalid = 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 historyTimecardMods) Editdate(val null.Val[int64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) EditdateFunc(f func() null.Val[int64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetEditdate() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Editdate = 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 historyTimecardMods) RandomEditdate(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTimecardMods) RandomEditdateNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTimecardMods) Editor(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) EditorFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetEditor() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Editor = 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 historyTimecardMods) RandomEditor(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Editor = 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 historyTimecardMods) RandomEditorNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Editor = 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 historyTimecardMods) Fieldtech(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) FieldtechFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetFieldtech() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Fieldtech = 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 historyTimecardMods) RandomFieldtech(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Fieldtech = 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 historyTimecardMods) RandomFieldtechNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Fieldtech = 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 historyTimecardMods) Globalid(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) GlobalidFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetGlobalid() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Globalid = 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 historyTimecardMods) RandomGlobalid(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - 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 historyTimecardMods) RandomGlobalidNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Globalid = 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 historyTimecardMods) Lclocid(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Lclocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) LclocidFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Lclocid = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetLclocid() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Lclocid = 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 historyTimecardMods) RandomLclocid(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Lclocid = 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 historyTimecardMods) RandomLclocidNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Lclocid = 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 historyTimecardMods) Linelocid(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Linelocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) LinelocidFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Linelocid = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetLinelocid() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Linelocid = 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 historyTimecardMods) RandomLinelocid(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Linelocid = 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 historyTimecardMods) RandomLinelocidNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Linelocid = 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 historyTimecardMods) Locationname(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) LocationnameFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetLocationname() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Locationname = 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 historyTimecardMods) RandomLocationname(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Locationname = 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 historyTimecardMods) RandomLocationnameNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Locationname = 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 historyTimecardMods) Objectid(val int32) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) ObjectidFunc(f func() int32) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetObjectid() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyTimecardMods) RandomObjectid(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyTimecardMods) Pointlocid(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Pointlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) PointlocidFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Pointlocid = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetPointlocid() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Pointlocid = 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 historyTimecardMods) RandomPointlocid(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Pointlocid = 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 historyTimecardMods) RandomPointlocidNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Pointlocid = 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 historyTimecardMods) Polygonlocid(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Polygonlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) PolygonlocidFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Polygonlocid = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetPolygonlocid() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Polygonlocid = 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 historyTimecardMods) RandomPolygonlocid(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Polygonlocid = 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 historyTimecardMods) RandomPolygonlocidNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Polygonlocid = 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 historyTimecardMods) Samplelocid(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Samplelocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) SamplelocidFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Samplelocid = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetSamplelocid() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Samplelocid = 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 historyTimecardMods) RandomSamplelocid(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Samplelocid = 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 historyTimecardMods) RandomSamplelocidNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Samplelocid = 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 historyTimecardMods) Srid(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Srid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) SridFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetSrid() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - 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 historyTimecardMods) RandomSrid(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Srid = 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 historyTimecardMods) RandomSridNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Srid = 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 historyTimecardMods) Startdatetime(val null.Val[int64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Startdatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) StartdatetimeFunc(f func() null.Val[int64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetStartdatetime() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Startdatetime = 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 historyTimecardMods) RandomStartdatetime(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTimecardMods) RandomStartdatetimeNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTimecardMods) Traplocid(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Traplocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) TraplocidFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Traplocid = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetTraplocid() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Traplocid = 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 historyTimecardMods) RandomTraplocid(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Traplocid = 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 historyTimecardMods) RandomTraplocidNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Traplocid = 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 historyTimecardMods) Zone(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) ZoneFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetZone() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Zone = 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 historyTimecardMods) RandomZone(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Zone = 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 historyTimecardMods) RandomZoneNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Zone = 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 historyTimecardMods) Zone2(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) Zone2Func(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetZone2() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Zone2 = 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 historyTimecardMods) RandomZone2(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Zone2 = 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 historyTimecardMods) RandomZone2NotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Zone2 = 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 historyTimecardMods) Created(val null.Val[time.Time]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) CreatedFunc(f func() null.Val[time.Time]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetCreated() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Created = 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 historyTimecardMods) RandomCreated(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyTimecardMods) RandomCreatedNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTimecardMods) CreatedDate(val null.Val[int64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) CreatedDateFunc(f func() null.Val[int64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetCreatedDate() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.CreatedDate = 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 historyTimecardMods) RandomCreatedDate(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTimecardMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTimecardMods) CreatedUser(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) CreatedUserFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetCreatedUser() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.CreatedUser = 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 historyTimecardMods) RandomCreatedUser(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.CreatedUser = 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 historyTimecardMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.CreatedUser = 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 historyTimecardMods) GeometryX(val null.Val[float64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) GeometryXFunc(f func() null.Val[float64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetGeometryX() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.GeometryX = 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 historyTimecardMods) RandomGeometryX(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - 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 historyTimecardMods) RandomGeometryXNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.GeometryX = 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 historyTimecardMods) GeometryY(val null.Val[float64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) GeometryYFunc(f func() null.Val[float64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetGeometryY() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.GeometryY = 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 historyTimecardMods) RandomGeometryY(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - 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 historyTimecardMods) RandomGeometryYNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.GeometryY = 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 historyTimecardMods) LastEditedDate(val null.Val[int64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetLastEditedDate() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.LastEditedDate = 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 historyTimecardMods) RandomLastEditedDate(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTimecardMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTimecardMods) LastEditedUser(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) LastEditedUserFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetLastEditedUser() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.LastEditedUser = 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 historyTimecardMods) RandomLastEditedUser(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.LastEditedUser = 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 historyTimecardMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.LastEditedUser = 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 historyTimecardMods) Rodentlocid(val null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Rodentlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) RodentlocidFunc(f func() null.Val[string]) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Rodentlocid = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetRodentlocid() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Rodentlocid = 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 historyTimecardMods) RandomRodentlocid(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Rodentlocid = 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 historyTimecardMods) RandomRodentlocidNotNull(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Rodentlocid = 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 historyTimecardMods) Version(val int32) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyTimecardMods) VersionFunc(f func() int32) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyTimecardMods) UnsetVersion() HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyTimecardMods) RandomVersion(f *faker.Faker) HistoryTimecardMod { - return HistoryTimecardModFunc(func(_ context.Context, o *HistoryTimecardTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyTimecardMods) WithParentsCascading() HistoryTimecardMod { - return HistoryTimecardModFunc(func(ctx context.Context, o *HistoryTimecardTemplate) { - if isDone, _ := historyTimecardWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyTimecardWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyTimecardMods) WithOrganization(rel *OrganizationTemplate) HistoryTimecardMod { - return HistoryTimecardModFunc(func(ctx context.Context, o *HistoryTimecardTemplate) { - o.r.Organization = &historyTimecardROrganizationR{ - o: rel, - } - }) -} - -func (m historyTimecardMods) WithNewOrganization(mods ...OrganizationMod) HistoryTimecardMod { - return HistoryTimecardModFunc(func(ctx context.Context, o *HistoryTimecardTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyTimecardMods) WithExistingOrganization(em *models.Organization) HistoryTimecardMod { - return HistoryTimecardModFunc(func(ctx context.Context, o *HistoryTimecardTemplate) { - o.r.Organization = &historyTimecardROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyTimecardMods) WithoutOrganization() HistoryTimecardMod { - return HistoryTimecardModFunc(func(ctx context.Context, o *HistoryTimecardTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_trapdata.bob.go b/db/factory/history_trapdata.bob.go deleted file mode 100644 index e5d7bb52..00000000 --- a/db/factory/history_trapdata.bob.go +++ /dev/null @@ -1,3144 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryTrapdatumMod interface { - Apply(context.Context, *HistoryTrapdatumTemplate) -} - -type HistoryTrapdatumModFunc func(context.Context, *HistoryTrapdatumTemplate) - -func (f HistoryTrapdatumModFunc) Apply(ctx context.Context, n *HistoryTrapdatumTemplate) { - f(ctx, n) -} - -type HistoryTrapdatumModSlice []HistoryTrapdatumMod - -func (mods HistoryTrapdatumModSlice) Apply(ctx context.Context, n *HistoryTrapdatumTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryTrapdatumTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryTrapdatumTemplate struct { - OrganizationID func() int32 - Avetemp func() null.Val[float64] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Enddatetime func() null.Val[int64] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fieldtech func() null.Val[string] - Field func() null.Val[int64] - Gatewaysync func() null.Val[int16] - Globalid func() null.Val[string] - Idbytech func() null.Val[string] - Locationname func() null.Val[string] - LocID func() null.Val[string] - LR func() null.Val[int16] - Objectid func() int32 - Processed func() null.Val[int16] - Raingauge func() null.Val[float64] - Recordstatus func() null.Val[int16] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[int64] - Sitecond func() null.Val[string] - Sortbytech func() null.Val[string] - Srid func() null.Val[string] - Startdatetime func() null.Val[int64] - Trapactivitytype func() null.Val[string] - Trapcondition func() null.Val[string] - Trapnights func() null.Val[int16] - Traptype func() null.Val[string] - Voltage func() null.Val[float64] - Winddir func() null.Val[string] - Windspeed func() null.Val[float64] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Lure func() null.Val[string] - Vectorsurvtrapdataid func() null.Val[string] - Vectorsurvtraplocationid func() null.Val[string] - Version func() int32 - - r historyTrapdatumR - f *Factory - - alreadyPersisted bool -} - -type historyTrapdatumR struct { - Organization *historyTrapdatumROrganizationR -} - -type historyTrapdatumROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryTrapdatumTemplate -func (o *HistoryTrapdatumTemplate) Apply(ctx context.Context, mods ...HistoryTrapdatumMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryTrapdatum -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryTrapdatumTemplate) setModelRels(o *models.HistoryTrapdatum) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryTrapdata = append(rel.R.HistoryTrapdata, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryTrapdatumSetter -// this does nothing with the relationship templates -func (o HistoryTrapdatumTemplate) BuildSetter() *models.HistoryTrapdatumSetter { - m := &models.HistoryTrapdatumSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Avetemp != nil { - val := o.Avetemp() - m.Avetemp = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Field != nil { - val := o.Field() - m.Field = omitnull.FromNull(val) - } - if o.Gatewaysync != nil { - val := o.Gatewaysync() - m.Gatewaysync = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Idbytech != nil { - val := o.Idbytech() - m.Idbytech = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.LocID != nil { - val := o.LocID() - m.LocID = omitnull.FromNull(val) - } - if o.LR != nil { - val := o.LR() - m.LR = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.Raingauge != nil { - val := o.Raingauge() - m.Raingauge = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Reviewed != nil { - val := o.Reviewed() - m.Reviewed = omitnull.FromNull(val) - } - if o.Reviewedby != nil { - val := o.Reviewedby() - m.Reviewedby = omitnull.FromNull(val) - } - if o.Revieweddate != nil { - val := o.Revieweddate() - m.Revieweddate = omitnull.FromNull(val) - } - if o.Sitecond != nil { - val := o.Sitecond() - m.Sitecond = omitnull.FromNull(val) - } - if o.Sortbytech != nil { - val := o.Sortbytech() - m.Sortbytech = omitnull.FromNull(val) - } - if o.Srid != nil { - val := o.Srid() - m.Srid = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Trapactivitytype != nil { - val := o.Trapactivitytype() - m.Trapactivitytype = omitnull.FromNull(val) - } - if o.Trapcondition != nil { - val := o.Trapcondition() - m.Trapcondition = omitnull.FromNull(val) - } - if o.Trapnights != nil { - val := o.Trapnights() - m.Trapnights = omitnull.FromNull(val) - } - if o.Traptype != nil { - val := o.Traptype() - m.Traptype = omitnull.FromNull(val) - } - if o.Voltage != nil { - val := o.Voltage() - m.Voltage = omitnull.FromNull(val) - } - if o.Winddir != nil { - val := o.Winddir() - m.Winddir = omitnull.FromNull(val) - } - if o.Windspeed != nil { - val := o.Windspeed() - m.Windspeed = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Lure != nil { - val := o.Lure() - m.Lure = omitnull.FromNull(val) - } - if o.Vectorsurvtrapdataid != nil { - val := o.Vectorsurvtrapdataid() - m.Vectorsurvtrapdataid = omitnull.FromNull(val) - } - if o.Vectorsurvtraplocationid != nil { - val := o.Vectorsurvtraplocationid() - m.Vectorsurvtraplocationid = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryTrapdatumSetter -// this does nothing with the relationship templates -func (o HistoryTrapdatumTemplate) BuildManySetter(number int) []*models.HistoryTrapdatumSetter { - m := make([]*models.HistoryTrapdatumSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryTrapdatum -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryTrapdatumTemplate.Create -func (o HistoryTrapdatumTemplate) Build() *models.HistoryTrapdatum { - m := &models.HistoryTrapdatum{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Avetemp != nil { - m.Avetemp = o.Avetemp() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Field != nil { - m.Field = o.Field() - } - if o.Gatewaysync != nil { - m.Gatewaysync = o.Gatewaysync() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Idbytech != nil { - m.Idbytech = o.Idbytech() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.LocID != nil { - m.LocID = o.LocID() - } - if o.LR != nil { - m.LR = o.LR() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.Raingauge != nil { - m.Raingauge = o.Raingauge() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Reviewed != nil { - m.Reviewed = o.Reviewed() - } - if o.Reviewedby != nil { - m.Reviewedby = o.Reviewedby() - } - if o.Revieweddate != nil { - m.Revieweddate = o.Revieweddate() - } - if o.Sitecond != nil { - m.Sitecond = o.Sitecond() - } - if o.Sortbytech != nil { - m.Sortbytech = o.Sortbytech() - } - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Trapactivitytype != nil { - m.Trapactivitytype = o.Trapactivitytype() - } - if o.Trapcondition != nil { - m.Trapcondition = o.Trapcondition() - } - if o.Trapnights != nil { - m.Trapnights = o.Trapnights() - } - if o.Traptype != nil { - m.Traptype = o.Traptype() - } - if o.Voltage != nil { - m.Voltage = o.Voltage() - } - if o.Winddir != nil { - m.Winddir = o.Winddir() - } - if o.Windspeed != nil { - m.Windspeed = o.Windspeed() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Lure != nil { - m.Lure = o.Lure() - } - if o.Vectorsurvtrapdataid != nil { - m.Vectorsurvtrapdataid = o.Vectorsurvtrapdataid() - } - if o.Vectorsurvtraplocationid != nil { - m.Vectorsurvtraplocationid = o.Vectorsurvtraplocationid() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryTrapdatumSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryTrapdatumTemplate.CreateMany -func (o HistoryTrapdatumTemplate) BuildMany(number int) models.HistoryTrapdatumSlice { - m := make(models.HistoryTrapdatumSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryTrapdatum(m *models.HistoryTrapdatumSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryTrapdatum -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryTrapdatumTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryTrapdatum) error { - var err error - - return err -} - -// Create builds a historyTrapdatum and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryTrapdatumTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryTrapdatum, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryTrapdatum(opt) - - if o.r.Organization == nil { - HistoryTrapdatumMods.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.HistoryTrapdata.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 historyTrapdatum and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryTrapdatumTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryTrapdatum { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyTrapdatum 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 *HistoryTrapdatumTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryTrapdatum { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyTrapdata and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryTrapdatumTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryTrapdatumSlice, error) { - var err error - m := make(models.HistoryTrapdatumSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyTrapdata and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryTrapdatumTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryTrapdatumSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyTrapdata 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 HistoryTrapdatumTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryTrapdatumSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryTrapdatum has methods that act as mods for the HistoryTrapdatumTemplate -var HistoryTrapdatumMods historyTrapdatumMods - -type historyTrapdatumMods struct{} - -func (m historyTrapdatumMods) RandomizeAllColumns(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModSlice{ - HistoryTrapdatumMods.RandomOrganizationID(f), - HistoryTrapdatumMods.RandomAvetemp(f), - HistoryTrapdatumMods.RandomComments(f), - HistoryTrapdatumMods.RandomCreationdate(f), - HistoryTrapdatumMods.RandomCreator(f), - HistoryTrapdatumMods.RandomEnddatetime(f), - HistoryTrapdatumMods.RandomEditdate(f), - HistoryTrapdatumMods.RandomEditor(f), - HistoryTrapdatumMods.RandomFieldtech(f), - HistoryTrapdatumMods.RandomField(f), - HistoryTrapdatumMods.RandomGatewaysync(f), - HistoryTrapdatumMods.RandomGlobalid(f), - HistoryTrapdatumMods.RandomIdbytech(f), - HistoryTrapdatumMods.RandomLocationname(f), - HistoryTrapdatumMods.RandomLocID(f), - HistoryTrapdatumMods.RandomLR(f), - HistoryTrapdatumMods.RandomObjectid(f), - HistoryTrapdatumMods.RandomProcessed(f), - HistoryTrapdatumMods.RandomRaingauge(f), - HistoryTrapdatumMods.RandomRecordstatus(f), - HistoryTrapdatumMods.RandomReviewed(f), - HistoryTrapdatumMods.RandomReviewedby(f), - HistoryTrapdatumMods.RandomRevieweddate(f), - HistoryTrapdatumMods.RandomSitecond(f), - HistoryTrapdatumMods.RandomSortbytech(f), - HistoryTrapdatumMods.RandomSrid(f), - HistoryTrapdatumMods.RandomStartdatetime(f), - HistoryTrapdatumMods.RandomTrapactivitytype(f), - HistoryTrapdatumMods.RandomTrapcondition(f), - HistoryTrapdatumMods.RandomTrapnights(f), - HistoryTrapdatumMods.RandomTraptype(f), - HistoryTrapdatumMods.RandomVoltage(f), - HistoryTrapdatumMods.RandomWinddir(f), - HistoryTrapdatumMods.RandomWindspeed(f), - HistoryTrapdatumMods.RandomZone(f), - HistoryTrapdatumMods.RandomZone2(f), - HistoryTrapdatumMods.RandomCreated(f), - HistoryTrapdatumMods.RandomCreatedDate(f), - HistoryTrapdatumMods.RandomCreatedUser(f), - HistoryTrapdatumMods.RandomGeometryX(f), - HistoryTrapdatumMods.RandomGeometryY(f), - HistoryTrapdatumMods.RandomLastEditedDate(f), - HistoryTrapdatumMods.RandomLastEditedUser(f), - HistoryTrapdatumMods.RandomLure(f), - HistoryTrapdatumMods.RandomVectorsurvtrapdataid(f), - HistoryTrapdatumMods.RandomVectorsurvtraplocationid(f), - HistoryTrapdatumMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyTrapdatumMods) OrganizationID(val int32) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) OrganizationIDFunc(f func() int32) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetOrganizationID() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - 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 historyTrapdatumMods) RandomOrganizationID(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) Avetemp(val null.Val[float64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Avetemp = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) AvetempFunc(f func() null.Val[float64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Avetemp = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetAvetemp() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Avetemp = 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 historyTrapdatumMods) RandomAvetemp(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Avetemp = 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 historyTrapdatumMods) RandomAvetempNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Avetemp = 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 historyTrapdatumMods) Comments(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) CommentsFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetComments() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Comments = 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 historyTrapdatumMods) RandomComments(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Comments = 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 historyTrapdatumMods) RandomCommentsNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Comments = 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 historyTrapdatumMods) Creationdate(val null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) CreationdateFunc(f func() null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetCreationdate() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Creationdate = 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 historyTrapdatumMods) RandomCreationdate(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTrapdatumMods) RandomCreationdateNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) Creator(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) CreatorFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetCreator() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Creator = 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 historyTrapdatumMods) RandomCreator(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Creator = 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 historyTrapdatumMods) RandomCreatorNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Creator = 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 historyTrapdatumMods) Enddatetime(val null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Enddatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) EnddatetimeFunc(f func() null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetEnddatetime() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Enddatetime = 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 historyTrapdatumMods) RandomEnddatetime(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTrapdatumMods) RandomEnddatetimeNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) Editdate(val null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) EditdateFunc(f func() null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetEditdate() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Editdate = 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 historyTrapdatumMods) RandomEditdate(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTrapdatumMods) RandomEditdateNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) Editor(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) EditorFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetEditor() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Editor = 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 historyTrapdatumMods) RandomEditor(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Editor = 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 historyTrapdatumMods) RandomEditorNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Editor = 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 historyTrapdatumMods) Fieldtech(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) FieldtechFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetFieldtech() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Fieldtech = 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 historyTrapdatumMods) RandomFieldtech(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Fieldtech = 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 historyTrapdatumMods) RandomFieldtechNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Fieldtech = 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 historyTrapdatumMods) Field(val null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Field = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) FieldFunc(f func() null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Field = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetField() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Field = 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 historyTrapdatumMods) RandomField(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Field = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTrapdatumMods) RandomFieldNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Field = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) Gatewaysync(val null.Val[int16]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Gatewaysync = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) GatewaysyncFunc(f func() null.Val[int16]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Gatewaysync = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetGatewaysync() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Gatewaysync = 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 historyTrapdatumMods) RandomGatewaysync(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyTrapdatumMods) RandomGatewaysyncNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) Globalid(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) GlobalidFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetGlobalid() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Globalid = 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 historyTrapdatumMods) RandomGlobalid(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - 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 historyTrapdatumMods) RandomGlobalidNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Globalid = 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 historyTrapdatumMods) Idbytech(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Idbytech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) IdbytechFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Idbytech = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetIdbytech() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Idbytech = 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 historyTrapdatumMods) RandomIdbytech(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Idbytech = 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 historyTrapdatumMods) RandomIdbytechNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Idbytech = 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 historyTrapdatumMods) Locationname(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) LocationnameFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetLocationname() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Locationname = 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 historyTrapdatumMods) RandomLocationname(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Locationname = 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 historyTrapdatumMods) RandomLocationnameNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Locationname = 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 historyTrapdatumMods) LocID(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LocID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) LocIDFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LocID = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetLocID() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LocID = 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 historyTrapdatumMods) RandomLocID(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LocID = 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 historyTrapdatumMods) RandomLocIDNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LocID = 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 historyTrapdatumMods) LR(val null.Val[int16]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LR = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) LRFunc(f func() null.Val[int16]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LR = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetLR() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LR = 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 historyTrapdatumMods) RandomLR(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LR = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyTrapdatumMods) RandomLRNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LR = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) Objectid(val int32) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) ObjectidFunc(f func() int32) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetObjectid() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyTrapdatumMods) RandomObjectid(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) Processed(val null.Val[int16]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) ProcessedFunc(f func() null.Val[int16]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetProcessed() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Processed = 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 historyTrapdatumMods) RandomProcessed(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyTrapdatumMods) RandomProcessedNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Processed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) Raingauge(val null.Val[float64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Raingauge = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) RaingaugeFunc(f func() null.Val[float64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Raingauge = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetRaingauge() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Raingauge = 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 historyTrapdatumMods) RandomRaingauge(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Raingauge = 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 historyTrapdatumMods) RandomRaingaugeNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Raingauge = 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 historyTrapdatumMods) Recordstatus(val null.Val[int16]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) RecordstatusFunc(f func() null.Val[int16]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetRecordstatus() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Recordstatus = 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 historyTrapdatumMods) RandomRecordstatus(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyTrapdatumMods) RandomRecordstatusNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) Reviewed(val null.Val[int16]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) ReviewedFunc(f func() null.Val[int16]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetReviewed() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Reviewed = 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 historyTrapdatumMods) RandomReviewed(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyTrapdatumMods) RandomReviewedNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) Reviewedby(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) ReviewedbyFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetReviewedby() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Reviewedby = 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 historyTrapdatumMods) RandomReviewedby(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Reviewedby = 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 historyTrapdatumMods) RandomReviewedbyNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Reviewedby = 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 historyTrapdatumMods) Revieweddate(val null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Revieweddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) RevieweddateFunc(f func() null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetRevieweddate() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Revieweddate = 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 historyTrapdatumMods) RandomRevieweddate(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTrapdatumMods) RandomRevieweddateNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) Sitecond(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Sitecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) SitecondFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Sitecond = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetSitecond() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Sitecond = 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 historyTrapdatumMods) RandomSitecond(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Sitecond = 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 historyTrapdatumMods) RandomSitecondNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Sitecond = 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 historyTrapdatumMods) Sortbytech(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Sortbytech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) SortbytechFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Sortbytech = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetSortbytech() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Sortbytech = 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 historyTrapdatumMods) RandomSortbytech(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Sortbytech = 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 historyTrapdatumMods) RandomSortbytechNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Sortbytech = 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 historyTrapdatumMods) Srid(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Srid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) SridFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetSrid() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - 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 historyTrapdatumMods) RandomSrid(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Srid = 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 historyTrapdatumMods) RandomSridNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Srid = 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 historyTrapdatumMods) Startdatetime(val null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Startdatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) StartdatetimeFunc(f func() null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetStartdatetime() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Startdatetime = 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 historyTrapdatumMods) RandomStartdatetime(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTrapdatumMods) RandomStartdatetimeNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) Trapactivitytype(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Trapactivitytype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) TrapactivitytypeFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Trapactivitytype = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetTrapactivitytype() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Trapactivitytype = 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 historyTrapdatumMods) RandomTrapactivitytype(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Trapactivitytype = 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 historyTrapdatumMods) RandomTrapactivitytypeNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Trapactivitytype = 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 historyTrapdatumMods) Trapcondition(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Trapcondition = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) TrapconditionFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Trapcondition = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetTrapcondition() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Trapcondition = 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 historyTrapdatumMods) RandomTrapcondition(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Trapcondition = 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 historyTrapdatumMods) RandomTrapconditionNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Trapcondition = 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 historyTrapdatumMods) Trapnights(val null.Val[int16]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Trapnights = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) TrapnightsFunc(f func() null.Val[int16]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Trapnights = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetTrapnights() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Trapnights = 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 historyTrapdatumMods) RandomTrapnights(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Trapnights = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyTrapdatumMods) RandomTrapnightsNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Trapnights = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) Traptype(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Traptype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) TraptypeFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Traptype = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetTraptype() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Traptype = 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 historyTrapdatumMods) RandomTraptype(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Traptype = 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 historyTrapdatumMods) RandomTraptypeNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Traptype = 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 historyTrapdatumMods) Voltage(val null.Val[float64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Voltage = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) VoltageFunc(f func() null.Val[float64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Voltage = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetVoltage() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Voltage = 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 historyTrapdatumMods) RandomVoltage(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Voltage = 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 historyTrapdatumMods) RandomVoltageNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Voltage = 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 historyTrapdatumMods) Winddir(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Winddir = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) WinddirFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Winddir = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetWinddir() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Winddir = 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 historyTrapdatumMods) RandomWinddir(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Winddir = 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 historyTrapdatumMods) RandomWinddirNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Winddir = 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 historyTrapdatumMods) Windspeed(val null.Val[float64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Windspeed = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) WindspeedFunc(f func() null.Val[float64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Windspeed = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetWindspeed() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Windspeed = 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 historyTrapdatumMods) RandomWindspeed(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Windspeed = 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 historyTrapdatumMods) RandomWindspeedNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Windspeed = 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 historyTrapdatumMods) Zone(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) ZoneFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetZone() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Zone = 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 historyTrapdatumMods) RandomZone(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Zone = 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 historyTrapdatumMods) RandomZoneNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Zone = 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 historyTrapdatumMods) Zone2(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) Zone2Func(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetZone2() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Zone2 = 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 historyTrapdatumMods) RandomZone2(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Zone2 = 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 historyTrapdatumMods) RandomZone2NotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Zone2 = 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 historyTrapdatumMods) Created(val null.Val[time.Time]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) CreatedFunc(f func() null.Val[time.Time]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetCreated() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Created = 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 historyTrapdatumMods) RandomCreated(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyTrapdatumMods) RandomCreatedNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) CreatedDate(val null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) CreatedDateFunc(f func() null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetCreatedDate() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.CreatedDate = 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 historyTrapdatumMods) RandomCreatedDate(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTrapdatumMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) CreatedUser(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) CreatedUserFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetCreatedUser() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.CreatedUser = 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 historyTrapdatumMods) RandomCreatedUser(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.CreatedUser = 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 historyTrapdatumMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.CreatedUser = 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 historyTrapdatumMods) GeometryX(val null.Val[float64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) GeometryXFunc(f func() null.Val[float64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetGeometryX() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.GeometryX = 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 historyTrapdatumMods) RandomGeometryX(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - 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 historyTrapdatumMods) RandomGeometryXNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.GeometryX = 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 historyTrapdatumMods) GeometryY(val null.Val[float64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) GeometryYFunc(f func() null.Val[float64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetGeometryY() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.GeometryY = 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 historyTrapdatumMods) RandomGeometryY(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - 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 historyTrapdatumMods) RandomGeometryYNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.GeometryY = 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 historyTrapdatumMods) LastEditedDate(val null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetLastEditedDate() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LastEditedDate = 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 historyTrapdatumMods) RandomLastEditedDate(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTrapdatumMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTrapdatumMods) LastEditedUser(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) LastEditedUserFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetLastEditedUser() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LastEditedUser = 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 historyTrapdatumMods) RandomLastEditedUser(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LastEditedUser = 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 historyTrapdatumMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.LastEditedUser = 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 historyTrapdatumMods) Lure(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Lure = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) LureFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Lure = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetLure() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Lure = 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 historyTrapdatumMods) RandomLure(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Lure = 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 historyTrapdatumMods) RandomLureNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Lure = 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 historyTrapdatumMods) Vectorsurvtrapdataid(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Vectorsurvtrapdataid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) VectorsurvtrapdataidFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Vectorsurvtrapdataid = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetVectorsurvtrapdataid() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Vectorsurvtrapdataid = 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 historyTrapdatumMods) RandomVectorsurvtrapdataid(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Vectorsurvtrapdataid = 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 historyTrapdatumMods) RandomVectorsurvtrapdataidNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Vectorsurvtrapdataid = 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 historyTrapdatumMods) Vectorsurvtraplocationid(val null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Vectorsurvtraplocationid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) VectorsurvtraplocationidFunc(f func() null.Val[string]) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Vectorsurvtraplocationid = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetVectorsurvtraplocationid() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Vectorsurvtraplocationid = 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 historyTrapdatumMods) RandomVectorsurvtraplocationid(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Vectorsurvtraplocationid = 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 historyTrapdatumMods) RandomVectorsurvtraplocationidNotNull(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Vectorsurvtraplocationid = 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 historyTrapdatumMods) Version(val int32) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyTrapdatumMods) VersionFunc(f func() int32) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyTrapdatumMods) UnsetVersion() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyTrapdatumMods) RandomVersion(f *faker.Faker) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(_ context.Context, o *HistoryTrapdatumTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyTrapdatumMods) WithParentsCascading() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(ctx context.Context, o *HistoryTrapdatumTemplate) { - if isDone, _ := historyTrapdatumWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyTrapdatumWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyTrapdatumMods) WithOrganization(rel *OrganizationTemplate) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(ctx context.Context, o *HistoryTrapdatumTemplate) { - o.r.Organization = &historyTrapdatumROrganizationR{ - o: rel, - } - }) -} - -func (m historyTrapdatumMods) WithNewOrganization(mods ...OrganizationMod) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(ctx context.Context, o *HistoryTrapdatumTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyTrapdatumMods) WithExistingOrganization(em *models.Organization) HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(ctx context.Context, o *HistoryTrapdatumTemplate) { - o.r.Organization = &historyTrapdatumROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyTrapdatumMods) WithoutOrganization() HistoryTrapdatumMod { - return HistoryTrapdatumModFunc(func(ctx context.Context, o *HistoryTrapdatumTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_traplocation.bob.go b/db/factory/history_traplocation.bob.go deleted file mode 100644 index 95c6e849..00000000 --- a/db/factory/history_traplocation.bob.go +++ /dev/null @@ -1,2400 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryTraplocationMod interface { - Apply(context.Context, *HistoryTraplocationTemplate) -} - -type HistoryTraplocationModFunc func(context.Context, *HistoryTraplocationTemplate) - -func (f HistoryTraplocationModFunc) Apply(ctx context.Context, n *HistoryTraplocationTemplate) { - f(ctx, n) -} - -type HistoryTraplocationModSlice []HistoryTraplocationMod - -func (mods HistoryTraplocationModSlice) Apply(ctx context.Context, n *HistoryTraplocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryTraplocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryTraplocationTemplate struct { - OrganizationID func() int32 - Accessdesc func() null.Val[string] - Active func() null.Val[int16] - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Description func() null.Val[string] - Externalid func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Gatewaysync func() null.Val[int16] - Globalid func() null.Val[string] - Habitat func() null.Val[string] - Locationnumber func() null.Val[int64] - Name func() null.Val[string] - Nextactiondatescheduled func() null.Val[int64] - Objectid func() int32 - Priority func() null.Val[string] - Usetype func() null.Val[string] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Route func() null.Val[int64] - RouteOrder func() null.Val[int64] - SetDow func() null.Val[int64] - Vectorsurvsiteid func() null.Val[string] - H3R7 func() null.Val[string] - H3R8 func() null.Val[string] - Version func() int32 - - r historyTraplocationR - f *Factory - - alreadyPersisted bool -} - -type historyTraplocationR struct { - Organization *historyTraplocationROrganizationR -} - -type historyTraplocationROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryTraplocationTemplate -func (o *HistoryTraplocationTemplate) Apply(ctx context.Context, mods ...HistoryTraplocationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryTraplocation -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryTraplocationTemplate) setModelRels(o *models.HistoryTraplocation) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryTraplocations = append(rel.R.HistoryTraplocations, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryTraplocationSetter -// this does nothing with the relationship templates -func (o HistoryTraplocationTemplate) BuildSetter() *models.HistoryTraplocationSetter { - m := &models.HistoryTraplocationSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Gatewaysync != nil { - val := o.Gatewaysync() - m.Gatewaysync = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Usetype != nil { - val := o.Usetype() - m.Usetype = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Route != nil { - val := o.Route() - m.Route = omitnull.FromNull(val) - } - if o.RouteOrder != nil { - val := o.RouteOrder() - m.RouteOrder = omitnull.FromNull(val) - } - if o.SetDow != nil { - val := o.SetDow() - m.SetDow = omitnull.FromNull(val) - } - if o.Vectorsurvsiteid != nil { - val := o.Vectorsurvsiteid() - m.Vectorsurvsiteid = omitnull.FromNull(val) - } - if o.H3R7 != nil { - val := o.H3R7() - m.H3R7 = omitnull.FromNull(val) - } - if o.H3R8 != nil { - val := o.H3R8() - m.H3R8 = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryTraplocationSetter -// this does nothing with the relationship templates -func (o HistoryTraplocationTemplate) BuildManySetter(number int) []*models.HistoryTraplocationSetter { - m := make([]*models.HistoryTraplocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryTraplocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryTraplocationTemplate.Create -func (o HistoryTraplocationTemplate) Build() *models.HistoryTraplocation { - m := &models.HistoryTraplocation{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Gatewaysync != nil { - m.Gatewaysync = o.Gatewaysync() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Route != nil { - m.Route = o.Route() - } - if o.RouteOrder != nil { - m.RouteOrder = o.RouteOrder() - } - if o.SetDow != nil { - m.SetDow = o.SetDow() - } - if o.Vectorsurvsiteid != nil { - m.Vectorsurvsiteid = o.Vectorsurvsiteid() - } - if o.H3R7 != nil { - m.H3R7 = o.H3R7() - } - if o.H3R8 != nil { - m.H3R8 = o.H3R8() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryTraplocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryTraplocationTemplate.CreateMany -func (o HistoryTraplocationTemplate) BuildMany(number int) models.HistoryTraplocationSlice { - m := make(models.HistoryTraplocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryTraplocation(m *models.HistoryTraplocationSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryTraplocation -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryTraplocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryTraplocation) error { - var err error - - return err -} - -// Create builds a historyTraplocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryTraplocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryTraplocation, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryTraplocation(opt) - - if o.r.Organization == nil { - HistoryTraplocationMods.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.HistoryTraplocations.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 historyTraplocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryTraplocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryTraplocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyTraplocation 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 *HistoryTraplocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryTraplocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyTraplocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryTraplocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryTraplocationSlice, error) { - var err error - m := make(models.HistoryTraplocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyTraplocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryTraplocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryTraplocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyTraplocations 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 HistoryTraplocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryTraplocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryTraplocation has methods that act as mods for the HistoryTraplocationTemplate -var HistoryTraplocationMods historyTraplocationMods - -type historyTraplocationMods struct{} - -func (m historyTraplocationMods) RandomizeAllColumns(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModSlice{ - HistoryTraplocationMods.RandomOrganizationID(f), - HistoryTraplocationMods.RandomAccessdesc(f), - HistoryTraplocationMods.RandomActive(f), - HistoryTraplocationMods.RandomComments(f), - HistoryTraplocationMods.RandomCreationdate(f), - HistoryTraplocationMods.RandomCreator(f), - HistoryTraplocationMods.RandomDescription(f), - HistoryTraplocationMods.RandomExternalid(f), - HistoryTraplocationMods.RandomEditdate(f), - HistoryTraplocationMods.RandomEditor(f), - HistoryTraplocationMods.RandomGatewaysync(f), - HistoryTraplocationMods.RandomGlobalid(f), - HistoryTraplocationMods.RandomHabitat(f), - HistoryTraplocationMods.RandomLocationnumber(f), - HistoryTraplocationMods.RandomName(f), - HistoryTraplocationMods.RandomNextactiondatescheduled(f), - HistoryTraplocationMods.RandomObjectid(f), - HistoryTraplocationMods.RandomPriority(f), - HistoryTraplocationMods.RandomUsetype(f), - HistoryTraplocationMods.RandomZone(f), - HistoryTraplocationMods.RandomZone2(f), - HistoryTraplocationMods.RandomCreated(f), - HistoryTraplocationMods.RandomCreatedDate(f), - HistoryTraplocationMods.RandomCreatedUser(f), - HistoryTraplocationMods.RandomGeometryX(f), - HistoryTraplocationMods.RandomGeometryY(f), - HistoryTraplocationMods.RandomLastEditedDate(f), - HistoryTraplocationMods.RandomLastEditedUser(f), - HistoryTraplocationMods.RandomRoute(f), - HistoryTraplocationMods.RandomRouteOrder(f), - HistoryTraplocationMods.RandomSetDow(f), - HistoryTraplocationMods.RandomVectorsurvsiteid(f), - HistoryTraplocationMods.RandomH3R7(f), - HistoryTraplocationMods.RandomH3R8(f), - HistoryTraplocationMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyTraplocationMods) OrganizationID(val int32) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) OrganizationIDFunc(f func() int32) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetOrganizationID() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - 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 historyTraplocationMods) RandomOrganizationID(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyTraplocationMods) Accessdesc(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) AccessdescFunc(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetAccessdesc() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Accessdesc = 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 historyTraplocationMods) RandomAccessdesc(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Accessdesc = 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 historyTraplocationMods) RandomAccessdescNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Accessdesc = 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 historyTraplocationMods) Active(val null.Val[int16]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) ActiveFunc(f func() null.Val[int16]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetActive() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Active = 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 historyTraplocationMods) RandomActive(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyTraplocationMods) RandomActiveNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Active = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTraplocationMods) Comments(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) CommentsFunc(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetComments() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Comments = 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 historyTraplocationMods) RandomComments(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Comments = 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 historyTraplocationMods) RandomCommentsNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Comments = 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 historyTraplocationMods) Creationdate(val null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) CreationdateFunc(f func() null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetCreationdate() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Creationdate = 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 historyTraplocationMods) RandomCreationdate(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTraplocationMods) RandomCreationdateNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTraplocationMods) Creator(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) CreatorFunc(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetCreator() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Creator = 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 historyTraplocationMods) RandomCreator(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Creator = 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 historyTraplocationMods) RandomCreatorNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Creator = 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 historyTraplocationMods) Description(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) DescriptionFunc(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetDescription() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Description = 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 historyTraplocationMods) RandomDescription(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Description = 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 historyTraplocationMods) RandomDescriptionNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Description = 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 historyTraplocationMods) Externalid(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) ExternalidFunc(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetExternalid() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Externalid = 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 historyTraplocationMods) RandomExternalid(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Externalid = 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 historyTraplocationMods) RandomExternalidNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Externalid = 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 historyTraplocationMods) Editdate(val null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) EditdateFunc(f func() null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetEditdate() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Editdate = 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 historyTraplocationMods) RandomEditdate(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTraplocationMods) RandomEditdateNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTraplocationMods) Editor(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) EditorFunc(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetEditor() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Editor = 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 historyTraplocationMods) RandomEditor(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Editor = 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 historyTraplocationMods) RandomEditorNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Editor = 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 historyTraplocationMods) Gatewaysync(val null.Val[int16]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Gatewaysync = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) GatewaysyncFunc(f func() null.Val[int16]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Gatewaysync = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetGatewaysync() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Gatewaysync = 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 historyTraplocationMods) RandomGatewaysync(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyTraplocationMods) RandomGatewaysyncNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Gatewaysync = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTraplocationMods) Globalid(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) GlobalidFunc(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetGlobalid() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Globalid = 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 historyTraplocationMods) RandomGlobalid(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - 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 historyTraplocationMods) RandomGlobalidNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Globalid = 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 historyTraplocationMods) Habitat(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) HabitatFunc(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetHabitat() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Habitat = 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 historyTraplocationMods) RandomHabitat(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Habitat = 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 historyTraplocationMods) RandomHabitatNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Habitat = 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 historyTraplocationMods) Locationnumber(val null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Locationnumber = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) LocationnumberFunc(f func() null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetLocationnumber() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Locationnumber = 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 historyTraplocationMods) RandomLocationnumber(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTraplocationMods) RandomLocationnumberNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Locationnumber = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTraplocationMods) Name(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) NameFunc(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetName() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Name = 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 historyTraplocationMods) RandomName(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Name = 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 historyTraplocationMods) RandomNameNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Name = 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 historyTraplocationMods) Nextactiondatescheduled(val null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) NextactiondatescheduledFunc(f func() null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetNextactiondatescheduled() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Nextactiondatescheduled = 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 historyTraplocationMods) RandomNextactiondatescheduled(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTraplocationMods) RandomNextactiondatescheduledNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTraplocationMods) Objectid(val int32) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) ObjectidFunc(f func() int32) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetObjectid() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyTraplocationMods) RandomObjectid(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyTraplocationMods) Priority(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) PriorityFunc(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetPriority() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Priority = 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 historyTraplocationMods) RandomPriority(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Priority = 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 historyTraplocationMods) RandomPriorityNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Priority = 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 historyTraplocationMods) Usetype(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) UsetypeFunc(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetUsetype() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Usetype = 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 historyTraplocationMods) RandomUsetype(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Usetype = 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 historyTraplocationMods) RandomUsetypeNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Usetype = 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 historyTraplocationMods) Zone(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) ZoneFunc(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetZone() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Zone = 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 historyTraplocationMods) RandomZone(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Zone = 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 historyTraplocationMods) RandomZoneNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Zone = 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 historyTraplocationMods) Zone2(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) Zone2Func(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetZone2() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Zone2 = 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 historyTraplocationMods) RandomZone2(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Zone2 = 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 historyTraplocationMods) RandomZone2NotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Zone2 = 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 historyTraplocationMods) Created(val null.Val[time.Time]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) CreatedFunc(f func() null.Val[time.Time]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetCreated() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Created = 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 historyTraplocationMods) RandomCreated(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyTraplocationMods) RandomCreatedNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTraplocationMods) CreatedDate(val null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) CreatedDateFunc(f func() null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetCreatedDate() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.CreatedDate = 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 historyTraplocationMods) RandomCreatedDate(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTraplocationMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTraplocationMods) CreatedUser(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) CreatedUserFunc(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetCreatedUser() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.CreatedUser = 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 historyTraplocationMods) RandomCreatedUser(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.CreatedUser = 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 historyTraplocationMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.CreatedUser = 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 historyTraplocationMods) GeometryX(val null.Val[float64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) GeometryXFunc(f func() null.Val[float64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetGeometryX() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.GeometryX = 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 historyTraplocationMods) RandomGeometryX(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - 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 historyTraplocationMods) RandomGeometryXNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.GeometryX = 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 historyTraplocationMods) GeometryY(val null.Val[float64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) GeometryYFunc(f func() null.Val[float64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetGeometryY() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.GeometryY = 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 historyTraplocationMods) RandomGeometryY(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - 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 historyTraplocationMods) RandomGeometryYNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.GeometryY = 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 historyTraplocationMods) LastEditedDate(val null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetLastEditedDate() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.LastEditedDate = 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 historyTraplocationMods) RandomLastEditedDate(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTraplocationMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTraplocationMods) LastEditedUser(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) LastEditedUserFunc(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetLastEditedUser() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.LastEditedUser = 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 historyTraplocationMods) RandomLastEditedUser(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.LastEditedUser = 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 historyTraplocationMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.LastEditedUser = 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 historyTraplocationMods) Route(val null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Route = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) RouteFunc(f func() null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Route = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetRoute() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Route = 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 historyTraplocationMods) RandomRoute(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Route = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTraplocationMods) RandomRouteNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Route = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTraplocationMods) RouteOrder(val null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.RouteOrder = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) RouteOrderFunc(f func() null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.RouteOrder = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetRouteOrder() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.RouteOrder = 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 historyTraplocationMods) RandomRouteOrder(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.RouteOrder = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTraplocationMods) RandomRouteOrderNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.RouteOrder = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTraplocationMods) SetDow(val null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.SetDow = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) SetDowFunc(f func() null.Val[int64]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.SetDow = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetSetDow() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.SetDow = 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 historyTraplocationMods) RandomSetDow(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.SetDow = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTraplocationMods) RandomSetDowNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.SetDow = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTraplocationMods) Vectorsurvsiteid(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Vectorsurvsiteid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) VectorsurvsiteidFunc(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Vectorsurvsiteid = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetVectorsurvsiteid() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Vectorsurvsiteid = 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 historyTraplocationMods) RandomVectorsurvsiteid(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Vectorsurvsiteid = 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 historyTraplocationMods) RandomVectorsurvsiteidNotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Vectorsurvsiteid = 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 historyTraplocationMods) H3R7(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.H3R7 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) H3R7Func(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.H3R7 = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetH3R7() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.H3R7 = 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 historyTraplocationMods) RandomH3R7(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.H3R7 = 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 historyTraplocationMods) RandomH3R7NotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.H3R7 = 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 historyTraplocationMods) H3R8(val null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.H3R8 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) H3R8Func(f func() null.Val[string]) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.H3R8 = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetH3R8() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.H3R8 = 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 historyTraplocationMods) RandomH3R8(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.H3R8 = 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 historyTraplocationMods) RandomH3R8NotNull(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.H3R8 = 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 historyTraplocationMods) Version(val int32) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyTraplocationMods) VersionFunc(f func() int32) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyTraplocationMods) UnsetVersion() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyTraplocationMods) RandomVersion(f *faker.Faker) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(_ context.Context, o *HistoryTraplocationTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyTraplocationMods) WithParentsCascading() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(ctx context.Context, o *HistoryTraplocationTemplate) { - if isDone, _ := historyTraplocationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyTraplocationWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyTraplocationMods) WithOrganization(rel *OrganizationTemplate) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(ctx context.Context, o *HistoryTraplocationTemplate) { - o.r.Organization = &historyTraplocationROrganizationR{ - o: rel, - } - }) -} - -func (m historyTraplocationMods) WithNewOrganization(mods ...OrganizationMod) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(ctx context.Context, o *HistoryTraplocationTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyTraplocationMods) WithExistingOrganization(em *models.Organization) HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(ctx context.Context, o *HistoryTraplocationTemplate) { - o.r.Organization = &historyTraplocationROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyTraplocationMods) WithoutOrganization() HistoryTraplocationMod { - return HistoryTraplocationModFunc(func(ctx context.Context, o *HistoryTraplocationTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_treatment.bob.go b/db/factory/history_treatment.bob.go deleted file mode 100644 index 7390eded..00000000 --- a/db/factory/history_treatment.bob.go +++ /dev/null @@ -1,3888 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryTreatmentMod interface { - Apply(context.Context, *HistoryTreatmentTemplate) -} - -type HistoryTreatmentModFunc func(context.Context, *HistoryTreatmentTemplate) - -func (f HistoryTreatmentModFunc) Apply(ctx context.Context, n *HistoryTreatmentTemplate) { - f(ctx, n) -} - -type HistoryTreatmentModSlice []HistoryTreatmentMod - -func (mods HistoryTreatmentModSlice) Apply(ctx context.Context, n *HistoryTreatmentTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryTreatmentTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryTreatmentTemplate struct { - OrganizationID func() int32 - Activity func() null.Val[string] - Areaunit func() null.Val[string] - Avetemp func() null.Val[float64] - Barrierrouteid func() null.Val[string] - Cbcount func() null.Val[int16] - Comments func() null.Val[string] - Containercount func() null.Val[int16] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Enddatetime func() null.Val[int64] - Equiptype func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Fieldtech func() null.Val[string] - Flowrate func() null.Val[float64] - Globalid func() null.Val[string] - Habitat func() null.Val[string] - InspID func() null.Val[string] - Invloc func() null.Val[string] - Linelocid func() null.Val[string] - Locationname func() null.Val[string] - Method func() null.Val[string] - Objectid func() int32 - Pointlocid func() null.Val[string] - Polygonlocid func() null.Val[string] - Product func() null.Val[string] - Ptaid func() null.Val[string] - Qty func() null.Val[float64] - Qtyunit func() null.Val[string] - Raingauge func() null.Val[float64] - Recordstatus func() null.Val[int16] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[int64] - Sdid func() null.Val[string] - Sitecond func() null.Val[string] - Srid func() null.Val[string] - Startdatetime func() null.Val[int64] - Targetspecies func() null.Val[string] - Tirecount func() null.Val[int16] - Treatacres func() null.Val[float64] - Treatarea func() null.Val[float64] - Treathectares func() null.Val[float64] - Treatmenthours func() null.Val[float64] - Treatmentlength func() null.Val[float64] - Treatmentlengthunits func() null.Val[string] - Totalcostprodcut func() null.Val[float64] - Ulvrouteid func() null.Val[string] - Warningoverride func() null.Val[int16] - Winddir func() null.Val[string] - Windspeed func() null.Val[float64] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - TempSitecond func() null.Val[string] - Version func() int32 - Created func() null.Val[time.Time] - - r historyTreatmentR - f *Factory - - alreadyPersisted bool -} - -type historyTreatmentR struct { - Organization *historyTreatmentROrganizationR -} - -type historyTreatmentROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryTreatmentTemplate -func (o *HistoryTreatmentTemplate) Apply(ctx context.Context, mods ...HistoryTreatmentMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryTreatment -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryTreatmentTemplate) setModelRels(o *models.HistoryTreatment) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryTreatments = append(rel.R.HistoryTreatments, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryTreatmentSetter -// this does nothing with the relationship templates -func (o HistoryTreatmentTemplate) BuildSetter() *models.HistoryTreatmentSetter { - m := &models.HistoryTreatmentSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Activity != nil { - val := o.Activity() - m.Activity = omitnull.FromNull(val) - } - if o.Areaunit != nil { - val := o.Areaunit() - m.Areaunit = omitnull.FromNull(val) - } - if o.Avetemp != nil { - val := o.Avetemp() - m.Avetemp = omitnull.FromNull(val) - } - if o.Barrierrouteid != nil { - val := o.Barrierrouteid() - m.Barrierrouteid = omitnull.FromNull(val) - } - if o.Cbcount != nil { - val := o.Cbcount() - m.Cbcount = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Containercount != nil { - val := o.Containercount() - m.Containercount = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Equiptype != nil { - val := o.Equiptype() - m.Equiptype = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Flowrate != nil { - val := o.Flowrate() - m.Flowrate = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(val) - } - if o.InspID != nil { - val := o.InspID() - m.InspID = omitnull.FromNull(val) - } - if o.Invloc != nil { - val := o.Invloc() - m.Invloc = omitnull.FromNull(val) - } - if o.Linelocid != nil { - val := o.Linelocid() - m.Linelocid = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.Method != nil { - val := o.Method() - m.Method = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Pointlocid != nil { - val := o.Pointlocid() - m.Pointlocid = omitnull.FromNull(val) - } - if o.Polygonlocid != nil { - val := o.Polygonlocid() - m.Polygonlocid = omitnull.FromNull(val) - } - if o.Product != nil { - val := o.Product() - m.Product = omitnull.FromNull(val) - } - if o.Ptaid != nil { - val := o.Ptaid() - m.Ptaid = omitnull.FromNull(val) - } - if o.Qty != nil { - val := o.Qty() - m.Qty = omitnull.FromNull(val) - } - if o.Qtyunit != nil { - val := o.Qtyunit() - m.Qtyunit = omitnull.FromNull(val) - } - if o.Raingauge != nil { - val := o.Raingauge() - m.Raingauge = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Reviewed != nil { - val := o.Reviewed() - m.Reviewed = omitnull.FromNull(val) - } - if o.Reviewedby != nil { - val := o.Reviewedby() - m.Reviewedby = omitnull.FromNull(val) - } - if o.Revieweddate != nil { - val := o.Revieweddate() - m.Revieweddate = omitnull.FromNull(val) - } - if o.Sdid != nil { - val := o.Sdid() - m.Sdid = omitnull.FromNull(val) - } - if o.Sitecond != nil { - val := o.Sitecond() - m.Sitecond = omitnull.FromNull(val) - } - if o.Srid != nil { - val := o.Srid() - m.Srid = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Targetspecies != nil { - val := o.Targetspecies() - m.Targetspecies = omitnull.FromNull(val) - } - if o.Tirecount != nil { - val := o.Tirecount() - m.Tirecount = omitnull.FromNull(val) - } - if o.Treatacres != nil { - val := o.Treatacres() - m.Treatacres = omitnull.FromNull(val) - } - if o.Treatarea != nil { - val := o.Treatarea() - m.Treatarea = omitnull.FromNull(val) - } - if o.Treathectares != nil { - val := o.Treathectares() - m.Treathectares = omitnull.FromNull(val) - } - if o.Treatmenthours != nil { - val := o.Treatmenthours() - m.Treatmenthours = omitnull.FromNull(val) - } - if o.Treatmentlength != nil { - val := o.Treatmentlength() - m.Treatmentlength = omitnull.FromNull(val) - } - if o.Treatmentlengthunits != nil { - val := o.Treatmentlengthunits() - m.Treatmentlengthunits = omitnull.FromNull(val) - } - if o.Totalcostprodcut != nil { - val := o.Totalcostprodcut() - m.Totalcostprodcut = omitnull.FromNull(val) - } - if o.Ulvrouteid != nil { - val := o.Ulvrouteid() - m.Ulvrouteid = omitnull.FromNull(val) - } - if o.Warningoverride != nil { - val := o.Warningoverride() - m.Warningoverride = omitnull.FromNull(val) - } - if o.Winddir != nil { - val := o.Winddir() - m.Winddir = omitnull.FromNull(val) - } - if o.Windspeed != nil { - val := o.Windspeed() - m.Windspeed = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.TempSitecond != nil { - val := o.TempSitecond() - m.TempSitecond = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryTreatmentSetter -// this does nothing with the relationship templates -func (o HistoryTreatmentTemplate) BuildManySetter(number int) []*models.HistoryTreatmentSetter { - m := make([]*models.HistoryTreatmentSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryTreatment -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryTreatmentTemplate.Create -func (o HistoryTreatmentTemplate) Build() *models.HistoryTreatment { - m := &models.HistoryTreatment{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Activity != nil { - m.Activity = o.Activity() - } - if o.Areaunit != nil { - m.Areaunit = o.Areaunit() - } - if o.Avetemp != nil { - m.Avetemp = o.Avetemp() - } - if o.Barrierrouteid != nil { - m.Barrierrouteid = o.Barrierrouteid() - } - if o.Cbcount != nil { - m.Cbcount = o.Cbcount() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Containercount != nil { - m.Containercount = o.Containercount() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Equiptype != nil { - m.Equiptype = o.Equiptype() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Flowrate != nil { - m.Flowrate = o.Flowrate() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.InspID != nil { - m.InspID = o.InspID() - } - if o.Invloc != nil { - m.Invloc = o.Invloc() - } - if o.Linelocid != nil { - m.Linelocid = o.Linelocid() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.Method != nil { - m.Method = o.Method() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Pointlocid != nil { - m.Pointlocid = o.Pointlocid() - } - if o.Polygonlocid != nil { - m.Polygonlocid = o.Polygonlocid() - } - if o.Product != nil { - m.Product = o.Product() - } - if o.Ptaid != nil { - m.Ptaid = o.Ptaid() - } - if o.Qty != nil { - m.Qty = o.Qty() - } - if o.Qtyunit != nil { - m.Qtyunit = o.Qtyunit() - } - if o.Raingauge != nil { - m.Raingauge = o.Raingauge() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Reviewed != nil { - m.Reviewed = o.Reviewed() - } - if o.Reviewedby != nil { - m.Reviewedby = o.Reviewedby() - } - if o.Revieweddate != nil { - m.Revieweddate = o.Revieweddate() - } - if o.Sdid != nil { - m.Sdid = o.Sdid() - } - if o.Sitecond != nil { - m.Sitecond = o.Sitecond() - } - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Targetspecies != nil { - m.Targetspecies = o.Targetspecies() - } - if o.Tirecount != nil { - m.Tirecount = o.Tirecount() - } - if o.Treatacres != nil { - m.Treatacres = o.Treatacres() - } - if o.Treatarea != nil { - m.Treatarea = o.Treatarea() - } - if o.Treathectares != nil { - m.Treathectares = o.Treathectares() - } - if o.Treatmenthours != nil { - m.Treatmenthours = o.Treatmenthours() - } - if o.Treatmentlength != nil { - m.Treatmentlength = o.Treatmentlength() - } - if o.Treatmentlengthunits != nil { - m.Treatmentlengthunits = o.Treatmentlengthunits() - } - if o.Totalcostprodcut != nil { - m.Totalcostprodcut = o.Totalcostprodcut() - } - if o.Ulvrouteid != nil { - m.Ulvrouteid = o.Ulvrouteid() - } - if o.Warningoverride != nil { - m.Warningoverride = o.Warningoverride() - } - if o.Winddir != nil { - m.Winddir = o.Winddir() - } - if o.Windspeed != nil { - m.Windspeed = o.Windspeed() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.TempSitecond != nil { - m.TempSitecond = o.TempSitecond() - } - if o.Version != nil { - m.Version = o.Version() - } - if o.Created != nil { - m.Created = o.Created() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryTreatmentSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryTreatmentTemplate.CreateMany -func (o HistoryTreatmentTemplate) BuildMany(number int) models.HistoryTreatmentSlice { - m := make(models.HistoryTreatmentSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryTreatment(m *models.HistoryTreatmentSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryTreatment -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryTreatmentTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryTreatment) error { - var err error - - return err -} - -// Create builds a historyTreatment and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryTreatmentTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryTreatment, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryTreatment(opt) - - if o.r.Organization == nil { - HistoryTreatmentMods.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.HistoryTreatments.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 historyTreatment and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryTreatmentTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryTreatment { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyTreatment 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 *HistoryTreatmentTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryTreatment { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyTreatments and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryTreatmentTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryTreatmentSlice, error) { - var err error - m := make(models.HistoryTreatmentSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyTreatments and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryTreatmentTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryTreatmentSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyTreatments 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 HistoryTreatmentTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryTreatmentSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryTreatment has methods that act as mods for the HistoryTreatmentTemplate -var HistoryTreatmentMods historyTreatmentMods - -type historyTreatmentMods struct{} - -func (m historyTreatmentMods) RandomizeAllColumns(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModSlice{ - HistoryTreatmentMods.RandomOrganizationID(f), - HistoryTreatmentMods.RandomActivity(f), - HistoryTreatmentMods.RandomAreaunit(f), - HistoryTreatmentMods.RandomAvetemp(f), - HistoryTreatmentMods.RandomBarrierrouteid(f), - HistoryTreatmentMods.RandomCbcount(f), - HistoryTreatmentMods.RandomComments(f), - HistoryTreatmentMods.RandomContainercount(f), - HistoryTreatmentMods.RandomCreationdate(f), - HistoryTreatmentMods.RandomCreator(f), - HistoryTreatmentMods.RandomEnddatetime(f), - HistoryTreatmentMods.RandomEquiptype(f), - HistoryTreatmentMods.RandomEditdate(f), - HistoryTreatmentMods.RandomEditor(f), - HistoryTreatmentMods.RandomFieldtech(f), - HistoryTreatmentMods.RandomFlowrate(f), - HistoryTreatmentMods.RandomGlobalid(f), - HistoryTreatmentMods.RandomHabitat(f), - HistoryTreatmentMods.RandomInspID(f), - HistoryTreatmentMods.RandomInvloc(f), - HistoryTreatmentMods.RandomLinelocid(f), - HistoryTreatmentMods.RandomLocationname(f), - HistoryTreatmentMods.RandomMethod(f), - HistoryTreatmentMods.RandomObjectid(f), - HistoryTreatmentMods.RandomPointlocid(f), - HistoryTreatmentMods.RandomPolygonlocid(f), - HistoryTreatmentMods.RandomProduct(f), - HistoryTreatmentMods.RandomPtaid(f), - HistoryTreatmentMods.RandomQty(f), - HistoryTreatmentMods.RandomQtyunit(f), - HistoryTreatmentMods.RandomRaingauge(f), - HistoryTreatmentMods.RandomRecordstatus(f), - HistoryTreatmentMods.RandomReviewed(f), - HistoryTreatmentMods.RandomReviewedby(f), - HistoryTreatmentMods.RandomRevieweddate(f), - HistoryTreatmentMods.RandomSdid(f), - HistoryTreatmentMods.RandomSitecond(f), - HistoryTreatmentMods.RandomSrid(f), - HistoryTreatmentMods.RandomStartdatetime(f), - HistoryTreatmentMods.RandomTargetspecies(f), - HistoryTreatmentMods.RandomTirecount(f), - HistoryTreatmentMods.RandomTreatacres(f), - HistoryTreatmentMods.RandomTreatarea(f), - HistoryTreatmentMods.RandomTreathectares(f), - HistoryTreatmentMods.RandomTreatmenthours(f), - HistoryTreatmentMods.RandomTreatmentlength(f), - HistoryTreatmentMods.RandomTreatmentlengthunits(f), - HistoryTreatmentMods.RandomTotalcostprodcut(f), - HistoryTreatmentMods.RandomUlvrouteid(f), - HistoryTreatmentMods.RandomWarningoverride(f), - HistoryTreatmentMods.RandomWinddir(f), - HistoryTreatmentMods.RandomWindspeed(f), - HistoryTreatmentMods.RandomZone(f), - HistoryTreatmentMods.RandomZone2(f), - HistoryTreatmentMods.RandomGeometryX(f), - HistoryTreatmentMods.RandomGeometryY(f), - HistoryTreatmentMods.RandomTempSitecond(f), - HistoryTreatmentMods.RandomVersion(f), - HistoryTreatmentMods.RandomCreated(f), - } -} - -// Set the model columns to this value -func (m historyTreatmentMods) OrganizationID(val int32) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) OrganizationIDFunc(f func() int32) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetOrganizationID() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - 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 historyTreatmentMods) RandomOrganizationID(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentMods) Activity(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Activity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) ActivityFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Activity = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetActivity() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Activity = 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 historyTreatmentMods) RandomActivity(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Activity = 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 historyTreatmentMods) RandomActivityNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Activity = 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 historyTreatmentMods) Areaunit(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Areaunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) AreaunitFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Areaunit = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetAreaunit() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Areaunit = 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 historyTreatmentMods) RandomAreaunit(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Areaunit = 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 historyTreatmentMods) RandomAreaunitNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Areaunit = 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 historyTreatmentMods) Avetemp(val null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Avetemp = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) AvetempFunc(f func() null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Avetemp = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetAvetemp() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Avetemp = 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 historyTreatmentMods) RandomAvetemp(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Avetemp = 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 historyTreatmentMods) RandomAvetempNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Avetemp = 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 historyTreatmentMods) Barrierrouteid(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Barrierrouteid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) BarrierrouteidFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Barrierrouteid = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetBarrierrouteid() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Barrierrouteid = 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 historyTreatmentMods) RandomBarrierrouteid(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Barrierrouteid = 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 historyTreatmentMods) RandomBarrierrouteidNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Barrierrouteid = 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 historyTreatmentMods) Cbcount(val null.Val[int16]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Cbcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) CbcountFunc(f func() null.Val[int16]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Cbcount = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetCbcount() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Cbcount = 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 historyTreatmentMods) RandomCbcount(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Cbcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyTreatmentMods) RandomCbcountNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Cbcount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentMods) Comments(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) CommentsFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetComments() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Comments = 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 historyTreatmentMods) RandomComments(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Comments = 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 historyTreatmentMods) RandomCommentsNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Comments = 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 historyTreatmentMods) Containercount(val null.Val[int16]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Containercount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) ContainercountFunc(f func() null.Val[int16]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Containercount = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetContainercount() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Containercount = 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 historyTreatmentMods) RandomContainercount(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Containercount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyTreatmentMods) RandomContainercountNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Containercount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentMods) Creationdate(val null.Val[int64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) CreationdateFunc(f func() null.Val[int64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetCreationdate() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Creationdate = 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 historyTreatmentMods) RandomCreationdate(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTreatmentMods) RandomCreationdateNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentMods) Creator(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) CreatorFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetCreator() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Creator = 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 historyTreatmentMods) RandomCreator(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Creator = 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 historyTreatmentMods) RandomCreatorNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Creator = 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 historyTreatmentMods) Enddatetime(val null.Val[int64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Enddatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) EnddatetimeFunc(f func() null.Val[int64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetEnddatetime() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Enddatetime = 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 historyTreatmentMods) RandomEnddatetime(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTreatmentMods) RandomEnddatetimeNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Enddatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentMods) Equiptype(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Equiptype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) EquiptypeFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Equiptype = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetEquiptype() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Equiptype = 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 historyTreatmentMods) RandomEquiptype(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Equiptype = 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 historyTreatmentMods) RandomEquiptypeNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Equiptype = 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 historyTreatmentMods) Editdate(val null.Val[int64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) EditdateFunc(f func() null.Val[int64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetEditdate() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Editdate = 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 historyTreatmentMods) RandomEditdate(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTreatmentMods) RandomEditdateNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentMods) Editor(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) EditorFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetEditor() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Editor = 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 historyTreatmentMods) RandomEditor(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Editor = 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 historyTreatmentMods) RandomEditorNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Editor = 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 historyTreatmentMods) Fieldtech(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) FieldtechFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetFieldtech() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Fieldtech = 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 historyTreatmentMods) RandomFieldtech(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Fieldtech = 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 historyTreatmentMods) RandomFieldtechNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Fieldtech = 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 historyTreatmentMods) Flowrate(val null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Flowrate = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) FlowrateFunc(f func() null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Flowrate = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetFlowrate() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Flowrate = 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 historyTreatmentMods) RandomFlowrate(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Flowrate = 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 historyTreatmentMods) RandomFlowrateNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Flowrate = 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 historyTreatmentMods) Globalid(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) GlobalidFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetGlobalid() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Globalid = 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 historyTreatmentMods) RandomGlobalid(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - 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 historyTreatmentMods) RandomGlobalidNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Globalid = 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 historyTreatmentMods) Habitat(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) HabitatFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetHabitat() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Habitat = 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 historyTreatmentMods) RandomHabitat(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Habitat = 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 historyTreatmentMods) RandomHabitatNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Habitat = 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 historyTreatmentMods) InspID(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.InspID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) InspIDFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.InspID = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetInspID() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.InspID = 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 historyTreatmentMods) RandomInspID(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.InspID = 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 historyTreatmentMods) RandomInspIDNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.InspID = 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 historyTreatmentMods) Invloc(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Invloc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) InvlocFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Invloc = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetInvloc() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Invloc = 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 historyTreatmentMods) RandomInvloc(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Invloc = 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 historyTreatmentMods) RandomInvlocNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Invloc = 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 historyTreatmentMods) Linelocid(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Linelocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) LinelocidFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Linelocid = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetLinelocid() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Linelocid = 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 historyTreatmentMods) RandomLinelocid(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Linelocid = 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 historyTreatmentMods) RandomLinelocidNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Linelocid = 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 historyTreatmentMods) Locationname(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) LocationnameFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetLocationname() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Locationname = 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 historyTreatmentMods) RandomLocationname(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Locationname = 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 historyTreatmentMods) RandomLocationnameNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Locationname = 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 historyTreatmentMods) Method(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Method = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) MethodFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Method = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetMethod() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Method = 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 historyTreatmentMods) RandomMethod(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Method = 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 historyTreatmentMods) RandomMethodNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Method = 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 historyTreatmentMods) Objectid(val int32) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) ObjectidFunc(f func() int32) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetObjectid() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyTreatmentMods) RandomObjectid(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentMods) Pointlocid(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Pointlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) PointlocidFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Pointlocid = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetPointlocid() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Pointlocid = 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 historyTreatmentMods) RandomPointlocid(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Pointlocid = 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 historyTreatmentMods) RandomPointlocidNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Pointlocid = 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 historyTreatmentMods) Polygonlocid(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Polygonlocid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) PolygonlocidFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Polygonlocid = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetPolygonlocid() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Polygonlocid = 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 historyTreatmentMods) RandomPolygonlocid(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Polygonlocid = 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 historyTreatmentMods) RandomPolygonlocidNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Polygonlocid = 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 historyTreatmentMods) Product(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Product = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) ProductFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Product = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetProduct() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Product = 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 historyTreatmentMods) RandomProduct(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Product = 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 historyTreatmentMods) RandomProductNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Product = 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 historyTreatmentMods) Ptaid(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Ptaid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) PtaidFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Ptaid = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetPtaid() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Ptaid = 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 historyTreatmentMods) RandomPtaid(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Ptaid = 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 historyTreatmentMods) RandomPtaidNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Ptaid = 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 historyTreatmentMods) Qty(val null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Qty = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) QtyFunc(f func() null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Qty = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetQty() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Qty = 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 historyTreatmentMods) RandomQty(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Qty = 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 historyTreatmentMods) RandomQtyNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Qty = 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 historyTreatmentMods) Qtyunit(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Qtyunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) QtyunitFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Qtyunit = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetQtyunit() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Qtyunit = 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 historyTreatmentMods) RandomQtyunit(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Qtyunit = 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 historyTreatmentMods) RandomQtyunitNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Qtyunit = 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 historyTreatmentMods) Raingauge(val null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Raingauge = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) RaingaugeFunc(f func() null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Raingauge = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetRaingauge() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Raingauge = 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 historyTreatmentMods) RandomRaingauge(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Raingauge = 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 historyTreatmentMods) RandomRaingaugeNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Raingauge = 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 historyTreatmentMods) Recordstatus(val null.Val[int16]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) RecordstatusFunc(f func() null.Val[int16]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetRecordstatus() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Recordstatus = 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 historyTreatmentMods) RandomRecordstatus(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyTreatmentMods) RandomRecordstatusNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Recordstatus = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentMods) Reviewed(val null.Val[int16]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) ReviewedFunc(f func() null.Val[int16]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetReviewed() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Reviewed = 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 historyTreatmentMods) RandomReviewed(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyTreatmentMods) RandomReviewedNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Reviewed = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentMods) Reviewedby(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) ReviewedbyFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetReviewedby() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Reviewedby = 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 historyTreatmentMods) RandomReviewedby(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Reviewedby = 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 historyTreatmentMods) RandomReviewedbyNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Reviewedby = 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 historyTreatmentMods) Revieweddate(val null.Val[int64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Revieweddate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) RevieweddateFunc(f func() null.Val[int64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetRevieweddate() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Revieweddate = 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 historyTreatmentMods) RandomRevieweddate(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTreatmentMods) RandomRevieweddateNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Revieweddate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentMods) Sdid(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Sdid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) SdidFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Sdid = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetSdid() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Sdid = 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 historyTreatmentMods) RandomSdid(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Sdid = 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 historyTreatmentMods) RandomSdidNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Sdid = 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 historyTreatmentMods) Sitecond(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Sitecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) SitecondFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Sitecond = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetSitecond() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Sitecond = 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 historyTreatmentMods) RandomSitecond(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Sitecond = 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 historyTreatmentMods) RandomSitecondNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Sitecond = 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 historyTreatmentMods) Srid(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Srid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) SridFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetSrid() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - 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 historyTreatmentMods) RandomSrid(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Srid = 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 historyTreatmentMods) RandomSridNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Srid = 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 historyTreatmentMods) Startdatetime(val null.Val[int64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Startdatetime = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) StartdatetimeFunc(f func() null.Val[int64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetStartdatetime() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Startdatetime = 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 historyTreatmentMods) RandomStartdatetime(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTreatmentMods) RandomStartdatetimeNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Startdatetime = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentMods) Targetspecies(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Targetspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) TargetspeciesFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Targetspecies = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetTargetspecies() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Targetspecies = 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 historyTreatmentMods) RandomTargetspecies(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Targetspecies = 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 historyTreatmentMods) RandomTargetspeciesNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Targetspecies = 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 historyTreatmentMods) Tirecount(val null.Val[int16]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Tirecount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) TirecountFunc(f func() null.Val[int16]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Tirecount = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetTirecount() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Tirecount = 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 historyTreatmentMods) RandomTirecount(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Tirecount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyTreatmentMods) RandomTirecountNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Tirecount = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentMods) Treatacres(val null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatacres = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) TreatacresFunc(f func() null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatacres = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetTreatacres() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatacres = 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 historyTreatmentMods) RandomTreatacres(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatacres = 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 historyTreatmentMods) RandomTreatacresNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatacres = 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 historyTreatmentMods) Treatarea(val null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatarea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) TreatareaFunc(f func() null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatarea = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetTreatarea() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatarea = 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 historyTreatmentMods) RandomTreatarea(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatarea = 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 historyTreatmentMods) RandomTreatareaNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatarea = 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 historyTreatmentMods) Treathectares(val null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treathectares = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) TreathectaresFunc(f func() null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treathectares = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetTreathectares() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treathectares = 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 historyTreatmentMods) RandomTreathectares(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treathectares = 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 historyTreatmentMods) RandomTreathectaresNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treathectares = 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 historyTreatmentMods) Treatmenthours(val null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatmenthours = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) TreatmenthoursFunc(f func() null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatmenthours = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetTreatmenthours() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatmenthours = 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 historyTreatmentMods) RandomTreatmenthours(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatmenthours = 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 historyTreatmentMods) RandomTreatmenthoursNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatmenthours = 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 historyTreatmentMods) Treatmentlength(val null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatmentlength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) TreatmentlengthFunc(f func() null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatmentlength = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetTreatmentlength() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatmentlength = 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 historyTreatmentMods) RandomTreatmentlength(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatmentlength = 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 historyTreatmentMods) RandomTreatmentlengthNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatmentlength = 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 historyTreatmentMods) Treatmentlengthunits(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatmentlengthunits = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) TreatmentlengthunitsFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatmentlengthunits = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetTreatmentlengthunits() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatmentlengthunits = 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 historyTreatmentMods) RandomTreatmentlengthunits(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatmentlengthunits = 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 historyTreatmentMods) RandomTreatmentlengthunitsNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Treatmentlengthunits = 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 historyTreatmentMods) Totalcostprodcut(val null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Totalcostprodcut = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) TotalcostprodcutFunc(f func() null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Totalcostprodcut = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetTotalcostprodcut() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Totalcostprodcut = 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 historyTreatmentMods) RandomTotalcostprodcut(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Totalcostprodcut = 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 historyTreatmentMods) RandomTotalcostprodcutNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Totalcostprodcut = 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 historyTreatmentMods) Ulvrouteid(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Ulvrouteid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) UlvrouteidFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Ulvrouteid = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetUlvrouteid() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Ulvrouteid = 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 historyTreatmentMods) RandomUlvrouteid(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Ulvrouteid = 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 historyTreatmentMods) RandomUlvrouteidNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Ulvrouteid = 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 historyTreatmentMods) Warningoverride(val null.Val[int16]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Warningoverride = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) WarningoverrideFunc(f func() null.Val[int16]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Warningoverride = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetWarningoverride() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Warningoverride = 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 historyTreatmentMods) RandomWarningoverride(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Warningoverride = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyTreatmentMods) RandomWarningoverrideNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Warningoverride = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentMods) Winddir(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Winddir = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) WinddirFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Winddir = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetWinddir() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Winddir = 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 historyTreatmentMods) RandomWinddir(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Winddir = 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 historyTreatmentMods) RandomWinddirNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Winddir = 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 historyTreatmentMods) Windspeed(val null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Windspeed = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) WindspeedFunc(f func() null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Windspeed = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetWindspeed() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Windspeed = 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 historyTreatmentMods) RandomWindspeed(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Windspeed = 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 historyTreatmentMods) RandomWindspeedNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Windspeed = 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 historyTreatmentMods) Zone(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) ZoneFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetZone() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Zone = 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 historyTreatmentMods) RandomZone(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Zone = 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 historyTreatmentMods) RandomZoneNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Zone = 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 historyTreatmentMods) Zone2(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) Zone2Func(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetZone2() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Zone2 = 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 historyTreatmentMods) RandomZone2(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Zone2 = 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 historyTreatmentMods) RandomZone2NotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Zone2 = 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 historyTreatmentMods) GeometryX(val null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) GeometryXFunc(f func() null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetGeometryX() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.GeometryX = 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 historyTreatmentMods) RandomGeometryX(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - 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 historyTreatmentMods) RandomGeometryXNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.GeometryX = 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 historyTreatmentMods) GeometryY(val null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) GeometryYFunc(f func() null.Val[float64]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetGeometryY() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.GeometryY = 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 historyTreatmentMods) RandomGeometryY(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - 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 historyTreatmentMods) RandomGeometryYNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.GeometryY = 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 historyTreatmentMods) TempSitecond(val null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.TempSitecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) TempSitecondFunc(f func() null.Val[string]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.TempSitecond = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetTempSitecond() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.TempSitecond = 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 historyTreatmentMods) RandomTempSitecond(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.TempSitecond = 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 historyTreatmentMods) RandomTempSitecondNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.TempSitecond = 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 historyTreatmentMods) Version(val int32) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) VersionFunc(f func() int32) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetVersion() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyTreatmentMods) RandomVersion(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentMods) Created(val null.Val[time.Time]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentMods) CreatedFunc(f func() null.Val[time.Time]) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyTreatmentMods) UnsetCreated() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Created = 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 historyTreatmentMods) RandomCreated(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyTreatmentMods) RandomCreatedNotNull(f *faker.Faker) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(_ context.Context, o *HistoryTreatmentTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -func (m historyTreatmentMods) WithParentsCascading() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(ctx context.Context, o *HistoryTreatmentTemplate) { - if isDone, _ := historyTreatmentWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyTreatmentWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyTreatmentMods) WithOrganization(rel *OrganizationTemplate) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(ctx context.Context, o *HistoryTreatmentTemplate) { - o.r.Organization = &historyTreatmentROrganizationR{ - o: rel, - } - }) -} - -func (m historyTreatmentMods) WithNewOrganization(mods ...OrganizationMod) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(ctx context.Context, o *HistoryTreatmentTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyTreatmentMods) WithExistingOrganization(em *models.Organization) HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(ctx context.Context, o *HistoryTreatmentTemplate) { - o.r.Organization = &historyTreatmentROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyTreatmentMods) WithoutOrganization() HistoryTreatmentMod { - return HistoryTreatmentModFunc(func(ctx context.Context, o *HistoryTreatmentTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_treatmentarea.bob.go b/db/factory/history_treatmentarea.bob.go deleted file mode 100644 index 3ea3b1db..00000000 --- a/db/factory/history_treatmentarea.bob.go +++ /dev/null @@ -1,1656 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryTreatmentareaMod interface { - Apply(context.Context, *HistoryTreatmentareaTemplate) -} - -type HistoryTreatmentareaModFunc func(context.Context, *HistoryTreatmentareaTemplate) - -func (f HistoryTreatmentareaModFunc) Apply(ctx context.Context, n *HistoryTreatmentareaTemplate) { - f(ctx, n) -} - -type HistoryTreatmentareaModSlice []HistoryTreatmentareaMod - -func (mods HistoryTreatmentareaModSlice) Apply(ctx context.Context, n *HistoryTreatmentareaTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryTreatmentareaTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryTreatmentareaTemplate struct { - OrganizationID func() int32 - Comments func() null.Val[string] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() null.Val[string] - Notified func() null.Val[int16] - Objectid func() int32 - SessionID func() null.Val[string] - ShapeArea func() null.Val[float64] - ShapeLength func() null.Val[float64] - Treatdate func() null.Val[int64] - TreatID func() null.Val[string] - Type func() null.Val[string] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Version func() int32 - - r historyTreatmentareaR - f *Factory - - alreadyPersisted bool -} - -type historyTreatmentareaR struct { - Organization *historyTreatmentareaROrganizationR -} - -type historyTreatmentareaROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryTreatmentareaTemplate -func (o *HistoryTreatmentareaTemplate) Apply(ctx context.Context, mods ...HistoryTreatmentareaMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryTreatmentarea -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryTreatmentareaTemplate) setModelRels(o *models.HistoryTreatmentarea) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryTreatmentareas = append(rel.R.HistoryTreatmentareas, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryTreatmentareaSetter -// this does nothing with the relationship templates -func (o HistoryTreatmentareaTemplate) BuildSetter() *models.HistoryTreatmentareaSetter { - m := &models.HistoryTreatmentareaSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Notified != nil { - val := o.Notified() - m.Notified = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.SessionID != nil { - val := o.SessionID() - m.SessionID = omitnull.FromNull(val) - } - if o.ShapeArea != nil { - val := o.ShapeArea() - m.ShapeArea = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - val := o.ShapeLength() - m.ShapeLength = omitnull.FromNull(val) - } - if o.Treatdate != nil { - val := o.Treatdate() - m.Treatdate = omitnull.FromNull(val) - } - if o.TreatID != nil { - val := o.TreatID() - m.TreatID = omitnull.FromNull(val) - } - if o.Type != nil { - val := o.Type() - m.Type = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryTreatmentareaSetter -// this does nothing with the relationship templates -func (o HistoryTreatmentareaTemplate) BuildManySetter(number int) []*models.HistoryTreatmentareaSetter { - m := make([]*models.HistoryTreatmentareaSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryTreatmentarea -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryTreatmentareaTemplate.Create -func (o HistoryTreatmentareaTemplate) Build() *models.HistoryTreatmentarea { - m := &models.HistoryTreatmentarea{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Notified != nil { - m.Notified = o.Notified() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.SessionID != nil { - m.SessionID = o.SessionID() - } - if o.ShapeArea != nil { - m.ShapeArea = o.ShapeArea() - } - if o.ShapeLength != nil { - m.ShapeLength = o.ShapeLength() - } - if o.Treatdate != nil { - m.Treatdate = o.Treatdate() - } - if o.TreatID != nil { - m.TreatID = o.TreatID() - } - if o.Type != nil { - m.Type = o.Type() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryTreatmentareaSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryTreatmentareaTemplate.CreateMany -func (o HistoryTreatmentareaTemplate) BuildMany(number int) models.HistoryTreatmentareaSlice { - m := make(models.HistoryTreatmentareaSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryTreatmentarea(m *models.HistoryTreatmentareaSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryTreatmentarea -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryTreatmentareaTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryTreatmentarea) error { - var err error - - return err -} - -// Create builds a historyTreatmentarea and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryTreatmentareaTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryTreatmentarea, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryTreatmentarea(opt) - - if o.r.Organization == nil { - HistoryTreatmentareaMods.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.HistoryTreatmentareas.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 historyTreatmentarea and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryTreatmentareaTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryTreatmentarea { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyTreatmentarea 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 *HistoryTreatmentareaTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryTreatmentarea { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyTreatmentareas and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryTreatmentareaTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryTreatmentareaSlice, error) { - var err error - m := make(models.HistoryTreatmentareaSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyTreatmentareas and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryTreatmentareaTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryTreatmentareaSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyTreatmentareas 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 HistoryTreatmentareaTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryTreatmentareaSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryTreatmentarea has methods that act as mods for the HistoryTreatmentareaTemplate -var HistoryTreatmentareaMods historyTreatmentareaMods - -type historyTreatmentareaMods struct{} - -func (m historyTreatmentareaMods) RandomizeAllColumns(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModSlice{ - HistoryTreatmentareaMods.RandomOrganizationID(f), - HistoryTreatmentareaMods.RandomComments(f), - HistoryTreatmentareaMods.RandomCreationdate(f), - HistoryTreatmentareaMods.RandomCreator(f), - HistoryTreatmentareaMods.RandomEditdate(f), - HistoryTreatmentareaMods.RandomEditor(f), - HistoryTreatmentareaMods.RandomGlobalid(f), - HistoryTreatmentareaMods.RandomNotified(f), - HistoryTreatmentareaMods.RandomObjectid(f), - HistoryTreatmentareaMods.RandomSessionID(f), - HistoryTreatmentareaMods.RandomShapeArea(f), - HistoryTreatmentareaMods.RandomShapeLength(f), - HistoryTreatmentareaMods.RandomTreatdate(f), - HistoryTreatmentareaMods.RandomTreatID(f), - HistoryTreatmentareaMods.RandomType(f), - HistoryTreatmentareaMods.RandomCreated(f), - HistoryTreatmentareaMods.RandomCreatedDate(f), - HistoryTreatmentareaMods.RandomCreatedUser(f), - HistoryTreatmentareaMods.RandomGeometryX(f), - HistoryTreatmentareaMods.RandomGeometryY(f), - HistoryTreatmentareaMods.RandomLastEditedDate(f), - HistoryTreatmentareaMods.RandomLastEditedUser(f), - HistoryTreatmentareaMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyTreatmentareaMods) OrganizationID(val int32) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) OrganizationIDFunc(f func() int32) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetOrganizationID() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - 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 historyTreatmentareaMods) RandomOrganizationID(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentareaMods) Comments(val null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) CommentsFunc(f func() null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetComments() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Comments = 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 historyTreatmentareaMods) RandomComments(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Comments = 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 historyTreatmentareaMods) RandomCommentsNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Comments = 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 historyTreatmentareaMods) Creationdate(val null.Val[int64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) CreationdateFunc(f func() null.Val[int64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetCreationdate() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Creationdate = 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 historyTreatmentareaMods) RandomCreationdate(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTreatmentareaMods) RandomCreationdateNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentareaMods) Creator(val null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) CreatorFunc(f func() null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetCreator() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Creator = 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 historyTreatmentareaMods) RandomCreator(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Creator = 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 historyTreatmentareaMods) RandomCreatorNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Creator = 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 historyTreatmentareaMods) Editdate(val null.Val[int64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) EditdateFunc(f func() null.Val[int64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetEditdate() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Editdate = 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 historyTreatmentareaMods) RandomEditdate(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTreatmentareaMods) RandomEditdateNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentareaMods) Editor(val null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) EditorFunc(f func() null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetEditor() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Editor = 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 historyTreatmentareaMods) RandomEditor(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Editor = 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 historyTreatmentareaMods) RandomEditorNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Editor = 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 historyTreatmentareaMods) Globalid(val null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) GlobalidFunc(f func() null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetGlobalid() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Globalid = 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 historyTreatmentareaMods) RandomGlobalid(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - 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 historyTreatmentareaMods) RandomGlobalidNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Globalid = 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 historyTreatmentareaMods) Notified(val null.Val[int16]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Notified = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) NotifiedFunc(f func() null.Val[int16]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Notified = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetNotified() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Notified = 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 historyTreatmentareaMods) RandomNotified(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Notified = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(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 historyTreatmentareaMods) RandomNotifiedNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Notified = func() null.Val[int16] { - if f == nil { - f = &defaultFaker - } - - val := random_int16(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentareaMods) Objectid(val int32) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) ObjectidFunc(f func() int32) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetObjectid() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyTreatmentareaMods) RandomObjectid(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentareaMods) SessionID(val null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.SessionID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) SessionIDFunc(f func() null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.SessionID = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetSessionID() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.SessionID = 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 historyTreatmentareaMods) RandomSessionID(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.SessionID = 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 historyTreatmentareaMods) RandomSessionIDNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.SessionID = 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 historyTreatmentareaMods) ShapeArea(val null.Val[float64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.ShapeArea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) ShapeAreaFunc(f func() null.Val[float64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.ShapeArea = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetShapeArea() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.ShapeArea = 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 historyTreatmentareaMods) RandomShapeArea(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.ShapeArea = 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 historyTreatmentareaMods) RandomShapeAreaNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.ShapeArea = 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 historyTreatmentareaMods) ShapeLength(val null.Val[float64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) ShapeLengthFunc(f func() null.Val[float64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetShapeLength() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.ShapeLength = 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 historyTreatmentareaMods) RandomShapeLength(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.ShapeLength = 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 historyTreatmentareaMods) RandomShapeLengthNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.ShapeLength = 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 historyTreatmentareaMods) Treatdate(val null.Val[int64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Treatdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) TreatdateFunc(f func() null.Val[int64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Treatdate = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetTreatdate() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Treatdate = 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 historyTreatmentareaMods) RandomTreatdate(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Treatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTreatmentareaMods) RandomTreatdateNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Treatdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentareaMods) TreatID(val null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.TreatID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) TreatIDFunc(f func() null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.TreatID = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetTreatID() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.TreatID = 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 historyTreatmentareaMods) RandomTreatID(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.TreatID = 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 historyTreatmentareaMods) RandomTreatIDNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.TreatID = 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 historyTreatmentareaMods) Type(val null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Type = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) TypeFunc(f func() null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetType() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - 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 historyTreatmentareaMods) RandomType(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - 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 historyTreatmentareaMods) RandomTypeNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Type = 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 historyTreatmentareaMods) Created(val null.Val[time.Time]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) CreatedFunc(f func() null.Val[time.Time]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetCreated() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Created = 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 historyTreatmentareaMods) RandomCreated(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyTreatmentareaMods) RandomCreatedNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentareaMods) CreatedDate(val null.Val[int64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) CreatedDateFunc(f func() null.Val[int64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetCreatedDate() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.CreatedDate = 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 historyTreatmentareaMods) RandomCreatedDate(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTreatmentareaMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentareaMods) CreatedUser(val null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) CreatedUserFunc(f func() null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetCreatedUser() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.CreatedUser = 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 historyTreatmentareaMods) RandomCreatedUser(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.CreatedUser = 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 historyTreatmentareaMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.CreatedUser = 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 historyTreatmentareaMods) GeometryX(val null.Val[float64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) GeometryXFunc(f func() null.Val[float64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetGeometryX() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.GeometryX = 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 historyTreatmentareaMods) RandomGeometryX(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - 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 historyTreatmentareaMods) RandomGeometryXNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.GeometryX = 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 historyTreatmentareaMods) GeometryY(val null.Val[float64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) GeometryYFunc(f func() null.Val[float64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetGeometryY() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.GeometryY = 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 historyTreatmentareaMods) RandomGeometryY(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - 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 historyTreatmentareaMods) RandomGeometryYNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.GeometryY = 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 historyTreatmentareaMods) LastEditedDate(val null.Val[int64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetLastEditedDate() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.LastEditedDate = 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 historyTreatmentareaMods) RandomLastEditedDate(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyTreatmentareaMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyTreatmentareaMods) LastEditedUser(val null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) LastEditedUserFunc(f func() null.Val[string]) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetLastEditedUser() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.LastEditedUser = 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 historyTreatmentareaMods) RandomLastEditedUser(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.LastEditedUser = 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 historyTreatmentareaMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.LastEditedUser = 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 historyTreatmentareaMods) Version(val int32) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyTreatmentareaMods) VersionFunc(f func() int32) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyTreatmentareaMods) UnsetVersion() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyTreatmentareaMods) RandomVersion(f *faker.Faker) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(_ context.Context, o *HistoryTreatmentareaTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyTreatmentareaMods) WithParentsCascading() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(ctx context.Context, o *HistoryTreatmentareaTemplate) { - if isDone, _ := historyTreatmentareaWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyTreatmentareaWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyTreatmentareaMods) WithOrganization(rel *OrganizationTemplate) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(ctx context.Context, o *HistoryTreatmentareaTemplate) { - o.r.Organization = &historyTreatmentareaROrganizationR{ - o: rel, - } - }) -} - -func (m historyTreatmentareaMods) WithNewOrganization(mods ...OrganizationMod) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(ctx context.Context, o *HistoryTreatmentareaTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyTreatmentareaMods) WithExistingOrganization(em *models.Organization) HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(ctx context.Context, o *HistoryTreatmentareaTemplate) { - o.r.Organization = &historyTreatmentareaROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyTreatmentareaMods) WithoutOrganization() HistoryTreatmentareaMod { - return HistoryTreatmentareaModFunc(func(ctx context.Context, o *HistoryTreatmentareaTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_zones.bob.go b/db/factory/history_zones.bob.go deleted file mode 100644 index ede15e6d..00000000 --- a/db/factory/history_zones.bob.go +++ /dev/null @@ -1,1408 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryZoneMod interface { - Apply(context.Context, *HistoryZoneTemplate) -} - -type HistoryZoneModFunc func(context.Context, *HistoryZoneTemplate) - -func (f HistoryZoneModFunc) Apply(ctx context.Context, n *HistoryZoneTemplate) { - f(ctx, n) -} - -type HistoryZoneModSlice []HistoryZoneMod - -func (mods HistoryZoneModSlice) Apply(ctx context.Context, n *HistoryZoneTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryZoneTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryZoneTemplate struct { - OrganizationID func() int32 - Active func() null.Val[int64] - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() null.Val[string] - Name func() null.Val[string] - Objectid func() int32 - ShapeArea func() null.Val[float64] - ShapeLength func() null.Val[float64] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Version func() int32 - - r historyZoneR - f *Factory - - alreadyPersisted bool -} - -type historyZoneR struct { - Organization *historyZoneROrganizationR -} - -type historyZoneROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryZoneTemplate -func (o *HistoryZoneTemplate) Apply(ctx context.Context, mods ...HistoryZoneMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryZone -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryZoneTemplate) setModelRels(o *models.HistoryZone) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryZones = append(rel.R.HistoryZones, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryZoneSetter -// this does nothing with the relationship templates -func (o HistoryZoneTemplate) BuildSetter() *models.HistoryZoneSetter { - m := &models.HistoryZoneSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.ShapeArea != nil { - val := o.ShapeArea() - m.ShapeArea = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - val := o.ShapeLength() - m.ShapeLength = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryZoneSetter -// this does nothing with the relationship templates -func (o HistoryZoneTemplate) BuildManySetter(number int) []*models.HistoryZoneSetter { - m := make([]*models.HistoryZoneSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryZone -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryZoneTemplate.Create -func (o HistoryZoneTemplate) Build() *models.HistoryZone { - m := &models.HistoryZone{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.ShapeArea != nil { - m.ShapeArea = o.ShapeArea() - } - if o.ShapeLength != nil { - m.ShapeLength = o.ShapeLength() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryZoneSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryZoneTemplate.CreateMany -func (o HistoryZoneTemplate) BuildMany(number int) models.HistoryZoneSlice { - m := make(models.HistoryZoneSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryZone(m *models.HistoryZoneSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryZone -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryZoneTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryZone) error { - var err error - - return err -} - -// Create builds a historyZone and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryZoneTemplate) Create(ctx context.Context, exec bob.Executor) (*models.HistoryZone, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryZone(opt) - - if o.r.Organization == nil { - HistoryZoneMods.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.HistoryZones.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 historyZone and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryZoneTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryZone { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyZone 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 *HistoryZoneTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryZone { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyZones and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryZoneTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryZoneSlice, error) { - var err error - m := make(models.HistoryZoneSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyZones and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryZoneTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryZoneSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyZones 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 HistoryZoneTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryZoneSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryZone has methods that act as mods for the HistoryZoneTemplate -var HistoryZoneMods historyZoneMods - -type historyZoneMods struct{} - -func (m historyZoneMods) RandomizeAllColumns(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModSlice{ - HistoryZoneMods.RandomOrganizationID(f), - HistoryZoneMods.RandomActive(f), - HistoryZoneMods.RandomCreationdate(f), - HistoryZoneMods.RandomCreator(f), - HistoryZoneMods.RandomEditdate(f), - HistoryZoneMods.RandomEditor(f), - HistoryZoneMods.RandomGlobalid(f), - HistoryZoneMods.RandomName(f), - HistoryZoneMods.RandomObjectid(f), - HistoryZoneMods.RandomShapeArea(f), - HistoryZoneMods.RandomShapeLength(f), - HistoryZoneMods.RandomCreated(f), - HistoryZoneMods.RandomCreatedDate(f), - HistoryZoneMods.RandomCreatedUser(f), - HistoryZoneMods.RandomGeometryX(f), - HistoryZoneMods.RandomGeometryY(f), - HistoryZoneMods.RandomLastEditedDate(f), - HistoryZoneMods.RandomLastEditedUser(f), - HistoryZoneMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyZoneMods) OrganizationID(val int32) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) OrganizationIDFunc(f func() int32) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetOrganizationID() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - 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 historyZoneMods) RandomOrganizationID(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyZoneMods) Active(val null.Val[int64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Active = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) ActiveFunc(f func() null.Val[int64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetActive() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Active = 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 historyZoneMods) RandomActive(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Active = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyZoneMods) RandomActiveNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Active = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyZoneMods) Creationdate(val null.Val[int64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) CreationdateFunc(f func() null.Val[int64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetCreationdate() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Creationdate = 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 historyZoneMods) RandomCreationdate(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyZoneMods) RandomCreationdateNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyZoneMods) Creator(val null.Val[string]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) CreatorFunc(f func() null.Val[string]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetCreator() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Creator = 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 historyZoneMods) RandomCreator(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Creator = 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 historyZoneMods) RandomCreatorNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Creator = 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 historyZoneMods) Editdate(val null.Val[int64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) EditdateFunc(f func() null.Val[int64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetEditdate() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Editdate = 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 historyZoneMods) RandomEditdate(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyZoneMods) RandomEditdateNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyZoneMods) Editor(val null.Val[string]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) EditorFunc(f func() null.Val[string]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetEditor() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Editor = 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 historyZoneMods) RandomEditor(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Editor = 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 historyZoneMods) RandomEditorNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Editor = 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 historyZoneMods) Globalid(val null.Val[string]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) GlobalidFunc(f func() null.Val[string]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetGlobalid() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Globalid = 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 historyZoneMods) RandomGlobalid(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - 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 historyZoneMods) RandomGlobalidNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Globalid = 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 historyZoneMods) Name(val null.Val[string]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) NameFunc(f func() null.Val[string]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetName() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Name = 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 historyZoneMods) RandomName(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Name = 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 historyZoneMods) RandomNameNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Name = 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 historyZoneMods) Objectid(val int32) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) ObjectidFunc(f func() int32) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetObjectid() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyZoneMods) RandomObjectid(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyZoneMods) ShapeArea(val null.Val[float64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.ShapeArea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) ShapeAreaFunc(f func() null.Val[float64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.ShapeArea = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetShapeArea() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.ShapeArea = 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 historyZoneMods) RandomShapeArea(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.ShapeArea = 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 historyZoneMods) RandomShapeAreaNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.ShapeArea = 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 historyZoneMods) ShapeLength(val null.Val[float64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) ShapeLengthFunc(f func() null.Val[float64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetShapeLength() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.ShapeLength = 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 historyZoneMods) RandomShapeLength(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.ShapeLength = 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 historyZoneMods) RandomShapeLengthNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.ShapeLength = 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 historyZoneMods) Created(val null.Val[time.Time]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) CreatedFunc(f func() null.Val[time.Time]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetCreated() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Created = 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 historyZoneMods) RandomCreated(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyZoneMods) RandomCreatedNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyZoneMods) CreatedDate(val null.Val[int64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) CreatedDateFunc(f func() null.Val[int64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetCreatedDate() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.CreatedDate = 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 historyZoneMods) RandomCreatedDate(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyZoneMods) RandomCreatedDateNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyZoneMods) CreatedUser(val null.Val[string]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) CreatedUserFunc(f func() null.Val[string]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetCreatedUser() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.CreatedUser = 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 historyZoneMods) RandomCreatedUser(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.CreatedUser = 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 historyZoneMods) RandomCreatedUserNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.CreatedUser = 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 historyZoneMods) GeometryX(val null.Val[float64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) GeometryXFunc(f func() null.Val[float64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetGeometryX() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.GeometryX = 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 historyZoneMods) RandomGeometryX(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - 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 historyZoneMods) RandomGeometryXNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.GeometryX = 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 historyZoneMods) GeometryY(val null.Val[float64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) GeometryYFunc(f func() null.Val[float64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetGeometryY() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.GeometryY = 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 historyZoneMods) RandomGeometryY(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - 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 historyZoneMods) RandomGeometryYNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.GeometryY = 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 historyZoneMods) LastEditedDate(val null.Val[int64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) LastEditedDateFunc(f func() null.Val[int64]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetLastEditedDate() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.LastEditedDate = 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 historyZoneMods) RandomLastEditedDate(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyZoneMods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyZoneMods) LastEditedUser(val null.Val[string]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) LastEditedUserFunc(f func() null.Val[string]) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetLastEditedUser() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.LastEditedUser = 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 historyZoneMods) RandomLastEditedUser(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.LastEditedUser = 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 historyZoneMods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.LastEditedUser = 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 historyZoneMods) Version(val int32) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyZoneMods) VersionFunc(f func() int32) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyZoneMods) UnsetVersion() HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyZoneMods) RandomVersion(f *faker.Faker) HistoryZoneMod { - return HistoryZoneModFunc(func(_ context.Context, o *HistoryZoneTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyZoneMods) WithParentsCascading() HistoryZoneMod { - return HistoryZoneModFunc(func(ctx context.Context, o *HistoryZoneTemplate) { - if isDone, _ := historyZoneWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyZoneWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyZoneMods) WithOrganization(rel *OrganizationTemplate) HistoryZoneMod { - return HistoryZoneModFunc(func(ctx context.Context, o *HistoryZoneTemplate) { - o.r.Organization = &historyZoneROrganizationR{ - o: rel, - } - }) -} - -func (m historyZoneMods) WithNewOrganization(mods ...OrganizationMod) HistoryZoneMod { - return HistoryZoneModFunc(func(ctx context.Context, o *HistoryZoneTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyZoneMods) WithExistingOrganization(em *models.Organization) HistoryZoneMod { - return HistoryZoneModFunc(func(ctx context.Context, o *HistoryZoneTemplate) { - o.r.Organization = &historyZoneROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyZoneMods) WithoutOrganization() HistoryZoneMod { - return HistoryZoneModFunc(func(ctx context.Context, o *HistoryZoneTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/history_zones2.bob.go b/db/factory/history_zones2.bob.go deleted file mode 100644 index 6a670c49..00000000 --- a/db/factory/history_zones2.bob.go +++ /dev/null @@ -1,1346 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - "time" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" - "github.com/jaswdr/faker/v2" - "github.com/stephenafamo/bob" -) - -type HistoryZones2Mod interface { - Apply(context.Context, *HistoryZones2Template) -} - -type HistoryZones2ModFunc func(context.Context, *HistoryZones2Template) - -func (f HistoryZones2ModFunc) Apply(ctx context.Context, n *HistoryZones2Template) { - f(ctx, n) -} - -type HistoryZones2ModSlice []HistoryZones2Mod - -func (mods HistoryZones2ModSlice) Apply(ctx context.Context, n *HistoryZones2Template) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// HistoryZones2Template is an object representing the database table. -// all columns are optional and should be set by mods -type HistoryZones2Template struct { - OrganizationID func() int32 - Creationdate func() null.Val[int64] - Creator func() null.Val[string] - Editdate func() null.Val[int64] - Editor func() null.Val[string] - Globalid func() null.Val[string] - Name func() null.Val[string] - Objectid func() int32 - ShapeArea func() null.Val[float64] - ShapeLength func() null.Val[float64] - Created func() null.Val[time.Time] - CreatedDate func() null.Val[int64] - CreatedUser func() null.Val[string] - GeometryX func() null.Val[float64] - GeometryY func() null.Val[float64] - LastEditedDate func() null.Val[int64] - LastEditedUser func() null.Val[string] - Version func() int32 - - r historyZones2R - f *Factory - - alreadyPersisted bool -} - -type historyZones2R struct { - Organization *historyZones2ROrganizationR -} - -type historyZones2ROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the HistoryZones2Template -func (o *HistoryZones2Template) Apply(ctx context.Context, mods ...HistoryZones2Mod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.HistoryZones2 -// according to the relationships in the template. Nothing is inserted into the db -func (t HistoryZones2Template) setModelRels(o *models.HistoryZones2) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.HistoryZones2s = append(rel.R.HistoryZones2s, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.HistoryZones2Setter -// this does nothing with the relationship templates -func (o HistoryZones2Template) BuildSetter() *models.HistoryZones2Setter { - m := &models.HistoryZones2Setter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Creationdate != nil { - val := o.Creationdate() - m.Creationdate = omitnull.FromNull(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omitnull.FromNull(val) - } - if o.Editdate != nil { - val := o.Editdate() - m.Editdate = omitnull.FromNull(val) - } - if o.Editor != nil { - val := o.Editor() - m.Editor = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omitnull.FromNull(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.ShapeArea != nil { - val := o.ShapeArea() - m.ShapeArea = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - val := o.ShapeLength() - m.ShapeLength = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.GeometryX != nil { - val := o.GeometryX() - m.GeometryX = omitnull.FromNull(val) - } - if o.GeometryY != nil { - val := o.GeometryY() - m.GeometryY = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.HistoryZones2Setter -// this does nothing with the relationship templates -func (o HistoryZones2Template) BuildManySetter(number int) []*models.HistoryZones2Setter { - m := make([]*models.HistoryZones2Setter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.HistoryZones2 -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryZones2Template.Create -func (o HistoryZones2Template) Build() *models.HistoryZones2 { - m := &models.HistoryZones2{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Creationdate != nil { - m.Creationdate = o.Creationdate() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.Editdate != nil { - m.Editdate = o.Editdate() - } - if o.Editor != nil { - m.Editor = o.Editor() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.ShapeArea != nil { - m.ShapeArea = o.ShapeArea() - } - if o.ShapeLength != nil { - m.ShapeLength = o.ShapeLength() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.GeometryX != nil { - m.GeometryX = o.GeometryX() - } - if o.GeometryY != nil { - m.GeometryY = o.GeometryY() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.HistoryZones2Slice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use HistoryZones2Template.CreateMany -func (o HistoryZones2Template) BuildMany(number int) models.HistoryZones2Slice { - m := make(models.HistoryZones2Slice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableHistoryZones2(m *models.HistoryZones2Setter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Objectid.IsValue()) { - val := random_int32(nil) - m.Objectid = omit.From(val) - } - if !(m.Version.IsValue()) { - val := random_int32(nil) - m.Version = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.HistoryZones2 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *HistoryZones2Template) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryZones2) error { - var err error - - return err -} - -// Create builds a historyZones2 and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *HistoryZones2Template) Create(ctx context.Context, exec bob.Executor) (*models.HistoryZones2, error) { - var err error - opt := o.BuildSetter() - ensureCreatableHistoryZones2(opt) - - if o.r.Organization == nil { - HistoryZones2Mods.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.HistoryZones2s.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 historyZones2 and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *HistoryZones2Template) MustCreate(ctx context.Context, exec bob.Executor) *models.HistoryZones2 { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a historyZones2 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 *HistoryZones2Template) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.HistoryZones2 { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple historyZones2s and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o HistoryZones2Template) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.HistoryZones2Slice, error) { - var err error - m := make(models.HistoryZones2Slice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple historyZones2s and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o HistoryZones2Template) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.HistoryZones2Slice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple historyZones2s 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 HistoryZones2Template) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.HistoryZones2Slice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// HistoryZones2 has methods that act as mods for the HistoryZones2Template -var HistoryZones2Mods historyZones2Mods - -type historyZones2Mods struct{} - -func (m historyZones2Mods) RandomizeAllColumns(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModSlice{ - HistoryZones2Mods.RandomOrganizationID(f), - HistoryZones2Mods.RandomCreationdate(f), - HistoryZones2Mods.RandomCreator(f), - HistoryZones2Mods.RandomEditdate(f), - HistoryZones2Mods.RandomEditor(f), - HistoryZones2Mods.RandomGlobalid(f), - HistoryZones2Mods.RandomName(f), - HistoryZones2Mods.RandomObjectid(f), - HistoryZones2Mods.RandomShapeArea(f), - HistoryZones2Mods.RandomShapeLength(f), - HistoryZones2Mods.RandomCreated(f), - HistoryZones2Mods.RandomCreatedDate(f), - HistoryZones2Mods.RandomCreatedUser(f), - HistoryZones2Mods.RandomGeometryX(f), - HistoryZones2Mods.RandomGeometryY(f), - HistoryZones2Mods.RandomLastEditedDate(f), - HistoryZones2Mods.RandomLastEditedUser(f), - HistoryZones2Mods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m historyZones2Mods) OrganizationID(val int32) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) OrganizationIDFunc(f func() int32) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetOrganizationID() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - 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 historyZones2Mods) RandomOrganizationID(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyZones2Mods) Creationdate(val null.Val[int64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Creationdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) CreationdateFunc(f func() null.Val[int64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetCreationdate() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Creationdate = 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 historyZones2Mods) RandomCreationdate(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyZones2Mods) RandomCreationdateNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Creationdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyZones2Mods) Creator(val null.Val[string]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) CreatorFunc(f func() null.Val[string]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetCreator() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Creator = 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 historyZones2Mods) RandomCreator(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Creator = 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 historyZones2Mods) RandomCreatorNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Creator = 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 historyZones2Mods) Editdate(val null.Val[int64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Editdate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) EditdateFunc(f func() null.Val[int64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetEditdate() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Editdate = 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 historyZones2Mods) RandomEditdate(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyZones2Mods) RandomEditdateNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Editdate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyZones2Mods) Editor(val null.Val[string]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) EditorFunc(f func() null.Val[string]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetEditor() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Editor = 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 historyZones2Mods) RandomEditor(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Editor = 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 historyZones2Mods) RandomEditorNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Editor = 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 historyZones2Mods) Globalid(val null.Val[string]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Globalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) GlobalidFunc(f func() null.Val[string]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetGlobalid() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Globalid = 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 historyZones2Mods) RandomGlobalid(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - 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 historyZones2Mods) RandomGlobalidNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Globalid = 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 historyZones2Mods) Name(val null.Val[string]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) NameFunc(f func() null.Val[string]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Name = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetName() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Name = 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 historyZones2Mods) RandomName(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Name = 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 historyZones2Mods) RandomNameNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Name = 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 historyZones2Mods) Objectid(val int32) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Objectid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) ObjectidFunc(f func() int32) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetObjectid() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Objectid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyZones2Mods) RandomObjectid(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Objectid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m historyZones2Mods) ShapeArea(val null.Val[float64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.ShapeArea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) ShapeAreaFunc(f func() null.Val[float64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.ShapeArea = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetShapeArea() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.ShapeArea = 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 historyZones2Mods) RandomShapeArea(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.ShapeArea = 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 historyZones2Mods) RandomShapeAreaNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.ShapeArea = 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 historyZones2Mods) ShapeLength(val null.Val[float64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) ShapeLengthFunc(f func() null.Val[float64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetShapeLength() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.ShapeLength = 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 historyZones2Mods) RandomShapeLength(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.ShapeLength = 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 historyZones2Mods) RandomShapeLengthNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.ShapeLength = 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 historyZones2Mods) Created(val null.Val[time.Time]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) CreatedFunc(f func() null.Val[time.Time]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Created = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetCreated() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Created = 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 historyZones2Mods) RandomCreated(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(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 historyZones2Mods) RandomCreatedNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Created = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyZones2Mods) CreatedDate(val null.Val[int64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.CreatedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) CreatedDateFunc(f func() null.Val[int64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetCreatedDate() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.CreatedDate = 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 historyZones2Mods) RandomCreatedDate(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyZones2Mods) RandomCreatedDateNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.CreatedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyZones2Mods) CreatedUser(val null.Val[string]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) CreatedUserFunc(f func() null.Val[string]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetCreatedUser() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.CreatedUser = 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 historyZones2Mods) RandomCreatedUser(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.CreatedUser = 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 historyZones2Mods) RandomCreatedUserNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.CreatedUser = 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 historyZones2Mods) GeometryX(val null.Val[float64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.GeometryX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) GeometryXFunc(f func() null.Val[float64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.GeometryX = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetGeometryX() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.GeometryX = 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 historyZones2Mods) RandomGeometryX(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - 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 historyZones2Mods) RandomGeometryXNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.GeometryX = 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 historyZones2Mods) GeometryY(val null.Val[float64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.GeometryY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) GeometryYFunc(f func() null.Val[float64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.GeometryY = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetGeometryY() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.GeometryY = 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 historyZones2Mods) RandomGeometryY(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - 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 historyZones2Mods) RandomGeometryYNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.GeometryY = 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 historyZones2Mods) LastEditedDate(val null.Val[int64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.LastEditedDate = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) LastEditedDateFunc(f func() null.Val[int64]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetLastEditedDate() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.LastEditedDate = 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 historyZones2Mods) RandomLastEditedDate(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(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 historyZones2Mods) RandomLastEditedDateNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.LastEditedDate = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m historyZones2Mods) LastEditedUser(val null.Val[string]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) LastEditedUserFunc(f func() null.Val[string]) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetLastEditedUser() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.LastEditedUser = 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 historyZones2Mods) RandomLastEditedUser(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.LastEditedUser = 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 historyZones2Mods) RandomLastEditedUserNotNull(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.LastEditedUser = 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 historyZones2Mods) Version(val int32) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m historyZones2Mods) VersionFunc(f func() int32) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Version = f - }) -} - -// Clear any values for the column -func (m historyZones2Mods) UnsetVersion() HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Version = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m historyZones2Mods) RandomVersion(f *faker.Faker) HistoryZones2Mod { - return HistoryZones2ModFunc(func(_ context.Context, o *HistoryZones2Template) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m historyZones2Mods) WithParentsCascading() HistoryZones2Mod { - return HistoryZones2ModFunc(func(ctx context.Context, o *HistoryZones2Template) { - if isDone, _ := historyZones2WithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = historyZones2WithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m historyZones2Mods) WithOrganization(rel *OrganizationTemplate) HistoryZones2Mod { - return HistoryZones2ModFunc(func(ctx context.Context, o *HistoryZones2Template) { - o.r.Organization = &historyZones2ROrganizationR{ - o: rel, - } - }) -} - -func (m historyZones2Mods) WithNewOrganization(mods ...OrganizationMod) HistoryZones2Mod { - return HistoryZones2ModFunc(func(ctx context.Context, o *HistoryZones2Template) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m historyZones2Mods) WithExistingOrganization(em *models.Organization) HistoryZones2Mod { - return HistoryZones2ModFunc(func(ctx context.Context, o *HistoryZones2Template) { - o.r.Organization = &historyZones2ROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m historyZones2Mods) WithoutOrganization() HistoryZones2Mod { - return HistoryZones2ModFunc(func(ctx context.Context, o *HistoryZones2Template) { - o.r.Organization = nil - }) -} diff --git a/db/factory/note_audio.bob.go b/db/factory/note_audio.bob.go new file mode 100644 index 00000000..a9470ebf --- /dev/null +++ b/db/factory/note_audio.bob.go @@ -0,0 +1,1082 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package factory + +import ( + "context" + "testing" + "time" + + models "github.com/Gleipnir-Technology/nidus-sync/db/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/google/uuid" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type NoteAudioMod interface { + Apply(context.Context, *NoteAudioTemplate) +} + +type NoteAudioModFunc func(context.Context, *NoteAudioTemplate) + +func (f NoteAudioModFunc) Apply(ctx context.Context, n *NoteAudioTemplate) { + f(ctx, n) +} + +type NoteAudioModSlice []NoteAudioMod + +func (mods NoteAudioModSlice) Apply(ctx context.Context, n *NoteAudioTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// NoteAudioTemplate is an object representing the database table. +// all columns are optional and should be set by mods +type NoteAudioTemplate struct { + Created func() time.Time + CreatorID func() int32 + Deleted func() null.Val[time.Time] + DeletorID func() null.Val[int32] + Duration func() float32 + OrganizationID func() int32 + Transcription func() null.Val[string] + TranscriptionUserEdited func() bool + Version func() int32 + UUID func() uuid.UUID + + r noteAudioR + f *Factory + + alreadyPersisted bool +} + +type noteAudioR struct { + CreatorUser *noteAudioRCreatorUserR + DeletorUser *noteAudioRDeletorUserR + Organization *noteAudioROrganizationR + NoteAudioBreadcrumbs []*noteAudioRNoteAudioBreadcrumbsR + NoteAudioData []*noteAudioRNoteAudioDataR +} + +type noteAudioRCreatorUserR struct { + o *UserTemplate +} +type noteAudioRDeletorUserR struct { + o *UserTemplate +} +type noteAudioROrganizationR struct { + o *OrganizationTemplate +} +type noteAudioRNoteAudioBreadcrumbsR struct { + number int + o *NoteAudioBreadcrumbTemplate +} +type noteAudioRNoteAudioDataR struct { + number int + o *NoteAudioDatumTemplate +} + +// Apply mods to the NoteAudioTemplate +func (o *NoteAudioTemplate) Apply(ctx context.Context, mods ...NoteAudioMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.NoteAudio +// according to the relationships in the template. Nothing is inserted into the db +func (t NoteAudioTemplate) setModelRels(o *models.NoteAudio) { + if t.r.CreatorUser != nil { + rel := t.r.CreatorUser.o.Build() + rel.R.CreatorNoteAudios = append(rel.R.CreatorNoteAudios, o) + o.CreatorID = rel.ID // h2 + o.R.CreatorUser = rel + } + + if t.r.DeletorUser != nil { + rel := t.r.DeletorUser.o.Build() + rel.R.DeletorNoteAudios = append(rel.R.DeletorNoteAudios, o) + o.DeletorID = null.From(rel.ID) // h2 + o.R.DeletorUser = rel + } + + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.NoteAudios = append(rel.R.NoteAudios, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } + + if t.r.NoteAudioBreadcrumbs != nil { + rel := models.NoteAudioBreadcrumbSlice{} + for _, r := range t.r.NoteAudioBreadcrumbs { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.NoteAudioVersion = o.Version // h2 + rel.NoteAudioUUID = o.UUID // h2 + rel.R.NoteAudio = o + } + rel = append(rel, related...) + } + o.R.NoteAudioBreadcrumbs = rel + } + + if t.r.NoteAudioData != nil { + rel := models.NoteAudioDatumSlice{} + for _, r := range t.r.NoteAudioData { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.NoteAudioVersion = o.Version // h2 + rel.NoteAudioUUID = o.UUID // h2 + rel.R.NoteAudio = o + } + rel = append(rel, related...) + } + o.R.NoteAudioData = rel + } +} + +// BuildSetter returns an *models.NoteAudioSetter +// this does nothing with the relationship templates +func (o NoteAudioTemplate) BuildSetter() *models.NoteAudioSetter { + m := &models.NoteAudioSetter{} + + if o.Created != nil { + val := o.Created() + m.Created = omit.From(val) + } + if o.CreatorID != nil { + val := o.CreatorID() + m.CreatorID = omit.From(val) + } + if o.Deleted != nil { + val := o.Deleted() + m.Deleted = omitnull.FromNull(val) + } + if o.DeletorID != nil { + val := o.DeletorID() + m.DeletorID = omitnull.FromNull(val) + } + if o.Duration != nil { + val := o.Duration() + m.Duration = omit.From(val) + } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } + if o.Transcription != nil { + val := o.Transcription() + m.Transcription = omitnull.FromNull(val) + } + if o.TranscriptionUserEdited != nil { + val := o.TranscriptionUserEdited() + m.TranscriptionUserEdited = omit.From(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + if o.UUID != nil { + val := o.UUID() + m.UUID = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.NoteAudioSetter +// this does nothing with the relationship templates +func (o NoteAudioTemplate) BuildManySetter(number int) []*models.NoteAudioSetter { + m := make([]*models.NoteAudioSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.NoteAudio +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use NoteAudioTemplate.Create +func (o NoteAudioTemplate) Build() *models.NoteAudio { + m := &models.NoteAudio{} + + if o.Created != nil { + m.Created = o.Created() + } + if o.CreatorID != nil { + m.CreatorID = o.CreatorID() + } + if o.Deleted != nil { + m.Deleted = o.Deleted() + } + if o.DeletorID != nil { + m.DeletorID = o.DeletorID() + } + if o.Duration != nil { + m.Duration = o.Duration() + } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Transcription != nil { + m.Transcription = o.Transcription() + } + if o.TranscriptionUserEdited != nil { + m.TranscriptionUserEdited = o.TranscriptionUserEdited() + } + if o.Version != nil { + m.Version = o.Version() + } + if o.UUID != nil { + m.UUID = o.UUID() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.NoteAudioSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use NoteAudioTemplate.CreateMany +func (o NoteAudioTemplate) BuildMany(number int) models.NoteAudioSlice { + m := make(models.NoteAudioSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableNoteAudio(m *models.NoteAudioSetter) { + if !(m.Created.IsValue()) { + val := random_time_Time(nil) + m.Created = omit.From(val) + } + if !(m.CreatorID.IsValue()) { + val := random_int32(nil) + m.CreatorID = omit.From(val) + } + if !(m.Duration.IsValue()) { + val := random_float32(nil) + m.Duration = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } + if !(m.TranscriptionUserEdited.IsValue()) { + val := random_bool(nil) + m.TranscriptionUserEdited = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } + if !(m.UUID.IsValue()) { + val := random_uuid_UUID(nil) + m.UUID = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.NoteAudio +// according to the relationships in the template. +// any required relationship should have already exist on the model +func (o *NoteAudioTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.NoteAudio) error { + var err error + + isDeletorUserDone, _ := noteAudioRelDeletorUserCtx.Value(ctx) + if !isDeletorUserDone && o.r.DeletorUser != nil { + ctx = noteAudioRelDeletorUserCtx.WithValue(ctx, true) + if o.r.DeletorUser.o.alreadyPersisted { + m.R.DeletorUser = o.r.DeletorUser.o.Build() + } else { + var rel1 *models.User + rel1, err = o.r.DeletorUser.o.Create(ctx, exec) + if err != nil { + return err + } + err = m.AttachDeletorUser(ctx, exec, rel1) + if err != nil { + return err + } + } + + } + + isNoteAudioBreadcrumbsDone, _ := noteAudioRelNoteAudioBreadcrumbsCtx.Value(ctx) + if !isNoteAudioBreadcrumbsDone && o.r.NoteAudioBreadcrumbs != nil { + ctx = noteAudioRelNoteAudioBreadcrumbsCtx.WithValue(ctx, true) + for _, r := range o.r.NoteAudioBreadcrumbs { + if r.o.alreadyPersisted { + m.R.NoteAudioBreadcrumbs = append(m.R.NoteAudioBreadcrumbs, r.o.Build()) + } else { + rel3, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachNoteAudioBreadcrumbs(ctx, exec, rel3...) + if err != nil { + return err + } + } + } + } + + isNoteAudioDataDone, _ := noteAudioRelNoteAudioDataCtx.Value(ctx) + if !isNoteAudioDataDone && o.r.NoteAudioData != nil { + ctx = noteAudioRelNoteAudioDataCtx.WithValue(ctx, true) + for _, r := range o.r.NoteAudioData { + if r.o.alreadyPersisted { + m.R.NoteAudioData = append(m.R.NoteAudioData, r.o.Build()) + } else { + rel4, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachNoteAudioData(ctx, exec, rel4...) + if err != nil { + return err + } + } + } + } + + return err +} + +// Create builds a noteAudio and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *NoteAudioTemplate) Create(ctx context.Context, exec bob.Executor) (*models.NoteAudio, error) { + var err error + opt := o.BuildSetter() + ensureCreatableNoteAudio(opt) + + if o.r.CreatorUser == nil { + NoteAudioMods.WithNewCreatorUser().Apply(ctx, o) + } + + var rel0 *models.User + + if o.r.CreatorUser.o.alreadyPersisted { + rel0 = o.r.CreatorUser.o.Build() + } else { + rel0, err = o.r.CreatorUser.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.CreatorID = omit.From(rel0.ID) + + if o.r.Organization == nil { + NoteAudioMods.WithNewOrganization().Apply(ctx, o) + } + + var rel2 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel2 = o.r.Organization.o.Build() + } else { + rel2, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel2.ID) + + m, err := models.NoteAudios.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + m.R.CreatorUser = rel0 + m.R.Organization = rel2 + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a noteAudio and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *NoteAudioTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.NoteAudio { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a noteAudio 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 *NoteAudioTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.NoteAudio { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple noteAudios and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o NoteAudioTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.NoteAudioSlice, error) { + var err error + m := make(models.NoteAudioSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple noteAudios and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o NoteAudioTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.NoteAudioSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple noteAudios 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 NoteAudioTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.NoteAudioSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// NoteAudio has methods that act as mods for the NoteAudioTemplate +var NoteAudioMods noteAudioMods + +type noteAudioMods struct{} + +func (m noteAudioMods) RandomizeAllColumns(f *faker.Faker) NoteAudioMod { + return NoteAudioModSlice{ + NoteAudioMods.RandomCreated(f), + NoteAudioMods.RandomCreatorID(f), + NoteAudioMods.RandomDeleted(f), + NoteAudioMods.RandomDeletorID(f), + NoteAudioMods.RandomDuration(f), + NoteAudioMods.RandomOrganizationID(f), + NoteAudioMods.RandomTranscription(f), + NoteAudioMods.RandomTranscriptionUserEdited(f), + NoteAudioMods.RandomVersion(f), + NoteAudioMods.RandomUUID(f), + } +} + +// Set the model columns to this value +func (m noteAudioMods) Created(val time.Time) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Created = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m noteAudioMods) CreatedFunc(f func() time.Time) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m noteAudioMods) UnsetCreated() NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteAudioMods) RandomCreated(f *faker.Faker) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Created = func() time.Time { + return random_time_Time(f) + } + }) +} + +// Set the model columns to this value +func (m noteAudioMods) CreatorID(val int32) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.CreatorID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m noteAudioMods) CreatorIDFunc(f func() int32) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.CreatorID = f + }) +} + +// Clear any values for the column +func (m noteAudioMods) UnsetCreatorID() NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.CreatorID = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteAudioMods) RandomCreatorID(f *faker.Faker) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.CreatorID = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m noteAudioMods) Deleted(val null.Val[time.Time]) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Deleted = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m noteAudioMods) DeletedFunc(f func() null.Val[time.Time]) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Deleted = f + }) +} + +// Clear any values for the column +func (m noteAudioMods) UnsetDeleted() NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Deleted = 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 noteAudioMods) RandomDeleted(f *faker.Faker) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Deleted = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(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 noteAudioMods) RandomDeletedNotNull(f *faker.Faker) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Deleted = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m noteAudioMods) DeletorID(val null.Val[int32]) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.DeletorID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m noteAudioMods) DeletorIDFunc(f func() null.Val[int32]) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.DeletorID = f + }) +} + +// Clear any values for the column +func (m noteAudioMods) UnsetDeletorID() NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.DeletorID = 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 noteAudioMods) RandomDeletorID(f *faker.Faker) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.DeletorID = 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 noteAudioMods) RandomDeletorIDNotNull(f *faker.Faker) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.DeletorID = 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 noteAudioMods) Duration(val float32) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Duration = func() float32 { return val } + }) +} + +// Set the Column from the function +func (m noteAudioMods) DurationFunc(f func() float32) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Duration = f + }) +} + +// Clear any values for the column +func (m noteAudioMods) UnsetDuration() NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Duration = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteAudioMods) RandomDuration(f *faker.Faker) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Duration = func() float32 { + return random_float32(f) + } + }) +} + +// Set the model columns to this value +func (m noteAudioMods) OrganizationID(val int32) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m noteAudioMods) OrganizationIDFunc(f func() int32) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m noteAudioMods) UnsetOrganizationID() NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + 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 noteAudioMods) RandomOrganizationID(f *faker.Faker) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m noteAudioMods) Transcription(val null.Val[string]) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Transcription = func() null.Val[string] { return val } + }) +} + +// Set the Column from the function +func (m noteAudioMods) TranscriptionFunc(f func() null.Val[string]) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Transcription = f + }) +} + +// Clear any values for the column +func (m noteAudioMods) UnsetTranscription() NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Transcription = 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 noteAudioMods) RandomTranscription(f *faker.Faker) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Transcription = 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 noteAudioMods) RandomTranscriptionNotNull(f *faker.Faker) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Transcription = 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 noteAudioMods) TranscriptionUserEdited(val bool) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.TranscriptionUserEdited = func() bool { return val } + }) +} + +// Set the Column from the function +func (m noteAudioMods) TranscriptionUserEditedFunc(f func() bool) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.TranscriptionUserEdited = f + }) +} + +// Clear any values for the column +func (m noteAudioMods) UnsetTranscriptionUserEdited() NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.TranscriptionUserEdited = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteAudioMods) RandomTranscriptionUserEdited(f *faker.Faker) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.TranscriptionUserEdited = func() bool { + return random_bool(f) + } + }) +} + +// Set the model columns to this value +func (m noteAudioMods) Version(val int32) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m noteAudioMods) VersionFunc(f func() int32) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m noteAudioMods) UnsetVersion() NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteAudioMods) RandomVersion(f *faker.Faker) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m noteAudioMods) UUID(val uuid.UUID) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.UUID = func() uuid.UUID { return val } + }) +} + +// Set the Column from the function +func (m noteAudioMods) UUIDFunc(f func() uuid.UUID) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.UUID = f + }) +} + +// Clear any values for the column +func (m noteAudioMods) UnsetUUID() NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.UUID = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteAudioMods) RandomUUID(f *faker.Faker) NoteAudioMod { + return NoteAudioModFunc(func(_ context.Context, o *NoteAudioTemplate) { + o.UUID = func() uuid.UUID { + return random_uuid_UUID(f) + } + }) +} + +func (m noteAudioMods) WithParentsCascading() NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + if isDone, _ := noteAudioWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = noteAudioWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) + m.WithCreatorUser(related).Apply(ctx, o) + } + { + + related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) + m.WithDeletorUser(related).Apply(ctx, o) + } + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m noteAudioMods) WithCreatorUser(rel *UserTemplate) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + o.r.CreatorUser = ¬eAudioRCreatorUserR{ + o: rel, + } + }) +} + +func (m noteAudioMods) WithNewCreatorUser(mods ...UserMod) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + related := o.f.NewUserWithContext(ctx, mods...) + + m.WithCreatorUser(related).Apply(ctx, o) + }) +} + +func (m noteAudioMods) WithExistingCreatorUser(em *models.User) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + o.r.CreatorUser = ¬eAudioRCreatorUserR{ + o: o.f.FromExistingUser(em), + } + }) +} + +func (m noteAudioMods) WithoutCreatorUser() NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + o.r.CreatorUser = nil + }) +} + +func (m noteAudioMods) WithDeletorUser(rel *UserTemplate) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + o.r.DeletorUser = ¬eAudioRDeletorUserR{ + o: rel, + } + }) +} + +func (m noteAudioMods) WithNewDeletorUser(mods ...UserMod) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + related := o.f.NewUserWithContext(ctx, mods...) + + m.WithDeletorUser(related).Apply(ctx, o) + }) +} + +func (m noteAudioMods) WithExistingDeletorUser(em *models.User) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + o.r.DeletorUser = ¬eAudioRDeletorUserR{ + o: o.f.FromExistingUser(em), + } + }) +} + +func (m noteAudioMods) WithoutDeletorUser() NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + o.r.DeletorUser = nil + }) +} + +func (m noteAudioMods) WithOrganization(rel *OrganizationTemplate) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + o.r.Organization = ¬eAudioROrganizationR{ + o: rel, + } + }) +} + +func (m noteAudioMods) WithNewOrganization(mods ...OrganizationMod) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m noteAudioMods) WithExistingOrganization(em *models.Organization) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + o.r.Organization = ¬eAudioROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m noteAudioMods) WithoutOrganization() NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + o.r.Organization = nil + }) +} + +func (m noteAudioMods) WithNoteAudioBreadcrumbs(number int, related *NoteAudioBreadcrumbTemplate) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + o.r.NoteAudioBreadcrumbs = []*noteAudioRNoteAudioBreadcrumbsR{{ + number: number, + o: related, + }} + }) +} + +func (m noteAudioMods) WithNewNoteAudioBreadcrumbs(number int, mods ...NoteAudioBreadcrumbMod) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + related := o.f.NewNoteAudioBreadcrumbWithContext(ctx, mods...) + m.WithNoteAudioBreadcrumbs(number, related).Apply(ctx, o) + }) +} + +func (m noteAudioMods) AddNoteAudioBreadcrumbs(number int, related *NoteAudioBreadcrumbTemplate) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + o.r.NoteAudioBreadcrumbs = append(o.r.NoteAudioBreadcrumbs, ¬eAudioRNoteAudioBreadcrumbsR{ + number: number, + o: related, + }) + }) +} + +func (m noteAudioMods) AddNewNoteAudioBreadcrumbs(number int, mods ...NoteAudioBreadcrumbMod) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + related := o.f.NewNoteAudioBreadcrumbWithContext(ctx, mods...) + m.AddNoteAudioBreadcrumbs(number, related).Apply(ctx, o) + }) +} + +func (m noteAudioMods) AddExistingNoteAudioBreadcrumbs(existingModels ...*models.NoteAudioBreadcrumb) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + for _, em := range existingModels { + o.r.NoteAudioBreadcrumbs = append(o.r.NoteAudioBreadcrumbs, ¬eAudioRNoteAudioBreadcrumbsR{ + o: o.f.FromExistingNoteAudioBreadcrumb(em), + }) + } + }) +} + +func (m noteAudioMods) WithoutNoteAudioBreadcrumbs() NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + o.r.NoteAudioBreadcrumbs = nil + }) +} + +func (m noteAudioMods) WithNoteAudioData(number int, related *NoteAudioDatumTemplate) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + o.r.NoteAudioData = []*noteAudioRNoteAudioDataR{{ + number: number, + o: related, + }} + }) +} + +func (m noteAudioMods) WithNewNoteAudioData(number int, mods ...NoteAudioDatumMod) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + related := o.f.NewNoteAudioDatumWithContext(ctx, mods...) + m.WithNoteAudioData(number, related).Apply(ctx, o) + }) +} + +func (m noteAudioMods) AddNoteAudioData(number int, related *NoteAudioDatumTemplate) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + o.r.NoteAudioData = append(o.r.NoteAudioData, ¬eAudioRNoteAudioDataR{ + number: number, + o: related, + }) + }) +} + +func (m noteAudioMods) AddNewNoteAudioData(number int, mods ...NoteAudioDatumMod) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + related := o.f.NewNoteAudioDatumWithContext(ctx, mods...) + m.AddNoteAudioData(number, related).Apply(ctx, o) + }) +} + +func (m noteAudioMods) AddExistingNoteAudioData(existingModels ...*models.NoteAudioDatum) NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + for _, em := range existingModels { + o.r.NoteAudioData = append(o.r.NoteAudioData, ¬eAudioRNoteAudioDataR{ + o: o.f.FromExistingNoteAudioDatum(em), + }) + } + }) +} + +func (m noteAudioMods) WithoutNoteAudioData() NoteAudioMod { + return NoteAudioModFunc(func(ctx context.Context, o *NoteAudioTemplate) { + o.r.NoteAudioData = nil + }) +} diff --git a/db/factory/note_audio_breadcrumb.bob.go b/db/factory/note_audio_breadcrumb.bob.go new file mode 100644 index 00000000..0a5ec1b4 --- /dev/null +++ b/db/factory/note_audio_breadcrumb.bob.go @@ -0,0 +1,549 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package factory + +import ( + "context" + "testing" + "time" + + models "github.com/Gleipnir-Technology/nidus-sync/db/models" + "github.com/aarondl/opt/omit" + "github.com/google/uuid" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type NoteAudioBreadcrumbMod interface { + Apply(context.Context, *NoteAudioBreadcrumbTemplate) +} + +type NoteAudioBreadcrumbModFunc func(context.Context, *NoteAudioBreadcrumbTemplate) + +func (f NoteAudioBreadcrumbModFunc) Apply(ctx context.Context, n *NoteAudioBreadcrumbTemplate) { + f(ctx, n) +} + +type NoteAudioBreadcrumbModSlice []NoteAudioBreadcrumbMod + +func (mods NoteAudioBreadcrumbModSlice) Apply(ctx context.Context, n *NoteAudioBreadcrumbTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// NoteAudioBreadcrumbTemplate is an object representing the database table. +// all columns are optional and should be set by mods +type NoteAudioBreadcrumbTemplate struct { + Cell func() string + Created func() time.Time + ManuallySelected func() bool + NoteAudioVersion func() int32 + NoteAudioUUID func() uuid.UUID + Position func() int32 + + r noteAudioBreadcrumbR + f *Factory + + alreadyPersisted bool +} + +type noteAudioBreadcrumbR struct { + NoteAudio *noteAudioBreadcrumbRNoteAudioR +} + +type noteAudioBreadcrumbRNoteAudioR struct { + o *NoteAudioTemplate +} + +// Apply mods to the NoteAudioBreadcrumbTemplate +func (o *NoteAudioBreadcrumbTemplate) Apply(ctx context.Context, mods ...NoteAudioBreadcrumbMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.NoteAudioBreadcrumb +// according to the relationships in the template. Nothing is inserted into the db +func (t NoteAudioBreadcrumbTemplate) setModelRels(o *models.NoteAudioBreadcrumb) { + if t.r.NoteAudio != nil { + rel := t.r.NoteAudio.o.Build() + rel.R.NoteAudioBreadcrumbs = append(rel.R.NoteAudioBreadcrumbs, o) + o.NoteAudioVersion = rel.Version // h2 + o.NoteAudioUUID = rel.UUID // h2 + o.R.NoteAudio = rel + } +} + +// BuildSetter returns an *models.NoteAudioBreadcrumbSetter +// this does nothing with the relationship templates +func (o NoteAudioBreadcrumbTemplate) BuildSetter() *models.NoteAudioBreadcrumbSetter { + m := &models.NoteAudioBreadcrumbSetter{} + + if o.Cell != nil { + val := o.Cell() + m.Cell = omit.From(val) + } + if o.Created != nil { + val := o.Created() + m.Created = omit.From(val) + } + if o.ManuallySelected != nil { + val := o.ManuallySelected() + m.ManuallySelected = omit.From(val) + } + if o.NoteAudioVersion != nil { + val := o.NoteAudioVersion() + m.NoteAudioVersion = omit.From(val) + } + if o.NoteAudioUUID != nil { + val := o.NoteAudioUUID() + m.NoteAudioUUID = omit.From(val) + } + if o.Position != nil { + val := o.Position() + m.Position = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.NoteAudioBreadcrumbSetter +// this does nothing with the relationship templates +func (o NoteAudioBreadcrumbTemplate) BuildManySetter(number int) []*models.NoteAudioBreadcrumbSetter { + m := make([]*models.NoteAudioBreadcrumbSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.NoteAudioBreadcrumb +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use NoteAudioBreadcrumbTemplate.Create +func (o NoteAudioBreadcrumbTemplate) Build() *models.NoteAudioBreadcrumb { + m := &models.NoteAudioBreadcrumb{} + + if o.Cell != nil { + m.Cell = o.Cell() + } + if o.Created != nil { + m.Created = o.Created() + } + if o.ManuallySelected != nil { + m.ManuallySelected = o.ManuallySelected() + } + if o.NoteAudioVersion != nil { + m.NoteAudioVersion = o.NoteAudioVersion() + } + if o.NoteAudioUUID != nil { + m.NoteAudioUUID = o.NoteAudioUUID() + } + if o.Position != nil { + m.Position = o.Position() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.NoteAudioBreadcrumbSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use NoteAudioBreadcrumbTemplate.CreateMany +func (o NoteAudioBreadcrumbTemplate) BuildMany(number int) models.NoteAudioBreadcrumbSlice { + m := make(models.NoteAudioBreadcrumbSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableNoteAudioBreadcrumb(m *models.NoteAudioBreadcrumbSetter) { + if !(m.Cell.IsValue()) { + val := random_string(nil) + m.Cell = omit.From(val) + } + if !(m.Created.IsValue()) { + val := random_time_Time(nil) + m.Created = omit.From(val) + } + if !(m.ManuallySelected.IsValue()) { + val := random_bool(nil) + m.ManuallySelected = omit.From(val) + } + if !(m.NoteAudioVersion.IsValue()) { + val := random_int32(nil) + m.NoteAudioVersion = omit.From(val) + } + if !(m.NoteAudioUUID.IsValue()) { + val := random_uuid_UUID(nil) + m.NoteAudioUUID = omit.From(val) + } + if !(m.Position.IsValue()) { + val := random_int32(nil) + m.Position = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.NoteAudioBreadcrumb +// according to the relationships in the template. +// any required relationship should have already exist on the model +func (o *NoteAudioBreadcrumbTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.NoteAudioBreadcrumb) error { + var err error + + return err +} + +// Create builds a noteAudioBreadcrumb and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *NoteAudioBreadcrumbTemplate) Create(ctx context.Context, exec bob.Executor) (*models.NoteAudioBreadcrumb, error) { + var err error + opt := o.BuildSetter() + ensureCreatableNoteAudioBreadcrumb(opt) + + if o.r.NoteAudio == nil { + NoteAudioBreadcrumbMods.WithNewNoteAudio().Apply(ctx, o) + } + + var rel0 *models.NoteAudio + + if o.r.NoteAudio.o.alreadyPersisted { + rel0 = o.r.NoteAudio.o.Build() + } else { + rel0, err = o.r.NoteAudio.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.NoteAudioVersion = omit.From(rel0.Version) + opt.NoteAudioUUID = omit.From(rel0.UUID) + + m, err := models.NoteAudioBreadcrumbs.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + m.R.NoteAudio = rel0 + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a noteAudioBreadcrumb and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *NoteAudioBreadcrumbTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.NoteAudioBreadcrumb { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a noteAudioBreadcrumb 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 *NoteAudioBreadcrumbTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.NoteAudioBreadcrumb { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple noteAudioBreadcrumbs and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o NoteAudioBreadcrumbTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.NoteAudioBreadcrumbSlice, error) { + var err error + m := make(models.NoteAudioBreadcrumbSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple noteAudioBreadcrumbs and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o NoteAudioBreadcrumbTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.NoteAudioBreadcrumbSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple noteAudioBreadcrumbs 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 NoteAudioBreadcrumbTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.NoteAudioBreadcrumbSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// NoteAudioBreadcrumb has methods that act as mods for the NoteAudioBreadcrumbTemplate +var NoteAudioBreadcrumbMods noteAudioBreadcrumbMods + +type noteAudioBreadcrumbMods struct{} + +func (m noteAudioBreadcrumbMods) RandomizeAllColumns(f *faker.Faker) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModSlice{ + NoteAudioBreadcrumbMods.RandomCell(f), + NoteAudioBreadcrumbMods.RandomCreated(f), + NoteAudioBreadcrumbMods.RandomManuallySelected(f), + NoteAudioBreadcrumbMods.RandomNoteAudioVersion(f), + NoteAudioBreadcrumbMods.RandomNoteAudioUUID(f), + NoteAudioBreadcrumbMods.RandomPosition(f), + } +} + +// Set the model columns to this value +func (m noteAudioBreadcrumbMods) Cell(val string) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.Cell = func() string { return val } + }) +} + +// Set the Column from the function +func (m noteAudioBreadcrumbMods) CellFunc(f func() string) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.Cell = f + }) +} + +// Clear any values for the column +func (m noteAudioBreadcrumbMods) UnsetCell() NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + 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 noteAudioBreadcrumbMods) RandomCell(f *faker.Faker) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.Cell = func() string { + return random_string(f) + } + }) +} + +// Set the model columns to this value +func (m noteAudioBreadcrumbMods) Created(val time.Time) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.Created = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m noteAudioBreadcrumbMods) CreatedFunc(f func() time.Time) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m noteAudioBreadcrumbMods) UnsetCreated() NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteAudioBreadcrumbMods) RandomCreated(f *faker.Faker) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.Created = func() time.Time { + return random_time_Time(f) + } + }) +} + +// Set the model columns to this value +func (m noteAudioBreadcrumbMods) ManuallySelected(val bool) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.ManuallySelected = func() bool { return val } + }) +} + +// Set the Column from the function +func (m noteAudioBreadcrumbMods) ManuallySelectedFunc(f func() bool) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.ManuallySelected = f + }) +} + +// Clear any values for the column +func (m noteAudioBreadcrumbMods) UnsetManuallySelected() NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.ManuallySelected = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteAudioBreadcrumbMods) RandomManuallySelected(f *faker.Faker) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.ManuallySelected = func() bool { + return random_bool(f) + } + }) +} + +// Set the model columns to this value +func (m noteAudioBreadcrumbMods) NoteAudioVersion(val int32) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.NoteAudioVersion = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m noteAudioBreadcrumbMods) NoteAudioVersionFunc(f func() int32) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.NoteAudioVersion = f + }) +} + +// Clear any values for the column +func (m noteAudioBreadcrumbMods) UnsetNoteAudioVersion() NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.NoteAudioVersion = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteAudioBreadcrumbMods) RandomNoteAudioVersion(f *faker.Faker) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.NoteAudioVersion = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m noteAudioBreadcrumbMods) NoteAudioUUID(val uuid.UUID) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.NoteAudioUUID = func() uuid.UUID { return val } + }) +} + +// Set the Column from the function +func (m noteAudioBreadcrumbMods) NoteAudioUUIDFunc(f func() uuid.UUID) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.NoteAudioUUID = f + }) +} + +// Clear any values for the column +func (m noteAudioBreadcrumbMods) UnsetNoteAudioUUID() NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.NoteAudioUUID = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteAudioBreadcrumbMods) RandomNoteAudioUUID(f *faker.Faker) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.NoteAudioUUID = func() uuid.UUID { + return random_uuid_UUID(f) + } + }) +} + +// Set the model columns to this value +func (m noteAudioBreadcrumbMods) Position(val int32) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.Position = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m noteAudioBreadcrumbMods) PositionFunc(f func() int32) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.Position = f + }) +} + +// Clear any values for the column +func (m noteAudioBreadcrumbMods) UnsetPosition() NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.Position = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteAudioBreadcrumbMods) RandomPosition(f *faker.Faker) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(_ context.Context, o *NoteAudioBreadcrumbTemplate) { + o.Position = func() int32 { + return random_int32(f) + } + }) +} + +func (m noteAudioBreadcrumbMods) WithParentsCascading() NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(ctx context.Context, o *NoteAudioBreadcrumbTemplate) { + if isDone, _ := noteAudioBreadcrumbWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = noteAudioBreadcrumbWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewNoteAudioWithContext(ctx, NoteAudioMods.WithParentsCascading()) + m.WithNoteAudio(related).Apply(ctx, o) + } + }) +} + +func (m noteAudioBreadcrumbMods) WithNoteAudio(rel *NoteAudioTemplate) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(ctx context.Context, o *NoteAudioBreadcrumbTemplate) { + o.r.NoteAudio = ¬eAudioBreadcrumbRNoteAudioR{ + o: rel, + } + }) +} + +func (m noteAudioBreadcrumbMods) WithNewNoteAudio(mods ...NoteAudioMod) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(ctx context.Context, o *NoteAudioBreadcrumbTemplate) { + related := o.f.NewNoteAudioWithContext(ctx, mods...) + + m.WithNoteAudio(related).Apply(ctx, o) + }) +} + +func (m noteAudioBreadcrumbMods) WithExistingNoteAudio(em *models.NoteAudio) NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(ctx context.Context, o *NoteAudioBreadcrumbTemplate) { + o.r.NoteAudio = ¬eAudioBreadcrumbRNoteAudioR{ + o: o.f.FromExistingNoteAudio(em), + } + }) +} + +func (m noteAudioBreadcrumbMods) WithoutNoteAudio() NoteAudioBreadcrumbMod { + return NoteAudioBreadcrumbModFunc(func(ctx context.Context, o *NoteAudioBreadcrumbTemplate) { + o.r.NoteAudio = nil + }) +} diff --git a/db/factory/note_audio_data.bob.go b/db/factory/note_audio_data.bob.go new file mode 100644 index 00000000..25b6da17 --- /dev/null +++ b/db/factory/note_audio_data.bob.go @@ -0,0 +1,462 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package factory + +import ( + "context" + "testing" + "time" + + enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" + models "github.com/Gleipnir-Technology/nidus-sync/db/models" + "github.com/aarondl/opt/omit" + "github.com/google/uuid" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type NoteAudioDatumMod interface { + Apply(context.Context, *NoteAudioDatumTemplate) +} + +type NoteAudioDatumModFunc func(context.Context, *NoteAudioDatumTemplate) + +func (f NoteAudioDatumModFunc) Apply(ctx context.Context, n *NoteAudioDatumTemplate) { + f(ctx, n) +} + +type NoteAudioDatumModSlice []NoteAudioDatumMod + +func (mods NoteAudioDatumModSlice) Apply(ctx context.Context, n *NoteAudioDatumTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// NoteAudioDatumTemplate is an object representing the database table. +// all columns are optional and should be set by mods +type NoteAudioDatumTemplate struct { + Created func() time.Time + NoteAudioVersion func() int32 + NoteAudioUUID func() uuid.UUID + Type func() enums.Audiodatatype + + r noteAudioDatumR + f *Factory + + alreadyPersisted bool +} + +type noteAudioDatumR struct { + NoteAudio *noteAudioDatumRNoteAudioR +} + +type noteAudioDatumRNoteAudioR struct { + o *NoteAudioTemplate +} + +// Apply mods to the NoteAudioDatumTemplate +func (o *NoteAudioDatumTemplate) Apply(ctx context.Context, mods ...NoteAudioDatumMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.NoteAudioDatum +// according to the relationships in the template. Nothing is inserted into the db +func (t NoteAudioDatumTemplate) setModelRels(o *models.NoteAudioDatum) { + if t.r.NoteAudio != nil { + rel := t.r.NoteAudio.o.Build() + rel.R.NoteAudioData = append(rel.R.NoteAudioData, o) + o.NoteAudioVersion = rel.Version // h2 + o.NoteAudioUUID = rel.UUID // h2 + o.R.NoteAudio = rel + } +} + +// BuildSetter returns an *models.NoteAudioDatumSetter +// this does nothing with the relationship templates +func (o NoteAudioDatumTemplate) BuildSetter() *models.NoteAudioDatumSetter { + m := &models.NoteAudioDatumSetter{} + + if o.Created != nil { + val := o.Created() + m.Created = omit.From(val) + } + if o.NoteAudioVersion != nil { + val := o.NoteAudioVersion() + m.NoteAudioVersion = omit.From(val) + } + if o.NoteAudioUUID != nil { + val := o.NoteAudioUUID() + m.NoteAudioUUID = omit.From(val) + } + if o.Type != nil { + val := o.Type() + m.Type = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.NoteAudioDatumSetter +// this does nothing with the relationship templates +func (o NoteAudioDatumTemplate) BuildManySetter(number int) []*models.NoteAudioDatumSetter { + m := make([]*models.NoteAudioDatumSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.NoteAudioDatum +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use NoteAudioDatumTemplate.Create +func (o NoteAudioDatumTemplate) Build() *models.NoteAudioDatum { + m := &models.NoteAudioDatum{} + + if o.Created != nil { + m.Created = o.Created() + } + if o.NoteAudioVersion != nil { + m.NoteAudioVersion = o.NoteAudioVersion() + } + if o.NoteAudioUUID != nil { + m.NoteAudioUUID = o.NoteAudioUUID() + } + if o.Type != nil { + m.Type = o.Type() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.NoteAudioDatumSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use NoteAudioDatumTemplate.CreateMany +func (o NoteAudioDatumTemplate) BuildMany(number int) models.NoteAudioDatumSlice { + m := make(models.NoteAudioDatumSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableNoteAudioDatum(m *models.NoteAudioDatumSetter) { + if !(m.Created.IsValue()) { + val := random_time_Time(nil) + m.Created = omit.From(val) + } + if !(m.NoteAudioVersion.IsValue()) { + val := random_int32(nil) + m.NoteAudioVersion = omit.From(val) + } + if !(m.NoteAudioUUID.IsValue()) { + val := random_uuid_UUID(nil) + m.NoteAudioUUID = omit.From(val) + } + if !(m.Type.IsValue()) { + val := random_enums_Audiodatatype(nil) + m.Type = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.NoteAudioDatum +// according to the relationships in the template. +// any required relationship should have already exist on the model +func (o *NoteAudioDatumTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.NoteAudioDatum) error { + var err error + + return err +} + +// Create builds a noteAudioDatum and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *NoteAudioDatumTemplate) Create(ctx context.Context, exec bob.Executor) (*models.NoteAudioDatum, error) { + var err error + opt := o.BuildSetter() + ensureCreatableNoteAudioDatum(opt) + + if o.r.NoteAudio == nil { + NoteAudioDatumMods.WithNewNoteAudio().Apply(ctx, o) + } + + var rel0 *models.NoteAudio + + if o.r.NoteAudio.o.alreadyPersisted { + rel0 = o.r.NoteAudio.o.Build() + } else { + rel0, err = o.r.NoteAudio.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.NoteAudioVersion = omit.From(rel0.Version) + opt.NoteAudioUUID = omit.From(rel0.UUID) + + m, err := models.NoteAudioData.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + m.R.NoteAudio = rel0 + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a noteAudioDatum and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *NoteAudioDatumTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.NoteAudioDatum { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a noteAudioDatum 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 *NoteAudioDatumTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.NoteAudioDatum { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple noteAudioData and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o NoteAudioDatumTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.NoteAudioDatumSlice, error) { + var err error + m := make(models.NoteAudioDatumSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple noteAudioData and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o NoteAudioDatumTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.NoteAudioDatumSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple noteAudioData 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 NoteAudioDatumTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.NoteAudioDatumSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// NoteAudioDatum has methods that act as mods for the NoteAudioDatumTemplate +var NoteAudioDatumMods noteAudioDatumMods + +type noteAudioDatumMods struct{} + +func (m noteAudioDatumMods) RandomizeAllColumns(f *faker.Faker) NoteAudioDatumMod { + return NoteAudioDatumModSlice{ + NoteAudioDatumMods.RandomCreated(f), + NoteAudioDatumMods.RandomNoteAudioVersion(f), + NoteAudioDatumMods.RandomNoteAudioUUID(f), + NoteAudioDatumMods.RandomType(f), + } +} + +// Set the model columns to this value +func (m noteAudioDatumMods) Created(val time.Time) NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + o.Created = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m noteAudioDatumMods) CreatedFunc(f func() time.Time) NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m noteAudioDatumMods) UnsetCreated() NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteAudioDatumMods) RandomCreated(f *faker.Faker) NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + o.Created = func() time.Time { + return random_time_Time(f) + } + }) +} + +// Set the model columns to this value +func (m noteAudioDatumMods) NoteAudioVersion(val int32) NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + o.NoteAudioVersion = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m noteAudioDatumMods) NoteAudioVersionFunc(f func() int32) NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + o.NoteAudioVersion = f + }) +} + +// Clear any values for the column +func (m noteAudioDatumMods) UnsetNoteAudioVersion() NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + o.NoteAudioVersion = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteAudioDatumMods) RandomNoteAudioVersion(f *faker.Faker) NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + o.NoteAudioVersion = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m noteAudioDatumMods) NoteAudioUUID(val uuid.UUID) NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + o.NoteAudioUUID = func() uuid.UUID { return val } + }) +} + +// Set the Column from the function +func (m noteAudioDatumMods) NoteAudioUUIDFunc(f func() uuid.UUID) NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + o.NoteAudioUUID = f + }) +} + +// Clear any values for the column +func (m noteAudioDatumMods) UnsetNoteAudioUUID() NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + o.NoteAudioUUID = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteAudioDatumMods) RandomNoteAudioUUID(f *faker.Faker) NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + o.NoteAudioUUID = func() uuid.UUID { + return random_uuid_UUID(f) + } + }) +} + +// Set the model columns to this value +func (m noteAudioDatumMods) Type(val enums.Audiodatatype) NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + o.Type = func() enums.Audiodatatype { return val } + }) +} + +// Set the Column from the function +func (m noteAudioDatumMods) TypeFunc(f func() enums.Audiodatatype) NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + o.Type = f + }) +} + +// Clear any values for the column +func (m noteAudioDatumMods) UnsetType() NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + 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 noteAudioDatumMods) RandomType(f *faker.Faker) NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(_ context.Context, o *NoteAudioDatumTemplate) { + o.Type = func() enums.Audiodatatype { + return random_enums_Audiodatatype(f) + } + }) +} + +func (m noteAudioDatumMods) WithParentsCascading() NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(ctx context.Context, o *NoteAudioDatumTemplate) { + if isDone, _ := noteAudioDatumWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = noteAudioDatumWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewNoteAudioWithContext(ctx, NoteAudioMods.WithParentsCascading()) + m.WithNoteAudio(related).Apply(ctx, o) + } + }) +} + +func (m noteAudioDatumMods) WithNoteAudio(rel *NoteAudioTemplate) NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(ctx context.Context, o *NoteAudioDatumTemplate) { + o.r.NoteAudio = ¬eAudioDatumRNoteAudioR{ + o: rel, + } + }) +} + +func (m noteAudioDatumMods) WithNewNoteAudio(mods ...NoteAudioMod) NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(ctx context.Context, o *NoteAudioDatumTemplate) { + related := o.f.NewNoteAudioWithContext(ctx, mods...) + + m.WithNoteAudio(related).Apply(ctx, o) + }) +} + +func (m noteAudioDatumMods) WithExistingNoteAudio(em *models.NoteAudio) NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(ctx context.Context, o *NoteAudioDatumTemplate) { + o.r.NoteAudio = ¬eAudioDatumRNoteAudioR{ + o: o.f.FromExistingNoteAudio(em), + } + }) +} + +func (m noteAudioDatumMods) WithoutNoteAudio() NoteAudioDatumMod { + return NoteAudioDatumModFunc(func(ctx context.Context, o *NoteAudioDatumTemplate) { + o.r.NoteAudio = nil + }) +} diff --git a/db/factory/note_image.bob.go b/db/factory/note_image.bob.go new file mode 100644 index 00000000..0ee3a490 --- /dev/null +++ b/db/factory/note_image.bob.go @@ -0,0 +1,932 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package factory + +import ( + "context" + "testing" + "time" + + models "github.com/Gleipnir-Technology/nidus-sync/db/models" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/google/uuid" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type NoteImageMod interface { + Apply(context.Context, *NoteImageTemplate) +} + +type NoteImageModFunc func(context.Context, *NoteImageTemplate) + +func (f NoteImageModFunc) Apply(ctx context.Context, n *NoteImageTemplate) { + f(ctx, n) +} + +type NoteImageModSlice []NoteImageMod + +func (mods NoteImageModSlice) Apply(ctx context.Context, n *NoteImageTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// NoteImageTemplate is an object representing the database table. +// all columns are optional and should be set by mods +type NoteImageTemplate struct { + Created func() time.Time + CreatorID func() int32 + Deleted func() null.Val[time.Time] + DeletorID func() null.Val[int32] + OrganizationID func() int32 + Version func() int32 + UUID func() uuid.UUID + + r noteImageR + f *Factory + + alreadyPersisted bool +} + +type noteImageR struct { + CreatorUser *noteImageRCreatorUserR + DeletorUser *noteImageRDeletorUserR + Organization *noteImageROrganizationR + NoteImageBreadcrumbs []*noteImageRNoteImageBreadcrumbsR + NoteImageData []*noteImageRNoteImageDataR +} + +type noteImageRCreatorUserR struct { + o *UserTemplate +} +type noteImageRDeletorUserR struct { + o *UserTemplate +} +type noteImageROrganizationR struct { + o *OrganizationTemplate +} +type noteImageRNoteImageBreadcrumbsR struct { + number int + o *NoteImageBreadcrumbTemplate +} +type noteImageRNoteImageDataR struct { + number int + o *NoteImageDatumTemplate +} + +// Apply mods to the NoteImageTemplate +func (o *NoteImageTemplate) Apply(ctx context.Context, mods ...NoteImageMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.NoteImage +// according to the relationships in the template. Nothing is inserted into the db +func (t NoteImageTemplate) setModelRels(o *models.NoteImage) { + if t.r.CreatorUser != nil { + rel := t.r.CreatorUser.o.Build() + rel.R.CreatorNoteImages = append(rel.R.CreatorNoteImages, o) + o.CreatorID = rel.ID // h2 + o.R.CreatorUser = rel + } + + if t.r.DeletorUser != nil { + rel := t.r.DeletorUser.o.Build() + rel.R.DeletorNoteImages = append(rel.R.DeletorNoteImages, o) + o.DeletorID = null.From(rel.ID) // h2 + o.R.DeletorUser = rel + } + + if t.r.Organization != nil { + rel := t.r.Organization.o.Build() + rel.R.NoteImages = append(rel.R.NoteImages, o) + o.OrganizationID = rel.ID // h2 + o.R.Organization = rel + } + + if t.r.NoteImageBreadcrumbs != nil { + rel := models.NoteImageBreadcrumbSlice{} + for _, r := range t.r.NoteImageBreadcrumbs { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.NoteImageVersion = o.Version // h2 + rel.NoteImageUUID = o.UUID // h2 + rel.R.NoteImage = o + } + rel = append(rel, related...) + } + o.R.NoteImageBreadcrumbs = rel + } + + if t.r.NoteImageData != nil { + rel := models.NoteImageDatumSlice{} + for _, r := range t.r.NoteImageData { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.NoteImageVersion = o.Version // h2 + rel.NoteImageUUID = o.UUID // h2 + rel.R.NoteImage = o + } + rel = append(rel, related...) + } + o.R.NoteImageData = rel + } +} + +// BuildSetter returns an *models.NoteImageSetter +// this does nothing with the relationship templates +func (o NoteImageTemplate) BuildSetter() *models.NoteImageSetter { + m := &models.NoteImageSetter{} + + if o.Created != nil { + val := o.Created() + m.Created = omit.From(val) + } + if o.CreatorID != nil { + val := o.CreatorID() + m.CreatorID = omit.From(val) + } + if o.Deleted != nil { + val := o.Deleted() + m.Deleted = omitnull.FromNull(val) + } + if o.DeletorID != nil { + val := o.DeletorID() + m.DeletorID = omitnull.FromNull(val) + } + if o.OrganizationID != nil { + val := o.OrganizationID() + m.OrganizationID = omit.From(val) + } + if o.Version != nil { + val := o.Version() + m.Version = omit.From(val) + } + if o.UUID != nil { + val := o.UUID() + m.UUID = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.NoteImageSetter +// this does nothing with the relationship templates +func (o NoteImageTemplate) BuildManySetter(number int) []*models.NoteImageSetter { + m := make([]*models.NoteImageSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.NoteImage +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use NoteImageTemplate.Create +func (o NoteImageTemplate) Build() *models.NoteImage { + m := &models.NoteImage{} + + if o.Created != nil { + m.Created = o.Created() + } + if o.CreatorID != nil { + m.CreatorID = o.CreatorID() + } + if o.Deleted != nil { + m.Deleted = o.Deleted() + } + if o.DeletorID != nil { + m.DeletorID = o.DeletorID() + } + if o.OrganizationID != nil { + m.OrganizationID = o.OrganizationID() + } + if o.Version != nil { + m.Version = o.Version() + } + if o.UUID != nil { + m.UUID = o.UUID() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.NoteImageSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use NoteImageTemplate.CreateMany +func (o NoteImageTemplate) BuildMany(number int) models.NoteImageSlice { + m := make(models.NoteImageSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableNoteImage(m *models.NoteImageSetter) { + if !(m.Created.IsValue()) { + val := random_time_Time(nil) + m.Created = omit.From(val) + } + if !(m.CreatorID.IsValue()) { + val := random_int32(nil) + m.CreatorID = omit.From(val) + } + if !(m.OrganizationID.IsValue()) { + val := random_int32(nil) + m.OrganizationID = omit.From(val) + } + if !(m.Version.IsValue()) { + val := random_int32(nil) + m.Version = omit.From(val) + } + if !(m.UUID.IsValue()) { + val := random_uuid_UUID(nil) + m.UUID = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.NoteImage +// according to the relationships in the template. +// any required relationship should have already exist on the model +func (o *NoteImageTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.NoteImage) error { + var err error + + isDeletorUserDone, _ := noteImageRelDeletorUserCtx.Value(ctx) + if !isDeletorUserDone && o.r.DeletorUser != nil { + ctx = noteImageRelDeletorUserCtx.WithValue(ctx, true) + if o.r.DeletorUser.o.alreadyPersisted { + m.R.DeletorUser = o.r.DeletorUser.o.Build() + } else { + var rel1 *models.User + rel1, err = o.r.DeletorUser.o.Create(ctx, exec) + if err != nil { + return err + } + err = m.AttachDeletorUser(ctx, exec, rel1) + if err != nil { + return err + } + } + + } + + isNoteImageBreadcrumbsDone, _ := noteImageRelNoteImageBreadcrumbsCtx.Value(ctx) + if !isNoteImageBreadcrumbsDone && o.r.NoteImageBreadcrumbs != nil { + ctx = noteImageRelNoteImageBreadcrumbsCtx.WithValue(ctx, true) + for _, r := range o.r.NoteImageBreadcrumbs { + if r.o.alreadyPersisted { + m.R.NoteImageBreadcrumbs = append(m.R.NoteImageBreadcrumbs, r.o.Build()) + } else { + rel3, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachNoteImageBreadcrumbs(ctx, exec, rel3...) + if err != nil { + return err + } + } + } + } + + isNoteImageDataDone, _ := noteImageRelNoteImageDataCtx.Value(ctx) + if !isNoteImageDataDone && o.r.NoteImageData != nil { + ctx = noteImageRelNoteImageDataCtx.WithValue(ctx, true) + for _, r := range o.r.NoteImageData { + if r.o.alreadyPersisted { + m.R.NoteImageData = append(m.R.NoteImageData, r.o.Build()) + } else { + rel4, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachNoteImageData(ctx, exec, rel4...) + if err != nil { + return err + } + } + } + } + + return err +} + +// Create builds a noteImage and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *NoteImageTemplate) Create(ctx context.Context, exec bob.Executor) (*models.NoteImage, error) { + var err error + opt := o.BuildSetter() + ensureCreatableNoteImage(opt) + + if o.r.CreatorUser == nil { + NoteImageMods.WithNewCreatorUser().Apply(ctx, o) + } + + var rel0 *models.User + + if o.r.CreatorUser.o.alreadyPersisted { + rel0 = o.r.CreatorUser.o.Build() + } else { + rel0, err = o.r.CreatorUser.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.CreatorID = omit.From(rel0.ID) + + if o.r.Organization == nil { + NoteImageMods.WithNewOrganization().Apply(ctx, o) + } + + var rel2 *models.Organization + + if o.r.Organization.o.alreadyPersisted { + rel2 = o.r.Organization.o.Build() + } else { + rel2, err = o.r.Organization.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.OrganizationID = omit.From(rel2.ID) + + m, err := models.NoteImages.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + m.R.CreatorUser = rel0 + m.R.Organization = rel2 + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a noteImage and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *NoteImageTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.NoteImage { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a noteImage 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 *NoteImageTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.NoteImage { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple noteImages and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o NoteImageTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.NoteImageSlice, error) { + var err error + m := make(models.NoteImageSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple noteImages and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o NoteImageTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.NoteImageSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple noteImages 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 NoteImageTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.NoteImageSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// NoteImage has methods that act as mods for the NoteImageTemplate +var NoteImageMods noteImageMods + +type noteImageMods struct{} + +func (m noteImageMods) RandomizeAllColumns(f *faker.Faker) NoteImageMod { + return NoteImageModSlice{ + NoteImageMods.RandomCreated(f), + NoteImageMods.RandomCreatorID(f), + NoteImageMods.RandomDeleted(f), + NoteImageMods.RandomDeletorID(f), + NoteImageMods.RandomOrganizationID(f), + NoteImageMods.RandomVersion(f), + NoteImageMods.RandomUUID(f), + } +} + +// Set the model columns to this value +func (m noteImageMods) Created(val time.Time) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.Created = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m noteImageMods) CreatedFunc(f func() time.Time) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m noteImageMods) UnsetCreated() NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteImageMods) RandomCreated(f *faker.Faker) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.Created = func() time.Time { + return random_time_Time(f) + } + }) +} + +// Set the model columns to this value +func (m noteImageMods) CreatorID(val int32) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.CreatorID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m noteImageMods) CreatorIDFunc(f func() int32) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.CreatorID = f + }) +} + +// Clear any values for the column +func (m noteImageMods) UnsetCreatorID() NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.CreatorID = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteImageMods) RandomCreatorID(f *faker.Faker) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.CreatorID = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m noteImageMods) Deleted(val null.Val[time.Time]) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.Deleted = func() null.Val[time.Time] { return val } + }) +} + +// Set the Column from the function +func (m noteImageMods) DeletedFunc(f func() null.Val[time.Time]) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.Deleted = f + }) +} + +// Clear any values for the column +func (m noteImageMods) UnsetDeleted() NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.Deleted = 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 noteImageMods) RandomDeleted(f *faker.Faker) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.Deleted = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(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 noteImageMods) RandomDeletedNotNull(f *faker.Faker) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.Deleted = func() null.Val[time.Time] { + if f == nil { + f = &defaultFaker + } + + val := random_time_Time(f) + return null.From(val) + } + }) +} + +// Set the model columns to this value +func (m noteImageMods) DeletorID(val null.Val[int32]) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.DeletorID = func() null.Val[int32] { return val } + }) +} + +// Set the Column from the function +func (m noteImageMods) DeletorIDFunc(f func() null.Val[int32]) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.DeletorID = f + }) +} + +// Clear any values for the column +func (m noteImageMods) UnsetDeletorID() NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.DeletorID = 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 noteImageMods) RandomDeletorID(f *faker.Faker) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.DeletorID = 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 noteImageMods) RandomDeletorIDNotNull(f *faker.Faker) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.DeletorID = 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 noteImageMods) OrganizationID(val int32) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.OrganizationID = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m noteImageMods) OrganizationIDFunc(f func() int32) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.OrganizationID = f + }) +} + +// Clear any values for the column +func (m noteImageMods) UnsetOrganizationID() NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + 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 noteImageMods) RandomOrganizationID(f *faker.Faker) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.OrganizationID = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m noteImageMods) Version(val int32) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.Version = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m noteImageMods) VersionFunc(f func() int32) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.Version = f + }) +} + +// Clear any values for the column +func (m noteImageMods) UnsetVersion() NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.Version = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteImageMods) RandomVersion(f *faker.Faker) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.Version = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m noteImageMods) UUID(val uuid.UUID) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.UUID = func() uuid.UUID { return val } + }) +} + +// Set the Column from the function +func (m noteImageMods) UUIDFunc(f func() uuid.UUID) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.UUID = f + }) +} + +// Clear any values for the column +func (m noteImageMods) UnsetUUID() NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.UUID = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteImageMods) RandomUUID(f *faker.Faker) NoteImageMod { + return NoteImageModFunc(func(_ context.Context, o *NoteImageTemplate) { + o.UUID = func() uuid.UUID { + return random_uuid_UUID(f) + } + }) +} + +func (m noteImageMods) WithParentsCascading() NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + if isDone, _ := noteImageWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = noteImageWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) + m.WithCreatorUser(related).Apply(ctx, o) + } + { + + related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) + m.WithDeletorUser(related).Apply(ctx, o) + } + { + + related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) + m.WithOrganization(related).Apply(ctx, o) + } + }) +} + +func (m noteImageMods) WithCreatorUser(rel *UserTemplate) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + o.r.CreatorUser = ¬eImageRCreatorUserR{ + o: rel, + } + }) +} + +func (m noteImageMods) WithNewCreatorUser(mods ...UserMod) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + related := o.f.NewUserWithContext(ctx, mods...) + + m.WithCreatorUser(related).Apply(ctx, o) + }) +} + +func (m noteImageMods) WithExistingCreatorUser(em *models.User) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + o.r.CreatorUser = ¬eImageRCreatorUserR{ + o: o.f.FromExistingUser(em), + } + }) +} + +func (m noteImageMods) WithoutCreatorUser() NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + o.r.CreatorUser = nil + }) +} + +func (m noteImageMods) WithDeletorUser(rel *UserTemplate) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + o.r.DeletorUser = ¬eImageRDeletorUserR{ + o: rel, + } + }) +} + +func (m noteImageMods) WithNewDeletorUser(mods ...UserMod) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + related := o.f.NewUserWithContext(ctx, mods...) + + m.WithDeletorUser(related).Apply(ctx, o) + }) +} + +func (m noteImageMods) WithExistingDeletorUser(em *models.User) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + o.r.DeletorUser = ¬eImageRDeletorUserR{ + o: o.f.FromExistingUser(em), + } + }) +} + +func (m noteImageMods) WithoutDeletorUser() NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + o.r.DeletorUser = nil + }) +} + +func (m noteImageMods) WithOrganization(rel *OrganizationTemplate) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + o.r.Organization = ¬eImageROrganizationR{ + o: rel, + } + }) +} + +func (m noteImageMods) WithNewOrganization(mods ...OrganizationMod) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + related := o.f.NewOrganizationWithContext(ctx, mods...) + + m.WithOrganization(related).Apply(ctx, o) + }) +} + +func (m noteImageMods) WithExistingOrganization(em *models.Organization) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + o.r.Organization = ¬eImageROrganizationR{ + o: o.f.FromExistingOrganization(em), + } + }) +} + +func (m noteImageMods) WithoutOrganization() NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + o.r.Organization = nil + }) +} + +func (m noteImageMods) WithNoteImageBreadcrumbs(number int, related *NoteImageBreadcrumbTemplate) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + o.r.NoteImageBreadcrumbs = []*noteImageRNoteImageBreadcrumbsR{{ + number: number, + o: related, + }} + }) +} + +func (m noteImageMods) WithNewNoteImageBreadcrumbs(number int, mods ...NoteImageBreadcrumbMod) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + related := o.f.NewNoteImageBreadcrumbWithContext(ctx, mods...) + m.WithNoteImageBreadcrumbs(number, related).Apply(ctx, o) + }) +} + +func (m noteImageMods) AddNoteImageBreadcrumbs(number int, related *NoteImageBreadcrumbTemplate) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + o.r.NoteImageBreadcrumbs = append(o.r.NoteImageBreadcrumbs, ¬eImageRNoteImageBreadcrumbsR{ + number: number, + o: related, + }) + }) +} + +func (m noteImageMods) AddNewNoteImageBreadcrumbs(number int, mods ...NoteImageBreadcrumbMod) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + related := o.f.NewNoteImageBreadcrumbWithContext(ctx, mods...) + m.AddNoteImageBreadcrumbs(number, related).Apply(ctx, o) + }) +} + +func (m noteImageMods) AddExistingNoteImageBreadcrumbs(existingModels ...*models.NoteImageBreadcrumb) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + for _, em := range existingModels { + o.r.NoteImageBreadcrumbs = append(o.r.NoteImageBreadcrumbs, ¬eImageRNoteImageBreadcrumbsR{ + o: o.f.FromExistingNoteImageBreadcrumb(em), + }) + } + }) +} + +func (m noteImageMods) WithoutNoteImageBreadcrumbs() NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + o.r.NoteImageBreadcrumbs = nil + }) +} + +func (m noteImageMods) WithNoteImageData(number int, related *NoteImageDatumTemplate) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + o.r.NoteImageData = []*noteImageRNoteImageDataR{{ + number: number, + o: related, + }} + }) +} + +func (m noteImageMods) WithNewNoteImageData(number int, mods ...NoteImageDatumMod) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + related := o.f.NewNoteImageDatumWithContext(ctx, mods...) + m.WithNoteImageData(number, related).Apply(ctx, o) + }) +} + +func (m noteImageMods) AddNoteImageData(number int, related *NoteImageDatumTemplate) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + o.r.NoteImageData = append(o.r.NoteImageData, ¬eImageRNoteImageDataR{ + number: number, + o: related, + }) + }) +} + +func (m noteImageMods) AddNewNoteImageData(number int, mods ...NoteImageDatumMod) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + related := o.f.NewNoteImageDatumWithContext(ctx, mods...) + m.AddNoteImageData(number, related).Apply(ctx, o) + }) +} + +func (m noteImageMods) AddExistingNoteImageData(existingModels ...*models.NoteImageDatum) NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + for _, em := range existingModels { + o.r.NoteImageData = append(o.r.NoteImageData, ¬eImageRNoteImageDataR{ + o: o.f.FromExistingNoteImageDatum(em), + }) + } + }) +} + +func (m noteImageMods) WithoutNoteImageData() NoteImageMod { + return NoteImageModFunc(func(ctx context.Context, o *NoteImageTemplate) { + o.r.NoteImageData = nil + }) +} diff --git a/db/factory/note_image_breadcrumb.bob.go b/db/factory/note_image_breadcrumb.bob.go new file mode 100644 index 00000000..d0b08ee4 --- /dev/null +++ b/db/factory/note_image_breadcrumb.bob.go @@ -0,0 +1,549 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package factory + +import ( + "context" + "testing" + "time" + + models "github.com/Gleipnir-Technology/nidus-sync/db/models" + "github.com/aarondl/opt/omit" + "github.com/google/uuid" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type NoteImageBreadcrumbMod interface { + Apply(context.Context, *NoteImageBreadcrumbTemplate) +} + +type NoteImageBreadcrumbModFunc func(context.Context, *NoteImageBreadcrumbTemplate) + +func (f NoteImageBreadcrumbModFunc) Apply(ctx context.Context, n *NoteImageBreadcrumbTemplate) { + f(ctx, n) +} + +type NoteImageBreadcrumbModSlice []NoteImageBreadcrumbMod + +func (mods NoteImageBreadcrumbModSlice) Apply(ctx context.Context, n *NoteImageBreadcrumbTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// NoteImageBreadcrumbTemplate is an object representing the database table. +// all columns are optional and should be set by mods +type NoteImageBreadcrumbTemplate struct { + Cell func() string + Created func() time.Time + ManuallySelected func() bool + NoteImageVersion func() int32 + NoteImageUUID func() uuid.UUID + Position func() int32 + + r noteImageBreadcrumbR + f *Factory + + alreadyPersisted bool +} + +type noteImageBreadcrumbR struct { + NoteImage *noteImageBreadcrumbRNoteImageR +} + +type noteImageBreadcrumbRNoteImageR struct { + o *NoteImageTemplate +} + +// Apply mods to the NoteImageBreadcrumbTemplate +func (o *NoteImageBreadcrumbTemplate) Apply(ctx context.Context, mods ...NoteImageBreadcrumbMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.NoteImageBreadcrumb +// according to the relationships in the template. Nothing is inserted into the db +func (t NoteImageBreadcrumbTemplate) setModelRels(o *models.NoteImageBreadcrumb) { + if t.r.NoteImage != nil { + rel := t.r.NoteImage.o.Build() + rel.R.NoteImageBreadcrumbs = append(rel.R.NoteImageBreadcrumbs, o) + o.NoteImageVersion = rel.Version // h2 + o.NoteImageUUID = rel.UUID // h2 + o.R.NoteImage = rel + } +} + +// BuildSetter returns an *models.NoteImageBreadcrumbSetter +// this does nothing with the relationship templates +func (o NoteImageBreadcrumbTemplate) BuildSetter() *models.NoteImageBreadcrumbSetter { + m := &models.NoteImageBreadcrumbSetter{} + + if o.Cell != nil { + val := o.Cell() + m.Cell = omit.From(val) + } + if o.Created != nil { + val := o.Created() + m.Created = omit.From(val) + } + if o.ManuallySelected != nil { + val := o.ManuallySelected() + m.ManuallySelected = omit.From(val) + } + if o.NoteImageVersion != nil { + val := o.NoteImageVersion() + m.NoteImageVersion = omit.From(val) + } + if o.NoteImageUUID != nil { + val := o.NoteImageUUID() + m.NoteImageUUID = omit.From(val) + } + if o.Position != nil { + val := o.Position() + m.Position = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.NoteImageBreadcrumbSetter +// this does nothing with the relationship templates +func (o NoteImageBreadcrumbTemplate) BuildManySetter(number int) []*models.NoteImageBreadcrumbSetter { + m := make([]*models.NoteImageBreadcrumbSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.NoteImageBreadcrumb +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use NoteImageBreadcrumbTemplate.Create +func (o NoteImageBreadcrumbTemplate) Build() *models.NoteImageBreadcrumb { + m := &models.NoteImageBreadcrumb{} + + if o.Cell != nil { + m.Cell = o.Cell() + } + if o.Created != nil { + m.Created = o.Created() + } + if o.ManuallySelected != nil { + m.ManuallySelected = o.ManuallySelected() + } + if o.NoteImageVersion != nil { + m.NoteImageVersion = o.NoteImageVersion() + } + if o.NoteImageUUID != nil { + m.NoteImageUUID = o.NoteImageUUID() + } + if o.Position != nil { + m.Position = o.Position() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.NoteImageBreadcrumbSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use NoteImageBreadcrumbTemplate.CreateMany +func (o NoteImageBreadcrumbTemplate) BuildMany(number int) models.NoteImageBreadcrumbSlice { + m := make(models.NoteImageBreadcrumbSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableNoteImageBreadcrumb(m *models.NoteImageBreadcrumbSetter) { + if !(m.Cell.IsValue()) { + val := random_string(nil) + m.Cell = omit.From(val) + } + if !(m.Created.IsValue()) { + val := random_time_Time(nil) + m.Created = omit.From(val) + } + if !(m.ManuallySelected.IsValue()) { + val := random_bool(nil) + m.ManuallySelected = omit.From(val) + } + if !(m.NoteImageVersion.IsValue()) { + val := random_int32(nil) + m.NoteImageVersion = omit.From(val) + } + if !(m.NoteImageUUID.IsValue()) { + val := random_uuid_UUID(nil) + m.NoteImageUUID = omit.From(val) + } + if !(m.Position.IsValue()) { + val := random_int32(nil) + m.Position = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.NoteImageBreadcrumb +// according to the relationships in the template. +// any required relationship should have already exist on the model +func (o *NoteImageBreadcrumbTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.NoteImageBreadcrumb) error { + var err error + + return err +} + +// Create builds a noteImageBreadcrumb and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *NoteImageBreadcrumbTemplate) Create(ctx context.Context, exec bob.Executor) (*models.NoteImageBreadcrumb, error) { + var err error + opt := o.BuildSetter() + ensureCreatableNoteImageBreadcrumb(opt) + + if o.r.NoteImage == nil { + NoteImageBreadcrumbMods.WithNewNoteImage().Apply(ctx, o) + } + + var rel0 *models.NoteImage + + if o.r.NoteImage.o.alreadyPersisted { + rel0 = o.r.NoteImage.o.Build() + } else { + rel0, err = o.r.NoteImage.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.NoteImageVersion = omit.From(rel0.Version) + opt.NoteImageUUID = omit.From(rel0.UUID) + + m, err := models.NoteImageBreadcrumbs.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + m.R.NoteImage = rel0 + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a noteImageBreadcrumb and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *NoteImageBreadcrumbTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.NoteImageBreadcrumb { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a noteImageBreadcrumb 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 *NoteImageBreadcrumbTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.NoteImageBreadcrumb { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple noteImageBreadcrumbs and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o NoteImageBreadcrumbTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.NoteImageBreadcrumbSlice, error) { + var err error + m := make(models.NoteImageBreadcrumbSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple noteImageBreadcrumbs and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o NoteImageBreadcrumbTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.NoteImageBreadcrumbSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple noteImageBreadcrumbs 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 NoteImageBreadcrumbTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.NoteImageBreadcrumbSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// NoteImageBreadcrumb has methods that act as mods for the NoteImageBreadcrumbTemplate +var NoteImageBreadcrumbMods noteImageBreadcrumbMods + +type noteImageBreadcrumbMods struct{} + +func (m noteImageBreadcrumbMods) RandomizeAllColumns(f *faker.Faker) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModSlice{ + NoteImageBreadcrumbMods.RandomCell(f), + NoteImageBreadcrumbMods.RandomCreated(f), + NoteImageBreadcrumbMods.RandomManuallySelected(f), + NoteImageBreadcrumbMods.RandomNoteImageVersion(f), + NoteImageBreadcrumbMods.RandomNoteImageUUID(f), + NoteImageBreadcrumbMods.RandomPosition(f), + } +} + +// Set the model columns to this value +func (m noteImageBreadcrumbMods) Cell(val string) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.Cell = func() string { return val } + }) +} + +// Set the Column from the function +func (m noteImageBreadcrumbMods) CellFunc(f func() string) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.Cell = f + }) +} + +// Clear any values for the column +func (m noteImageBreadcrumbMods) UnsetCell() NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + 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 noteImageBreadcrumbMods) RandomCell(f *faker.Faker) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.Cell = func() string { + return random_string(f) + } + }) +} + +// Set the model columns to this value +func (m noteImageBreadcrumbMods) Created(val time.Time) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.Created = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m noteImageBreadcrumbMods) CreatedFunc(f func() time.Time) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m noteImageBreadcrumbMods) UnsetCreated() NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteImageBreadcrumbMods) RandomCreated(f *faker.Faker) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.Created = func() time.Time { + return random_time_Time(f) + } + }) +} + +// Set the model columns to this value +func (m noteImageBreadcrumbMods) ManuallySelected(val bool) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.ManuallySelected = func() bool { return val } + }) +} + +// Set the Column from the function +func (m noteImageBreadcrumbMods) ManuallySelectedFunc(f func() bool) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.ManuallySelected = f + }) +} + +// Clear any values for the column +func (m noteImageBreadcrumbMods) UnsetManuallySelected() NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.ManuallySelected = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteImageBreadcrumbMods) RandomManuallySelected(f *faker.Faker) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.ManuallySelected = func() bool { + return random_bool(f) + } + }) +} + +// Set the model columns to this value +func (m noteImageBreadcrumbMods) NoteImageVersion(val int32) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.NoteImageVersion = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m noteImageBreadcrumbMods) NoteImageVersionFunc(f func() int32) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.NoteImageVersion = f + }) +} + +// Clear any values for the column +func (m noteImageBreadcrumbMods) UnsetNoteImageVersion() NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.NoteImageVersion = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteImageBreadcrumbMods) RandomNoteImageVersion(f *faker.Faker) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.NoteImageVersion = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m noteImageBreadcrumbMods) NoteImageUUID(val uuid.UUID) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.NoteImageUUID = func() uuid.UUID { return val } + }) +} + +// Set the Column from the function +func (m noteImageBreadcrumbMods) NoteImageUUIDFunc(f func() uuid.UUID) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.NoteImageUUID = f + }) +} + +// Clear any values for the column +func (m noteImageBreadcrumbMods) UnsetNoteImageUUID() NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.NoteImageUUID = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteImageBreadcrumbMods) RandomNoteImageUUID(f *faker.Faker) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.NoteImageUUID = func() uuid.UUID { + return random_uuid_UUID(f) + } + }) +} + +// Set the model columns to this value +func (m noteImageBreadcrumbMods) Position(val int32) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.Position = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m noteImageBreadcrumbMods) PositionFunc(f func() int32) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.Position = f + }) +} + +// Clear any values for the column +func (m noteImageBreadcrumbMods) UnsetPosition() NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.Position = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteImageBreadcrumbMods) RandomPosition(f *faker.Faker) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(_ context.Context, o *NoteImageBreadcrumbTemplate) { + o.Position = func() int32 { + return random_int32(f) + } + }) +} + +func (m noteImageBreadcrumbMods) WithParentsCascading() NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(ctx context.Context, o *NoteImageBreadcrumbTemplate) { + if isDone, _ := noteImageBreadcrumbWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = noteImageBreadcrumbWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewNoteImageWithContext(ctx, NoteImageMods.WithParentsCascading()) + m.WithNoteImage(related).Apply(ctx, o) + } + }) +} + +func (m noteImageBreadcrumbMods) WithNoteImage(rel *NoteImageTemplate) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(ctx context.Context, o *NoteImageBreadcrumbTemplate) { + o.r.NoteImage = ¬eImageBreadcrumbRNoteImageR{ + o: rel, + } + }) +} + +func (m noteImageBreadcrumbMods) WithNewNoteImage(mods ...NoteImageMod) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(ctx context.Context, o *NoteImageBreadcrumbTemplate) { + related := o.f.NewNoteImageWithContext(ctx, mods...) + + m.WithNoteImage(related).Apply(ctx, o) + }) +} + +func (m noteImageBreadcrumbMods) WithExistingNoteImage(em *models.NoteImage) NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(ctx context.Context, o *NoteImageBreadcrumbTemplate) { + o.r.NoteImage = ¬eImageBreadcrumbRNoteImageR{ + o: o.f.FromExistingNoteImage(em), + } + }) +} + +func (m noteImageBreadcrumbMods) WithoutNoteImage() NoteImageBreadcrumbMod { + return NoteImageBreadcrumbModFunc(func(ctx context.Context, o *NoteImageBreadcrumbTemplate) { + o.r.NoteImage = nil + }) +} diff --git a/db/factory/note_image_data.bob.go b/db/factory/note_image_data.bob.go new file mode 100644 index 00000000..1625c4f8 --- /dev/null +++ b/db/factory/note_image_data.bob.go @@ -0,0 +1,462 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package factory + +import ( + "context" + "testing" + "time" + + enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" + models "github.com/Gleipnir-Technology/nidus-sync/db/models" + "github.com/aarondl/opt/omit" + "github.com/google/uuid" + "github.com/jaswdr/faker/v2" + "github.com/stephenafamo/bob" +) + +type NoteImageDatumMod interface { + Apply(context.Context, *NoteImageDatumTemplate) +} + +type NoteImageDatumModFunc func(context.Context, *NoteImageDatumTemplate) + +func (f NoteImageDatumModFunc) Apply(ctx context.Context, n *NoteImageDatumTemplate) { + f(ctx, n) +} + +type NoteImageDatumModSlice []NoteImageDatumMod + +func (mods NoteImageDatumModSlice) Apply(ctx context.Context, n *NoteImageDatumTemplate) { + for _, f := range mods { + f.Apply(ctx, n) + } +} + +// NoteImageDatumTemplate is an object representing the database table. +// all columns are optional and should be set by mods +type NoteImageDatumTemplate struct { + Created func() time.Time + NoteImageVersion func() int32 + NoteImageUUID func() uuid.UUID + Type func() enums.Audiodatatype + + r noteImageDatumR + f *Factory + + alreadyPersisted bool +} + +type noteImageDatumR struct { + NoteImage *noteImageDatumRNoteImageR +} + +type noteImageDatumRNoteImageR struct { + o *NoteImageTemplate +} + +// Apply mods to the NoteImageDatumTemplate +func (o *NoteImageDatumTemplate) Apply(ctx context.Context, mods ...NoteImageDatumMod) { + for _, mod := range mods { + mod.Apply(ctx, o) + } +} + +// setModelRels creates and sets the relationships on *models.NoteImageDatum +// according to the relationships in the template. Nothing is inserted into the db +func (t NoteImageDatumTemplate) setModelRels(o *models.NoteImageDatum) { + if t.r.NoteImage != nil { + rel := t.r.NoteImage.o.Build() + rel.R.NoteImageData = append(rel.R.NoteImageData, o) + o.NoteImageVersion = rel.Version // h2 + o.NoteImageUUID = rel.UUID // h2 + o.R.NoteImage = rel + } +} + +// BuildSetter returns an *models.NoteImageDatumSetter +// this does nothing with the relationship templates +func (o NoteImageDatumTemplate) BuildSetter() *models.NoteImageDatumSetter { + m := &models.NoteImageDatumSetter{} + + if o.Created != nil { + val := o.Created() + m.Created = omit.From(val) + } + if o.NoteImageVersion != nil { + val := o.NoteImageVersion() + m.NoteImageVersion = omit.From(val) + } + if o.NoteImageUUID != nil { + val := o.NoteImageUUID() + m.NoteImageUUID = omit.From(val) + } + if o.Type != nil { + val := o.Type() + m.Type = omit.From(val) + } + + return m +} + +// BuildManySetter returns an []*models.NoteImageDatumSetter +// this does nothing with the relationship templates +func (o NoteImageDatumTemplate) BuildManySetter(number int) []*models.NoteImageDatumSetter { + m := make([]*models.NoteImageDatumSetter, number) + + for i := range m { + m[i] = o.BuildSetter() + } + + return m +} + +// Build returns an *models.NoteImageDatum +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use NoteImageDatumTemplate.Create +func (o NoteImageDatumTemplate) Build() *models.NoteImageDatum { + m := &models.NoteImageDatum{} + + if o.Created != nil { + m.Created = o.Created() + } + if o.NoteImageVersion != nil { + m.NoteImageVersion = o.NoteImageVersion() + } + if o.NoteImageUUID != nil { + m.NoteImageUUID = o.NoteImageUUID() + } + if o.Type != nil { + m.Type = o.Type() + } + + o.setModelRels(m) + + return m +} + +// BuildMany returns an models.NoteImageDatumSlice +// Related objects are also created and placed in the .R field +// NOTE: Objects are not inserted into the database. Use NoteImageDatumTemplate.CreateMany +func (o NoteImageDatumTemplate) BuildMany(number int) models.NoteImageDatumSlice { + m := make(models.NoteImageDatumSlice, number) + + for i := range m { + m[i] = o.Build() + } + + return m +} + +func ensureCreatableNoteImageDatum(m *models.NoteImageDatumSetter) { + if !(m.Created.IsValue()) { + val := random_time_Time(nil) + m.Created = omit.From(val) + } + if !(m.NoteImageVersion.IsValue()) { + val := random_int32(nil) + m.NoteImageVersion = omit.From(val) + } + if !(m.NoteImageUUID.IsValue()) { + val := random_uuid_UUID(nil) + m.NoteImageUUID = omit.From(val) + } + if !(m.Type.IsValue()) { + val := random_enums_Audiodatatype(nil) + m.Type = omit.From(val) + } +} + +// insertOptRels creates and inserts any optional the relationships on *models.NoteImageDatum +// according to the relationships in the template. +// any required relationship should have already exist on the model +func (o *NoteImageDatumTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.NoteImageDatum) error { + var err error + + return err +} + +// Create builds a noteImageDatum and inserts it into the database +// Relations objects are also inserted and placed in the .R field +func (o *NoteImageDatumTemplate) Create(ctx context.Context, exec bob.Executor) (*models.NoteImageDatum, error) { + var err error + opt := o.BuildSetter() + ensureCreatableNoteImageDatum(opt) + + if o.r.NoteImage == nil { + NoteImageDatumMods.WithNewNoteImage().Apply(ctx, o) + } + + var rel0 *models.NoteImage + + if o.r.NoteImage.o.alreadyPersisted { + rel0 = o.r.NoteImage.o.Build() + } else { + rel0, err = o.r.NoteImage.o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + opt.NoteImageVersion = omit.From(rel0.Version) + opt.NoteImageUUID = omit.From(rel0.UUID) + + m, err := models.NoteImageData.Insert(opt).One(ctx, exec) + if err != nil { + return nil, err + } + + m.R.NoteImage = rel0 + + if err := o.insertOptRels(ctx, exec, m); err != nil { + return nil, err + } + return m, err +} + +// MustCreate builds a noteImageDatum and inserts it into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o *NoteImageDatumTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.NoteImageDatum { + m, err := o.Create(ctx, exec) + if err != nil { + panic(err) + } + return m +} + +// CreateOrFail builds a noteImageDatum 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 *NoteImageDatumTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.NoteImageDatum { + tb.Helper() + m, err := o.Create(ctx, exec) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// CreateMany builds multiple noteImageData and inserts them into the database +// Relations objects are also inserted and placed in the .R field +func (o NoteImageDatumTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.NoteImageDatumSlice, error) { + var err error + m := make(models.NoteImageDatumSlice, number) + + for i := range m { + m[i], err = o.Create(ctx, exec) + if err != nil { + return nil, err + } + } + + return m, nil +} + +// MustCreateMany builds multiple noteImageData and inserts them into the database +// Relations objects are also inserted and placed in the .R field +// panics if an error occurs +func (o NoteImageDatumTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.NoteImageDatumSlice { + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + panic(err) + } + return m +} + +// CreateManyOrFail builds multiple noteImageData 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 NoteImageDatumTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.NoteImageDatumSlice { + tb.Helper() + m, err := o.CreateMany(ctx, exec, number) + if err != nil { + tb.Fatal(err) + return nil + } + return m +} + +// NoteImageDatum has methods that act as mods for the NoteImageDatumTemplate +var NoteImageDatumMods noteImageDatumMods + +type noteImageDatumMods struct{} + +func (m noteImageDatumMods) RandomizeAllColumns(f *faker.Faker) NoteImageDatumMod { + return NoteImageDatumModSlice{ + NoteImageDatumMods.RandomCreated(f), + NoteImageDatumMods.RandomNoteImageVersion(f), + NoteImageDatumMods.RandomNoteImageUUID(f), + NoteImageDatumMods.RandomType(f), + } +} + +// Set the model columns to this value +func (m noteImageDatumMods) Created(val time.Time) NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + o.Created = func() time.Time { return val } + }) +} + +// Set the Column from the function +func (m noteImageDatumMods) CreatedFunc(f func() time.Time) NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + o.Created = f + }) +} + +// Clear any values for the column +func (m noteImageDatumMods) UnsetCreated() NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + o.Created = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteImageDatumMods) RandomCreated(f *faker.Faker) NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + o.Created = func() time.Time { + return random_time_Time(f) + } + }) +} + +// Set the model columns to this value +func (m noteImageDatumMods) NoteImageVersion(val int32) NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + o.NoteImageVersion = func() int32 { return val } + }) +} + +// Set the Column from the function +func (m noteImageDatumMods) NoteImageVersionFunc(f func() int32) NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + o.NoteImageVersion = f + }) +} + +// Clear any values for the column +func (m noteImageDatumMods) UnsetNoteImageVersion() NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + o.NoteImageVersion = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteImageDatumMods) RandomNoteImageVersion(f *faker.Faker) NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + o.NoteImageVersion = func() int32 { + return random_int32(f) + } + }) +} + +// Set the model columns to this value +func (m noteImageDatumMods) NoteImageUUID(val uuid.UUID) NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + o.NoteImageUUID = func() uuid.UUID { return val } + }) +} + +// Set the Column from the function +func (m noteImageDatumMods) NoteImageUUIDFunc(f func() uuid.UUID) NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + o.NoteImageUUID = f + }) +} + +// Clear any values for the column +func (m noteImageDatumMods) UnsetNoteImageUUID() NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + o.NoteImageUUID = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m noteImageDatumMods) RandomNoteImageUUID(f *faker.Faker) NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + o.NoteImageUUID = func() uuid.UUID { + return random_uuid_UUID(f) + } + }) +} + +// Set the model columns to this value +func (m noteImageDatumMods) Type(val enums.Audiodatatype) NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + o.Type = func() enums.Audiodatatype { return val } + }) +} + +// Set the Column from the function +func (m noteImageDatumMods) TypeFunc(f func() enums.Audiodatatype) NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + o.Type = f + }) +} + +// Clear any values for the column +func (m noteImageDatumMods) UnsetType() NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + 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 noteImageDatumMods) RandomType(f *faker.Faker) NoteImageDatumMod { + return NoteImageDatumModFunc(func(_ context.Context, o *NoteImageDatumTemplate) { + o.Type = func() enums.Audiodatatype { + return random_enums_Audiodatatype(f) + } + }) +} + +func (m noteImageDatumMods) WithParentsCascading() NoteImageDatumMod { + return NoteImageDatumModFunc(func(ctx context.Context, o *NoteImageDatumTemplate) { + if isDone, _ := noteImageDatumWithParentsCascadingCtx.Value(ctx); isDone { + return + } + ctx = noteImageDatumWithParentsCascadingCtx.WithValue(ctx, true) + { + + related := o.f.NewNoteImageWithContext(ctx, NoteImageMods.WithParentsCascading()) + m.WithNoteImage(related).Apply(ctx, o) + } + }) +} + +func (m noteImageDatumMods) WithNoteImage(rel *NoteImageTemplate) NoteImageDatumMod { + return NoteImageDatumModFunc(func(ctx context.Context, o *NoteImageDatumTemplate) { + o.r.NoteImage = ¬eImageDatumRNoteImageR{ + o: rel, + } + }) +} + +func (m noteImageDatumMods) WithNewNoteImage(mods ...NoteImageMod) NoteImageDatumMod { + return NoteImageDatumModFunc(func(ctx context.Context, o *NoteImageDatumTemplate) { + related := o.f.NewNoteImageWithContext(ctx, mods...) + + m.WithNoteImage(related).Apply(ctx, o) + }) +} + +func (m noteImageDatumMods) WithExistingNoteImage(em *models.NoteImage) NoteImageDatumMod { + return NoteImageDatumModFunc(func(ctx context.Context, o *NoteImageDatumTemplate) { + o.r.NoteImage = ¬eImageDatumRNoteImageR{ + o: o.f.FromExistingNoteImage(em), + } + }) +} + +func (m noteImageDatumMods) WithoutNoteImage() NoteImageDatumMod { + return NoteImageDatumModFunc(func(ctx context.Context, o *NoteImageDatumTemplate) { + o.r.NoteImage = nil + }) +} diff --git a/db/factory/notification.bob.go b/db/factory/notification.bob.go index 545c1d87..ca760e02 100644 --- a/db/factory/notification.bob.go +++ b/db/factory/notification.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory diff --git a/db/factory/oauth_token.bob.go b/db/factory/oauth_token.bob.go index 5e5076f1..146a303c 100644 --- a/db/factory/oauth_token.bob.go +++ b/db/factory/oauth_token.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory diff --git a/db/factory/organization.bob.go b/db/factory/organization.bob.go index b449b008..989b76f0 100644 --- a/db/factory/organization.bob.go +++ b/db/factory/organization.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory @@ -49,288 +49,163 @@ type OrganizationTemplate struct { } type organizationR struct { - FieldseekerSyncs []*organizationRFieldseekerSyncsR - FSContainerrelates []*organizationRFSContainerrelatesR - FSFieldscoutinglogs []*organizationRFSFieldscoutinglogsR - FSHabitatrelates []*organizationRFSHabitatrelatesR - FSInspectionsamples []*organizationRFSInspectionsamplesR - FSInspectionsampledetails []*organizationRFSInspectionsampledetailsR - FSLinelocations []*organizationRFSLinelocationsR - FSLocationtrackings []*organizationRFSLocationtrackingsR - FSMosquitoinspections []*organizationRFSMosquitoinspectionsR - FSPointlocations []*organizationRFSPointlocationsR - FSPolygonlocations []*organizationRFSPolygonlocationsR - FSPools []*organizationRFSPoolsR - FSPooldetails []*organizationRFSPooldetailsR - FSProposedtreatmentareas []*organizationRFSProposedtreatmentareasR - FSQamosquitoinspections []*organizationRFSQamosquitoinspectionsR - FSRodentlocations []*organizationRFSRodentlocationsR - FSSamplecollections []*organizationRFSSamplecollectionsR - FSSamplelocations []*organizationRFSSamplelocationsR - FSServicerequests []*organizationRFSServicerequestsR - FSSpeciesabundances []*organizationRFSSpeciesabundancesR - FSStormdrains []*organizationRFSStormdrainsR - FSTimecards []*organizationRFSTimecardsR - FSTrapdata []*organizationRFSTrapdataR - FSTraplocations []*organizationRFSTraplocationsR - FSTreatments []*organizationRFSTreatmentsR - FSTreatmentareas []*organizationRFSTreatmentareasR - FSZones []*organizationRFSZonesR - FSZones2s []*organizationRFSZones2sR - H3Aggregations []*organizationRH3AggregationsR - HistoryContainerrelates []*organizationRHistoryContainerrelatesR - HistoryFieldscoutinglogs []*organizationRHistoryFieldscoutinglogsR - HistoryHabitatrelates []*organizationRHistoryHabitatrelatesR - HistoryInspectionsamples []*organizationRHistoryInspectionsamplesR - HistoryInspectionsampledetails []*organizationRHistoryInspectionsampledetailsR - HistoryLinelocations []*organizationRHistoryLinelocationsR - HistoryLocationtrackings []*organizationRHistoryLocationtrackingsR - HistoryMosquitoinspections []*organizationRHistoryMosquitoinspectionsR - HistoryPointlocations []*organizationRHistoryPointlocationsR - HistoryPolygonlocations []*organizationRHistoryPolygonlocationsR - HistoryPools []*organizationRHistoryPoolsR - HistoryPooldetails []*organizationRHistoryPooldetailsR - HistoryProposedtreatmentareas []*organizationRHistoryProposedtreatmentareasR - HistoryQamosquitoinspections []*organizationRHistoryQamosquitoinspectionsR - HistoryRodentlocations []*organizationRHistoryRodentlocationsR - HistorySamplecollections []*organizationRHistorySamplecollectionsR - HistorySamplelocations []*organizationRHistorySamplelocationsR - HistoryServicerequests []*organizationRHistoryServicerequestsR - HistorySpeciesabundances []*organizationRHistorySpeciesabundancesR - HistoryStormdrains []*organizationRHistoryStormdrainsR - HistoryTimecards []*organizationRHistoryTimecardsR - HistoryTrapdata []*organizationRHistoryTrapdataR - HistoryTraplocations []*organizationRHistoryTraplocationsR - HistoryTreatments []*organizationRHistoryTreatmentsR - HistoryTreatmentareas []*organizationRHistoryTreatmentareasR - HistoryZones []*organizationRHistoryZonesR - HistoryZones2s []*organizationRHistoryZones2sR - User []*organizationRUserR + Containerrelates []*organizationRContainerrelatesR + Fieldscoutinglogs []*organizationRFieldscoutinglogsR + Habitatrelates []*organizationRHabitatrelatesR + Inspectionsamples []*organizationRInspectionsamplesR + Inspectionsampledetails []*organizationRInspectionsampledetailsR + Linelocations []*organizationRLinelocationsR + Locationtrackings []*organizationRLocationtrackingsR + Mosquitoinspections []*organizationRMosquitoinspectionsR + Pointlocations []*organizationRPointlocationsR + Polygonlocations []*organizationRPolygonlocationsR + Pools []*organizationRPoolsR + Pooldetails []*organizationRPooldetailsR + Proposedtreatmentareas []*organizationRProposedtreatmentareasR + Qamosquitoinspections []*organizationRQamosquitoinspectionsR + Rodentlocations []*organizationRRodentlocationsR + Samplecollections []*organizationRSamplecollectionsR + Samplelocations []*organizationRSamplelocationsR + Servicerequests []*organizationRServicerequestsR + Speciesabundances []*organizationRSpeciesabundancesR + Stormdrains []*organizationRStormdrainsR + Timecards []*organizationRTimecardsR + Trapdata []*organizationRTrapdataR + Traplocations []*organizationRTraplocationsR + Treatments []*organizationRTreatmentsR + Treatmentareas []*organizationRTreatmentareasR + Zones []*organizationRZonesR + Zones2s []*organizationRZones2sR + FieldseekerSyncs []*organizationRFieldseekerSyncsR + H3Aggregations []*organizationRH3AggregationsR + NoteAudios []*organizationRNoteAudiosR + NoteImages []*organizationRNoteImagesR + User []*organizationRUserR } +type organizationRContainerrelatesR struct { + number int + o *FieldseekerContainerrelateTemplate +} +type organizationRFieldscoutinglogsR struct { + number int + o *FieldseekerFieldscoutinglogTemplate +} +type organizationRHabitatrelatesR struct { + number int + o *FieldseekerHabitatrelateTemplate +} +type organizationRInspectionsamplesR struct { + number int + o *FieldseekerInspectionsampleTemplate +} +type organizationRInspectionsampledetailsR struct { + number int + o *FieldseekerInspectionsampledetailTemplate +} +type organizationRLinelocationsR struct { + number int + o *FieldseekerLinelocationTemplate +} +type organizationRLocationtrackingsR struct { + number int + o *FieldseekerLocationtrackingTemplate +} +type organizationRMosquitoinspectionsR struct { + number int + o *FieldseekerMosquitoinspectionTemplate +} +type organizationRPointlocationsR struct { + number int + o *FieldseekerPointlocationTemplate +} +type organizationRPolygonlocationsR struct { + number int + o *FieldseekerPolygonlocationTemplate +} +type organizationRPoolsR struct { + number int + o *FieldseekerPoolTemplate +} +type organizationRPooldetailsR struct { + number int + o *FieldseekerPooldetailTemplate +} +type organizationRProposedtreatmentareasR struct { + number int + o *FieldseekerProposedtreatmentareaTemplate +} +type organizationRQamosquitoinspectionsR struct { + number int + o *FieldseekerQamosquitoinspectionTemplate +} +type organizationRRodentlocationsR struct { + number int + o *FieldseekerRodentlocationTemplate +} +type organizationRSamplecollectionsR struct { + number int + o *FieldseekerSamplecollectionTemplate +} +type organizationRSamplelocationsR struct { + number int + o *FieldseekerSamplelocationTemplate +} +type organizationRServicerequestsR struct { + number int + o *FieldseekerServicerequestTemplate +} +type organizationRSpeciesabundancesR struct { + number int + o *FieldseekerSpeciesabundanceTemplate +} +type organizationRStormdrainsR struct { + number int + o *FieldseekerStormdrainTemplate +} +type organizationRTimecardsR struct { + number int + o *FieldseekerTimecardTemplate +} +type organizationRTrapdataR struct { + number int + o *FieldseekerTrapdatumTemplate +} +type organizationRTraplocationsR struct { + number int + o *FieldseekerTraplocationTemplate +} +type organizationRTreatmentsR struct { + number int + o *FieldseekerTreatmentTemplate +} +type organizationRTreatmentareasR struct { + number int + o *FieldseekerTreatmentareaTemplate +} +type organizationRZonesR struct { + number int + o *FieldseekerZoneTemplate +} +type organizationRZones2sR struct { + number int + o *FieldseekerZones2Template +} type organizationRFieldseekerSyncsR struct { number int o *FieldseekerSyncTemplate } -type organizationRFSContainerrelatesR struct { - number int - o *FSContainerrelateTemplate -} -type organizationRFSFieldscoutinglogsR struct { - number int - o *FSFieldscoutinglogTemplate -} -type organizationRFSHabitatrelatesR struct { - number int - o *FSHabitatrelateTemplate -} -type organizationRFSInspectionsamplesR struct { - number int - o *FSInspectionsampleTemplate -} -type organizationRFSInspectionsampledetailsR struct { - number int - o *FSInspectionsampledetailTemplate -} -type organizationRFSLinelocationsR struct { - number int - o *FSLinelocationTemplate -} -type organizationRFSLocationtrackingsR struct { - number int - o *FSLocationtrackingTemplate -} -type organizationRFSMosquitoinspectionsR struct { - number int - o *FSMosquitoinspectionTemplate -} -type organizationRFSPointlocationsR struct { - number int - o *FSPointlocationTemplate -} -type organizationRFSPolygonlocationsR struct { - number int - o *FSPolygonlocationTemplate -} -type organizationRFSPoolsR struct { - number int - o *FSPoolTemplate -} -type organizationRFSPooldetailsR struct { - number int - o *FSPooldetailTemplate -} -type organizationRFSProposedtreatmentareasR struct { - number int - o *FSProposedtreatmentareaTemplate -} -type organizationRFSQamosquitoinspectionsR struct { - number int - o *FSQamosquitoinspectionTemplate -} -type organizationRFSRodentlocationsR struct { - number int - o *FSRodentlocationTemplate -} -type organizationRFSSamplecollectionsR struct { - number int - o *FSSamplecollectionTemplate -} -type organizationRFSSamplelocationsR struct { - number int - o *FSSamplelocationTemplate -} -type organizationRFSServicerequestsR struct { - number int - o *FSServicerequestTemplate -} -type organizationRFSSpeciesabundancesR struct { - number int - o *FSSpeciesabundanceTemplate -} -type organizationRFSStormdrainsR struct { - number int - o *FSStormdrainTemplate -} -type organizationRFSTimecardsR struct { - number int - o *FSTimecardTemplate -} -type organizationRFSTrapdataR struct { - number int - o *FSTrapdatumTemplate -} -type organizationRFSTraplocationsR struct { - number int - o *FSTraplocationTemplate -} -type organizationRFSTreatmentsR struct { - number int - o *FSTreatmentTemplate -} -type organizationRFSTreatmentareasR struct { - number int - o *FSTreatmentareaTemplate -} -type organizationRFSZonesR struct { - number int - o *FSZoneTemplate -} -type organizationRFSZones2sR struct { - number int - o *FSZones2Template -} type organizationRH3AggregationsR struct { number int o *H3AggregationTemplate } -type organizationRHistoryContainerrelatesR struct { +type organizationRNoteAudiosR struct { number int - o *HistoryContainerrelateTemplate + o *NoteAudioTemplate } -type organizationRHistoryFieldscoutinglogsR struct { +type organizationRNoteImagesR struct { number int - o *HistoryFieldscoutinglogTemplate -} -type organizationRHistoryHabitatrelatesR struct { - number int - o *HistoryHabitatrelateTemplate -} -type organizationRHistoryInspectionsamplesR struct { - number int - o *HistoryInspectionsampleTemplate -} -type organizationRHistoryInspectionsampledetailsR struct { - number int - o *HistoryInspectionsampledetailTemplate -} -type organizationRHistoryLinelocationsR struct { - number int - o *HistoryLinelocationTemplate -} -type organizationRHistoryLocationtrackingsR struct { - number int - o *HistoryLocationtrackingTemplate -} -type organizationRHistoryMosquitoinspectionsR struct { - number int - o *HistoryMosquitoinspectionTemplate -} -type organizationRHistoryPointlocationsR struct { - number int - o *HistoryPointlocationTemplate -} -type organizationRHistoryPolygonlocationsR struct { - number int - o *HistoryPolygonlocationTemplate -} -type organizationRHistoryPoolsR struct { - number int - o *HistoryPoolTemplate -} -type organizationRHistoryPooldetailsR struct { - number int - o *HistoryPooldetailTemplate -} -type organizationRHistoryProposedtreatmentareasR struct { - number int - o *HistoryProposedtreatmentareaTemplate -} -type organizationRHistoryQamosquitoinspectionsR struct { - number int - o *HistoryQamosquitoinspectionTemplate -} -type organizationRHistoryRodentlocationsR struct { - number int - o *HistoryRodentlocationTemplate -} -type organizationRHistorySamplecollectionsR struct { - number int - o *HistorySamplecollectionTemplate -} -type organizationRHistorySamplelocationsR struct { - number int - o *HistorySamplelocationTemplate -} -type organizationRHistoryServicerequestsR struct { - number int - o *HistoryServicerequestTemplate -} -type organizationRHistorySpeciesabundancesR struct { - number int - o *HistorySpeciesabundanceTemplate -} -type organizationRHistoryStormdrainsR struct { - number int - o *HistoryStormdrainTemplate -} -type organizationRHistoryTimecardsR struct { - number int - o *HistoryTimecardTemplate -} -type organizationRHistoryTrapdataR struct { - number int - o *HistoryTrapdatumTemplate -} -type organizationRHistoryTraplocationsR struct { - number int - o *HistoryTraplocationTemplate -} -type organizationRHistoryTreatmentsR struct { - number int - o *HistoryTreatmentTemplate -} -type organizationRHistoryTreatmentareasR struct { - number int - o *HistoryTreatmentareaTemplate -} -type organizationRHistoryZonesR struct { - number int - o *HistoryZoneTemplate -} -type organizationRHistoryZones2sR struct { - number int - o *HistoryZones2Template + o *NoteImageTemplate } type organizationRUserR struct { number int @@ -347,6 +222,357 @@ func (o *OrganizationTemplate) Apply(ctx context.Context, mods ...OrganizationMo // setModelRels creates and sets the relationships on *models.Organization // according to the relationships in the template. Nothing is inserted into the db func (t OrganizationTemplate) setModelRels(o *models.Organization) { + if t.r.Containerrelates != nil { + rel := models.FieldseekerContainerrelateSlice{} + for _, r := range t.r.Containerrelates { + 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.Containerrelates = rel + } + + if t.r.Fieldscoutinglogs != nil { + rel := models.FieldseekerFieldscoutinglogSlice{} + for _, r := range t.r.Fieldscoutinglogs { + 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.Fieldscoutinglogs = rel + } + + if t.r.Habitatrelates != nil { + rel := models.FieldseekerHabitatrelateSlice{} + for _, r := range t.r.Habitatrelates { + 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.Habitatrelates = rel + } + + if t.r.Inspectionsamples != nil { + rel := models.FieldseekerInspectionsampleSlice{} + for _, r := range t.r.Inspectionsamples { + 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.Inspectionsamples = rel + } + + if t.r.Inspectionsampledetails != nil { + rel := models.FieldseekerInspectionsampledetailSlice{} + for _, r := range t.r.Inspectionsampledetails { + 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.Inspectionsampledetails = rel + } + + if t.r.Linelocations != nil { + rel := models.FieldseekerLinelocationSlice{} + for _, r := range t.r.Linelocations { + 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.Linelocations = rel + } + + if t.r.Locationtrackings != nil { + rel := models.FieldseekerLocationtrackingSlice{} + for _, r := range t.r.Locationtrackings { + 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.Locationtrackings = rel + } + + if t.r.Mosquitoinspections != nil { + rel := models.FieldseekerMosquitoinspectionSlice{} + for _, r := range t.r.Mosquitoinspections { + 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.Mosquitoinspections = rel + } + + if t.r.Pointlocations != nil { + rel := models.FieldseekerPointlocationSlice{} + for _, r := range t.r.Pointlocations { + 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.Pointlocations = rel + } + + if t.r.Polygonlocations != nil { + rel := models.FieldseekerPolygonlocationSlice{} + for _, r := range t.r.Polygonlocations { + 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.Polygonlocations = rel + } + + if t.r.Pools != nil { + rel := models.FieldseekerPoolSlice{} + for _, r := range t.r.Pools { + 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.Pools = rel + } + + if t.r.Pooldetails != nil { + rel := models.FieldseekerPooldetailSlice{} + for _, r := range t.r.Pooldetails { + 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.Pooldetails = rel + } + + if t.r.Proposedtreatmentareas != nil { + rel := models.FieldseekerProposedtreatmentareaSlice{} + for _, r := range t.r.Proposedtreatmentareas { + 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.Proposedtreatmentareas = rel + } + + if t.r.Qamosquitoinspections != nil { + rel := models.FieldseekerQamosquitoinspectionSlice{} + for _, r := range t.r.Qamosquitoinspections { + 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.Qamosquitoinspections = rel + } + + if t.r.Rodentlocations != nil { + rel := models.FieldseekerRodentlocationSlice{} + for _, r := range t.r.Rodentlocations { + 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.Rodentlocations = rel + } + + if t.r.Samplecollections != nil { + rel := models.FieldseekerSamplecollectionSlice{} + for _, r := range t.r.Samplecollections { + 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.Samplecollections = rel + } + + if t.r.Samplelocations != nil { + rel := models.FieldseekerSamplelocationSlice{} + for _, r := range t.r.Samplelocations { + 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.Samplelocations = rel + } + + if t.r.Servicerequests != nil { + rel := models.FieldseekerServicerequestSlice{} + for _, r := range t.r.Servicerequests { + 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.Servicerequests = rel + } + + if t.r.Speciesabundances != nil { + rel := models.FieldseekerSpeciesabundanceSlice{} + for _, r := range t.r.Speciesabundances { + 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.Speciesabundances = rel + } + + if t.r.Stormdrains != nil { + rel := models.FieldseekerStormdrainSlice{} + for _, r := range t.r.Stormdrains { + 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.Stormdrains = rel + } + + if t.r.Timecards != nil { + rel := models.FieldseekerTimecardSlice{} + for _, r := range t.r.Timecards { + 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.Timecards = rel + } + + if t.r.Trapdata != nil { + rel := models.FieldseekerTrapdatumSlice{} + for _, r := range t.r.Trapdata { + 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.Trapdata = rel + } + + if t.r.Traplocations != nil { + rel := models.FieldseekerTraplocationSlice{} + for _, r := range t.r.Traplocations { + 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.Traplocations = rel + } + + if t.r.Treatments != nil { + rel := models.FieldseekerTreatmentSlice{} + for _, r := range t.r.Treatments { + 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.Treatments = rel + } + + if t.r.Treatmentareas != nil { + rel := models.FieldseekerTreatmentareaSlice{} + for _, r := range t.r.Treatmentareas { + 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.Treatmentareas = rel + } + + if t.r.Zones != nil { + rel := models.FieldseekerZoneSlice{} + for _, r := range t.r.Zones { + 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.Zones = rel + } + + if t.r.Zones2s != nil { + rel := models.FieldseekerZones2Slice{} + for _, r := range t.r.Zones2s { + 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.Zones2s = rel + } + if t.r.FieldseekerSyncs != nil { rel := models.FieldseekerSyncSlice{} for _, r := range t.r.FieldseekerSyncs { @@ -360,357 +586,6 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { o.R.FieldseekerSyncs = rel } - if t.r.FSContainerrelates != nil { - rel := models.FSContainerrelateSlice{} - for _, r := range t.r.FSContainerrelates { - 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.FSContainerrelates = rel - } - - if t.r.FSFieldscoutinglogs != nil { - rel := models.FSFieldscoutinglogSlice{} - for _, r := range t.r.FSFieldscoutinglogs { - 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.FSFieldscoutinglogs = rel - } - - if t.r.FSHabitatrelates != nil { - rel := models.FSHabitatrelateSlice{} - for _, r := range t.r.FSHabitatrelates { - 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.FSHabitatrelates = rel - } - - if t.r.FSInspectionsamples != nil { - rel := models.FSInspectionsampleSlice{} - for _, r := range t.r.FSInspectionsamples { - 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.FSInspectionsamples = rel - } - - if t.r.FSInspectionsampledetails != nil { - rel := models.FSInspectionsampledetailSlice{} - for _, r := range t.r.FSInspectionsampledetails { - 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.FSInspectionsampledetails = rel - } - - if t.r.FSLinelocations != nil { - rel := models.FSLinelocationSlice{} - for _, r := range t.r.FSLinelocations { - 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.FSLinelocations = rel - } - - if t.r.FSLocationtrackings != nil { - rel := models.FSLocationtrackingSlice{} - for _, r := range t.r.FSLocationtrackings { - 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.FSLocationtrackings = rel - } - - if t.r.FSMosquitoinspections != nil { - rel := models.FSMosquitoinspectionSlice{} - for _, r := range t.r.FSMosquitoinspections { - 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.FSMosquitoinspections = rel - } - - if t.r.FSPointlocations != nil { - rel := models.FSPointlocationSlice{} - for _, r := range t.r.FSPointlocations { - 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.FSPointlocations = rel - } - - if t.r.FSPolygonlocations != nil { - rel := models.FSPolygonlocationSlice{} - for _, r := range t.r.FSPolygonlocations { - 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.FSPolygonlocations = rel - } - - if t.r.FSPools != nil { - rel := models.FSPoolSlice{} - for _, r := range t.r.FSPools { - 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.FSPools = rel - } - - if t.r.FSPooldetails != nil { - rel := models.FSPooldetailSlice{} - for _, r := range t.r.FSPooldetails { - 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.FSPooldetails = rel - } - - if t.r.FSProposedtreatmentareas != nil { - rel := models.FSProposedtreatmentareaSlice{} - for _, r := range t.r.FSProposedtreatmentareas { - 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.FSProposedtreatmentareas = rel - } - - if t.r.FSQamosquitoinspections != nil { - rel := models.FSQamosquitoinspectionSlice{} - for _, r := range t.r.FSQamosquitoinspections { - 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.FSQamosquitoinspections = rel - } - - if t.r.FSRodentlocations != nil { - rel := models.FSRodentlocationSlice{} - for _, r := range t.r.FSRodentlocations { - 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.FSRodentlocations = rel - } - - if t.r.FSSamplecollections != nil { - rel := models.FSSamplecollectionSlice{} - for _, r := range t.r.FSSamplecollections { - 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.FSSamplecollections = rel - } - - if t.r.FSSamplelocations != nil { - rel := models.FSSamplelocationSlice{} - for _, r := range t.r.FSSamplelocations { - 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.FSSamplelocations = rel - } - - if t.r.FSServicerequests != nil { - rel := models.FSServicerequestSlice{} - for _, r := range t.r.FSServicerequests { - 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.FSServicerequests = rel - } - - if t.r.FSSpeciesabundances != nil { - rel := models.FSSpeciesabundanceSlice{} - for _, r := range t.r.FSSpeciesabundances { - 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.FSSpeciesabundances = rel - } - - if t.r.FSStormdrains != nil { - rel := models.FSStormdrainSlice{} - for _, r := range t.r.FSStormdrains { - 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.FSStormdrains = rel - } - - if t.r.FSTimecards != nil { - rel := models.FSTimecardSlice{} - for _, r := range t.r.FSTimecards { - 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.FSTimecards = rel - } - - if t.r.FSTrapdata != nil { - rel := models.FSTrapdatumSlice{} - for _, r := range t.r.FSTrapdata { - 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.FSTrapdata = rel - } - - if t.r.FSTraplocations != nil { - rel := models.FSTraplocationSlice{} - for _, r := range t.r.FSTraplocations { - 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.FSTraplocations = rel - } - - if t.r.FSTreatments != nil { - rel := models.FSTreatmentSlice{} - for _, r := range t.r.FSTreatments { - 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.FSTreatments = rel - } - - if t.r.FSTreatmentareas != nil { - rel := models.FSTreatmentareaSlice{} - for _, r := range t.r.FSTreatmentareas { - 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.FSTreatmentareas = rel - } - - if t.r.FSZones != nil { - rel := models.FSZoneSlice{} - for _, r := range t.r.FSZones { - 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.FSZones = rel - } - - if t.r.FSZones2s != nil { - rel := models.FSZones2Slice{} - for _, r := range t.r.FSZones2s { - 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.FSZones2s = rel - } - if t.r.H3Aggregations != nil { rel := models.H3AggregationSlice{} for _, r := range t.r.H3Aggregations { @@ -724,9 +599,9 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { o.R.H3Aggregations = rel } - if t.r.HistoryContainerrelates != nil { - rel := models.HistoryContainerrelateSlice{} - for _, r := range t.r.HistoryContainerrelates { + if t.r.NoteAudios != nil { + rel := models.NoteAudioSlice{} + for _, r := range t.r.NoteAudios { related := r.o.BuildMany(r.number) for _, rel := range related { rel.OrganizationID = o.ID // h2 @@ -734,12 +609,12 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { } rel = append(rel, related...) } - o.R.HistoryContainerrelates = rel + o.R.NoteAudios = rel } - if t.r.HistoryFieldscoutinglogs != nil { - rel := models.HistoryFieldscoutinglogSlice{} - for _, r := range t.r.HistoryFieldscoutinglogs { + if t.r.NoteImages != nil { + rel := models.NoteImageSlice{} + for _, r := range t.r.NoteImages { related := r.o.BuildMany(r.number) for _, rel := range related { rel.OrganizationID = o.ID // h2 @@ -747,332 +622,7 @@ func (t OrganizationTemplate) setModelRels(o *models.Organization) { } rel = append(rel, related...) } - o.R.HistoryFieldscoutinglogs = rel - } - - if t.r.HistoryHabitatrelates != nil { - rel := models.HistoryHabitatrelateSlice{} - for _, r := range t.r.HistoryHabitatrelates { - 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.HistoryHabitatrelates = rel - } - - if t.r.HistoryInspectionsamples != nil { - rel := models.HistoryInspectionsampleSlice{} - for _, r := range t.r.HistoryInspectionsamples { - 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.HistoryInspectionsamples = rel - } - - if t.r.HistoryInspectionsampledetails != nil { - rel := models.HistoryInspectionsampledetailSlice{} - for _, r := range t.r.HistoryInspectionsampledetails { - 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.HistoryInspectionsampledetails = rel - } - - if t.r.HistoryLinelocations != nil { - rel := models.HistoryLinelocationSlice{} - for _, r := range t.r.HistoryLinelocations { - 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.HistoryLinelocations = rel - } - - if t.r.HistoryLocationtrackings != nil { - rel := models.HistoryLocationtrackingSlice{} - for _, r := range t.r.HistoryLocationtrackings { - 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.HistoryLocationtrackings = rel - } - - if t.r.HistoryMosquitoinspections != nil { - rel := models.HistoryMosquitoinspectionSlice{} - for _, r := range t.r.HistoryMosquitoinspections { - 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.HistoryMosquitoinspections = rel - } - - if t.r.HistoryPointlocations != nil { - rel := models.HistoryPointlocationSlice{} - for _, r := range t.r.HistoryPointlocations { - 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.HistoryPointlocations = rel - } - - if t.r.HistoryPolygonlocations != nil { - rel := models.HistoryPolygonlocationSlice{} - for _, r := range t.r.HistoryPolygonlocations { - 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.HistoryPolygonlocations = rel - } - - if t.r.HistoryPools != nil { - rel := models.HistoryPoolSlice{} - for _, r := range t.r.HistoryPools { - 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.HistoryPools = rel - } - - if t.r.HistoryPooldetails != nil { - rel := models.HistoryPooldetailSlice{} - for _, r := range t.r.HistoryPooldetails { - 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.HistoryPooldetails = rel - } - - if t.r.HistoryProposedtreatmentareas != nil { - rel := models.HistoryProposedtreatmentareaSlice{} - for _, r := range t.r.HistoryProposedtreatmentareas { - 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.HistoryProposedtreatmentareas = rel - } - - if t.r.HistoryQamosquitoinspections != nil { - rel := models.HistoryQamosquitoinspectionSlice{} - for _, r := range t.r.HistoryQamosquitoinspections { - 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.HistoryQamosquitoinspections = rel - } - - if t.r.HistoryRodentlocations != nil { - rel := models.HistoryRodentlocationSlice{} - for _, r := range t.r.HistoryRodentlocations { - 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.HistoryRodentlocations = rel - } - - if t.r.HistorySamplecollections != nil { - rel := models.HistorySamplecollectionSlice{} - for _, r := range t.r.HistorySamplecollections { - 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.HistorySamplecollections = rel - } - - if t.r.HistorySamplelocations != nil { - rel := models.HistorySamplelocationSlice{} - for _, r := range t.r.HistorySamplelocations { - 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.HistorySamplelocations = rel - } - - if t.r.HistoryServicerequests != nil { - rel := models.HistoryServicerequestSlice{} - for _, r := range t.r.HistoryServicerequests { - 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.HistoryServicerequests = rel - } - - if t.r.HistorySpeciesabundances != nil { - rel := models.HistorySpeciesabundanceSlice{} - for _, r := range t.r.HistorySpeciesabundances { - 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.HistorySpeciesabundances = rel - } - - if t.r.HistoryStormdrains != nil { - rel := models.HistoryStormdrainSlice{} - for _, r := range t.r.HistoryStormdrains { - 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.HistoryStormdrains = rel - } - - if t.r.HistoryTimecards != nil { - rel := models.HistoryTimecardSlice{} - for _, r := range t.r.HistoryTimecards { - 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.HistoryTimecards = rel - } - - if t.r.HistoryTrapdata != nil { - rel := models.HistoryTrapdatumSlice{} - for _, r := range t.r.HistoryTrapdata { - 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.HistoryTrapdata = rel - } - - if t.r.HistoryTraplocations != nil { - rel := models.HistoryTraplocationSlice{} - for _, r := range t.r.HistoryTraplocations { - 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.HistoryTraplocations = rel - } - - if t.r.HistoryTreatments != nil { - rel := models.HistoryTreatmentSlice{} - for _, r := range t.r.HistoryTreatments { - 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.HistoryTreatments = rel - } - - if t.r.HistoryTreatmentareas != nil { - rel := models.HistoryTreatmentareaSlice{} - for _, r := range t.r.HistoryTreatmentareas { - 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.HistoryTreatmentareas = rel - } - - if t.r.HistoryZones != nil { - rel := models.HistoryZoneSlice{} - for _, r := range t.r.HistoryZones { - 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.HistoryZones = rel - } - - if t.r.HistoryZones2s != nil { - rel := models.HistoryZones2Slice{} - for _, r := range t.r.HistoryZones2s { - 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.HistoryZones2s = rel + o.R.NoteImages = rel } if t.r.User != nil { @@ -1179,559 +729,559 @@ func ensureCreatableOrganization(m *models.OrganizationSetter) { func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.Organization) error { var err error + isContainerrelatesDone, _ := organizationRelContainerrelatesCtx.Value(ctx) + if !isContainerrelatesDone && o.r.Containerrelates != nil { + ctx = organizationRelContainerrelatesCtx.WithValue(ctx, true) + for _, r := range o.r.Containerrelates { + if r.o.alreadyPersisted { + m.R.Containerrelates = append(m.R.Containerrelates, r.o.Build()) + } else { + rel0, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachContainerrelates(ctx, exec, rel0...) + if err != nil { + return err + } + } + } + } + + isFieldscoutinglogsDone, _ := organizationRelFieldscoutinglogsCtx.Value(ctx) + if !isFieldscoutinglogsDone && o.r.Fieldscoutinglogs != nil { + ctx = organizationRelFieldscoutinglogsCtx.WithValue(ctx, true) + for _, r := range o.r.Fieldscoutinglogs { + if r.o.alreadyPersisted { + m.R.Fieldscoutinglogs = append(m.R.Fieldscoutinglogs, r.o.Build()) + } else { + rel1, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachFieldscoutinglogs(ctx, exec, rel1...) + if err != nil { + return err + } + } + } + } + + isHabitatrelatesDone, _ := organizationRelHabitatrelatesCtx.Value(ctx) + if !isHabitatrelatesDone && o.r.Habitatrelates != nil { + ctx = organizationRelHabitatrelatesCtx.WithValue(ctx, true) + for _, r := range o.r.Habitatrelates { + if r.o.alreadyPersisted { + m.R.Habitatrelates = append(m.R.Habitatrelates, r.o.Build()) + } else { + rel2, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachHabitatrelates(ctx, exec, rel2...) + if err != nil { + return err + } + } + } + } + + isInspectionsamplesDone, _ := organizationRelInspectionsamplesCtx.Value(ctx) + if !isInspectionsamplesDone && o.r.Inspectionsamples != nil { + ctx = organizationRelInspectionsamplesCtx.WithValue(ctx, true) + for _, r := range o.r.Inspectionsamples { + if r.o.alreadyPersisted { + m.R.Inspectionsamples = append(m.R.Inspectionsamples, r.o.Build()) + } else { + rel3, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachInspectionsamples(ctx, exec, rel3...) + if err != nil { + return err + } + } + } + } + + isInspectionsampledetailsDone, _ := organizationRelInspectionsampledetailsCtx.Value(ctx) + if !isInspectionsampledetailsDone && o.r.Inspectionsampledetails != nil { + ctx = organizationRelInspectionsampledetailsCtx.WithValue(ctx, true) + for _, r := range o.r.Inspectionsampledetails { + if r.o.alreadyPersisted { + m.R.Inspectionsampledetails = append(m.R.Inspectionsampledetails, r.o.Build()) + } else { + rel4, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachInspectionsampledetails(ctx, exec, rel4...) + if err != nil { + return err + } + } + } + } + + isLinelocationsDone, _ := organizationRelLinelocationsCtx.Value(ctx) + if !isLinelocationsDone && o.r.Linelocations != nil { + ctx = organizationRelLinelocationsCtx.WithValue(ctx, true) + for _, r := range o.r.Linelocations { + if r.o.alreadyPersisted { + m.R.Linelocations = append(m.R.Linelocations, r.o.Build()) + } else { + rel5, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachLinelocations(ctx, exec, rel5...) + if err != nil { + return err + } + } + } + } + + isLocationtrackingsDone, _ := organizationRelLocationtrackingsCtx.Value(ctx) + if !isLocationtrackingsDone && o.r.Locationtrackings != nil { + ctx = organizationRelLocationtrackingsCtx.WithValue(ctx, true) + for _, r := range o.r.Locationtrackings { + if r.o.alreadyPersisted { + m.R.Locationtrackings = append(m.R.Locationtrackings, r.o.Build()) + } else { + rel6, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachLocationtrackings(ctx, exec, rel6...) + if err != nil { + return err + } + } + } + } + + isMosquitoinspectionsDone, _ := organizationRelMosquitoinspectionsCtx.Value(ctx) + if !isMosquitoinspectionsDone && o.r.Mosquitoinspections != nil { + ctx = organizationRelMosquitoinspectionsCtx.WithValue(ctx, true) + for _, r := range o.r.Mosquitoinspections { + if r.o.alreadyPersisted { + m.R.Mosquitoinspections = append(m.R.Mosquitoinspections, r.o.Build()) + } else { + rel7, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachMosquitoinspections(ctx, exec, rel7...) + if err != nil { + return err + } + } + } + } + + isPointlocationsDone, _ := organizationRelPointlocationsCtx.Value(ctx) + if !isPointlocationsDone && o.r.Pointlocations != nil { + ctx = organizationRelPointlocationsCtx.WithValue(ctx, true) + for _, r := range o.r.Pointlocations { + if r.o.alreadyPersisted { + m.R.Pointlocations = append(m.R.Pointlocations, r.o.Build()) + } else { + rel8, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachPointlocations(ctx, exec, rel8...) + if err != nil { + return err + } + } + } + } + + isPolygonlocationsDone, _ := organizationRelPolygonlocationsCtx.Value(ctx) + if !isPolygonlocationsDone && o.r.Polygonlocations != nil { + ctx = organizationRelPolygonlocationsCtx.WithValue(ctx, true) + for _, r := range o.r.Polygonlocations { + if r.o.alreadyPersisted { + m.R.Polygonlocations = append(m.R.Polygonlocations, r.o.Build()) + } else { + rel9, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachPolygonlocations(ctx, exec, rel9...) + if err != nil { + return err + } + } + } + } + + isPoolsDone, _ := organizationRelPoolsCtx.Value(ctx) + if !isPoolsDone && o.r.Pools != nil { + ctx = organizationRelPoolsCtx.WithValue(ctx, true) + for _, r := range o.r.Pools { + if r.o.alreadyPersisted { + m.R.Pools = append(m.R.Pools, r.o.Build()) + } else { + rel10, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachPools(ctx, exec, rel10...) + if err != nil { + return err + } + } + } + } + + isPooldetailsDone, _ := organizationRelPooldetailsCtx.Value(ctx) + if !isPooldetailsDone && o.r.Pooldetails != nil { + ctx = organizationRelPooldetailsCtx.WithValue(ctx, true) + for _, r := range o.r.Pooldetails { + if r.o.alreadyPersisted { + m.R.Pooldetails = append(m.R.Pooldetails, r.o.Build()) + } else { + rel11, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachPooldetails(ctx, exec, rel11...) + if err != nil { + return err + } + } + } + } + + isProposedtreatmentareasDone, _ := organizationRelProposedtreatmentareasCtx.Value(ctx) + if !isProposedtreatmentareasDone && o.r.Proposedtreatmentareas != nil { + ctx = organizationRelProposedtreatmentareasCtx.WithValue(ctx, true) + for _, r := range o.r.Proposedtreatmentareas { + if r.o.alreadyPersisted { + m.R.Proposedtreatmentareas = append(m.R.Proposedtreatmentareas, r.o.Build()) + } else { + rel12, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachProposedtreatmentareas(ctx, exec, rel12...) + if err != nil { + return err + } + } + } + } + + isQamosquitoinspectionsDone, _ := organizationRelQamosquitoinspectionsCtx.Value(ctx) + if !isQamosquitoinspectionsDone && o.r.Qamosquitoinspections != nil { + ctx = organizationRelQamosquitoinspectionsCtx.WithValue(ctx, true) + for _, r := range o.r.Qamosquitoinspections { + if r.o.alreadyPersisted { + m.R.Qamosquitoinspections = append(m.R.Qamosquitoinspections, r.o.Build()) + } else { + rel13, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachQamosquitoinspections(ctx, exec, rel13...) + if err != nil { + return err + } + } + } + } + + isRodentlocationsDone, _ := organizationRelRodentlocationsCtx.Value(ctx) + if !isRodentlocationsDone && o.r.Rodentlocations != nil { + ctx = organizationRelRodentlocationsCtx.WithValue(ctx, true) + for _, r := range o.r.Rodentlocations { + if r.o.alreadyPersisted { + m.R.Rodentlocations = append(m.R.Rodentlocations, r.o.Build()) + } else { + rel14, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachRodentlocations(ctx, exec, rel14...) + if err != nil { + return err + } + } + } + } + + isSamplecollectionsDone, _ := organizationRelSamplecollectionsCtx.Value(ctx) + if !isSamplecollectionsDone && o.r.Samplecollections != nil { + ctx = organizationRelSamplecollectionsCtx.WithValue(ctx, true) + for _, r := range o.r.Samplecollections { + if r.o.alreadyPersisted { + m.R.Samplecollections = append(m.R.Samplecollections, r.o.Build()) + } else { + rel15, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachSamplecollections(ctx, exec, rel15...) + if err != nil { + return err + } + } + } + } + + isSamplelocationsDone, _ := organizationRelSamplelocationsCtx.Value(ctx) + if !isSamplelocationsDone && o.r.Samplelocations != nil { + ctx = organizationRelSamplelocationsCtx.WithValue(ctx, true) + for _, r := range o.r.Samplelocations { + if r.o.alreadyPersisted { + m.R.Samplelocations = append(m.R.Samplelocations, r.o.Build()) + } else { + rel16, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachSamplelocations(ctx, exec, rel16...) + if err != nil { + return err + } + } + } + } + + isServicerequestsDone, _ := organizationRelServicerequestsCtx.Value(ctx) + if !isServicerequestsDone && o.r.Servicerequests != nil { + ctx = organizationRelServicerequestsCtx.WithValue(ctx, true) + for _, r := range o.r.Servicerequests { + if r.o.alreadyPersisted { + m.R.Servicerequests = append(m.R.Servicerequests, r.o.Build()) + } else { + rel17, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachServicerequests(ctx, exec, rel17...) + if err != nil { + return err + } + } + } + } + + isSpeciesabundancesDone, _ := organizationRelSpeciesabundancesCtx.Value(ctx) + if !isSpeciesabundancesDone && o.r.Speciesabundances != nil { + ctx = organizationRelSpeciesabundancesCtx.WithValue(ctx, true) + for _, r := range o.r.Speciesabundances { + if r.o.alreadyPersisted { + m.R.Speciesabundances = append(m.R.Speciesabundances, r.o.Build()) + } else { + rel18, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachSpeciesabundances(ctx, exec, rel18...) + if err != nil { + return err + } + } + } + } + + isStormdrainsDone, _ := organizationRelStormdrainsCtx.Value(ctx) + if !isStormdrainsDone && o.r.Stormdrains != nil { + ctx = organizationRelStormdrainsCtx.WithValue(ctx, true) + for _, r := range o.r.Stormdrains { + if r.o.alreadyPersisted { + m.R.Stormdrains = append(m.R.Stormdrains, r.o.Build()) + } else { + rel19, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachStormdrains(ctx, exec, rel19...) + if err != nil { + return err + } + } + } + } + + isTimecardsDone, _ := organizationRelTimecardsCtx.Value(ctx) + if !isTimecardsDone && o.r.Timecards != nil { + ctx = organizationRelTimecardsCtx.WithValue(ctx, true) + for _, r := range o.r.Timecards { + if r.o.alreadyPersisted { + m.R.Timecards = append(m.R.Timecards, r.o.Build()) + } else { + rel20, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachTimecards(ctx, exec, rel20...) + if err != nil { + return err + } + } + } + } + + isTrapdataDone, _ := organizationRelTrapdataCtx.Value(ctx) + if !isTrapdataDone && o.r.Trapdata != nil { + ctx = organizationRelTrapdataCtx.WithValue(ctx, true) + for _, r := range o.r.Trapdata { + if r.o.alreadyPersisted { + m.R.Trapdata = append(m.R.Trapdata, r.o.Build()) + } else { + rel21, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachTrapdata(ctx, exec, rel21...) + if err != nil { + return err + } + } + } + } + + isTraplocationsDone, _ := organizationRelTraplocationsCtx.Value(ctx) + if !isTraplocationsDone && o.r.Traplocations != nil { + ctx = organizationRelTraplocationsCtx.WithValue(ctx, true) + for _, r := range o.r.Traplocations { + if r.o.alreadyPersisted { + m.R.Traplocations = append(m.R.Traplocations, r.o.Build()) + } else { + rel22, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachTraplocations(ctx, exec, rel22...) + if err != nil { + return err + } + } + } + } + + isTreatmentsDone, _ := organizationRelTreatmentsCtx.Value(ctx) + if !isTreatmentsDone && o.r.Treatments != nil { + ctx = organizationRelTreatmentsCtx.WithValue(ctx, true) + for _, r := range o.r.Treatments { + if r.o.alreadyPersisted { + m.R.Treatments = append(m.R.Treatments, r.o.Build()) + } else { + rel23, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachTreatments(ctx, exec, rel23...) + if err != nil { + return err + } + } + } + } + + isTreatmentareasDone, _ := organizationRelTreatmentareasCtx.Value(ctx) + if !isTreatmentareasDone && o.r.Treatmentareas != nil { + ctx = organizationRelTreatmentareasCtx.WithValue(ctx, true) + for _, r := range o.r.Treatmentareas { + if r.o.alreadyPersisted { + m.R.Treatmentareas = append(m.R.Treatmentareas, r.o.Build()) + } else { + rel24, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachTreatmentareas(ctx, exec, rel24...) + if err != nil { + return err + } + } + } + } + + isZonesDone, _ := organizationRelZonesCtx.Value(ctx) + if !isZonesDone && o.r.Zones != nil { + ctx = organizationRelZonesCtx.WithValue(ctx, true) + for _, r := range o.r.Zones { + if r.o.alreadyPersisted { + m.R.Zones = append(m.R.Zones, r.o.Build()) + } else { + rel25, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachZones(ctx, exec, rel25...) + if err != nil { + return err + } + } + } + } + + isZones2sDone, _ := organizationRelZones2sCtx.Value(ctx) + if !isZones2sDone && o.r.Zones2s != nil { + ctx = organizationRelZones2sCtx.WithValue(ctx, true) + for _, r := range o.r.Zones2s { + if r.o.alreadyPersisted { + m.R.Zones2s = append(m.R.Zones2s, r.o.Build()) + } else { + rel26, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachZones2s(ctx, exec, rel26...) + if err != nil { + return err + } + } + } + } + isFieldseekerSyncsDone, _ := organizationRelFieldseekerSyncsCtx.Value(ctx) if !isFieldseekerSyncsDone && o.r.FieldseekerSyncs != nil { ctx = organizationRelFieldseekerSyncsCtx.WithValue(ctx, true) for _, r := range o.r.FieldseekerSyncs { if r.o.alreadyPersisted { m.R.FieldseekerSyncs = append(m.R.FieldseekerSyncs, r.o.Build()) - } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFieldseekerSyncs(ctx, exec, rel0...) - if err != nil { - return err - } - } - } - } - - isFSContainerrelatesDone, _ := organizationRelFSContainerrelatesCtx.Value(ctx) - if !isFSContainerrelatesDone && o.r.FSContainerrelates != nil { - ctx = organizationRelFSContainerrelatesCtx.WithValue(ctx, true) - for _, r := range o.r.FSContainerrelates { - if r.o.alreadyPersisted { - m.R.FSContainerrelates = append(m.R.FSContainerrelates, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSContainerrelates(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - isFSFieldscoutinglogsDone, _ := organizationRelFSFieldscoutinglogsCtx.Value(ctx) - if !isFSFieldscoutinglogsDone && o.r.FSFieldscoutinglogs != nil { - ctx = organizationRelFSFieldscoutinglogsCtx.WithValue(ctx, true) - for _, r := range o.r.FSFieldscoutinglogs { - if r.o.alreadyPersisted { - m.R.FSFieldscoutinglogs = append(m.R.FSFieldscoutinglogs, r.o.Build()) - } else { - rel2, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSFieldscoutinglogs(ctx, exec, rel2...) - if err != nil { - return err - } - } - } - } - - isFSHabitatrelatesDone, _ := organizationRelFSHabitatrelatesCtx.Value(ctx) - if !isFSHabitatrelatesDone && o.r.FSHabitatrelates != nil { - ctx = organizationRelFSHabitatrelatesCtx.WithValue(ctx, true) - for _, r := range o.r.FSHabitatrelates { - if r.o.alreadyPersisted { - m.R.FSHabitatrelates = append(m.R.FSHabitatrelates, r.o.Build()) - } else { - rel3, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSHabitatrelates(ctx, exec, rel3...) - if err != nil { - return err - } - } - } - } - - isFSInspectionsamplesDone, _ := organizationRelFSInspectionsamplesCtx.Value(ctx) - if !isFSInspectionsamplesDone && o.r.FSInspectionsamples != nil { - ctx = organizationRelFSInspectionsamplesCtx.WithValue(ctx, true) - for _, r := range o.r.FSInspectionsamples { - if r.o.alreadyPersisted { - m.R.FSInspectionsamples = append(m.R.FSInspectionsamples, r.o.Build()) - } else { - rel4, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSInspectionsamples(ctx, exec, rel4...) - if err != nil { - return err - } - } - } - } - - isFSInspectionsampledetailsDone, _ := organizationRelFSInspectionsampledetailsCtx.Value(ctx) - if !isFSInspectionsampledetailsDone && o.r.FSInspectionsampledetails != nil { - ctx = organizationRelFSInspectionsampledetailsCtx.WithValue(ctx, true) - for _, r := range o.r.FSInspectionsampledetails { - if r.o.alreadyPersisted { - m.R.FSInspectionsampledetails = append(m.R.FSInspectionsampledetails, r.o.Build()) - } else { - rel5, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSInspectionsampledetails(ctx, exec, rel5...) - if err != nil { - return err - } - } - } - } - - isFSLinelocationsDone, _ := organizationRelFSLinelocationsCtx.Value(ctx) - if !isFSLinelocationsDone && o.r.FSLinelocations != nil { - ctx = organizationRelFSLinelocationsCtx.WithValue(ctx, true) - for _, r := range o.r.FSLinelocations { - if r.o.alreadyPersisted { - m.R.FSLinelocations = append(m.R.FSLinelocations, r.o.Build()) - } else { - rel6, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSLinelocations(ctx, exec, rel6...) - if err != nil { - return err - } - } - } - } - - isFSLocationtrackingsDone, _ := organizationRelFSLocationtrackingsCtx.Value(ctx) - if !isFSLocationtrackingsDone && o.r.FSLocationtrackings != nil { - ctx = organizationRelFSLocationtrackingsCtx.WithValue(ctx, true) - for _, r := range o.r.FSLocationtrackings { - if r.o.alreadyPersisted { - m.R.FSLocationtrackings = append(m.R.FSLocationtrackings, r.o.Build()) - } else { - rel7, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSLocationtrackings(ctx, exec, rel7...) - if err != nil { - return err - } - } - } - } - - isFSMosquitoinspectionsDone, _ := organizationRelFSMosquitoinspectionsCtx.Value(ctx) - if !isFSMosquitoinspectionsDone && o.r.FSMosquitoinspections != nil { - ctx = organizationRelFSMosquitoinspectionsCtx.WithValue(ctx, true) - for _, r := range o.r.FSMosquitoinspections { - if r.o.alreadyPersisted { - m.R.FSMosquitoinspections = append(m.R.FSMosquitoinspections, r.o.Build()) - } else { - rel8, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSMosquitoinspections(ctx, exec, rel8...) - if err != nil { - return err - } - } - } - } - - isFSPointlocationsDone, _ := organizationRelFSPointlocationsCtx.Value(ctx) - if !isFSPointlocationsDone && o.r.FSPointlocations != nil { - ctx = organizationRelFSPointlocationsCtx.WithValue(ctx, true) - for _, r := range o.r.FSPointlocations { - if r.o.alreadyPersisted { - m.R.FSPointlocations = append(m.R.FSPointlocations, r.o.Build()) - } else { - rel9, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSPointlocations(ctx, exec, rel9...) - if err != nil { - return err - } - } - } - } - - isFSPolygonlocationsDone, _ := organizationRelFSPolygonlocationsCtx.Value(ctx) - if !isFSPolygonlocationsDone && o.r.FSPolygonlocations != nil { - ctx = organizationRelFSPolygonlocationsCtx.WithValue(ctx, true) - for _, r := range o.r.FSPolygonlocations { - if r.o.alreadyPersisted { - m.R.FSPolygonlocations = append(m.R.FSPolygonlocations, r.o.Build()) - } else { - rel10, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSPolygonlocations(ctx, exec, rel10...) - if err != nil { - return err - } - } - } - } - - isFSPoolsDone, _ := organizationRelFSPoolsCtx.Value(ctx) - if !isFSPoolsDone && o.r.FSPools != nil { - ctx = organizationRelFSPoolsCtx.WithValue(ctx, true) - for _, r := range o.r.FSPools { - if r.o.alreadyPersisted { - m.R.FSPools = append(m.R.FSPools, r.o.Build()) - } else { - rel11, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSPools(ctx, exec, rel11...) - if err != nil { - return err - } - } - } - } - - isFSPooldetailsDone, _ := organizationRelFSPooldetailsCtx.Value(ctx) - if !isFSPooldetailsDone && o.r.FSPooldetails != nil { - ctx = organizationRelFSPooldetailsCtx.WithValue(ctx, true) - for _, r := range o.r.FSPooldetails { - if r.o.alreadyPersisted { - m.R.FSPooldetails = append(m.R.FSPooldetails, r.o.Build()) - } else { - rel12, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSPooldetails(ctx, exec, rel12...) - if err != nil { - return err - } - } - } - } - - isFSProposedtreatmentareasDone, _ := organizationRelFSProposedtreatmentareasCtx.Value(ctx) - if !isFSProposedtreatmentareasDone && o.r.FSProposedtreatmentareas != nil { - ctx = organizationRelFSProposedtreatmentareasCtx.WithValue(ctx, true) - for _, r := range o.r.FSProposedtreatmentareas { - if r.o.alreadyPersisted { - m.R.FSProposedtreatmentareas = append(m.R.FSProposedtreatmentareas, r.o.Build()) - } else { - rel13, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSProposedtreatmentareas(ctx, exec, rel13...) - if err != nil { - return err - } - } - } - } - - isFSQamosquitoinspectionsDone, _ := organizationRelFSQamosquitoinspectionsCtx.Value(ctx) - if !isFSQamosquitoinspectionsDone && o.r.FSQamosquitoinspections != nil { - ctx = organizationRelFSQamosquitoinspectionsCtx.WithValue(ctx, true) - for _, r := range o.r.FSQamosquitoinspections { - if r.o.alreadyPersisted { - m.R.FSQamosquitoinspections = append(m.R.FSQamosquitoinspections, r.o.Build()) - } else { - rel14, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSQamosquitoinspections(ctx, exec, rel14...) - if err != nil { - return err - } - } - } - } - - isFSRodentlocationsDone, _ := organizationRelFSRodentlocationsCtx.Value(ctx) - if !isFSRodentlocationsDone && o.r.FSRodentlocations != nil { - ctx = organizationRelFSRodentlocationsCtx.WithValue(ctx, true) - for _, r := range o.r.FSRodentlocations { - if r.o.alreadyPersisted { - m.R.FSRodentlocations = append(m.R.FSRodentlocations, r.o.Build()) - } else { - rel15, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSRodentlocations(ctx, exec, rel15...) - if err != nil { - return err - } - } - } - } - - isFSSamplecollectionsDone, _ := organizationRelFSSamplecollectionsCtx.Value(ctx) - if !isFSSamplecollectionsDone && o.r.FSSamplecollections != nil { - ctx = organizationRelFSSamplecollectionsCtx.WithValue(ctx, true) - for _, r := range o.r.FSSamplecollections { - if r.o.alreadyPersisted { - m.R.FSSamplecollections = append(m.R.FSSamplecollections, r.o.Build()) - } else { - rel16, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSSamplecollections(ctx, exec, rel16...) - if err != nil { - return err - } - } - } - } - - isFSSamplelocationsDone, _ := organizationRelFSSamplelocationsCtx.Value(ctx) - if !isFSSamplelocationsDone && o.r.FSSamplelocations != nil { - ctx = organizationRelFSSamplelocationsCtx.WithValue(ctx, true) - for _, r := range o.r.FSSamplelocations { - if r.o.alreadyPersisted { - m.R.FSSamplelocations = append(m.R.FSSamplelocations, r.o.Build()) - } else { - rel17, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSSamplelocations(ctx, exec, rel17...) - if err != nil { - return err - } - } - } - } - - isFSServicerequestsDone, _ := organizationRelFSServicerequestsCtx.Value(ctx) - if !isFSServicerequestsDone && o.r.FSServicerequests != nil { - ctx = organizationRelFSServicerequestsCtx.WithValue(ctx, true) - for _, r := range o.r.FSServicerequests { - if r.o.alreadyPersisted { - m.R.FSServicerequests = append(m.R.FSServicerequests, r.o.Build()) - } else { - rel18, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSServicerequests(ctx, exec, rel18...) - if err != nil { - return err - } - } - } - } - - isFSSpeciesabundancesDone, _ := organizationRelFSSpeciesabundancesCtx.Value(ctx) - if !isFSSpeciesabundancesDone && o.r.FSSpeciesabundances != nil { - ctx = organizationRelFSSpeciesabundancesCtx.WithValue(ctx, true) - for _, r := range o.r.FSSpeciesabundances { - if r.o.alreadyPersisted { - m.R.FSSpeciesabundances = append(m.R.FSSpeciesabundances, r.o.Build()) - } else { - rel19, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSSpeciesabundances(ctx, exec, rel19...) - if err != nil { - return err - } - } - } - } - - isFSStormdrainsDone, _ := organizationRelFSStormdrainsCtx.Value(ctx) - if !isFSStormdrainsDone && o.r.FSStormdrains != nil { - ctx = organizationRelFSStormdrainsCtx.WithValue(ctx, true) - for _, r := range o.r.FSStormdrains { - if r.o.alreadyPersisted { - m.R.FSStormdrains = append(m.R.FSStormdrains, r.o.Build()) - } else { - rel20, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSStormdrains(ctx, exec, rel20...) - if err != nil { - return err - } - } - } - } - - isFSTimecardsDone, _ := organizationRelFSTimecardsCtx.Value(ctx) - if !isFSTimecardsDone && o.r.FSTimecards != nil { - ctx = organizationRelFSTimecardsCtx.WithValue(ctx, true) - for _, r := range o.r.FSTimecards { - if r.o.alreadyPersisted { - m.R.FSTimecards = append(m.R.FSTimecards, r.o.Build()) - } else { - rel21, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSTimecards(ctx, exec, rel21...) - if err != nil { - return err - } - } - } - } - - isFSTrapdataDone, _ := organizationRelFSTrapdataCtx.Value(ctx) - if !isFSTrapdataDone && o.r.FSTrapdata != nil { - ctx = organizationRelFSTrapdataCtx.WithValue(ctx, true) - for _, r := range o.r.FSTrapdata { - if r.o.alreadyPersisted { - m.R.FSTrapdata = append(m.R.FSTrapdata, r.o.Build()) - } else { - rel22, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSTrapdata(ctx, exec, rel22...) - if err != nil { - return err - } - } - } - } - - isFSTraplocationsDone, _ := organizationRelFSTraplocationsCtx.Value(ctx) - if !isFSTraplocationsDone && o.r.FSTraplocations != nil { - ctx = organizationRelFSTraplocationsCtx.WithValue(ctx, true) - for _, r := range o.r.FSTraplocations { - if r.o.alreadyPersisted { - m.R.FSTraplocations = append(m.R.FSTraplocations, r.o.Build()) - } else { - rel23, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSTraplocations(ctx, exec, rel23...) - if err != nil { - return err - } - } - } - } - - isFSTreatmentsDone, _ := organizationRelFSTreatmentsCtx.Value(ctx) - if !isFSTreatmentsDone && o.r.FSTreatments != nil { - ctx = organizationRelFSTreatmentsCtx.WithValue(ctx, true) - for _, r := range o.r.FSTreatments { - if r.o.alreadyPersisted { - m.R.FSTreatments = append(m.R.FSTreatments, r.o.Build()) - } else { - rel24, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSTreatments(ctx, exec, rel24...) - if err != nil { - return err - } - } - } - } - - isFSTreatmentareasDone, _ := organizationRelFSTreatmentareasCtx.Value(ctx) - if !isFSTreatmentareasDone && o.r.FSTreatmentareas != nil { - ctx = organizationRelFSTreatmentareasCtx.WithValue(ctx, true) - for _, r := range o.r.FSTreatmentareas { - if r.o.alreadyPersisted { - m.R.FSTreatmentareas = append(m.R.FSTreatmentareas, r.o.Build()) - } else { - rel25, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSTreatmentareas(ctx, exec, rel25...) - if err != nil { - return err - } - } - } - } - - isFSZonesDone, _ := organizationRelFSZonesCtx.Value(ctx) - if !isFSZonesDone && o.r.FSZones != nil { - ctx = organizationRelFSZonesCtx.WithValue(ctx, true) - for _, r := range o.r.FSZones { - if r.o.alreadyPersisted { - m.R.FSZones = append(m.R.FSZones, r.o.Build()) - } else { - rel26, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFSZones(ctx, exec, rel26...) - if err != nil { - return err - } - } - } - } - - isFSZones2sDone, _ := organizationRelFSZones2sCtx.Value(ctx) - if !isFSZones2sDone && o.r.FSZones2s != nil { - ctx = organizationRelFSZones2sCtx.WithValue(ctx, true) - for _, r := range o.r.FSZones2s { - if r.o.alreadyPersisted { - m.R.FSZones2s = append(m.R.FSZones2s, r.o.Build()) } else { rel27, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachFSZones2s(ctx, exec, rel27...) + err = m.AttachFieldseekerSyncs(ctx, exec, rel27...) if err != nil { return err } @@ -1759,19 +1309,19 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu } } - isHistoryContainerrelatesDone, _ := organizationRelHistoryContainerrelatesCtx.Value(ctx) - if !isHistoryContainerrelatesDone && o.r.HistoryContainerrelates != nil { - ctx = organizationRelHistoryContainerrelatesCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryContainerrelates { + isNoteAudiosDone, _ := organizationRelNoteAudiosCtx.Value(ctx) + if !isNoteAudiosDone && o.r.NoteAudios != nil { + ctx = organizationRelNoteAudiosCtx.WithValue(ctx, true) + for _, r := range o.r.NoteAudios { if r.o.alreadyPersisted { - m.R.HistoryContainerrelates = append(m.R.HistoryContainerrelates, r.o.Build()) + m.R.NoteAudios = append(m.R.NoteAudios, r.o.Build()) } else { rel29, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryContainerrelates(ctx, exec, rel29...) + err = m.AttachNoteAudios(ctx, exec, rel29...) if err != nil { return err } @@ -1779,519 +1329,19 @@ func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Execu } } - isHistoryFieldscoutinglogsDone, _ := organizationRelHistoryFieldscoutinglogsCtx.Value(ctx) - if !isHistoryFieldscoutinglogsDone && o.r.HistoryFieldscoutinglogs != nil { - ctx = organizationRelHistoryFieldscoutinglogsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryFieldscoutinglogs { + isNoteImagesDone, _ := organizationRelNoteImagesCtx.Value(ctx) + if !isNoteImagesDone && o.r.NoteImages != nil { + ctx = organizationRelNoteImagesCtx.WithValue(ctx, true) + for _, r := range o.r.NoteImages { if r.o.alreadyPersisted { - m.R.HistoryFieldscoutinglogs = append(m.R.HistoryFieldscoutinglogs, r.o.Build()) + m.R.NoteImages = append(m.R.NoteImages, r.o.Build()) } else { rel30, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachHistoryFieldscoutinglogs(ctx, exec, rel30...) - if err != nil { - return err - } - } - } - } - - isHistoryHabitatrelatesDone, _ := organizationRelHistoryHabitatrelatesCtx.Value(ctx) - if !isHistoryHabitatrelatesDone && o.r.HistoryHabitatrelates != nil { - ctx = organizationRelHistoryHabitatrelatesCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryHabitatrelates { - if r.o.alreadyPersisted { - m.R.HistoryHabitatrelates = append(m.R.HistoryHabitatrelates, r.o.Build()) - } else { - rel31, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryHabitatrelates(ctx, exec, rel31...) - if err != nil { - return err - } - } - } - } - - isHistoryInspectionsamplesDone, _ := organizationRelHistoryInspectionsamplesCtx.Value(ctx) - if !isHistoryInspectionsamplesDone && o.r.HistoryInspectionsamples != nil { - ctx = organizationRelHistoryInspectionsamplesCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryInspectionsamples { - if r.o.alreadyPersisted { - m.R.HistoryInspectionsamples = append(m.R.HistoryInspectionsamples, r.o.Build()) - } else { - rel32, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryInspectionsamples(ctx, exec, rel32...) - if err != nil { - return err - } - } - } - } - - isHistoryInspectionsampledetailsDone, _ := organizationRelHistoryInspectionsampledetailsCtx.Value(ctx) - if !isHistoryInspectionsampledetailsDone && o.r.HistoryInspectionsampledetails != nil { - ctx = organizationRelHistoryInspectionsampledetailsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryInspectionsampledetails { - if r.o.alreadyPersisted { - m.R.HistoryInspectionsampledetails = append(m.R.HistoryInspectionsampledetails, r.o.Build()) - } else { - rel33, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryInspectionsampledetails(ctx, exec, rel33...) - if err != nil { - return err - } - } - } - } - - isHistoryLinelocationsDone, _ := organizationRelHistoryLinelocationsCtx.Value(ctx) - if !isHistoryLinelocationsDone && o.r.HistoryLinelocations != nil { - ctx = organizationRelHistoryLinelocationsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryLinelocations { - if r.o.alreadyPersisted { - m.R.HistoryLinelocations = append(m.R.HistoryLinelocations, r.o.Build()) - } else { - rel34, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryLinelocations(ctx, exec, rel34...) - if err != nil { - return err - } - } - } - } - - isHistoryLocationtrackingsDone, _ := organizationRelHistoryLocationtrackingsCtx.Value(ctx) - if !isHistoryLocationtrackingsDone && o.r.HistoryLocationtrackings != nil { - ctx = organizationRelHistoryLocationtrackingsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryLocationtrackings { - if r.o.alreadyPersisted { - m.R.HistoryLocationtrackings = append(m.R.HistoryLocationtrackings, r.o.Build()) - } else { - rel35, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryLocationtrackings(ctx, exec, rel35...) - if err != nil { - return err - } - } - } - } - - isHistoryMosquitoinspectionsDone, _ := organizationRelHistoryMosquitoinspectionsCtx.Value(ctx) - if !isHistoryMosquitoinspectionsDone && o.r.HistoryMosquitoinspections != nil { - ctx = organizationRelHistoryMosquitoinspectionsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryMosquitoinspections { - if r.o.alreadyPersisted { - m.R.HistoryMosquitoinspections = append(m.R.HistoryMosquitoinspections, r.o.Build()) - } else { - rel36, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryMosquitoinspections(ctx, exec, rel36...) - if err != nil { - return err - } - } - } - } - - isHistoryPointlocationsDone, _ := organizationRelHistoryPointlocationsCtx.Value(ctx) - if !isHistoryPointlocationsDone && o.r.HistoryPointlocations != nil { - ctx = organizationRelHistoryPointlocationsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryPointlocations { - if r.o.alreadyPersisted { - m.R.HistoryPointlocations = append(m.R.HistoryPointlocations, r.o.Build()) - } else { - rel37, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryPointlocations(ctx, exec, rel37...) - if err != nil { - return err - } - } - } - } - - isHistoryPolygonlocationsDone, _ := organizationRelHistoryPolygonlocationsCtx.Value(ctx) - if !isHistoryPolygonlocationsDone && o.r.HistoryPolygonlocations != nil { - ctx = organizationRelHistoryPolygonlocationsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryPolygonlocations { - if r.o.alreadyPersisted { - m.R.HistoryPolygonlocations = append(m.R.HistoryPolygonlocations, r.o.Build()) - } else { - rel38, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryPolygonlocations(ctx, exec, rel38...) - if err != nil { - return err - } - } - } - } - - isHistoryPoolsDone, _ := organizationRelHistoryPoolsCtx.Value(ctx) - if !isHistoryPoolsDone && o.r.HistoryPools != nil { - ctx = organizationRelHistoryPoolsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryPools { - if r.o.alreadyPersisted { - m.R.HistoryPools = append(m.R.HistoryPools, r.o.Build()) - } else { - rel39, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryPools(ctx, exec, rel39...) - if err != nil { - return err - } - } - } - } - - isHistoryPooldetailsDone, _ := organizationRelHistoryPooldetailsCtx.Value(ctx) - if !isHistoryPooldetailsDone && o.r.HistoryPooldetails != nil { - ctx = organizationRelHistoryPooldetailsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryPooldetails { - if r.o.alreadyPersisted { - m.R.HistoryPooldetails = append(m.R.HistoryPooldetails, r.o.Build()) - } else { - rel40, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryPooldetails(ctx, exec, rel40...) - if err != nil { - return err - } - } - } - } - - isHistoryProposedtreatmentareasDone, _ := organizationRelHistoryProposedtreatmentareasCtx.Value(ctx) - if !isHistoryProposedtreatmentareasDone && o.r.HistoryProposedtreatmentareas != nil { - ctx = organizationRelHistoryProposedtreatmentareasCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryProposedtreatmentareas { - if r.o.alreadyPersisted { - m.R.HistoryProposedtreatmentareas = append(m.R.HistoryProposedtreatmentareas, r.o.Build()) - } else { - rel41, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryProposedtreatmentareas(ctx, exec, rel41...) - if err != nil { - return err - } - } - } - } - - isHistoryQamosquitoinspectionsDone, _ := organizationRelHistoryQamosquitoinspectionsCtx.Value(ctx) - if !isHistoryQamosquitoinspectionsDone && o.r.HistoryQamosquitoinspections != nil { - ctx = organizationRelHistoryQamosquitoinspectionsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryQamosquitoinspections { - if r.o.alreadyPersisted { - m.R.HistoryQamosquitoinspections = append(m.R.HistoryQamosquitoinspections, r.o.Build()) - } else { - rel42, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryQamosquitoinspections(ctx, exec, rel42...) - if err != nil { - return err - } - } - } - } - - isHistoryRodentlocationsDone, _ := organizationRelHistoryRodentlocationsCtx.Value(ctx) - if !isHistoryRodentlocationsDone && o.r.HistoryRodentlocations != nil { - ctx = organizationRelHistoryRodentlocationsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryRodentlocations { - if r.o.alreadyPersisted { - m.R.HistoryRodentlocations = append(m.R.HistoryRodentlocations, r.o.Build()) - } else { - rel43, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryRodentlocations(ctx, exec, rel43...) - if err != nil { - return err - } - } - } - } - - isHistorySamplecollectionsDone, _ := organizationRelHistorySamplecollectionsCtx.Value(ctx) - if !isHistorySamplecollectionsDone && o.r.HistorySamplecollections != nil { - ctx = organizationRelHistorySamplecollectionsCtx.WithValue(ctx, true) - for _, r := range o.r.HistorySamplecollections { - if r.o.alreadyPersisted { - m.R.HistorySamplecollections = append(m.R.HistorySamplecollections, r.o.Build()) - } else { - rel44, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistorySamplecollections(ctx, exec, rel44...) - if err != nil { - return err - } - } - } - } - - isHistorySamplelocationsDone, _ := organizationRelHistorySamplelocationsCtx.Value(ctx) - if !isHistorySamplelocationsDone && o.r.HistorySamplelocations != nil { - ctx = organizationRelHistorySamplelocationsCtx.WithValue(ctx, true) - for _, r := range o.r.HistorySamplelocations { - if r.o.alreadyPersisted { - m.R.HistorySamplelocations = append(m.R.HistorySamplelocations, r.o.Build()) - } else { - rel45, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistorySamplelocations(ctx, exec, rel45...) - if err != nil { - return err - } - } - } - } - - isHistoryServicerequestsDone, _ := organizationRelHistoryServicerequestsCtx.Value(ctx) - if !isHistoryServicerequestsDone && o.r.HistoryServicerequests != nil { - ctx = organizationRelHistoryServicerequestsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryServicerequests { - if r.o.alreadyPersisted { - m.R.HistoryServicerequests = append(m.R.HistoryServicerequests, r.o.Build()) - } else { - rel46, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryServicerequests(ctx, exec, rel46...) - if err != nil { - return err - } - } - } - } - - isHistorySpeciesabundancesDone, _ := organizationRelHistorySpeciesabundancesCtx.Value(ctx) - if !isHistorySpeciesabundancesDone && o.r.HistorySpeciesabundances != nil { - ctx = organizationRelHistorySpeciesabundancesCtx.WithValue(ctx, true) - for _, r := range o.r.HistorySpeciesabundances { - if r.o.alreadyPersisted { - m.R.HistorySpeciesabundances = append(m.R.HistorySpeciesabundances, r.o.Build()) - } else { - rel47, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistorySpeciesabundances(ctx, exec, rel47...) - if err != nil { - return err - } - } - } - } - - isHistoryStormdrainsDone, _ := organizationRelHistoryStormdrainsCtx.Value(ctx) - if !isHistoryStormdrainsDone && o.r.HistoryStormdrains != nil { - ctx = organizationRelHistoryStormdrainsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryStormdrains { - if r.o.alreadyPersisted { - m.R.HistoryStormdrains = append(m.R.HistoryStormdrains, r.o.Build()) - } else { - rel48, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryStormdrains(ctx, exec, rel48...) - if err != nil { - return err - } - } - } - } - - isHistoryTimecardsDone, _ := organizationRelHistoryTimecardsCtx.Value(ctx) - if !isHistoryTimecardsDone && o.r.HistoryTimecards != nil { - ctx = organizationRelHistoryTimecardsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryTimecards { - if r.o.alreadyPersisted { - m.R.HistoryTimecards = append(m.R.HistoryTimecards, r.o.Build()) - } else { - rel49, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryTimecards(ctx, exec, rel49...) - if err != nil { - return err - } - } - } - } - - isHistoryTrapdataDone, _ := organizationRelHistoryTrapdataCtx.Value(ctx) - if !isHistoryTrapdataDone && o.r.HistoryTrapdata != nil { - ctx = organizationRelHistoryTrapdataCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryTrapdata { - if r.o.alreadyPersisted { - m.R.HistoryTrapdata = append(m.R.HistoryTrapdata, r.o.Build()) - } else { - rel50, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryTrapdata(ctx, exec, rel50...) - if err != nil { - return err - } - } - } - } - - isHistoryTraplocationsDone, _ := organizationRelHistoryTraplocationsCtx.Value(ctx) - if !isHistoryTraplocationsDone && o.r.HistoryTraplocations != nil { - ctx = organizationRelHistoryTraplocationsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryTraplocations { - if r.o.alreadyPersisted { - m.R.HistoryTraplocations = append(m.R.HistoryTraplocations, r.o.Build()) - } else { - rel51, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryTraplocations(ctx, exec, rel51...) - if err != nil { - return err - } - } - } - } - - isHistoryTreatmentsDone, _ := organizationRelHistoryTreatmentsCtx.Value(ctx) - if !isHistoryTreatmentsDone && o.r.HistoryTreatments != nil { - ctx = organizationRelHistoryTreatmentsCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryTreatments { - if r.o.alreadyPersisted { - m.R.HistoryTreatments = append(m.R.HistoryTreatments, r.o.Build()) - } else { - rel52, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryTreatments(ctx, exec, rel52...) - if err != nil { - return err - } - } - } - } - - isHistoryTreatmentareasDone, _ := organizationRelHistoryTreatmentareasCtx.Value(ctx) - if !isHistoryTreatmentareasDone && o.r.HistoryTreatmentareas != nil { - ctx = organizationRelHistoryTreatmentareasCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryTreatmentareas { - if r.o.alreadyPersisted { - m.R.HistoryTreatmentareas = append(m.R.HistoryTreatmentareas, r.o.Build()) - } else { - rel53, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryTreatmentareas(ctx, exec, rel53...) - if err != nil { - return err - } - } - } - } - - isHistoryZonesDone, _ := organizationRelHistoryZonesCtx.Value(ctx) - if !isHistoryZonesDone && o.r.HistoryZones != nil { - ctx = organizationRelHistoryZonesCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryZones { - if r.o.alreadyPersisted { - m.R.HistoryZones = append(m.R.HistoryZones, r.o.Build()) - } else { - rel54, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryZones(ctx, exec, rel54...) - if err != nil { - return err - } - } - } - } - - isHistoryZones2sDone, _ := organizationRelHistoryZones2sCtx.Value(ctx) - if !isHistoryZones2sDone && o.r.HistoryZones2s != nil { - ctx = organizationRelHistoryZones2sCtx.WithValue(ctx, true) - for _, r := range o.r.HistoryZones2s { - if r.o.alreadyPersisted { - m.R.HistoryZones2s = append(m.R.HistoryZones2s, r.o.Build()) - } else { - rel55, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHistoryZones2s(ctx, exec, rel55...) + err = m.AttachNoteImages(ctx, exec, rel30...) if err != nil { return err } @@ -2306,12 +1356,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 { - rel56, err := r.o.CreateMany(ctx, exec, r.number) + rel31, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachUser(ctx, exec, rel56...) + err = m.AttachUser(ctx, exec, rel31...) if err != nil { return err } @@ -2671,6 +1721,1302 @@ func (m organizationMods) WithParentsCascading() OrganizationMod { }) } +func (m organizationMods) WithContainerrelates(number int, related *FieldseekerContainerrelateTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Containerrelates = []*organizationRContainerrelatesR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewContainerrelates(number int, mods ...FieldseekerContainerrelateMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerContainerrelateWithContext(ctx, mods...) + m.WithContainerrelates(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddContainerrelates(number int, related *FieldseekerContainerrelateTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Containerrelates = append(o.r.Containerrelates, &organizationRContainerrelatesR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewContainerrelates(number int, mods ...FieldseekerContainerrelateMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerContainerrelateWithContext(ctx, mods...) + m.AddContainerrelates(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingContainerrelates(existingModels ...*models.FieldseekerContainerrelate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Containerrelates = append(o.r.Containerrelates, &organizationRContainerrelatesR{ + o: o.f.FromExistingFieldseekerContainerrelate(em), + }) + } + }) +} + +func (m organizationMods) WithoutContainerrelates() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Containerrelates = nil + }) +} + +func (m organizationMods) WithFieldscoutinglogs(number int, related *FieldseekerFieldscoutinglogTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Fieldscoutinglogs = []*organizationRFieldscoutinglogsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewFieldscoutinglogs(number int, mods ...FieldseekerFieldscoutinglogMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerFieldscoutinglogWithContext(ctx, mods...) + m.WithFieldscoutinglogs(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddFieldscoutinglogs(number int, related *FieldseekerFieldscoutinglogTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Fieldscoutinglogs = append(o.r.Fieldscoutinglogs, &organizationRFieldscoutinglogsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewFieldscoutinglogs(number int, mods ...FieldseekerFieldscoutinglogMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerFieldscoutinglogWithContext(ctx, mods...) + m.AddFieldscoutinglogs(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingFieldscoutinglogs(existingModels ...*models.FieldseekerFieldscoutinglog) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Fieldscoutinglogs = append(o.r.Fieldscoutinglogs, &organizationRFieldscoutinglogsR{ + o: o.f.FromExistingFieldseekerFieldscoutinglog(em), + }) + } + }) +} + +func (m organizationMods) WithoutFieldscoutinglogs() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Fieldscoutinglogs = nil + }) +} + +func (m organizationMods) WithHabitatrelates(number int, related *FieldseekerHabitatrelateTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Habitatrelates = []*organizationRHabitatrelatesR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewHabitatrelates(number int, mods ...FieldseekerHabitatrelateMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerHabitatrelateWithContext(ctx, mods...) + m.WithHabitatrelates(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddHabitatrelates(number int, related *FieldseekerHabitatrelateTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Habitatrelates = append(o.r.Habitatrelates, &organizationRHabitatrelatesR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewHabitatrelates(number int, mods ...FieldseekerHabitatrelateMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerHabitatrelateWithContext(ctx, mods...) + m.AddHabitatrelates(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingHabitatrelates(existingModels ...*models.FieldseekerHabitatrelate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Habitatrelates = append(o.r.Habitatrelates, &organizationRHabitatrelatesR{ + o: o.f.FromExistingFieldseekerHabitatrelate(em), + }) + } + }) +} + +func (m organizationMods) WithoutHabitatrelates() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Habitatrelates = nil + }) +} + +func (m organizationMods) WithInspectionsamples(number int, related *FieldseekerInspectionsampleTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Inspectionsamples = []*organizationRInspectionsamplesR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewInspectionsamples(number int, mods ...FieldseekerInspectionsampleMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerInspectionsampleWithContext(ctx, mods...) + m.WithInspectionsamples(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddInspectionsamples(number int, related *FieldseekerInspectionsampleTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Inspectionsamples = append(o.r.Inspectionsamples, &organizationRInspectionsamplesR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewInspectionsamples(number int, mods ...FieldseekerInspectionsampleMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerInspectionsampleWithContext(ctx, mods...) + m.AddInspectionsamples(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingInspectionsamples(existingModels ...*models.FieldseekerInspectionsample) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Inspectionsamples = append(o.r.Inspectionsamples, &organizationRInspectionsamplesR{ + o: o.f.FromExistingFieldseekerInspectionsample(em), + }) + } + }) +} + +func (m organizationMods) WithoutInspectionsamples() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Inspectionsamples = nil + }) +} + +func (m organizationMods) WithInspectionsampledetails(number int, related *FieldseekerInspectionsampledetailTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Inspectionsampledetails = []*organizationRInspectionsampledetailsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewInspectionsampledetails(number int, mods ...FieldseekerInspectionsampledetailMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerInspectionsampledetailWithContext(ctx, mods...) + m.WithInspectionsampledetails(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddInspectionsampledetails(number int, related *FieldseekerInspectionsampledetailTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Inspectionsampledetails = append(o.r.Inspectionsampledetails, &organizationRInspectionsampledetailsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewInspectionsampledetails(number int, mods ...FieldseekerInspectionsampledetailMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerInspectionsampledetailWithContext(ctx, mods...) + m.AddInspectionsampledetails(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingInspectionsampledetails(existingModels ...*models.FieldseekerInspectionsampledetail) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Inspectionsampledetails = append(o.r.Inspectionsampledetails, &organizationRInspectionsampledetailsR{ + o: o.f.FromExistingFieldseekerInspectionsampledetail(em), + }) + } + }) +} + +func (m organizationMods) WithoutInspectionsampledetails() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Inspectionsampledetails = nil + }) +} + +func (m organizationMods) WithLinelocations(number int, related *FieldseekerLinelocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Linelocations = []*organizationRLinelocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewLinelocations(number int, mods ...FieldseekerLinelocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerLinelocationWithContext(ctx, mods...) + m.WithLinelocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddLinelocations(number int, related *FieldseekerLinelocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Linelocations = append(o.r.Linelocations, &organizationRLinelocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewLinelocations(number int, mods ...FieldseekerLinelocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerLinelocationWithContext(ctx, mods...) + m.AddLinelocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingLinelocations(existingModels ...*models.FieldseekerLinelocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Linelocations = append(o.r.Linelocations, &organizationRLinelocationsR{ + o: o.f.FromExistingFieldseekerLinelocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutLinelocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Linelocations = nil + }) +} + +func (m organizationMods) WithLocationtrackings(number int, related *FieldseekerLocationtrackingTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Locationtrackings = []*organizationRLocationtrackingsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewLocationtrackings(number int, mods ...FieldseekerLocationtrackingMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerLocationtrackingWithContext(ctx, mods...) + m.WithLocationtrackings(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddLocationtrackings(number int, related *FieldseekerLocationtrackingTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Locationtrackings = append(o.r.Locationtrackings, &organizationRLocationtrackingsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewLocationtrackings(number int, mods ...FieldseekerLocationtrackingMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerLocationtrackingWithContext(ctx, mods...) + m.AddLocationtrackings(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingLocationtrackings(existingModels ...*models.FieldseekerLocationtracking) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Locationtrackings = append(o.r.Locationtrackings, &organizationRLocationtrackingsR{ + o: o.f.FromExistingFieldseekerLocationtracking(em), + }) + } + }) +} + +func (m organizationMods) WithoutLocationtrackings() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Locationtrackings = nil + }) +} + +func (m organizationMods) WithMosquitoinspections(number int, related *FieldseekerMosquitoinspectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Mosquitoinspections = []*organizationRMosquitoinspectionsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewMosquitoinspections(number int, mods ...FieldseekerMosquitoinspectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerMosquitoinspectionWithContext(ctx, mods...) + m.WithMosquitoinspections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddMosquitoinspections(number int, related *FieldseekerMosquitoinspectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Mosquitoinspections = append(o.r.Mosquitoinspections, &organizationRMosquitoinspectionsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewMosquitoinspections(number int, mods ...FieldseekerMosquitoinspectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerMosquitoinspectionWithContext(ctx, mods...) + m.AddMosquitoinspections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingMosquitoinspections(existingModels ...*models.FieldseekerMosquitoinspection) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Mosquitoinspections = append(o.r.Mosquitoinspections, &organizationRMosquitoinspectionsR{ + o: o.f.FromExistingFieldseekerMosquitoinspection(em), + }) + } + }) +} + +func (m organizationMods) WithoutMosquitoinspections() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Mosquitoinspections = nil + }) +} + +func (m organizationMods) WithPointlocations(number int, related *FieldseekerPointlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Pointlocations = []*organizationRPointlocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewPointlocations(number int, mods ...FieldseekerPointlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerPointlocationWithContext(ctx, mods...) + m.WithPointlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddPointlocations(number int, related *FieldseekerPointlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Pointlocations = append(o.r.Pointlocations, &organizationRPointlocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewPointlocations(number int, mods ...FieldseekerPointlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerPointlocationWithContext(ctx, mods...) + m.AddPointlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingPointlocations(existingModels ...*models.FieldseekerPointlocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Pointlocations = append(o.r.Pointlocations, &organizationRPointlocationsR{ + o: o.f.FromExistingFieldseekerPointlocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutPointlocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Pointlocations = nil + }) +} + +func (m organizationMods) WithPolygonlocations(number int, related *FieldseekerPolygonlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Polygonlocations = []*organizationRPolygonlocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewPolygonlocations(number int, mods ...FieldseekerPolygonlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerPolygonlocationWithContext(ctx, mods...) + m.WithPolygonlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddPolygonlocations(number int, related *FieldseekerPolygonlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Polygonlocations = append(o.r.Polygonlocations, &organizationRPolygonlocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewPolygonlocations(number int, mods ...FieldseekerPolygonlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerPolygonlocationWithContext(ctx, mods...) + m.AddPolygonlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingPolygonlocations(existingModels ...*models.FieldseekerPolygonlocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Polygonlocations = append(o.r.Polygonlocations, &organizationRPolygonlocationsR{ + o: o.f.FromExistingFieldseekerPolygonlocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutPolygonlocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Polygonlocations = nil + }) +} + +func (m organizationMods) WithPools(number int, related *FieldseekerPoolTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Pools = []*organizationRPoolsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewPools(number int, mods ...FieldseekerPoolMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerPoolWithContext(ctx, mods...) + m.WithPools(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddPools(number int, related *FieldseekerPoolTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Pools = append(o.r.Pools, &organizationRPoolsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewPools(number int, mods ...FieldseekerPoolMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerPoolWithContext(ctx, mods...) + m.AddPools(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingPools(existingModels ...*models.FieldseekerPool) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Pools = append(o.r.Pools, &organizationRPoolsR{ + o: o.f.FromExistingFieldseekerPool(em), + }) + } + }) +} + +func (m organizationMods) WithoutPools() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Pools = nil + }) +} + +func (m organizationMods) WithPooldetails(number int, related *FieldseekerPooldetailTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Pooldetails = []*organizationRPooldetailsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewPooldetails(number int, mods ...FieldseekerPooldetailMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerPooldetailWithContext(ctx, mods...) + m.WithPooldetails(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddPooldetails(number int, related *FieldseekerPooldetailTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Pooldetails = append(o.r.Pooldetails, &organizationRPooldetailsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewPooldetails(number int, mods ...FieldseekerPooldetailMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerPooldetailWithContext(ctx, mods...) + m.AddPooldetails(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingPooldetails(existingModels ...*models.FieldseekerPooldetail) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Pooldetails = append(o.r.Pooldetails, &organizationRPooldetailsR{ + o: o.f.FromExistingFieldseekerPooldetail(em), + }) + } + }) +} + +func (m organizationMods) WithoutPooldetails() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Pooldetails = nil + }) +} + +func (m organizationMods) WithProposedtreatmentareas(number int, related *FieldseekerProposedtreatmentareaTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Proposedtreatmentareas = []*organizationRProposedtreatmentareasR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewProposedtreatmentareas(number int, mods ...FieldseekerProposedtreatmentareaMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerProposedtreatmentareaWithContext(ctx, mods...) + m.WithProposedtreatmentareas(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddProposedtreatmentareas(number int, related *FieldseekerProposedtreatmentareaTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Proposedtreatmentareas = append(o.r.Proposedtreatmentareas, &organizationRProposedtreatmentareasR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewProposedtreatmentareas(number int, mods ...FieldseekerProposedtreatmentareaMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerProposedtreatmentareaWithContext(ctx, mods...) + m.AddProposedtreatmentareas(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingProposedtreatmentareas(existingModels ...*models.FieldseekerProposedtreatmentarea) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Proposedtreatmentareas = append(o.r.Proposedtreatmentareas, &organizationRProposedtreatmentareasR{ + o: o.f.FromExistingFieldseekerProposedtreatmentarea(em), + }) + } + }) +} + +func (m organizationMods) WithoutProposedtreatmentareas() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Proposedtreatmentareas = nil + }) +} + +func (m organizationMods) WithQamosquitoinspections(number int, related *FieldseekerQamosquitoinspectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Qamosquitoinspections = []*organizationRQamosquitoinspectionsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewQamosquitoinspections(number int, mods ...FieldseekerQamosquitoinspectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerQamosquitoinspectionWithContext(ctx, mods...) + m.WithQamosquitoinspections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddQamosquitoinspections(number int, related *FieldseekerQamosquitoinspectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Qamosquitoinspections = append(o.r.Qamosquitoinspections, &organizationRQamosquitoinspectionsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewQamosquitoinspections(number int, mods ...FieldseekerQamosquitoinspectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerQamosquitoinspectionWithContext(ctx, mods...) + m.AddQamosquitoinspections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingQamosquitoinspections(existingModels ...*models.FieldseekerQamosquitoinspection) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Qamosquitoinspections = append(o.r.Qamosquitoinspections, &organizationRQamosquitoinspectionsR{ + o: o.f.FromExistingFieldseekerQamosquitoinspection(em), + }) + } + }) +} + +func (m organizationMods) WithoutQamosquitoinspections() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Qamosquitoinspections = nil + }) +} + +func (m organizationMods) WithRodentlocations(number int, related *FieldseekerRodentlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Rodentlocations = []*organizationRRodentlocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewRodentlocations(number int, mods ...FieldseekerRodentlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerRodentlocationWithContext(ctx, mods...) + m.WithRodentlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddRodentlocations(number int, related *FieldseekerRodentlocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Rodentlocations = append(o.r.Rodentlocations, &organizationRRodentlocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewRodentlocations(number int, mods ...FieldseekerRodentlocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerRodentlocationWithContext(ctx, mods...) + m.AddRodentlocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingRodentlocations(existingModels ...*models.FieldseekerRodentlocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Rodentlocations = append(o.r.Rodentlocations, &organizationRRodentlocationsR{ + o: o.f.FromExistingFieldseekerRodentlocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutRodentlocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Rodentlocations = nil + }) +} + +func (m organizationMods) WithSamplecollections(number int, related *FieldseekerSamplecollectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Samplecollections = []*organizationRSamplecollectionsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewSamplecollections(number int, mods ...FieldseekerSamplecollectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerSamplecollectionWithContext(ctx, mods...) + m.WithSamplecollections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddSamplecollections(number int, related *FieldseekerSamplecollectionTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Samplecollections = append(o.r.Samplecollections, &organizationRSamplecollectionsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewSamplecollections(number int, mods ...FieldseekerSamplecollectionMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerSamplecollectionWithContext(ctx, mods...) + m.AddSamplecollections(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingSamplecollections(existingModels ...*models.FieldseekerSamplecollection) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Samplecollections = append(o.r.Samplecollections, &organizationRSamplecollectionsR{ + o: o.f.FromExistingFieldseekerSamplecollection(em), + }) + } + }) +} + +func (m organizationMods) WithoutSamplecollections() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Samplecollections = nil + }) +} + +func (m organizationMods) WithSamplelocations(number int, related *FieldseekerSamplelocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Samplelocations = []*organizationRSamplelocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewSamplelocations(number int, mods ...FieldseekerSamplelocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerSamplelocationWithContext(ctx, mods...) + m.WithSamplelocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddSamplelocations(number int, related *FieldseekerSamplelocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Samplelocations = append(o.r.Samplelocations, &organizationRSamplelocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewSamplelocations(number int, mods ...FieldseekerSamplelocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerSamplelocationWithContext(ctx, mods...) + m.AddSamplelocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingSamplelocations(existingModels ...*models.FieldseekerSamplelocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Samplelocations = append(o.r.Samplelocations, &organizationRSamplelocationsR{ + o: o.f.FromExistingFieldseekerSamplelocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutSamplelocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Samplelocations = nil + }) +} + +func (m organizationMods) WithServicerequests(number int, related *FieldseekerServicerequestTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Servicerequests = []*organizationRServicerequestsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewServicerequests(number int, mods ...FieldseekerServicerequestMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerServicerequestWithContext(ctx, mods...) + m.WithServicerequests(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddServicerequests(number int, related *FieldseekerServicerequestTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Servicerequests = append(o.r.Servicerequests, &organizationRServicerequestsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewServicerequests(number int, mods ...FieldseekerServicerequestMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerServicerequestWithContext(ctx, mods...) + m.AddServicerequests(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingServicerequests(existingModels ...*models.FieldseekerServicerequest) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Servicerequests = append(o.r.Servicerequests, &organizationRServicerequestsR{ + o: o.f.FromExistingFieldseekerServicerequest(em), + }) + } + }) +} + +func (m organizationMods) WithoutServicerequests() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Servicerequests = nil + }) +} + +func (m organizationMods) WithSpeciesabundances(number int, related *FieldseekerSpeciesabundanceTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Speciesabundances = []*organizationRSpeciesabundancesR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewSpeciesabundances(number int, mods ...FieldseekerSpeciesabundanceMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerSpeciesabundanceWithContext(ctx, mods...) + m.WithSpeciesabundances(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddSpeciesabundances(number int, related *FieldseekerSpeciesabundanceTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Speciesabundances = append(o.r.Speciesabundances, &organizationRSpeciesabundancesR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewSpeciesabundances(number int, mods ...FieldseekerSpeciesabundanceMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerSpeciesabundanceWithContext(ctx, mods...) + m.AddSpeciesabundances(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingSpeciesabundances(existingModels ...*models.FieldseekerSpeciesabundance) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Speciesabundances = append(o.r.Speciesabundances, &organizationRSpeciesabundancesR{ + o: o.f.FromExistingFieldseekerSpeciesabundance(em), + }) + } + }) +} + +func (m organizationMods) WithoutSpeciesabundances() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Speciesabundances = nil + }) +} + +func (m organizationMods) WithStormdrains(number int, related *FieldseekerStormdrainTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Stormdrains = []*organizationRStormdrainsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewStormdrains(number int, mods ...FieldseekerStormdrainMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerStormdrainWithContext(ctx, mods...) + m.WithStormdrains(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddStormdrains(number int, related *FieldseekerStormdrainTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Stormdrains = append(o.r.Stormdrains, &organizationRStormdrainsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewStormdrains(number int, mods ...FieldseekerStormdrainMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerStormdrainWithContext(ctx, mods...) + m.AddStormdrains(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingStormdrains(existingModels ...*models.FieldseekerStormdrain) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Stormdrains = append(o.r.Stormdrains, &organizationRStormdrainsR{ + o: o.f.FromExistingFieldseekerStormdrain(em), + }) + } + }) +} + +func (m organizationMods) WithoutStormdrains() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Stormdrains = nil + }) +} + +func (m organizationMods) WithTimecards(number int, related *FieldseekerTimecardTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Timecards = []*organizationRTimecardsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewTimecards(number int, mods ...FieldseekerTimecardMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerTimecardWithContext(ctx, mods...) + m.WithTimecards(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddTimecards(number int, related *FieldseekerTimecardTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Timecards = append(o.r.Timecards, &organizationRTimecardsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewTimecards(number int, mods ...FieldseekerTimecardMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerTimecardWithContext(ctx, mods...) + m.AddTimecards(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingTimecards(existingModels ...*models.FieldseekerTimecard) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Timecards = append(o.r.Timecards, &organizationRTimecardsR{ + o: o.f.FromExistingFieldseekerTimecard(em), + }) + } + }) +} + +func (m organizationMods) WithoutTimecards() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Timecards = nil + }) +} + +func (m organizationMods) WithTrapdata(number int, related *FieldseekerTrapdatumTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Trapdata = []*organizationRTrapdataR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewTrapdata(number int, mods ...FieldseekerTrapdatumMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerTrapdatumWithContext(ctx, mods...) + m.WithTrapdata(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddTrapdata(number int, related *FieldseekerTrapdatumTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Trapdata = append(o.r.Trapdata, &organizationRTrapdataR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewTrapdata(number int, mods ...FieldseekerTrapdatumMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerTrapdatumWithContext(ctx, mods...) + m.AddTrapdata(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingTrapdata(existingModels ...*models.FieldseekerTrapdatum) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Trapdata = append(o.r.Trapdata, &organizationRTrapdataR{ + o: o.f.FromExistingFieldseekerTrapdatum(em), + }) + } + }) +} + +func (m organizationMods) WithoutTrapdata() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Trapdata = nil + }) +} + +func (m organizationMods) WithTraplocations(number int, related *FieldseekerTraplocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Traplocations = []*organizationRTraplocationsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewTraplocations(number int, mods ...FieldseekerTraplocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerTraplocationWithContext(ctx, mods...) + m.WithTraplocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddTraplocations(number int, related *FieldseekerTraplocationTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Traplocations = append(o.r.Traplocations, &organizationRTraplocationsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewTraplocations(number int, mods ...FieldseekerTraplocationMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerTraplocationWithContext(ctx, mods...) + m.AddTraplocations(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingTraplocations(existingModels ...*models.FieldseekerTraplocation) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Traplocations = append(o.r.Traplocations, &organizationRTraplocationsR{ + o: o.f.FromExistingFieldseekerTraplocation(em), + }) + } + }) +} + +func (m organizationMods) WithoutTraplocations() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Traplocations = nil + }) +} + +func (m organizationMods) WithTreatments(number int, related *FieldseekerTreatmentTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Treatments = []*organizationRTreatmentsR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewTreatments(number int, mods ...FieldseekerTreatmentMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerTreatmentWithContext(ctx, mods...) + m.WithTreatments(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddTreatments(number int, related *FieldseekerTreatmentTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Treatments = append(o.r.Treatments, &organizationRTreatmentsR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewTreatments(number int, mods ...FieldseekerTreatmentMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerTreatmentWithContext(ctx, mods...) + m.AddTreatments(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingTreatments(existingModels ...*models.FieldseekerTreatment) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Treatments = append(o.r.Treatments, &organizationRTreatmentsR{ + o: o.f.FromExistingFieldseekerTreatment(em), + }) + } + }) +} + +func (m organizationMods) WithoutTreatments() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Treatments = nil + }) +} + +func (m organizationMods) WithTreatmentareas(number int, related *FieldseekerTreatmentareaTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Treatmentareas = []*organizationRTreatmentareasR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewTreatmentareas(number int, mods ...FieldseekerTreatmentareaMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerTreatmentareaWithContext(ctx, mods...) + m.WithTreatmentareas(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddTreatmentareas(number int, related *FieldseekerTreatmentareaTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Treatmentareas = append(o.r.Treatmentareas, &organizationRTreatmentareasR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewTreatmentareas(number int, mods ...FieldseekerTreatmentareaMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerTreatmentareaWithContext(ctx, mods...) + m.AddTreatmentareas(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingTreatmentareas(existingModels ...*models.FieldseekerTreatmentarea) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Treatmentareas = append(o.r.Treatmentareas, &organizationRTreatmentareasR{ + o: o.f.FromExistingFieldseekerTreatmentarea(em), + }) + } + }) +} + +func (m organizationMods) WithoutTreatmentareas() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Treatmentareas = nil + }) +} + +func (m organizationMods) WithZones(number int, related *FieldseekerZoneTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Zones = []*organizationRZonesR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewZones(number int, mods ...FieldseekerZoneMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerZoneWithContext(ctx, mods...) + m.WithZones(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddZones(number int, related *FieldseekerZoneTemplate) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Zones = append(o.r.Zones, &organizationRZonesR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewZones(number int, mods ...FieldseekerZoneMod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerZoneWithContext(ctx, mods...) + m.AddZones(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingZones(existingModels ...*models.FieldseekerZone) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Zones = append(o.r.Zones, &organizationRZonesR{ + o: o.f.FromExistingFieldseekerZone(em), + }) + } + }) +} + +func (m organizationMods) WithoutZones() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Zones = nil + }) +} + +func (m organizationMods) WithZones2s(number int, related *FieldseekerZones2Template) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Zones2s = []*organizationRZones2sR{{ + number: number, + o: related, + }} + }) +} + +func (m organizationMods) WithNewZones2s(number int, mods ...FieldseekerZones2Mod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerZones2WithContext(ctx, mods...) + m.WithZones2s(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddZones2s(number int, related *FieldseekerZones2Template) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Zones2s = append(o.r.Zones2s, &organizationRZones2sR{ + number: number, + o: related, + }) + }) +} + +func (m organizationMods) AddNewZones2s(number int, mods ...FieldseekerZones2Mod) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + related := o.f.NewFieldseekerZones2WithContext(ctx, mods...) + m.AddZones2s(number, related).Apply(ctx, o) + }) +} + +func (m organizationMods) AddExistingZones2s(existingModels ...*models.FieldseekerZones2) OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + for _, em := range existingModels { + o.r.Zones2s = append(o.r.Zones2s, &organizationRZones2sR{ + o: o.f.FromExistingFieldseekerZones2(em), + }) + } + }) +} + +func (m organizationMods) WithoutZones2s() OrganizationMod { + return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { + o.r.Zones2s = nil + }) +} + func (m organizationMods) WithFieldseekerSyncs(number int, related *FieldseekerSyncTemplate) OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { o.r.FieldseekerSyncs = []*organizationRFieldseekerSyncsR{{ @@ -2719,1302 +3065,6 @@ func (m organizationMods) WithoutFieldseekerSyncs() OrganizationMod { }) } -func (m organizationMods) WithFSContainerrelates(number int, related *FSContainerrelateTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSContainerrelates = []*organizationRFSContainerrelatesR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSContainerrelates(number int, mods ...FSContainerrelateMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSContainerrelateWithContext(ctx, mods...) - m.WithFSContainerrelates(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSContainerrelates(number int, related *FSContainerrelateTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSContainerrelates = append(o.r.FSContainerrelates, &organizationRFSContainerrelatesR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSContainerrelates(number int, mods ...FSContainerrelateMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSContainerrelateWithContext(ctx, mods...) - m.AddFSContainerrelates(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSContainerrelates(existingModels ...*models.FSContainerrelate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSContainerrelates = append(o.r.FSContainerrelates, &organizationRFSContainerrelatesR{ - o: o.f.FromExistingFSContainerrelate(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSContainerrelates() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSContainerrelates = nil - }) -} - -func (m organizationMods) WithFSFieldscoutinglogs(number int, related *FSFieldscoutinglogTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSFieldscoutinglogs = []*organizationRFSFieldscoutinglogsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSFieldscoutinglogs(number int, mods ...FSFieldscoutinglogMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSFieldscoutinglogWithContext(ctx, mods...) - m.WithFSFieldscoutinglogs(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSFieldscoutinglogs(number int, related *FSFieldscoutinglogTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSFieldscoutinglogs = append(o.r.FSFieldscoutinglogs, &organizationRFSFieldscoutinglogsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSFieldscoutinglogs(number int, mods ...FSFieldscoutinglogMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSFieldscoutinglogWithContext(ctx, mods...) - m.AddFSFieldscoutinglogs(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSFieldscoutinglogs(existingModels ...*models.FSFieldscoutinglog) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSFieldscoutinglogs = append(o.r.FSFieldscoutinglogs, &organizationRFSFieldscoutinglogsR{ - o: o.f.FromExistingFSFieldscoutinglog(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSFieldscoutinglogs() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSFieldscoutinglogs = nil - }) -} - -func (m organizationMods) WithFSHabitatrelates(number int, related *FSHabitatrelateTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSHabitatrelates = []*organizationRFSHabitatrelatesR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSHabitatrelates(number int, mods ...FSHabitatrelateMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSHabitatrelateWithContext(ctx, mods...) - m.WithFSHabitatrelates(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSHabitatrelates(number int, related *FSHabitatrelateTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSHabitatrelates = append(o.r.FSHabitatrelates, &organizationRFSHabitatrelatesR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSHabitatrelates(number int, mods ...FSHabitatrelateMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSHabitatrelateWithContext(ctx, mods...) - m.AddFSHabitatrelates(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSHabitatrelates(existingModels ...*models.FSHabitatrelate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSHabitatrelates = append(o.r.FSHabitatrelates, &organizationRFSHabitatrelatesR{ - o: o.f.FromExistingFSHabitatrelate(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSHabitatrelates() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSHabitatrelates = nil - }) -} - -func (m organizationMods) WithFSInspectionsamples(number int, related *FSInspectionsampleTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSInspectionsamples = []*organizationRFSInspectionsamplesR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSInspectionsamples(number int, mods ...FSInspectionsampleMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSInspectionsampleWithContext(ctx, mods...) - m.WithFSInspectionsamples(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSInspectionsamples(number int, related *FSInspectionsampleTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSInspectionsamples = append(o.r.FSInspectionsamples, &organizationRFSInspectionsamplesR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSInspectionsamples(number int, mods ...FSInspectionsampleMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSInspectionsampleWithContext(ctx, mods...) - m.AddFSInspectionsamples(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSInspectionsamples(existingModels ...*models.FSInspectionsample) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSInspectionsamples = append(o.r.FSInspectionsamples, &organizationRFSInspectionsamplesR{ - o: o.f.FromExistingFSInspectionsample(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSInspectionsamples() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSInspectionsamples = nil - }) -} - -func (m organizationMods) WithFSInspectionsampledetails(number int, related *FSInspectionsampledetailTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSInspectionsampledetails = []*organizationRFSInspectionsampledetailsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSInspectionsampledetails(number int, mods ...FSInspectionsampledetailMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSInspectionsampledetailWithContext(ctx, mods...) - m.WithFSInspectionsampledetails(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSInspectionsampledetails(number int, related *FSInspectionsampledetailTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSInspectionsampledetails = append(o.r.FSInspectionsampledetails, &organizationRFSInspectionsampledetailsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSInspectionsampledetails(number int, mods ...FSInspectionsampledetailMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSInspectionsampledetailWithContext(ctx, mods...) - m.AddFSInspectionsampledetails(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSInspectionsampledetails(existingModels ...*models.FSInspectionsampledetail) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSInspectionsampledetails = append(o.r.FSInspectionsampledetails, &organizationRFSInspectionsampledetailsR{ - o: o.f.FromExistingFSInspectionsampledetail(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSInspectionsampledetails() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSInspectionsampledetails = nil - }) -} - -func (m organizationMods) WithFSLinelocations(number int, related *FSLinelocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSLinelocations = []*organizationRFSLinelocationsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSLinelocations(number int, mods ...FSLinelocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSLinelocationWithContext(ctx, mods...) - m.WithFSLinelocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSLinelocations(number int, related *FSLinelocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSLinelocations = append(o.r.FSLinelocations, &organizationRFSLinelocationsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSLinelocations(number int, mods ...FSLinelocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSLinelocationWithContext(ctx, mods...) - m.AddFSLinelocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSLinelocations(existingModels ...*models.FSLinelocation) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSLinelocations = append(o.r.FSLinelocations, &organizationRFSLinelocationsR{ - o: o.f.FromExistingFSLinelocation(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSLinelocations() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSLinelocations = nil - }) -} - -func (m organizationMods) WithFSLocationtrackings(number int, related *FSLocationtrackingTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSLocationtrackings = []*organizationRFSLocationtrackingsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSLocationtrackings(number int, mods ...FSLocationtrackingMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSLocationtrackingWithContext(ctx, mods...) - m.WithFSLocationtrackings(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSLocationtrackings(number int, related *FSLocationtrackingTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSLocationtrackings = append(o.r.FSLocationtrackings, &organizationRFSLocationtrackingsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSLocationtrackings(number int, mods ...FSLocationtrackingMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSLocationtrackingWithContext(ctx, mods...) - m.AddFSLocationtrackings(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSLocationtrackings(existingModels ...*models.FSLocationtracking) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSLocationtrackings = append(o.r.FSLocationtrackings, &organizationRFSLocationtrackingsR{ - o: o.f.FromExistingFSLocationtracking(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSLocationtrackings() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSLocationtrackings = nil - }) -} - -func (m organizationMods) WithFSMosquitoinspections(number int, related *FSMosquitoinspectionTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSMosquitoinspections = []*organizationRFSMosquitoinspectionsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSMosquitoinspections(number int, mods ...FSMosquitoinspectionMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSMosquitoinspectionWithContext(ctx, mods...) - m.WithFSMosquitoinspections(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSMosquitoinspections(number int, related *FSMosquitoinspectionTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSMosquitoinspections = append(o.r.FSMosquitoinspections, &organizationRFSMosquitoinspectionsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSMosquitoinspections(number int, mods ...FSMosquitoinspectionMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSMosquitoinspectionWithContext(ctx, mods...) - m.AddFSMosquitoinspections(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSMosquitoinspections(existingModels ...*models.FSMosquitoinspection) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSMosquitoinspections = append(o.r.FSMosquitoinspections, &organizationRFSMosquitoinspectionsR{ - o: o.f.FromExistingFSMosquitoinspection(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSMosquitoinspections() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSMosquitoinspections = nil - }) -} - -func (m organizationMods) WithFSPointlocations(number int, related *FSPointlocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSPointlocations = []*organizationRFSPointlocationsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSPointlocations(number int, mods ...FSPointlocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSPointlocationWithContext(ctx, mods...) - m.WithFSPointlocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSPointlocations(number int, related *FSPointlocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSPointlocations = append(o.r.FSPointlocations, &organizationRFSPointlocationsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSPointlocations(number int, mods ...FSPointlocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSPointlocationWithContext(ctx, mods...) - m.AddFSPointlocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSPointlocations(existingModels ...*models.FSPointlocation) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSPointlocations = append(o.r.FSPointlocations, &organizationRFSPointlocationsR{ - o: o.f.FromExistingFSPointlocation(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSPointlocations() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSPointlocations = nil - }) -} - -func (m organizationMods) WithFSPolygonlocations(number int, related *FSPolygonlocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSPolygonlocations = []*organizationRFSPolygonlocationsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSPolygonlocations(number int, mods ...FSPolygonlocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSPolygonlocationWithContext(ctx, mods...) - m.WithFSPolygonlocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSPolygonlocations(number int, related *FSPolygonlocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSPolygonlocations = append(o.r.FSPolygonlocations, &organizationRFSPolygonlocationsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSPolygonlocations(number int, mods ...FSPolygonlocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSPolygonlocationWithContext(ctx, mods...) - m.AddFSPolygonlocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSPolygonlocations(existingModels ...*models.FSPolygonlocation) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSPolygonlocations = append(o.r.FSPolygonlocations, &organizationRFSPolygonlocationsR{ - o: o.f.FromExistingFSPolygonlocation(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSPolygonlocations() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSPolygonlocations = nil - }) -} - -func (m organizationMods) WithFSPools(number int, related *FSPoolTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSPools = []*organizationRFSPoolsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSPools(number int, mods ...FSPoolMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSPoolWithContext(ctx, mods...) - m.WithFSPools(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSPools(number int, related *FSPoolTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSPools = append(o.r.FSPools, &organizationRFSPoolsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSPools(number int, mods ...FSPoolMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSPoolWithContext(ctx, mods...) - m.AddFSPools(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSPools(existingModels ...*models.FSPool) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSPools = append(o.r.FSPools, &organizationRFSPoolsR{ - o: o.f.FromExistingFSPool(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSPools() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSPools = nil - }) -} - -func (m organizationMods) WithFSPooldetails(number int, related *FSPooldetailTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSPooldetails = []*organizationRFSPooldetailsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSPooldetails(number int, mods ...FSPooldetailMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSPooldetailWithContext(ctx, mods...) - m.WithFSPooldetails(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSPooldetails(number int, related *FSPooldetailTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSPooldetails = append(o.r.FSPooldetails, &organizationRFSPooldetailsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSPooldetails(number int, mods ...FSPooldetailMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSPooldetailWithContext(ctx, mods...) - m.AddFSPooldetails(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSPooldetails(existingModels ...*models.FSPooldetail) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSPooldetails = append(o.r.FSPooldetails, &organizationRFSPooldetailsR{ - o: o.f.FromExistingFSPooldetail(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSPooldetails() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSPooldetails = nil - }) -} - -func (m organizationMods) WithFSProposedtreatmentareas(number int, related *FSProposedtreatmentareaTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSProposedtreatmentareas = []*organizationRFSProposedtreatmentareasR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSProposedtreatmentareas(number int, mods ...FSProposedtreatmentareaMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSProposedtreatmentareaWithContext(ctx, mods...) - m.WithFSProposedtreatmentareas(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSProposedtreatmentareas(number int, related *FSProposedtreatmentareaTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSProposedtreatmentareas = append(o.r.FSProposedtreatmentareas, &organizationRFSProposedtreatmentareasR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSProposedtreatmentareas(number int, mods ...FSProposedtreatmentareaMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSProposedtreatmentareaWithContext(ctx, mods...) - m.AddFSProposedtreatmentareas(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSProposedtreatmentareas(existingModels ...*models.FSProposedtreatmentarea) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSProposedtreatmentareas = append(o.r.FSProposedtreatmentareas, &organizationRFSProposedtreatmentareasR{ - o: o.f.FromExistingFSProposedtreatmentarea(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSProposedtreatmentareas() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSProposedtreatmentareas = nil - }) -} - -func (m organizationMods) WithFSQamosquitoinspections(number int, related *FSQamosquitoinspectionTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSQamosquitoinspections = []*organizationRFSQamosquitoinspectionsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSQamosquitoinspections(number int, mods ...FSQamosquitoinspectionMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSQamosquitoinspectionWithContext(ctx, mods...) - m.WithFSQamosquitoinspections(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSQamosquitoinspections(number int, related *FSQamosquitoinspectionTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSQamosquitoinspections = append(o.r.FSQamosquitoinspections, &organizationRFSQamosquitoinspectionsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSQamosquitoinspections(number int, mods ...FSQamosquitoinspectionMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSQamosquitoinspectionWithContext(ctx, mods...) - m.AddFSQamosquitoinspections(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSQamosquitoinspections(existingModels ...*models.FSQamosquitoinspection) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSQamosquitoinspections = append(o.r.FSQamosquitoinspections, &organizationRFSQamosquitoinspectionsR{ - o: o.f.FromExistingFSQamosquitoinspection(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSQamosquitoinspections() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSQamosquitoinspections = nil - }) -} - -func (m organizationMods) WithFSRodentlocations(number int, related *FSRodentlocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSRodentlocations = []*organizationRFSRodentlocationsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSRodentlocations(number int, mods ...FSRodentlocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSRodentlocationWithContext(ctx, mods...) - m.WithFSRodentlocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSRodentlocations(number int, related *FSRodentlocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSRodentlocations = append(o.r.FSRodentlocations, &organizationRFSRodentlocationsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSRodentlocations(number int, mods ...FSRodentlocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSRodentlocationWithContext(ctx, mods...) - m.AddFSRodentlocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSRodentlocations(existingModels ...*models.FSRodentlocation) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSRodentlocations = append(o.r.FSRodentlocations, &organizationRFSRodentlocationsR{ - o: o.f.FromExistingFSRodentlocation(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSRodentlocations() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSRodentlocations = nil - }) -} - -func (m organizationMods) WithFSSamplecollections(number int, related *FSSamplecollectionTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSSamplecollections = []*organizationRFSSamplecollectionsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSSamplecollections(number int, mods ...FSSamplecollectionMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSSamplecollectionWithContext(ctx, mods...) - m.WithFSSamplecollections(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSSamplecollections(number int, related *FSSamplecollectionTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSSamplecollections = append(o.r.FSSamplecollections, &organizationRFSSamplecollectionsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSSamplecollections(number int, mods ...FSSamplecollectionMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSSamplecollectionWithContext(ctx, mods...) - m.AddFSSamplecollections(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSSamplecollections(existingModels ...*models.FSSamplecollection) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSSamplecollections = append(o.r.FSSamplecollections, &organizationRFSSamplecollectionsR{ - o: o.f.FromExistingFSSamplecollection(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSSamplecollections() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSSamplecollections = nil - }) -} - -func (m organizationMods) WithFSSamplelocations(number int, related *FSSamplelocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSSamplelocations = []*organizationRFSSamplelocationsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSSamplelocations(number int, mods ...FSSamplelocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSSamplelocationWithContext(ctx, mods...) - m.WithFSSamplelocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSSamplelocations(number int, related *FSSamplelocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSSamplelocations = append(o.r.FSSamplelocations, &organizationRFSSamplelocationsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSSamplelocations(number int, mods ...FSSamplelocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSSamplelocationWithContext(ctx, mods...) - m.AddFSSamplelocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSSamplelocations(existingModels ...*models.FSSamplelocation) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSSamplelocations = append(o.r.FSSamplelocations, &organizationRFSSamplelocationsR{ - o: o.f.FromExistingFSSamplelocation(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSSamplelocations() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSSamplelocations = nil - }) -} - -func (m organizationMods) WithFSServicerequests(number int, related *FSServicerequestTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSServicerequests = []*organizationRFSServicerequestsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSServicerequests(number int, mods ...FSServicerequestMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSServicerequestWithContext(ctx, mods...) - m.WithFSServicerequests(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSServicerequests(number int, related *FSServicerequestTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSServicerequests = append(o.r.FSServicerequests, &organizationRFSServicerequestsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSServicerequests(number int, mods ...FSServicerequestMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSServicerequestWithContext(ctx, mods...) - m.AddFSServicerequests(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSServicerequests(existingModels ...*models.FSServicerequest) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSServicerequests = append(o.r.FSServicerequests, &organizationRFSServicerequestsR{ - o: o.f.FromExistingFSServicerequest(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSServicerequests() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSServicerequests = nil - }) -} - -func (m organizationMods) WithFSSpeciesabundances(number int, related *FSSpeciesabundanceTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSSpeciesabundances = []*organizationRFSSpeciesabundancesR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSSpeciesabundances(number int, mods ...FSSpeciesabundanceMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSSpeciesabundanceWithContext(ctx, mods...) - m.WithFSSpeciesabundances(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSSpeciesabundances(number int, related *FSSpeciesabundanceTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSSpeciesabundances = append(o.r.FSSpeciesabundances, &organizationRFSSpeciesabundancesR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSSpeciesabundances(number int, mods ...FSSpeciesabundanceMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSSpeciesabundanceWithContext(ctx, mods...) - m.AddFSSpeciesabundances(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSSpeciesabundances(existingModels ...*models.FSSpeciesabundance) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSSpeciesabundances = append(o.r.FSSpeciesabundances, &organizationRFSSpeciesabundancesR{ - o: o.f.FromExistingFSSpeciesabundance(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSSpeciesabundances() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSSpeciesabundances = nil - }) -} - -func (m organizationMods) WithFSStormdrains(number int, related *FSStormdrainTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSStormdrains = []*organizationRFSStormdrainsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSStormdrains(number int, mods ...FSStormdrainMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSStormdrainWithContext(ctx, mods...) - m.WithFSStormdrains(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSStormdrains(number int, related *FSStormdrainTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSStormdrains = append(o.r.FSStormdrains, &organizationRFSStormdrainsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSStormdrains(number int, mods ...FSStormdrainMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSStormdrainWithContext(ctx, mods...) - m.AddFSStormdrains(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSStormdrains(existingModels ...*models.FSStormdrain) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSStormdrains = append(o.r.FSStormdrains, &organizationRFSStormdrainsR{ - o: o.f.FromExistingFSStormdrain(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSStormdrains() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSStormdrains = nil - }) -} - -func (m organizationMods) WithFSTimecards(number int, related *FSTimecardTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSTimecards = []*organizationRFSTimecardsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSTimecards(number int, mods ...FSTimecardMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSTimecardWithContext(ctx, mods...) - m.WithFSTimecards(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSTimecards(number int, related *FSTimecardTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSTimecards = append(o.r.FSTimecards, &organizationRFSTimecardsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSTimecards(number int, mods ...FSTimecardMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSTimecardWithContext(ctx, mods...) - m.AddFSTimecards(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSTimecards(existingModels ...*models.FSTimecard) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSTimecards = append(o.r.FSTimecards, &organizationRFSTimecardsR{ - o: o.f.FromExistingFSTimecard(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSTimecards() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSTimecards = nil - }) -} - -func (m organizationMods) WithFSTrapdata(number int, related *FSTrapdatumTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSTrapdata = []*organizationRFSTrapdataR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSTrapdata(number int, mods ...FSTrapdatumMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSTrapdatumWithContext(ctx, mods...) - m.WithFSTrapdata(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSTrapdata(number int, related *FSTrapdatumTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSTrapdata = append(o.r.FSTrapdata, &organizationRFSTrapdataR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSTrapdata(number int, mods ...FSTrapdatumMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSTrapdatumWithContext(ctx, mods...) - m.AddFSTrapdata(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSTrapdata(existingModels ...*models.FSTrapdatum) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSTrapdata = append(o.r.FSTrapdata, &organizationRFSTrapdataR{ - o: o.f.FromExistingFSTrapdatum(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSTrapdata() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSTrapdata = nil - }) -} - -func (m organizationMods) WithFSTraplocations(number int, related *FSTraplocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSTraplocations = []*organizationRFSTraplocationsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSTraplocations(number int, mods ...FSTraplocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSTraplocationWithContext(ctx, mods...) - m.WithFSTraplocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSTraplocations(number int, related *FSTraplocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSTraplocations = append(o.r.FSTraplocations, &organizationRFSTraplocationsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSTraplocations(number int, mods ...FSTraplocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSTraplocationWithContext(ctx, mods...) - m.AddFSTraplocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSTraplocations(existingModels ...*models.FSTraplocation) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSTraplocations = append(o.r.FSTraplocations, &organizationRFSTraplocationsR{ - o: o.f.FromExistingFSTraplocation(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSTraplocations() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSTraplocations = nil - }) -} - -func (m organizationMods) WithFSTreatments(number int, related *FSTreatmentTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSTreatments = []*organizationRFSTreatmentsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSTreatments(number int, mods ...FSTreatmentMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSTreatmentWithContext(ctx, mods...) - m.WithFSTreatments(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSTreatments(number int, related *FSTreatmentTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSTreatments = append(o.r.FSTreatments, &organizationRFSTreatmentsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSTreatments(number int, mods ...FSTreatmentMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSTreatmentWithContext(ctx, mods...) - m.AddFSTreatments(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSTreatments(existingModels ...*models.FSTreatment) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSTreatments = append(o.r.FSTreatments, &organizationRFSTreatmentsR{ - o: o.f.FromExistingFSTreatment(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSTreatments() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSTreatments = nil - }) -} - -func (m organizationMods) WithFSTreatmentareas(number int, related *FSTreatmentareaTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSTreatmentareas = []*organizationRFSTreatmentareasR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSTreatmentareas(number int, mods ...FSTreatmentareaMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSTreatmentareaWithContext(ctx, mods...) - m.WithFSTreatmentareas(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSTreatmentareas(number int, related *FSTreatmentareaTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSTreatmentareas = append(o.r.FSTreatmentareas, &organizationRFSTreatmentareasR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSTreatmentareas(number int, mods ...FSTreatmentareaMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSTreatmentareaWithContext(ctx, mods...) - m.AddFSTreatmentareas(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSTreatmentareas(existingModels ...*models.FSTreatmentarea) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSTreatmentareas = append(o.r.FSTreatmentareas, &organizationRFSTreatmentareasR{ - o: o.f.FromExistingFSTreatmentarea(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSTreatmentareas() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSTreatmentareas = nil - }) -} - -func (m organizationMods) WithFSZones(number int, related *FSZoneTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSZones = []*organizationRFSZonesR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSZones(number int, mods ...FSZoneMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSZoneWithContext(ctx, mods...) - m.WithFSZones(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSZones(number int, related *FSZoneTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSZones = append(o.r.FSZones, &organizationRFSZonesR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSZones(number int, mods ...FSZoneMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSZoneWithContext(ctx, mods...) - m.AddFSZones(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSZones(existingModels ...*models.FSZone) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSZones = append(o.r.FSZones, &organizationRFSZonesR{ - o: o.f.FromExistingFSZone(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSZones() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSZones = nil - }) -} - -func (m organizationMods) WithFSZones2s(number int, related *FSZones2Template) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSZones2s = []*organizationRFSZones2sR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFSZones2s(number int, mods ...FSZones2Mod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSZones2WithContext(ctx, mods...) - m.WithFSZones2s(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFSZones2s(number int, related *FSZones2Template) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSZones2s = append(o.r.FSZones2s, &organizationRFSZones2sR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFSZones2s(number int, mods ...FSZones2Mod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFSZones2WithContext(ctx, mods...) - m.AddFSZones2s(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFSZones2s(existingModels ...*models.FSZones2) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FSZones2s = append(o.r.FSZones2s, &organizationRFSZones2sR{ - o: o.f.FromExistingFSZones2(em), - }) - } - }) -} - -func (m organizationMods) WithoutFSZones2s() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FSZones2s = nil - }) -} - func (m organizationMods) WithH3Aggregations(number int, related *H3AggregationTemplate) OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { o.r.H3Aggregations = []*organizationRH3AggregationsR{{ @@ -4063,1299 +3113,99 @@ func (m organizationMods) WithoutH3Aggregations() OrganizationMod { }) } -func (m organizationMods) WithHistoryContainerrelates(number int, related *HistoryContainerrelateTemplate) OrganizationMod { +func (m organizationMods) WithNoteAudios(number int, related *NoteAudioTemplate) OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryContainerrelates = []*organizationRHistoryContainerrelatesR{{ + o.r.NoteAudios = []*organizationRNoteAudiosR{{ number: number, o: related, }} }) } -func (m organizationMods) WithNewHistoryContainerrelates(number int, mods ...HistoryContainerrelateMod) OrganizationMod { +func (m organizationMods) WithNewNoteAudios(number int, mods ...NoteAudioMod) OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryContainerrelateWithContext(ctx, mods...) - m.WithHistoryContainerrelates(number, related).Apply(ctx, o) + related := o.f.NewNoteAudioWithContext(ctx, mods...) + m.WithNoteAudios(number, related).Apply(ctx, o) }) } -func (m organizationMods) AddHistoryContainerrelates(number int, related *HistoryContainerrelateTemplate) OrganizationMod { +func (m organizationMods) AddNoteAudios(number int, related *NoteAudioTemplate) OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryContainerrelates = append(o.r.HistoryContainerrelates, &organizationRHistoryContainerrelatesR{ + o.r.NoteAudios = append(o.r.NoteAudios, &organizationRNoteAudiosR{ number: number, o: related, }) }) } -func (m organizationMods) AddNewHistoryContainerrelates(number int, mods ...HistoryContainerrelateMod) OrganizationMod { +func (m organizationMods) AddNewNoteAudios(number int, mods ...NoteAudioMod) OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryContainerrelateWithContext(ctx, mods...) - m.AddHistoryContainerrelates(number, related).Apply(ctx, o) + related := o.f.NewNoteAudioWithContext(ctx, mods...) + m.AddNoteAudios(number, related).Apply(ctx, o) }) } -func (m organizationMods) AddExistingHistoryContainerrelates(existingModels ...*models.HistoryContainerrelate) OrganizationMod { +func (m organizationMods) AddExistingNoteAudios(existingModels ...*models.NoteAudio) OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { for _, em := range existingModels { - o.r.HistoryContainerrelates = append(o.r.HistoryContainerrelates, &organizationRHistoryContainerrelatesR{ - o: o.f.FromExistingHistoryContainerrelate(em), + o.r.NoteAudios = append(o.r.NoteAudios, &organizationRNoteAudiosR{ + o: o.f.FromExistingNoteAudio(em), }) } }) } -func (m organizationMods) WithoutHistoryContainerrelates() OrganizationMod { +func (m organizationMods) WithoutNoteAudios() OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryContainerrelates = nil + o.r.NoteAudios = nil }) } -func (m organizationMods) WithHistoryFieldscoutinglogs(number int, related *HistoryFieldscoutinglogTemplate) OrganizationMod { +func (m organizationMods) WithNoteImages(number int, related *NoteImageTemplate) OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryFieldscoutinglogs = []*organizationRHistoryFieldscoutinglogsR{{ + o.r.NoteImages = []*organizationRNoteImagesR{{ number: number, o: related, }} }) } -func (m organizationMods) WithNewHistoryFieldscoutinglogs(number int, mods ...HistoryFieldscoutinglogMod) OrganizationMod { +func (m organizationMods) WithNewNoteImages(number int, mods ...NoteImageMod) OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryFieldscoutinglogWithContext(ctx, mods...) - m.WithHistoryFieldscoutinglogs(number, related).Apply(ctx, o) + related := o.f.NewNoteImageWithContext(ctx, mods...) + m.WithNoteImages(number, related).Apply(ctx, o) }) } -func (m organizationMods) AddHistoryFieldscoutinglogs(number int, related *HistoryFieldscoutinglogTemplate) OrganizationMod { +func (m organizationMods) AddNoteImages(number int, related *NoteImageTemplate) OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryFieldscoutinglogs = append(o.r.HistoryFieldscoutinglogs, &organizationRHistoryFieldscoutinglogsR{ + o.r.NoteImages = append(o.r.NoteImages, &organizationRNoteImagesR{ number: number, o: related, }) }) } -func (m organizationMods) AddNewHistoryFieldscoutinglogs(number int, mods ...HistoryFieldscoutinglogMod) OrganizationMod { +func (m organizationMods) AddNewNoteImages(number int, mods ...NoteImageMod) OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryFieldscoutinglogWithContext(ctx, mods...) - m.AddHistoryFieldscoutinglogs(number, related).Apply(ctx, o) + related := o.f.NewNoteImageWithContext(ctx, mods...) + m.AddNoteImages(number, related).Apply(ctx, o) }) } -func (m organizationMods) AddExistingHistoryFieldscoutinglogs(existingModels ...*models.HistoryFieldscoutinglog) OrganizationMod { +func (m organizationMods) AddExistingNoteImages(existingModels ...*models.NoteImage) OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { for _, em := range existingModels { - o.r.HistoryFieldscoutinglogs = append(o.r.HistoryFieldscoutinglogs, &organizationRHistoryFieldscoutinglogsR{ - o: o.f.FromExistingHistoryFieldscoutinglog(em), + o.r.NoteImages = append(o.r.NoteImages, &organizationRNoteImagesR{ + o: o.f.FromExistingNoteImage(em), }) } }) } -func (m organizationMods) WithoutHistoryFieldscoutinglogs() OrganizationMod { +func (m organizationMods) WithoutNoteImages() OrganizationMod { return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryFieldscoutinglogs = nil - }) -} - -func (m organizationMods) WithHistoryHabitatrelates(number int, related *HistoryHabitatrelateTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryHabitatrelates = []*organizationRHistoryHabitatrelatesR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryHabitatrelates(number int, mods ...HistoryHabitatrelateMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryHabitatrelateWithContext(ctx, mods...) - m.WithHistoryHabitatrelates(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryHabitatrelates(number int, related *HistoryHabitatrelateTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryHabitatrelates = append(o.r.HistoryHabitatrelates, &organizationRHistoryHabitatrelatesR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryHabitatrelates(number int, mods ...HistoryHabitatrelateMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryHabitatrelateWithContext(ctx, mods...) - m.AddHistoryHabitatrelates(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryHabitatrelates(existingModels ...*models.HistoryHabitatrelate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryHabitatrelates = append(o.r.HistoryHabitatrelates, &organizationRHistoryHabitatrelatesR{ - o: o.f.FromExistingHistoryHabitatrelate(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryHabitatrelates() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryHabitatrelates = nil - }) -} - -func (m organizationMods) WithHistoryInspectionsamples(number int, related *HistoryInspectionsampleTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryInspectionsamples = []*organizationRHistoryInspectionsamplesR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryInspectionsamples(number int, mods ...HistoryInspectionsampleMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryInspectionsampleWithContext(ctx, mods...) - m.WithHistoryInspectionsamples(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryInspectionsamples(number int, related *HistoryInspectionsampleTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryInspectionsamples = append(o.r.HistoryInspectionsamples, &organizationRHistoryInspectionsamplesR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryInspectionsamples(number int, mods ...HistoryInspectionsampleMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryInspectionsampleWithContext(ctx, mods...) - m.AddHistoryInspectionsamples(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryInspectionsamples(existingModels ...*models.HistoryInspectionsample) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryInspectionsamples = append(o.r.HistoryInspectionsamples, &organizationRHistoryInspectionsamplesR{ - o: o.f.FromExistingHistoryInspectionsample(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryInspectionsamples() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryInspectionsamples = nil - }) -} - -func (m organizationMods) WithHistoryInspectionsampledetails(number int, related *HistoryInspectionsampledetailTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryInspectionsampledetails = []*organizationRHistoryInspectionsampledetailsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryInspectionsampledetails(number int, mods ...HistoryInspectionsampledetailMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryInspectionsampledetailWithContext(ctx, mods...) - m.WithHistoryInspectionsampledetails(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryInspectionsampledetails(number int, related *HistoryInspectionsampledetailTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryInspectionsampledetails = append(o.r.HistoryInspectionsampledetails, &organizationRHistoryInspectionsampledetailsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryInspectionsampledetails(number int, mods ...HistoryInspectionsampledetailMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryInspectionsampledetailWithContext(ctx, mods...) - m.AddHistoryInspectionsampledetails(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryInspectionsampledetails(existingModels ...*models.HistoryInspectionsampledetail) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryInspectionsampledetails = append(o.r.HistoryInspectionsampledetails, &organizationRHistoryInspectionsampledetailsR{ - o: o.f.FromExistingHistoryInspectionsampledetail(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryInspectionsampledetails() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryInspectionsampledetails = nil - }) -} - -func (m organizationMods) WithHistoryLinelocations(number int, related *HistoryLinelocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryLinelocations = []*organizationRHistoryLinelocationsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryLinelocations(number int, mods ...HistoryLinelocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryLinelocationWithContext(ctx, mods...) - m.WithHistoryLinelocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryLinelocations(number int, related *HistoryLinelocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryLinelocations = append(o.r.HistoryLinelocations, &organizationRHistoryLinelocationsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryLinelocations(number int, mods ...HistoryLinelocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryLinelocationWithContext(ctx, mods...) - m.AddHistoryLinelocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryLinelocations(existingModels ...*models.HistoryLinelocation) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryLinelocations = append(o.r.HistoryLinelocations, &organizationRHistoryLinelocationsR{ - o: o.f.FromExistingHistoryLinelocation(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryLinelocations() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryLinelocations = nil - }) -} - -func (m organizationMods) WithHistoryLocationtrackings(number int, related *HistoryLocationtrackingTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryLocationtrackings = []*organizationRHistoryLocationtrackingsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryLocationtrackings(number int, mods ...HistoryLocationtrackingMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryLocationtrackingWithContext(ctx, mods...) - m.WithHistoryLocationtrackings(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryLocationtrackings(number int, related *HistoryLocationtrackingTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryLocationtrackings = append(o.r.HistoryLocationtrackings, &organizationRHistoryLocationtrackingsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryLocationtrackings(number int, mods ...HistoryLocationtrackingMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryLocationtrackingWithContext(ctx, mods...) - m.AddHistoryLocationtrackings(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryLocationtrackings(existingModels ...*models.HistoryLocationtracking) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryLocationtrackings = append(o.r.HistoryLocationtrackings, &organizationRHistoryLocationtrackingsR{ - o: o.f.FromExistingHistoryLocationtracking(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryLocationtrackings() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryLocationtrackings = nil - }) -} - -func (m organizationMods) WithHistoryMosquitoinspections(number int, related *HistoryMosquitoinspectionTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryMosquitoinspections = []*organizationRHistoryMosquitoinspectionsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryMosquitoinspections(number int, mods ...HistoryMosquitoinspectionMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryMosquitoinspectionWithContext(ctx, mods...) - m.WithHistoryMosquitoinspections(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryMosquitoinspections(number int, related *HistoryMosquitoinspectionTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryMosquitoinspections = append(o.r.HistoryMosquitoinspections, &organizationRHistoryMosquitoinspectionsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryMosquitoinspections(number int, mods ...HistoryMosquitoinspectionMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryMosquitoinspectionWithContext(ctx, mods...) - m.AddHistoryMosquitoinspections(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryMosquitoinspections(existingModels ...*models.HistoryMosquitoinspection) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryMosquitoinspections = append(o.r.HistoryMosquitoinspections, &organizationRHistoryMosquitoinspectionsR{ - o: o.f.FromExistingHistoryMosquitoinspection(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryMosquitoinspections() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryMosquitoinspections = nil - }) -} - -func (m organizationMods) WithHistoryPointlocations(number int, related *HistoryPointlocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryPointlocations = []*organizationRHistoryPointlocationsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryPointlocations(number int, mods ...HistoryPointlocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryPointlocationWithContext(ctx, mods...) - m.WithHistoryPointlocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryPointlocations(number int, related *HistoryPointlocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryPointlocations = append(o.r.HistoryPointlocations, &organizationRHistoryPointlocationsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryPointlocations(number int, mods ...HistoryPointlocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryPointlocationWithContext(ctx, mods...) - m.AddHistoryPointlocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryPointlocations(existingModels ...*models.HistoryPointlocation) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryPointlocations = append(o.r.HistoryPointlocations, &organizationRHistoryPointlocationsR{ - o: o.f.FromExistingHistoryPointlocation(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryPointlocations() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryPointlocations = nil - }) -} - -func (m organizationMods) WithHistoryPolygonlocations(number int, related *HistoryPolygonlocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryPolygonlocations = []*organizationRHistoryPolygonlocationsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryPolygonlocations(number int, mods ...HistoryPolygonlocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryPolygonlocationWithContext(ctx, mods...) - m.WithHistoryPolygonlocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryPolygonlocations(number int, related *HistoryPolygonlocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryPolygonlocations = append(o.r.HistoryPolygonlocations, &organizationRHistoryPolygonlocationsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryPolygonlocations(number int, mods ...HistoryPolygonlocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryPolygonlocationWithContext(ctx, mods...) - m.AddHistoryPolygonlocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryPolygonlocations(existingModels ...*models.HistoryPolygonlocation) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryPolygonlocations = append(o.r.HistoryPolygonlocations, &organizationRHistoryPolygonlocationsR{ - o: o.f.FromExistingHistoryPolygonlocation(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryPolygonlocations() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryPolygonlocations = nil - }) -} - -func (m organizationMods) WithHistoryPools(number int, related *HistoryPoolTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryPools = []*organizationRHistoryPoolsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryPools(number int, mods ...HistoryPoolMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryPoolWithContext(ctx, mods...) - m.WithHistoryPools(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryPools(number int, related *HistoryPoolTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryPools = append(o.r.HistoryPools, &organizationRHistoryPoolsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryPools(number int, mods ...HistoryPoolMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryPoolWithContext(ctx, mods...) - m.AddHistoryPools(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryPools(existingModels ...*models.HistoryPool) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryPools = append(o.r.HistoryPools, &organizationRHistoryPoolsR{ - o: o.f.FromExistingHistoryPool(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryPools() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryPools = nil - }) -} - -func (m organizationMods) WithHistoryPooldetails(number int, related *HistoryPooldetailTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryPooldetails = []*organizationRHistoryPooldetailsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryPooldetails(number int, mods ...HistoryPooldetailMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryPooldetailWithContext(ctx, mods...) - m.WithHistoryPooldetails(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryPooldetails(number int, related *HistoryPooldetailTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryPooldetails = append(o.r.HistoryPooldetails, &organizationRHistoryPooldetailsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryPooldetails(number int, mods ...HistoryPooldetailMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryPooldetailWithContext(ctx, mods...) - m.AddHistoryPooldetails(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryPooldetails(existingModels ...*models.HistoryPooldetail) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryPooldetails = append(o.r.HistoryPooldetails, &organizationRHistoryPooldetailsR{ - o: o.f.FromExistingHistoryPooldetail(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryPooldetails() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryPooldetails = nil - }) -} - -func (m organizationMods) WithHistoryProposedtreatmentareas(number int, related *HistoryProposedtreatmentareaTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryProposedtreatmentareas = []*organizationRHistoryProposedtreatmentareasR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryProposedtreatmentareas(number int, mods ...HistoryProposedtreatmentareaMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryProposedtreatmentareaWithContext(ctx, mods...) - m.WithHistoryProposedtreatmentareas(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryProposedtreatmentareas(number int, related *HistoryProposedtreatmentareaTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryProposedtreatmentareas = append(o.r.HistoryProposedtreatmentareas, &organizationRHistoryProposedtreatmentareasR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryProposedtreatmentareas(number int, mods ...HistoryProposedtreatmentareaMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryProposedtreatmentareaWithContext(ctx, mods...) - m.AddHistoryProposedtreatmentareas(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryProposedtreatmentareas(existingModels ...*models.HistoryProposedtreatmentarea) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryProposedtreatmentareas = append(o.r.HistoryProposedtreatmentareas, &organizationRHistoryProposedtreatmentareasR{ - o: o.f.FromExistingHistoryProposedtreatmentarea(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryProposedtreatmentareas() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryProposedtreatmentareas = nil - }) -} - -func (m organizationMods) WithHistoryQamosquitoinspections(number int, related *HistoryQamosquitoinspectionTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryQamosquitoinspections = []*organizationRHistoryQamosquitoinspectionsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryQamosquitoinspections(number int, mods ...HistoryQamosquitoinspectionMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryQamosquitoinspectionWithContext(ctx, mods...) - m.WithHistoryQamosquitoinspections(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryQamosquitoinspections(number int, related *HistoryQamosquitoinspectionTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryQamosquitoinspections = append(o.r.HistoryQamosquitoinspections, &organizationRHistoryQamosquitoinspectionsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryQamosquitoinspections(number int, mods ...HistoryQamosquitoinspectionMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryQamosquitoinspectionWithContext(ctx, mods...) - m.AddHistoryQamosquitoinspections(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryQamosquitoinspections(existingModels ...*models.HistoryQamosquitoinspection) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryQamosquitoinspections = append(o.r.HistoryQamosquitoinspections, &organizationRHistoryQamosquitoinspectionsR{ - o: o.f.FromExistingHistoryQamosquitoinspection(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryQamosquitoinspections() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryQamosquitoinspections = nil - }) -} - -func (m organizationMods) WithHistoryRodentlocations(number int, related *HistoryRodentlocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryRodentlocations = []*organizationRHistoryRodentlocationsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryRodentlocations(number int, mods ...HistoryRodentlocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryRodentlocationWithContext(ctx, mods...) - m.WithHistoryRodentlocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryRodentlocations(number int, related *HistoryRodentlocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryRodentlocations = append(o.r.HistoryRodentlocations, &organizationRHistoryRodentlocationsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryRodentlocations(number int, mods ...HistoryRodentlocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryRodentlocationWithContext(ctx, mods...) - m.AddHistoryRodentlocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryRodentlocations(existingModels ...*models.HistoryRodentlocation) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryRodentlocations = append(o.r.HistoryRodentlocations, &organizationRHistoryRodentlocationsR{ - o: o.f.FromExistingHistoryRodentlocation(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryRodentlocations() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryRodentlocations = nil - }) -} - -func (m organizationMods) WithHistorySamplecollections(number int, related *HistorySamplecollectionTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistorySamplecollections = []*organizationRHistorySamplecollectionsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistorySamplecollections(number int, mods ...HistorySamplecollectionMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistorySamplecollectionWithContext(ctx, mods...) - m.WithHistorySamplecollections(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistorySamplecollections(number int, related *HistorySamplecollectionTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistorySamplecollections = append(o.r.HistorySamplecollections, &organizationRHistorySamplecollectionsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistorySamplecollections(number int, mods ...HistorySamplecollectionMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistorySamplecollectionWithContext(ctx, mods...) - m.AddHistorySamplecollections(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistorySamplecollections(existingModels ...*models.HistorySamplecollection) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistorySamplecollections = append(o.r.HistorySamplecollections, &organizationRHistorySamplecollectionsR{ - o: o.f.FromExistingHistorySamplecollection(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistorySamplecollections() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistorySamplecollections = nil - }) -} - -func (m organizationMods) WithHistorySamplelocations(number int, related *HistorySamplelocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistorySamplelocations = []*organizationRHistorySamplelocationsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistorySamplelocations(number int, mods ...HistorySamplelocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistorySamplelocationWithContext(ctx, mods...) - m.WithHistorySamplelocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistorySamplelocations(number int, related *HistorySamplelocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistorySamplelocations = append(o.r.HistorySamplelocations, &organizationRHistorySamplelocationsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistorySamplelocations(number int, mods ...HistorySamplelocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistorySamplelocationWithContext(ctx, mods...) - m.AddHistorySamplelocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistorySamplelocations(existingModels ...*models.HistorySamplelocation) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistorySamplelocations = append(o.r.HistorySamplelocations, &organizationRHistorySamplelocationsR{ - o: o.f.FromExistingHistorySamplelocation(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistorySamplelocations() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistorySamplelocations = nil - }) -} - -func (m organizationMods) WithHistoryServicerequests(number int, related *HistoryServicerequestTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryServicerequests = []*organizationRHistoryServicerequestsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryServicerequests(number int, mods ...HistoryServicerequestMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryServicerequestWithContext(ctx, mods...) - m.WithHistoryServicerequests(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryServicerequests(number int, related *HistoryServicerequestTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryServicerequests = append(o.r.HistoryServicerequests, &organizationRHistoryServicerequestsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryServicerequests(number int, mods ...HistoryServicerequestMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryServicerequestWithContext(ctx, mods...) - m.AddHistoryServicerequests(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryServicerequests(existingModels ...*models.HistoryServicerequest) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryServicerequests = append(o.r.HistoryServicerequests, &organizationRHistoryServicerequestsR{ - o: o.f.FromExistingHistoryServicerequest(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryServicerequests() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryServicerequests = nil - }) -} - -func (m organizationMods) WithHistorySpeciesabundances(number int, related *HistorySpeciesabundanceTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistorySpeciesabundances = []*organizationRHistorySpeciesabundancesR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistorySpeciesabundances(number int, mods ...HistorySpeciesabundanceMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistorySpeciesabundanceWithContext(ctx, mods...) - m.WithHistorySpeciesabundances(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistorySpeciesabundances(number int, related *HistorySpeciesabundanceTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistorySpeciesabundances = append(o.r.HistorySpeciesabundances, &organizationRHistorySpeciesabundancesR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistorySpeciesabundances(number int, mods ...HistorySpeciesabundanceMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistorySpeciesabundanceWithContext(ctx, mods...) - m.AddHistorySpeciesabundances(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistorySpeciesabundances(existingModels ...*models.HistorySpeciesabundance) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistorySpeciesabundances = append(o.r.HistorySpeciesabundances, &organizationRHistorySpeciesabundancesR{ - o: o.f.FromExistingHistorySpeciesabundance(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistorySpeciesabundances() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistorySpeciesabundances = nil - }) -} - -func (m organizationMods) WithHistoryStormdrains(number int, related *HistoryStormdrainTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryStormdrains = []*organizationRHistoryStormdrainsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryStormdrains(number int, mods ...HistoryStormdrainMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryStormdrainWithContext(ctx, mods...) - m.WithHistoryStormdrains(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryStormdrains(number int, related *HistoryStormdrainTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryStormdrains = append(o.r.HistoryStormdrains, &organizationRHistoryStormdrainsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryStormdrains(number int, mods ...HistoryStormdrainMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryStormdrainWithContext(ctx, mods...) - m.AddHistoryStormdrains(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryStormdrains(existingModels ...*models.HistoryStormdrain) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryStormdrains = append(o.r.HistoryStormdrains, &organizationRHistoryStormdrainsR{ - o: o.f.FromExistingHistoryStormdrain(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryStormdrains() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryStormdrains = nil - }) -} - -func (m organizationMods) WithHistoryTimecards(number int, related *HistoryTimecardTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryTimecards = []*organizationRHistoryTimecardsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryTimecards(number int, mods ...HistoryTimecardMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryTimecardWithContext(ctx, mods...) - m.WithHistoryTimecards(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryTimecards(number int, related *HistoryTimecardTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryTimecards = append(o.r.HistoryTimecards, &organizationRHistoryTimecardsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryTimecards(number int, mods ...HistoryTimecardMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryTimecardWithContext(ctx, mods...) - m.AddHistoryTimecards(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryTimecards(existingModels ...*models.HistoryTimecard) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryTimecards = append(o.r.HistoryTimecards, &organizationRHistoryTimecardsR{ - o: o.f.FromExistingHistoryTimecard(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryTimecards() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryTimecards = nil - }) -} - -func (m organizationMods) WithHistoryTrapdata(number int, related *HistoryTrapdatumTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryTrapdata = []*organizationRHistoryTrapdataR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryTrapdata(number int, mods ...HistoryTrapdatumMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryTrapdatumWithContext(ctx, mods...) - m.WithHistoryTrapdata(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryTrapdata(number int, related *HistoryTrapdatumTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryTrapdata = append(o.r.HistoryTrapdata, &organizationRHistoryTrapdataR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryTrapdata(number int, mods ...HistoryTrapdatumMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryTrapdatumWithContext(ctx, mods...) - m.AddHistoryTrapdata(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryTrapdata(existingModels ...*models.HistoryTrapdatum) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryTrapdata = append(o.r.HistoryTrapdata, &organizationRHistoryTrapdataR{ - o: o.f.FromExistingHistoryTrapdatum(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryTrapdata() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryTrapdata = nil - }) -} - -func (m organizationMods) WithHistoryTraplocations(number int, related *HistoryTraplocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryTraplocations = []*organizationRHistoryTraplocationsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryTraplocations(number int, mods ...HistoryTraplocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryTraplocationWithContext(ctx, mods...) - m.WithHistoryTraplocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryTraplocations(number int, related *HistoryTraplocationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryTraplocations = append(o.r.HistoryTraplocations, &organizationRHistoryTraplocationsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryTraplocations(number int, mods ...HistoryTraplocationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryTraplocationWithContext(ctx, mods...) - m.AddHistoryTraplocations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryTraplocations(existingModels ...*models.HistoryTraplocation) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryTraplocations = append(o.r.HistoryTraplocations, &organizationRHistoryTraplocationsR{ - o: o.f.FromExistingHistoryTraplocation(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryTraplocations() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryTraplocations = nil - }) -} - -func (m organizationMods) WithHistoryTreatments(number int, related *HistoryTreatmentTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryTreatments = []*organizationRHistoryTreatmentsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryTreatments(number int, mods ...HistoryTreatmentMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryTreatmentWithContext(ctx, mods...) - m.WithHistoryTreatments(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryTreatments(number int, related *HistoryTreatmentTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryTreatments = append(o.r.HistoryTreatments, &organizationRHistoryTreatmentsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryTreatments(number int, mods ...HistoryTreatmentMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryTreatmentWithContext(ctx, mods...) - m.AddHistoryTreatments(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryTreatments(existingModels ...*models.HistoryTreatment) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryTreatments = append(o.r.HistoryTreatments, &organizationRHistoryTreatmentsR{ - o: o.f.FromExistingHistoryTreatment(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryTreatments() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryTreatments = nil - }) -} - -func (m organizationMods) WithHistoryTreatmentareas(number int, related *HistoryTreatmentareaTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryTreatmentareas = []*organizationRHistoryTreatmentareasR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryTreatmentareas(number int, mods ...HistoryTreatmentareaMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryTreatmentareaWithContext(ctx, mods...) - m.WithHistoryTreatmentareas(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryTreatmentareas(number int, related *HistoryTreatmentareaTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryTreatmentareas = append(o.r.HistoryTreatmentareas, &organizationRHistoryTreatmentareasR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryTreatmentareas(number int, mods ...HistoryTreatmentareaMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryTreatmentareaWithContext(ctx, mods...) - m.AddHistoryTreatmentareas(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryTreatmentareas(existingModels ...*models.HistoryTreatmentarea) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryTreatmentareas = append(o.r.HistoryTreatmentareas, &organizationRHistoryTreatmentareasR{ - o: o.f.FromExistingHistoryTreatmentarea(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryTreatmentareas() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryTreatmentareas = nil - }) -} - -func (m organizationMods) WithHistoryZones(number int, related *HistoryZoneTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryZones = []*organizationRHistoryZonesR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryZones(number int, mods ...HistoryZoneMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryZoneWithContext(ctx, mods...) - m.WithHistoryZones(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryZones(number int, related *HistoryZoneTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryZones = append(o.r.HistoryZones, &organizationRHistoryZonesR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryZones(number int, mods ...HistoryZoneMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryZoneWithContext(ctx, mods...) - m.AddHistoryZones(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryZones(existingModels ...*models.HistoryZone) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryZones = append(o.r.HistoryZones, &organizationRHistoryZonesR{ - o: o.f.FromExistingHistoryZone(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryZones() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryZones = nil - }) -} - -func (m organizationMods) WithHistoryZones2s(number int, related *HistoryZones2Template) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryZones2s = []*organizationRHistoryZones2sR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewHistoryZones2s(number int, mods ...HistoryZones2Mod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryZones2WithContext(ctx, mods...) - m.WithHistoryZones2s(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddHistoryZones2s(number int, related *HistoryZones2Template) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryZones2s = append(o.r.HistoryZones2s, &organizationRHistoryZones2sR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewHistoryZones2s(number int, mods ...HistoryZones2Mod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewHistoryZones2WithContext(ctx, mods...) - m.AddHistoryZones2s(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingHistoryZones2s(existingModels ...*models.HistoryZones2) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.HistoryZones2s = append(o.r.HistoryZones2s, &organizationRHistoryZones2sR{ - o: o.f.FromExistingHistoryZones2(em), - }) - } - }) -} - -func (m organizationMods) WithoutHistoryZones2s() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.HistoryZones2s = nil + o.r.NoteImages = nil }) } diff --git a/db/factory/raster_columns.bob.go b/db/factory/raster_columns.bob.go index 46263218..86893474 100644 --- a/db/factory/raster_columns.bob.go +++ b/db/factory/raster_columns.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory diff --git a/db/factory/raster_overviews.bob.go b/db/factory/raster_overviews.bob.go index 6cf5e80e..dd69a1c2 100644 --- a/db/factory/raster_overviews.bob.go +++ b/db/factory/raster_overviews.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory diff --git a/db/factory/sessions.bob.go b/db/factory/sessions.bob.go index b6578f6e..c46fe717 100644 --- a/db/factory/sessions.bob.go +++ b/db/factory/sessions.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory diff --git a/db/factory/spatial_ref_sys.bob.go b/db/factory/spatial_ref_sys.bob.go index 08ae3011..1a7e8a71 100644 --- a/db/factory/spatial_ref_sys.bob.go +++ b/db/factory/spatial_ref_sys.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory diff --git a/db/factory/user_.bob.go b/db/factory/user_.bob.go index 42017dd9..6984bb9e 100644 --- a/db/factory/user_.bob.go +++ b/db/factory/user_.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package factory @@ -58,11 +58,31 @@ type UserTemplate struct { } type userR struct { + CreatorNoteAudios []*userRCreatorNoteAudiosR + DeletorNoteAudios []*userRDeletorNoteAudiosR + CreatorNoteImages []*userRCreatorNoteImagesR + DeletorNoteImages []*userRDeletorNoteImagesR UserNotifications []*userRUserNotificationsR UserOauthTokens []*userRUserOauthTokensR Organization *userROrganizationR } +type userRCreatorNoteAudiosR struct { + number int + o *NoteAudioTemplate +} +type userRDeletorNoteAudiosR struct { + number int + o *NoteAudioTemplate +} +type userRCreatorNoteImagesR struct { + number int + o *NoteImageTemplate +} +type userRDeletorNoteImagesR struct { + number int + o *NoteImageTemplate +} type userRUserNotificationsR struct { number int o *NotificationTemplate @@ -85,6 +105,58 @@ func (o *UserTemplate) Apply(ctx context.Context, mods ...UserMod) { // setModelRels creates and sets the relationships on *models.User // according to the relationships in the template. Nothing is inserted into the db func (t UserTemplate) setModelRels(o *models.User) { + if t.r.CreatorNoteAudios != nil { + rel := models.NoteAudioSlice{} + for _, r := range t.r.CreatorNoteAudios { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.CreatorID = o.ID // h2 + rel.R.CreatorUser = o + } + rel = append(rel, related...) + } + o.R.CreatorNoteAudios = rel + } + + if t.r.DeletorNoteAudios != nil { + rel := models.NoteAudioSlice{} + for _, r := range t.r.DeletorNoteAudios { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.DeletorID = null.From(o.ID) // h2 + rel.R.DeletorUser = o + } + rel = append(rel, related...) + } + o.R.DeletorNoteAudios = rel + } + + if t.r.CreatorNoteImages != nil { + rel := models.NoteImageSlice{} + for _, r := range t.r.CreatorNoteImages { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.CreatorID = o.ID // h2 + rel.R.CreatorUser = o + } + rel = append(rel, related...) + } + o.R.CreatorNoteImages = rel + } + + if t.r.DeletorNoteImages != nil { + rel := models.NoteImageSlice{} + for _, r := range t.r.DeletorNoteImages { + related := r.o.BuildMany(r.number) + for _, rel := range related { + rel.DeletorID = null.From(o.ID) // h2 + rel.R.DeletorUser = o + } + rel = append(rel, related...) + } + o.R.DeletorNoteImages = rel + } + if t.r.UserNotifications != nil { rel := models.NotificationSlice{} for _, r := range t.r.UserNotifications { @@ -274,6 +346,86 @@ func ensureCreatableUser(m *models.UserSetter) { func (o *UserTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.User) error { var err error + isCreatorNoteAudiosDone, _ := userRelCreatorNoteAudiosCtx.Value(ctx) + if !isCreatorNoteAudiosDone && o.r.CreatorNoteAudios != nil { + ctx = userRelCreatorNoteAudiosCtx.WithValue(ctx, true) + for _, r := range o.r.CreatorNoteAudios { + if r.o.alreadyPersisted { + m.R.CreatorNoteAudios = append(m.R.CreatorNoteAudios, r.o.Build()) + } else { + rel0, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachCreatorNoteAudios(ctx, exec, rel0...) + if err != nil { + return err + } + } + } + } + + isDeletorNoteAudiosDone, _ := userRelDeletorNoteAudiosCtx.Value(ctx) + if !isDeletorNoteAudiosDone && o.r.DeletorNoteAudios != nil { + ctx = userRelDeletorNoteAudiosCtx.WithValue(ctx, true) + for _, r := range o.r.DeletorNoteAudios { + if r.o.alreadyPersisted { + m.R.DeletorNoteAudios = append(m.R.DeletorNoteAudios, r.o.Build()) + } else { + rel1, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachDeletorNoteAudios(ctx, exec, rel1...) + if err != nil { + return err + } + } + } + } + + isCreatorNoteImagesDone, _ := userRelCreatorNoteImagesCtx.Value(ctx) + if !isCreatorNoteImagesDone && o.r.CreatorNoteImages != nil { + ctx = userRelCreatorNoteImagesCtx.WithValue(ctx, true) + for _, r := range o.r.CreatorNoteImages { + if r.o.alreadyPersisted { + m.R.CreatorNoteImages = append(m.R.CreatorNoteImages, r.o.Build()) + } else { + rel2, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachCreatorNoteImages(ctx, exec, rel2...) + if err != nil { + return err + } + } + } + } + + isDeletorNoteImagesDone, _ := userRelDeletorNoteImagesCtx.Value(ctx) + if !isDeletorNoteImagesDone && o.r.DeletorNoteImages != nil { + ctx = userRelDeletorNoteImagesCtx.WithValue(ctx, true) + for _, r := range o.r.DeletorNoteImages { + if r.o.alreadyPersisted { + m.R.DeletorNoteImages = append(m.R.DeletorNoteImages, r.o.Build()) + } else { + rel3, err := r.o.CreateMany(ctx, exec, r.number) + if err != nil { + return err + } + + err = m.AttachDeletorNoteImages(ctx, exec, rel3...) + if err != nil { + return err + } + } + } + } + isUserNotificationsDone, _ := userRelUserNotificationsCtx.Value(ctx) if !isUserNotificationsDone && o.r.UserNotifications != nil { ctx = userRelUserNotificationsCtx.WithValue(ctx, true) @@ -281,12 +433,12 @@ func (o *UserTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m * if r.o.alreadyPersisted { m.R.UserNotifications = append(m.R.UserNotifications, r.o.Build()) } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) + rel4, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachUserNotifications(ctx, exec, rel0...) + err = m.AttachUserNotifications(ctx, exec, rel4...) if err != nil { return err } @@ -301,12 +453,12 @@ func (o *UserTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m * if r.o.alreadyPersisted { m.R.UserOauthTokens = append(m.R.UserOauthTokens, r.o.Build()) } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) + rel5, err := r.o.CreateMany(ctx, exec, r.number) if err != nil { return err } - err = m.AttachUserOauthTokens(ctx, exec, rel1...) + err = m.AttachUserOauthTokens(ctx, exec, rel5...) if err != nil { return err } @@ -320,12 +472,12 @@ func (o *UserTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m * if o.r.Organization.o.alreadyPersisted { m.R.Organization = o.r.Organization.o.Build() } else { - var rel2 *models.Organization - rel2, err = o.r.Organization.o.Create(ctx, exec) + var rel6 *models.Organization + rel6, err = o.r.Organization.o.Create(ctx, exec) if err != nil { return err } - err = m.AttachOrganization(ctx, exec, rel2) + err = m.AttachOrganization(ctx, exec, rel6) if err != nil { return err } @@ -1010,6 +1162,198 @@ func (m userMods) WithoutOrganization() UserMod { }) } +func (m userMods) WithCreatorNoteAudios(number int, related *NoteAudioTemplate) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + o.r.CreatorNoteAudios = []*userRCreatorNoteAudiosR{{ + number: number, + o: related, + }} + }) +} + +func (m userMods) WithNewCreatorNoteAudios(number int, mods ...NoteAudioMod) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + related := o.f.NewNoteAudioWithContext(ctx, mods...) + m.WithCreatorNoteAudios(number, related).Apply(ctx, o) + }) +} + +func (m userMods) AddCreatorNoteAudios(number int, related *NoteAudioTemplate) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + o.r.CreatorNoteAudios = append(o.r.CreatorNoteAudios, &userRCreatorNoteAudiosR{ + number: number, + o: related, + }) + }) +} + +func (m userMods) AddNewCreatorNoteAudios(number int, mods ...NoteAudioMod) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + related := o.f.NewNoteAudioWithContext(ctx, mods...) + m.AddCreatorNoteAudios(number, related).Apply(ctx, o) + }) +} + +func (m userMods) AddExistingCreatorNoteAudios(existingModels ...*models.NoteAudio) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + for _, em := range existingModels { + o.r.CreatorNoteAudios = append(o.r.CreatorNoteAudios, &userRCreatorNoteAudiosR{ + o: o.f.FromExistingNoteAudio(em), + }) + } + }) +} + +func (m userMods) WithoutCreatorNoteAudios() UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + o.r.CreatorNoteAudios = nil + }) +} + +func (m userMods) WithDeletorNoteAudios(number int, related *NoteAudioTemplate) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + o.r.DeletorNoteAudios = []*userRDeletorNoteAudiosR{{ + number: number, + o: related, + }} + }) +} + +func (m userMods) WithNewDeletorNoteAudios(number int, mods ...NoteAudioMod) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + related := o.f.NewNoteAudioWithContext(ctx, mods...) + m.WithDeletorNoteAudios(number, related).Apply(ctx, o) + }) +} + +func (m userMods) AddDeletorNoteAudios(number int, related *NoteAudioTemplate) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + o.r.DeletorNoteAudios = append(o.r.DeletorNoteAudios, &userRDeletorNoteAudiosR{ + number: number, + o: related, + }) + }) +} + +func (m userMods) AddNewDeletorNoteAudios(number int, mods ...NoteAudioMod) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + related := o.f.NewNoteAudioWithContext(ctx, mods...) + m.AddDeletorNoteAudios(number, related).Apply(ctx, o) + }) +} + +func (m userMods) AddExistingDeletorNoteAudios(existingModels ...*models.NoteAudio) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + for _, em := range existingModels { + o.r.DeletorNoteAudios = append(o.r.DeletorNoteAudios, &userRDeletorNoteAudiosR{ + o: o.f.FromExistingNoteAudio(em), + }) + } + }) +} + +func (m userMods) WithoutDeletorNoteAudios() UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + o.r.DeletorNoteAudios = nil + }) +} + +func (m userMods) WithCreatorNoteImages(number int, related *NoteImageTemplate) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + o.r.CreatorNoteImages = []*userRCreatorNoteImagesR{{ + number: number, + o: related, + }} + }) +} + +func (m userMods) WithNewCreatorNoteImages(number int, mods ...NoteImageMod) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + related := o.f.NewNoteImageWithContext(ctx, mods...) + m.WithCreatorNoteImages(number, related).Apply(ctx, o) + }) +} + +func (m userMods) AddCreatorNoteImages(number int, related *NoteImageTemplate) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + o.r.CreatorNoteImages = append(o.r.CreatorNoteImages, &userRCreatorNoteImagesR{ + number: number, + o: related, + }) + }) +} + +func (m userMods) AddNewCreatorNoteImages(number int, mods ...NoteImageMod) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + related := o.f.NewNoteImageWithContext(ctx, mods...) + m.AddCreatorNoteImages(number, related).Apply(ctx, o) + }) +} + +func (m userMods) AddExistingCreatorNoteImages(existingModels ...*models.NoteImage) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + for _, em := range existingModels { + o.r.CreatorNoteImages = append(o.r.CreatorNoteImages, &userRCreatorNoteImagesR{ + o: o.f.FromExistingNoteImage(em), + }) + } + }) +} + +func (m userMods) WithoutCreatorNoteImages() UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + o.r.CreatorNoteImages = nil + }) +} + +func (m userMods) WithDeletorNoteImages(number int, related *NoteImageTemplate) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + o.r.DeletorNoteImages = []*userRDeletorNoteImagesR{{ + number: number, + o: related, + }} + }) +} + +func (m userMods) WithNewDeletorNoteImages(number int, mods ...NoteImageMod) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + related := o.f.NewNoteImageWithContext(ctx, mods...) + m.WithDeletorNoteImages(number, related).Apply(ctx, o) + }) +} + +func (m userMods) AddDeletorNoteImages(number int, related *NoteImageTemplate) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + o.r.DeletorNoteImages = append(o.r.DeletorNoteImages, &userRDeletorNoteImagesR{ + number: number, + o: related, + }) + }) +} + +func (m userMods) AddNewDeletorNoteImages(number int, mods ...NoteImageMod) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + related := o.f.NewNoteImageWithContext(ctx, mods...) + m.AddDeletorNoteImages(number, related).Apply(ctx, o) + }) +} + +func (m userMods) AddExistingDeletorNoteImages(existingModels ...*models.NoteImage) UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + for _, em := range existingModels { + o.r.DeletorNoteImages = append(o.r.DeletorNoteImages, &userRDeletorNoteImagesR{ + o: o.f.FromExistingNoteImage(em), + }) + } + }) +} + +func (m userMods) WithoutDeletorNoteImages() UserMod { + return UserModFunc(func(ctx context.Context, o *UserTemplate) { + o.r.DeletorNoteImages = nil + }) +} + func (m userMods) WithUserNotifications(number int, related *NotificationTemplate) UserMod { return UserModFunc(func(ctx context.Context, o *UserTemplate) { o.r.UserNotifications = []*userRUserNotificationsR{{ diff --git a/db/fieldseeker.go b/db/fieldseeker.go index 4acb4400..24d80942 100644 --- a/db/fieldseeker.go +++ b/db/fieldseeker.go @@ -65,6 +65,7 @@ func SaveOrUpdateContainerRelate(ctx context.Context, org *models.Organization, } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), UUID("p_globalid", row.GlobalID), String("p_created_user", row.CreatedUser), Timestamp("p_created_date", row.CreatedDate), @@ -91,6 +92,7 @@ func SaveOrUpdateFieldScoutingLog(ctx context.Context, org *models.Organization, } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), Int16("p_status", row.Status), UUID("p_globalid", row.GlobalID), String("p_created_user", row.CreatedUser), @@ -115,6 +117,7 @@ func SaveOrUpdateHabitatRelate(ctx context.Context, org *models.Organization, fs } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), UUID("p_foreign_id", row.ForeignID), UUID("p_globalid", row.GlobalID), String("p_created_user", row.CreatedUser), @@ -140,6 +143,7 @@ func SaveOrUpdateInspectionSample(ctx context.Context, org *models.Organization, } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), UUID("p_insp_id", row.InspID), String("p_sampleid", row.SampleID), Int16("p_processed", row.Processed), @@ -167,6 +171,7 @@ func SaveOrUpdateInspectionSampleDetail(ctx context.Context, org *models.Organiz } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), UUID("p_inspsample_id", row.InspsampleID), String("p_fieldspecies", row.FieldSpecies), Int16("p_flarvcount", row.FieldLarvaCount), @@ -227,6 +232,7 @@ func SaveOrUpdateLineLocation(ctx context.Context, org *models.Organization, fs } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), String("p_name", row.Name), String("p_zone", row.Zone), String("p_habitat", row.Habitat), @@ -288,6 +294,7 @@ func SaveOrUpdateLocationTracking(ctx context.Context, org *models.Organization, } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), Float64("p_accuracy", row.Accuracym), String("p_created_user", row.CreatedUser), Timestamp("p_created_date", row.CreatedDate), @@ -313,6 +320,7 @@ func SaveOrUpdateMosquitoInspection(ctx context.Context, org *models.Organizatio } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), Int16("p_numdips", row.Dips), String("p_activity", row.Activity), String("p_breeding", row.Breeding), @@ -396,6 +404,7 @@ func SaveOrUpdateProposedTreatmentArea(ctx context.Context, org *models.Organiza gisPoint = NullParam{"p_geospatial"} return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), String("p_method", row.Method), String("p_comments", row.Comments), String("p_zone", row.Zone), @@ -441,6 +450,7 @@ func SaveOrUpdatePointLocation(ctx context.Context, org *models.Organization, fs } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), String("p_name", row.Name), String("p_zone", row.Zone), String("p_habitat", row.Habitat), @@ -501,6 +511,7 @@ func SaveOrUpdatePolygonLocation(ctx context.Context, org *models.Organization, gisPoint = NullParam{"p_geospatial"} return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), String("p_name", row.Name), String("p_zone", row.Zone), String("p_habitat", row.Habitat), @@ -556,6 +567,7 @@ func SaveOrUpdatePoolDetail(ctx context.Context, org *models.Organization, fs [] } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), UUID("p_trapdata_id", row.TrapDataID), UUID("p_pool_id", row.PoolID), String("p_species", row.Species), @@ -583,6 +595,7 @@ func SaveOrUpdatePool(ctx context.Context, org *models.Organization, fs []*fslay } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), UUID("p_trapdata_id", row.TrapDataID), Timestamp("p_datesent", row.DateSent), String("p_survtech", row.SurveyTech), @@ -646,6 +659,7 @@ func SaveOrUpdateQAMosquitoInspection(ctx context.Context, org *models.Organizat } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), Int16("p_posdips", row.PositiveDips), String("p_actiontaken", row.Action), String("p_comments", row.Comments), @@ -754,6 +768,7 @@ func SaveOrUpdateRodentLocation(ctx context.Context, org *models.Organization, f } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), String("p_locationname", row.LocationName), String("p_zone", row.Zone), String("p_zone2", row.Zone2), @@ -797,6 +812,7 @@ func SaveOrUpdateSampleCollection(ctx context.Context, org *models.Organization, } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), UUID("p_loc_id", row.LocID), Timestamp("p_startdatetime", row.Start), Timestamp("p_enddatetime", row.Finish), @@ -856,6 +872,7 @@ func SaveOrUpdateSampleLocation(ctx context.Context, org *models.Organization, f } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), String("p_name", row.Name), String("p_zone", row.Zone), String("p_habitat", row.Habitat), @@ -893,6 +910,7 @@ func SaveOrUpdateServiceRequest(ctx context.Context, org *models.Organization, f } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), Timestamp("p_recdatetime", row.Received), String("p_source", row.Source), String("p_entrytech", row.EnteredBy), @@ -992,6 +1010,7 @@ func SaveOrUpdateSpeciesAbundance(ctx context.Context, org *models.Organization, } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), UUID("p_trapdata_id", row.TrapDataID), String("p_species", row.Species), Int16("p_males", row.Males), @@ -1034,6 +1053,7 @@ func SaveOrUpdateStormDrain(ctx context.Context, org *models.Organization, fs [] } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), Timestamp("p_nexttreatmentdate", row.NextTreatmentDate), Timestamp("p_lasttreatdate", row.LastTreatDate), String("p_lastaction", row.LastAction), @@ -1077,6 +1097,7 @@ func SaveOrUpdateTrapLocation(ctx context.Context, org *models.Organization, fs } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), String("p_name", row.Name), String("p_zone", row.Zone), String("p_habitat", row.Habitat), @@ -1120,6 +1141,7 @@ func SaveOrUpdateTrapData(ctx context.Context, org *models.Organization, fs []*f } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), String("p_traptype", row.TrapType), String("p_trapactivitytype", row.TrapActivityType), Timestamp("p_startdatetime", row.Start), @@ -1175,6 +1197,7 @@ func SaveOrUpdateTimeCard(ctx context.Context, org *models.Organization, fs []*f } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), String("p_activity", row.Activity), Timestamp("p_startdatetime", row.Start), Timestamp("p_enddatetime", row.Finish), @@ -1216,6 +1239,7 @@ func SaveOrUpdateTreatment(ctx context.Context, org *models.Organization, fs []* } return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), String("p_activity", row.Activity), Float64("p_treatarea", row.AreaTreated), String("p_areaunit", row.AreaUnit), @@ -1284,6 +1308,7 @@ func SaveOrUpdateTreatmentArea(ctx context.Context, org *models.Organization, fs gisPoint = NullParam{"p_geospatial"} return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), UUID("p_treat_id", row.TreatID), UUID("p_session_id", row.SessionID), Timestamp("p_treatdate", row.TreatmentDate), @@ -1329,6 +1354,7 @@ func SaveOrUpdateZones(ctx context.Context, org *models.Organization, fs []*fsla gisPoint = NullParam{"p_geospatial"} return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), String("p_name", row.Name), UUID("p_globalid", row.GlobalID), String("p_created_user", row.CreatedUser), @@ -1359,6 +1385,7 @@ func SaveOrUpdateZones2(ctx context.Context, org *models.Organization, fs []*fsl gisPoint = NullParam{"p_geospatial"} return []SqlParam{ Uint("p_objectid", row.ObjectID), + Int32("p_organization_id", org.ID), String("p_name", row.Name), UUID("p_globalid", row.GlobalID), String("p_created_user", row.CreatedUser), diff --git a/db/migrations/00019_remove_fieldseeker_v1.sql b/db/migrations/00019_remove_fieldseeker_v1.sql new file mode 100644 index 00000000..1ea767cf --- /dev/null +++ b/db/migrations/00019_remove_fieldseeker_v1.sql @@ -0,0 +1,2217 @@ +-- +goose Up +DROP TABLE fs_containerrelate; +DROP TABLE fs_fieldscoutinglog; +DROP TABLE fs_habitatrelate; +DROP TABLE fs_inspectionsample; +DROP TABLE fs_inspectionsampledetail; +DROP TABLE fs_linelocation; +DROP TABLE fs_locationtracking; +DROP TABLE fs_mosquitoinspection; +DROP TABLE fs_pointlocation; +DROP TABLE fs_polygonlocation; +DROP TABLE fs_pool; +DROP TABLE fs_pooldetail; +DROP TABLE fs_proposedtreatmentarea; +DROP TABLE fs_qamosquitoinspection; +DROP TABLE fs_rodentlocation; +DROP TABLE fs_samplecollection; +DROP TABLE fs_samplelocation; +DROP TABLE fs_servicerequest; +DROP TABLE fs_speciesabundance; +DROP TABLE fs_stormdrain; +DROP TABLE fs_timecard; +DROP TABLE fs_trapdata; +DROP TABLE fs_traplocation; +DROP TABLE fs_treatment; +DROP TABLE fs_treatmentarea; +DROP TABLE fs_zones; +DROP TABLE fs_zones2; +DROP TABLE history_containerrelate; +DROP TABLE history_fieldscoutinglog; +DROP TABLE history_habitatrelate; +DROP TABLE history_inspectionsample; +DROP TABLE history_inspectionsampledetail; +DROP TABLE history_linelocation; +DROP TABLE history_locationtracking; +DROP TABLE history_mosquitoinspection; +DROP TABLE history_pointlocation; +DROP TABLE history_polygonlocation; +DROP TABLE history_pool; +DROP TABLE history_pooldetail; +DROP TABLE history_proposedtreatmentarea; +DROP TABLE history_qamosquitoinspection; +DROP TABLE history_rodentlocation; +DROP TABLE history_samplecollection; +DROP TABLE history_samplelocation; +DROP TABLE history_servicerequest; +DROP TABLE history_speciesabundance; +DROP TABLE history_stormdrain; +DROP TABLE history_timecard; +DROP TABLE history_trapdata; +DROP TABLE history_traplocation; +DROP TABLE history_treatment; +DROP TABLE history_treatmentarea; +DROP TABLE history_zones; +DROP TABLE history_zones2; + +-- +goose Down +CREATE TABLE fs_containerrelate ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + containertype text, + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + inspsampleid text, + mosquitoinspid text, + objectid integer PRIMARY KEY, + treatmentid text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_fieldscoutinglog ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + objectid integer PRIMARY KEY, + status smallint, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_habitatrelate ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + foreign_id text, + globalid text, + habitattype text, + objectid integer PRIMARY KEY, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_inspectionsample ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + idbytech text, + insp_id text, + objectid integer PRIMARY KEY, + processed smallint, + sampleid text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_inspectionsampledetail ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + comments text, + creationdate bigint, + creator text, + editdate bigint, + editor text, + fadultact text, + fdomstage text, + feggcount smallint, + fieldspecies text, + flarvcount smallint, + flstages text, + fpupcount smallint, + globalid text, + inspsample_id text, + labspecies text, + ldomstage text, + leggcount smallint, + llarvcount smallint, + lpupcount smallint, + objectid integer PRIMARY KEY, + processed smallint, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_linelocation ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accessdesc text, + acres double precision, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + globalid text, + habitat text, + hectares double precision, + jurisdiction text, + larvinspectinterval smallint, + lastinspectactiontaken text, + lastinspectactivity text, + lastinspectavglarvae double precision, + lastinspectavgpupae double precision, + lastinspectbreeding text, + lastinspectconditions text, + lastinspectdate bigint, + lastinspectfieldspecies text, + lastinspectlstages text, + lasttreatactivity text, + lasttreatdate bigint, + lasttreatproduct text, + lasttreatqty double precision, + lasttreatqtyunit text, + length_ft double precision, + length_meters double precision, + locationnumber bigint, + name text, + nextactiondatescheduled bigint, + objectid integer PRIMARY KEY, + priority text, + symbology text, + shape__length double precision, + usetype text, + waterorigin text, + width_ft double precision, + width_meters double precision, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_locationtracking ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accuracy double precision, + creationdate bigint, + creator text, + editdate bigint, + editor text, + fieldtech text, + globalid text, + objectid integer PRIMARY KEY, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_mosquitoinspection ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + actiontaken text, + activity text, + adultact text, + avetemp double precision, + avglarvae double precision, + avgpupae double precision, + breeding text, + cbcount smallint, + comments text, + containercount smallint, + creationdate bigint, + creator text, + domstage text, + eggs smallint, + enddatetime bigint, + editdate bigint, + editor text, + fieldspecies text, + fieldtech text, + globalid text, + jurisdiction text, + larvaepresent smallint, + linelocid text, + locationname text, + lstages text, + numdips smallint, + objectid integer PRIMARY KEY, + personalcontact smallint, + pointlocid text, + polygonlocid text, + posdips smallint, + positivecontainercount smallint, + pupaepresent smallint, + raingauge double precision, + recordstatus smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + sdid text, + sitecond text, + srid text, + startdatetime bigint, + tirecount smallint, + totlarvae smallint, + totpupae smallint, + visualmonitoring smallint, + vmcomments text, + winddir text, + windspeed double precision, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + adminaction text, + ptaid text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_pointlocation ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accessdesc text, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + globalid text, + habitat text, + jurisdiction text, + larvinspectinterval smallint, + lastinspectactiontaken text, + lastinspectactivity text, + lastinspectavglarvae double precision, + lastinspectavgpupae double precision, + lastinspectbreeding text, + lastinspectconditions text, + lastinspectdate bigint, + lastinspectfieldspecies text, + lastinspectlstages text, + lasttreatactivity text, + lasttreatdate bigint, + lasttreatproduct text, + lasttreatqty double precision, + lasttreatqtyunit text, + locationnumber bigint, + name text, + nextactiondatescheduled bigint, + objectid integer PRIMARY KEY, + priority text, + stype text, + symbology text, + usetype text, + waterorigin text, + x double precision, + y double precision, + zone text, + zone2 text, + geometry_x double precision, + geometry_y double precision, + assignedtech text, + deactivate_reason text, + scalarpriority bigint, + sourcestatus text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_polygonlocation ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accessdesc text, + acres double precision, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + filter text, + globalid text, + habitat text, + hectares double precision, + jurisdiction text, + larvinspectinterval smallint, + lastinspectactiontaken text, + lastinspectactivity text, + lastinspectavglarvae double precision, + lastinspectavgpupae double precision, + lastinspectbreeding text, + lastinspectconditions text, + lastinspectdate bigint, + lastinspectfieldspecies text, + lastinspectlstages text, + lasttreatactivity text, + lasttreatdate bigint, + lasttreatproduct text, + lasttreatqty double precision, + lasttreatqtyunit text, + locationnumber bigint, + name text, + nextactiondatescheduled bigint, + objectid integer PRIMARY KEY, + priority text, + symbology text, + shape__area double precision, + shape__length double precision, + usetype text, + waterorigin text, + zone text, + zone2 text, + geometry_x double precision, + geometry_y double precision, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_pool ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + comments text, + creationdate bigint, + creator text, + datesent bigint, + datetested bigint, + diseasepos text, + diseasetested text, + editdate bigint, + editor text, + gatewaysync smallint, + globalid text, + lab text, + lab_id text, + objectid integer PRIMARY KEY, + poolyear smallint, + processed smallint, + sampleid text, + survtech text, + testmethod text, + testtech text, + trapdata_id text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + vectorsurvcollectionid text, + vectorsurvpoolid text, + vectorsurvtrapdataid text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_pooldetail ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + females smallint, + globalid text, + objectid integer PRIMARY KEY, + pool_id text, + species text, + trapdata_id text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_proposedtreatmentarea ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + acres double precision, + comments text, + completed smallint, + completedby text, + completeddate bigint, + creationdate bigint, + creator text, + duedate bigint, + exported smallint, + editdate bigint, + editor text, + globalid text, + hectares double precision, + issprayroute smallint, + lasttreatactivity text, + lasttreatdate bigint, + lasttreatproduct text, + lasttreatqty double precision, + lasttreatqtyunit text, + method text, + name text, + objectid integer PRIMARY KEY, + priority text, + reviewed smallint, + reviewedby text, + revieweddate bigint, + shape__area double precision, + shape__length double precision, + targetapprate double precision, + targetproduct text, + targetspecies text, + zone text, + zone2 text, + geometry_x double precision, + geometry_y double precision, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_qamosquitoinspection ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + acresbreeding double precision, + actiontaken text, + adultactivity smallint, + aquaticorganisms text, + avetemp double precision, + breedingpotential text, + comments text, + creationdate bigint, + creator text, + enddatetime bigint, + editdate bigint, + editor text, + fieldtech text, + fish smallint, + globalid text, + habvalue1 smallint, + habvalue1percent smallint, + habvalue2 smallint, + habvalue2percent smallint, + larvaeinsidetreatedarea smallint, + larvaeoutsidetreatedarea smallint, + larvaepresent smallint, + larvaereason text, + linelocid text, + locationname text, + lr smallint, + mosquitohabitat text, + movingwater smallint, + negdips smallint, + nowaterever smallint, + objectid integer PRIMARY KEY, + pointlocid text, + polygonlocid text, + posdips smallint, + potential smallint, + raingauge double precision, + recordstatus smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + sitetype text, + soilconditions text, + sourcereduction text, + startdatetime bigint, + totalacres double precision, + vegetation text, + waterconditions text, + waterduration text, + watermovement1 text, + watermovement1percent smallint, + watermovement2 text, + watermovement2percent smallint, + waterpresent smallint, + watersource text, + winddir text, + windspeed double precision, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_rodentlocation ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accessdesc text, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + globalid text, + habitat text, + lastinspectaction text, + lastinspectconditions text, + lastinspectdate bigint, + lastinspectrodentevidence text, + lastinspectspecies text, + locationname text, + locationnumber bigint, + nextactiondatescheduled bigint, + objectid integer PRIMARY KEY, + priority text, + symbology text, + usetype text, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + jurisdiction text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_samplecollection ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + activity text, + avetemp double precision, + chickenid text, + comments text, + creationdate bigint, + creator text, + datesent bigint, + datetested bigint, + diseasepos text, + diseasetested text, + enddatetime bigint, + editdate bigint, + editor text, + fieldtech text, + flockid text, + gatewaysync smallint, + globalid text, + lab text, + locationname text, + loc_id text, + objectid integer PRIMARY KEY, + processed smallint, + raingauge double precision, + recordstatus smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + samplecond text, + samplecount smallint, + sampleid text, + sampletype text, + sex text, + sitecond text, + species text, + startdatetime bigint, + survtech text, + testmethod text, + testtech text, + winddir text, + windspeed double precision, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE fs_samplelocation ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accessdesc text, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + gatewaysync smallint, + globalid text, + habitat text, + locationnumber bigint, + name text, + nextactiondatescheduled bigint, + objectid integer PRIMARY KEY, + priority text, + usetype text, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_servicerequest ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accepted smallint, + acceptedby text, + accepteddate bigint, + allowed text, + assignedtech text, + clraddr1 text, + clraddr2 text, + clranon smallint, + clrcity text, + clrcompany text, + clrcontpref text, + clremail text, + clrfname text, + clrother text, + clrphone1 text, + clrphone2 text, + clrstate text, + clrzip text, + comments text, + creationdate bigint, + creator text, + datetimeclosed bigint, + duedate bigint, + entrytech text, + estcompletedate bigint, + externalerror text, + externalid text, + editdate bigint, + editor text, + firstresponsedate bigint, + globalid text, + issuesreported text, + jurisdiction text, + nextaction text, + notificationtimestamp text, + notified smallint, + notifieddate bigint, + objectid integer PRIMARY KEY, + pointlocid text, + priority text, + recdatetime bigint, + recordstatus smallint, + rejectedby text, + rejecteddate bigint, + rejectedreason text, + reqaddr1 text, + reqaddr2 text, + reqcity text, + reqcompany text, + reqcrossst text, + reqdescr text, + reqfldnotes text, + reqmapgrid text, + reqnotesforcust text, + reqnotesfortech text, + reqpermission smallint, + reqprogramactions text, + reqstate text, + reqsubdiv text, + reqtarget text, + reqzip text, + responsedaycount smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + scheduled smallint, + scheduleddate bigint, + source text, + sr_number bigint, + status text, + supervisor text, + techclosed text, + validx text, + validy text, + xvalue text, + yvalue text, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + dog bigint, + spanish bigint, + schedule_notes text, + schedule_period text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_speciesabundance ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + bloodedfem smallint, + creationdate bigint, + creator text, + eggs smallint, + editdate bigint, + editor text, + females bigint, + gravidfem smallint, + globalid text, + larvae smallint, + males smallint, + objectid integer PRIMARY KEY, + poolstogen smallint, + processed smallint, + pupae smallint, + species text, + total bigint, + trapdata_id text, + unknown smallint, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + globalzscore double precision, + h3r7 text, + h3r8 text, + r7score double precision, + r8score double precision, + yearweek bigint, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_stormdrain ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + jurisdiction text, + lastaction text, + laststatus text, + lasttreatdate bigint, + nexttreatmentdate bigint, + objectid integer PRIMARY KEY, + symbology text, + type text, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_timecard ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + activity text, + comments text, + creationdate bigint, + creator text, + enddatetime bigint, + equiptype text, + externalid text, + editdate bigint, + editor text, + fieldtech text, + globalid text, + lclocid text, + linelocid text, + locationname text, + objectid integer PRIMARY KEY, + pointlocid text, + polygonlocid text, + samplelocid text, + srid text, + startdatetime bigint, + traplocid text, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + rodentlocid text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_trapdata ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + avetemp double precision, + comments text, + creationdate bigint, + creator text, + enddatetime bigint, + editdate bigint, + editor text, + fieldtech text, + field bigint, + gatewaysync smallint, + globalid text, + idbytech text, + locationname text, + loc_id text, + lr smallint, + objectid integer PRIMARY KEY, + processed smallint, + raingauge double precision, + recordstatus smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + sitecond text, + sortbytech text, + srid text, + startdatetime bigint, + trapactivitytype text, + trapcondition text, + trapnights smallint, + traptype text, + voltage double precision, + winddir text, + windspeed double precision, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + lure text, + vectorsurvtrapdataid text, + vectorsurvtraplocationid text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_traplocation ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accessdesc text, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + gatewaysync smallint, + globalid text, + habitat text, + locationnumber bigint, + name text, + nextactiondatescheduled bigint, + objectid integer PRIMARY KEY, + priority text, + usetype text, + zone text, + zone2 text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + route bigint, + route_order bigint, + set_dow bigint, + vectorsurvsiteid text, + h3r7 text, + h3r8 text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_treatment ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + activity text, + areaunit text, + avetemp double precision, + barrierrouteid text, + cbcount smallint, + comments text, + containercount smallint, + creationdate bigint, + creator text, + enddatetime bigint, + equiptype text, + editdate bigint, + editor text, + fieldtech text, + flowrate double precision, + globalid text, + habitat text, + insp_id text, + invloc text, + linelocid text, + locationname text, + method text, + objectid integer PRIMARY KEY, + pointlocid text, + polygonlocid text, + product text, + ptaid text, + qty double precision, + qtyunit text, + raingauge double precision, + recordstatus smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + sdid text, + sitecond text, + srid text, + startdatetime bigint, + targetspecies text, + tirecount smallint, + treatacres double precision, + treatarea double precision, + treathectares double precision, + treatmenthours double precision, + treatmentlength double precision, + treatmentlengthunits text, + totalcostprodcut double precision, + ulvrouteid text, + warningoverride smallint, + winddir text, + windspeed double precision, + zone text, + zone2 text, + geometry_x double precision, + geometry_y double precision, + temp_sitecond text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_treatmentarea ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + comments text, + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + notified smallint, + objectid integer PRIMARY KEY, + session_id text, + shape__area double precision, + shape__length double precision, + treatdate bigint, + treat_id text, + type text, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_zones ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + active bigint, + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + name text, + objectid integer PRIMARY KEY, + shape__area double precision, + shape__length double precision, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +CREATE TABLE fs_zones2 ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + name text, + objectid integer PRIMARY KEY, + shape__area double precision, + shape__length double precision, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + +CREATE TABLE history_containerrelate ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + containertype text, + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + inspsampleid text, + mosquitoinspid text, + objectid integer NOT NULL, + treatmentid text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_fieldscoutinglog ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + objectid integer NOT NULL, + status smallint, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_habitatrelate ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + foreign_id text, + globalid text, + habitattype text, + objectid integer NOT NULL, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + +CREATE TABLE history_inspectionsample ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + idbytech text, + insp_id text, + objectid integer NOT NULL, + processed smallint, + sampleid text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + +CREATE TABLE history_inspectionsampledetail ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + comments text, + creationdate bigint, + creator text, + editdate bigint, + editor text, + fadultact text, + fdomstage text, + feggcount smallint, + fieldspecies text, + flarvcount smallint, + flstages text, + fpupcount smallint, + globalid text, + inspsample_id text, + labspecies text, + ldomstage text, + leggcount smallint, + llarvcount smallint, + lpupcount smallint, + objectid integer NOT NULL, + processed smallint, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + +CREATE TABLE history_linelocation ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accessdesc text, + acres double precision, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + globalid text, + habitat text, + hectares double precision, + jurisdiction text, + larvinspectinterval smallint, + lastinspectactiontaken text, + lastinspectactivity text, + lastinspectavglarvae double precision, + lastinspectavgpupae double precision, + lastinspectbreeding text, + lastinspectconditions text, + lastinspectdate bigint, + lastinspectfieldspecies text, + lastinspectlstages text, + lasttreatactivity text, + lasttreatdate bigint, + lasttreatproduct text, + lasttreatqty double precision, + lasttreatqtyunit text, + length_ft double precision, + length_meters double precision, + locationnumber bigint, + name text, + nextactiondatescheduled bigint, + objectid integer NOT NULL, + priority text, + symbology text, + shape__length double precision, + usetype text, + waterorigin text, + width_ft double precision, + width_meters double precision, + zone text, + zone2 text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_locationtracking ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accuracy double precision, + creationdate bigint, + creator text, + editdate bigint, + editor text, + fieldtech text, + globalid text, + objectid integer NOT NULL, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_mosquitoinspection ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + actiontaken text, + activity text, + adultact text, + avetemp double precision, + avglarvae double precision, + avgpupae double precision, + breeding text, + cbcount smallint, + comments text, + containercount smallint, + creationdate bigint, + creator text, + domstage text, + eggs smallint, + enddatetime bigint, + editdate bigint, + editor text, + fieldspecies text, + fieldtech text, + globalid text, + jurisdiction text, + larvaepresent smallint, + linelocid text, + locationname text, + lstages text, + numdips smallint, + objectid integer NOT NULL, + personalcontact smallint, + pointlocid text, + polygonlocid text, + posdips smallint, + positivecontainercount smallint, + pupaepresent smallint, + raingauge double precision, + recordstatus smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + sdid text, + sitecond text, + srid text, + startdatetime bigint, + tirecount smallint, + totlarvae smallint, + totpupae smallint, + visualmonitoring smallint, + vmcomments text, + winddir text, + windspeed double precision, + zone text, + zone2 text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + adminaction text, + ptaid text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_pointlocation ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accessdesc text, + active smallint, + comments text, + created TIMESTAMP, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + globalid text, + habitat text, + jurisdiction text, + larvinspectinterval smallint, + lastinspectactiontaken text, + lastinspectactivity text, + lastinspectavglarvae double precision, + lastinspectavgpupae double precision, + lastinspectbreeding text, + lastinspectconditions text, + lastinspectdate bigint, + lastinspectfieldspecies text, + lastinspectlstages text, + lasttreatactivity text, + lasttreatdate bigint, + lasttreatproduct text, + lasttreatqty double precision, + lasttreatqtyunit text, + locationnumber bigint, + name text, + nextactiondatescheduled bigint, + objectid integer NOT NULL, + priority text, + stype text, + symbology text, + usetype text, + waterorigin text, + x double precision, + y double precision, + zone text, + zone2 text, + geometry_x double precision, + geometry_y double precision, + assignedtech text, + deactivate_reason text, + scalarpriority bigint, + sourcestatus text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_polygonlocation ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accessdesc text, + acres double precision, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + filter text, + globalid text, + habitat text, + hectares double precision, + jurisdiction text, + larvinspectinterval smallint, + lastinspectactiontaken text, + lastinspectactivity text, + lastinspectavglarvae double precision, + lastinspectavgpupae double precision, + lastinspectbreeding text, + lastinspectconditions text, + lastinspectdate bigint, + lastinspectfieldspecies text, + lastinspectlstages text, + lasttreatactivity text, + lasttreatdate bigint, + lasttreatproduct text, + lasttreatqty double precision, + lasttreatqtyunit text, + locationnumber bigint, + name text, + nextactiondatescheduled bigint, + objectid integer NOT NULL, + priority text, + symbology text, + shape__area double precision, + shape__length double precision, + usetype text, + waterorigin text, + zone text, + zone2 text, + geometry_x double precision, + geometry_y double precision, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_pool ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + comments text, + creationdate bigint, + creator text, + datesent bigint, + datetested bigint, + diseasepos text, + diseasetested text, + editdate bigint, + editor text, + gatewaysync smallint, + globalid text, + lab text, + lab_id text, + objectid integer NOT NULL, + poolyear smallint, + processed smallint, + sampleid text, + survtech text, + testmethod text, + testtech text, + trapdata_id text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + vectorsurvcollectionid text, + vectorsurvpoolid text, + vectorsurvtrapdataid text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + +CREATE TABLE history_pooldetail ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + females smallint, + globalid text, + objectid integer NOT NULL, + pool_id text, + species text, + trapdata_id text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + +CREATE TABLE history_proposedtreatmentarea ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + acres double precision, + comments text, + completed smallint, + completedby text, + completeddate bigint, + creationdate bigint, + creator text, + duedate bigint, + exported smallint, + editdate bigint, + editor text, + globalid text, + hectares double precision, + issprayroute smallint, + lasttreatactivity text, + lasttreatdate bigint, + lasttreatproduct text, + lasttreatqty double precision, + lasttreatqtyunit text, + method text, + name text, + objectid integer NOT NULL, + priority text, + reviewed smallint, + reviewedby text, + revieweddate bigint, + shape__area double precision, + shape__length double precision, + targetapprate double precision, + targetproduct text, + targetspecies text, + zone text, + zone2 text, + geometry_x double precision, + geometry_y double precision, + version INT, + PRIMARY KEY(OBJECTID, version) +); + +CREATE TABLE history_qamosquitoinspection ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + acresbreeding double precision, + actiontaken text, + adultactivity smallint, + aquaticorganisms text, + avetemp double precision, + breedingpotential text, + comments text, + creationdate bigint, + creator text, + enddatetime bigint, + editdate bigint, + editor text, + fieldtech text, + fish smallint, + globalid text, + habvalue1 smallint, + habvalue1percent smallint, + habvalue2 smallint, + habvalue2percent smallint, + larvaeinsidetreatedarea smallint, + larvaeoutsidetreatedarea smallint, + larvaepresent smallint, + larvaereason text, + linelocid text, + locationname text, + lr smallint, + mosquitohabitat text, + movingwater smallint, + negdips smallint, + nowaterever smallint, + objectid integer NOT NULL, + pointlocid text, + polygonlocid text, + posdips smallint, + potential smallint, + raingauge double precision, + recordstatus smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + sitetype text, + soilconditions text, + sourcereduction text, + startdatetime bigint, + totalacres double precision, + vegetation text, + waterconditions text, + waterduration text, + watermovement1 text, + watermovement1percent smallint, + watermovement2 text, + watermovement2percent smallint, + waterpresent smallint, + watersource text, + winddir text, + windspeed double precision, + zone text, + zone2 text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + +CREATE TABLE history_rodentlocation ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accessdesc text, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + globalid text, + habitat text, + lastinspectaction text, + lastinspectconditions text, + lastinspectdate bigint, + lastinspectrodentevidence text, + lastinspectspecies text, + locationname text, + locationnumber bigint, + nextactiondatescheduled bigint, + objectid integer NOT NULL, + priority text, + symbology text, + usetype text, + zone text, + zone2 text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + jurisdiction text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + +CREATE TABLE history_samplecollection ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + activity text, + avetemp double precision, + chickenid text, + comments text, + creationdate bigint, + creator text, + datesent bigint, + datetested bigint, + diseasepos text, + diseasetested text, + enddatetime bigint, + editdate bigint, + editor text, + fieldtech text, + flockid text, + gatewaysync smallint, + globalid text, + lab text, + locationname text, + loc_id text, + objectid integer NOT NULL, + processed smallint, + raingauge double precision, + recordstatus smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + samplecond text, + samplecount smallint, + sampleid text, + sampletype text, + sex text, + sitecond text, + species text, + startdatetime bigint, + survtech text, + testmethod text, + testtech text, + winddir text, + windspeed double precision, + zone text, + zone2 text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + +CREATE TABLE history_samplelocation ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accessdesc text, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + gatewaysync smallint, + globalid text, + habitat text, + locationnumber bigint, + name text, + nextactiondatescheduled bigint, + objectid integer NOT NULL, + priority text, + usetype text, + zone text, + zone2 text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_servicerequest ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accepted smallint, + acceptedby text, + accepteddate bigint, + allowed text, + assignedtech text, + clraddr1 text, + clraddr2 text, + clranon smallint, + clrcity text, + clrcompany text, + clrcontpref text, + clremail text, + clrfname text, + clrother text, + clrphone1 text, + clrphone2 text, + clrstate text, + clrzip text, + comments text, + creationdate bigint, + creator text, + datetimeclosed bigint, + duedate bigint, + entrytech text, + estcompletedate bigint, + externalerror text, + externalid text, + editdate bigint, + editor text, + firstresponsedate bigint, + globalid text, + issuesreported text, + jurisdiction text, + nextaction text, + notificationtimestamp text, + notified smallint, + notifieddate bigint, + objectid integer NOT NULL, + pointlocid text, + priority text, + recdatetime bigint, + recordstatus smallint, + rejectedby text, + rejecteddate bigint, + rejectedreason text, + reqaddr1 text, + reqaddr2 text, + reqcity text, + reqcompany text, + reqcrossst text, + reqdescr text, + reqfldnotes text, + reqmapgrid text, + reqnotesforcust text, + reqnotesfortech text, + reqpermission smallint, + reqprogramactions text, + reqstate text, + reqsubdiv text, + reqtarget text, + reqzip text, + responsedaycount smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + scheduled smallint, + scheduleddate bigint, + source text, + sr_number bigint, + status text, + supervisor text, + techclosed text, + validx text, + validy text, + xvalue text, + yvalue text, + zone text, + zone2 text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + dog bigint, + spanish bigint, + schedule_notes text, + schedule_period text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_speciesabundance ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + bloodedfem smallint, + creationdate bigint, + creator text, + eggs smallint, + editdate bigint, + editor text, + females bigint, + gravidfem smallint, + globalid text, + larvae smallint, + males smallint, + objectid integer NOT NULL, + poolstogen smallint, + processed smallint, + pupae smallint, + species text, + total bigint, + trapdata_id text, + unknown smallint, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + globalzscore double precision, + h3r7 text, + h3r8 text, + r7score double precision, + r8score double precision, + yearweek bigint, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_stormdrain ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + jurisdiction text, + lastaction text, + laststatus text, + lasttreatdate bigint, + nexttreatmentdate bigint, + objectid integer NOT NULL, + symbology text, + type text, + zone text, + zone2 text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_timecard ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + activity text, + comments text, + creationdate bigint, + creator text, + enddatetime bigint, + equiptype text, + externalid text, + editdate bigint, + editor text, + fieldtech text, + globalid text, + lclocid text, + linelocid text, + locationname text, + objectid integer NOT NULL, + pointlocid text, + polygonlocid text, + samplelocid text, + srid text, + startdatetime bigint, + traplocid text, + zone text, + zone2 text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + rodentlocid text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_trapdata ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + avetemp double precision, + comments text, + creationdate bigint, + creator text, + enddatetime bigint, + editdate bigint, + editor text, + fieldtech text, + field bigint, + gatewaysync smallint, + globalid text, + idbytech text, + locationname text, + loc_id text, + lr smallint, + objectid integer NOT NULL, + processed smallint, + raingauge double precision, + recordstatus smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + sitecond text, + sortbytech text, + srid text, + startdatetime bigint, + trapactivitytype text, + trapcondition text, + trapnights smallint, + traptype text, + voltage double precision, + winddir text, + windspeed double precision, + zone text, + zone2 text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + lure text, + vectorsurvtrapdataid text, + vectorsurvtraplocationid text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_traplocation ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + accessdesc text, + active smallint, + comments text, + creationdate bigint, + creator text, + description text, + externalid text, + editdate bigint, + editor text, + gatewaysync smallint, + globalid text, + habitat text, + locationnumber bigint, + name text, + nextactiondatescheduled bigint, + objectid integer NOT NULL, + priority text, + usetype text, + zone text, + zone2 text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + route bigint, + route_order bigint, + set_dow bigint, + vectorsurvsiteid text, + h3r7 text, + h3r8 text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_treatment ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + activity text, + areaunit text, + avetemp double precision, + barrierrouteid text, + cbcount smallint, + comments text, + containercount smallint, + creationdate bigint, + creator text, + enddatetime bigint, + equiptype text, + editdate bigint, + editor text, + fieldtech text, + flowrate double precision, + globalid text, + habitat text, + insp_id text, + invloc text, + linelocid text, + locationname text, + method text, + objectid integer NOT NULL, + pointlocid text, + polygonlocid text, + product text, + ptaid text, + qty double precision, + qtyunit text, + raingauge double precision, + recordstatus smallint, + reviewed smallint, + reviewedby text, + revieweddate bigint, + sdid text, + sitecond text, + srid text, + startdatetime bigint, + targetspecies text, + tirecount smallint, + treatacres double precision, + treatarea double precision, + treathectares double precision, + treatmenthours double precision, + treatmentlength double precision, + treatmentlengthunits text, + totalcostprodcut double precision, + ulvrouteid text, + warningoverride smallint, + winddir text, + windspeed double precision, + zone text, + zone2 text, + geometry_x double precision, + geometry_y double precision, + temp_sitecond text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_treatmentarea ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + comments text, + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + notified smallint, + objectid integer NOT NULL, + session_id text, + shape__area double precision, + shape__length double precision, + treatdate bigint, + treat_id text, + type text, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_zones ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + active bigint, + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + name text, + objectid integer NOT NULL, + shape__area double precision, + shape__length double precision, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) +); + + +CREATE TABLE history_zones2 ( + organization_id INTEGER NOT NULL REFERENCES organization(id), + creationdate bigint, + creator text, + editdate bigint, + editor text, + globalid text, + name text, + objectid integer NOT NULL, + shape__area double precision, + shape__length double precision, + created TIMESTAMP, + created_date bigint, + created_user text, + geometry_x double precision, + geometry_y double precision, + last_edited_date bigint, + last_edited_user text, + version INT, + PRIMARY KEY(OBJECTID, version) +); diff --git a/db/migrations/00020_add_org_id_fieldseeker_v2.sql b/db/migrations/00020_add_org_id_fieldseeker_v2.sql new file mode 100644 index 00000000..8081514d --- /dev/null +++ b/db/migrations/00020_add_org_id_fieldseeker_v2.sql @@ -0,0 +1,9817 @@ +-- +goose Up +ALTER TABLE fieldseeker.containerrelate ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.fieldscoutinglog ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.habitatrelate ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.inspectionsample ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.inspectionsampledetail ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.linelocation ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.locationtracking ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.mosquitoinspection ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.pointlocation ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.polygonlocation ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.pool ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.pooldetail ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.proposedtreatmentarea ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.qamosquitoinspection ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.rodentlocation ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.samplecollection ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.samplelocation ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.servicerequest ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.speciesabundance ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.stormdrain ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.timecard ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.trapdata ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.traplocation ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.treatment ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.treatmentarea ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.zones ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); +ALTER TABLE fieldseeker.zones2 ADD COLUMN organization_id INTEGER NOT NULL REFERENCES organization(id); + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_containerrelate( + p_objectid bigint, + p_organization_id INTEGER, + + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_inspsampleid uuid, + p_mosquitoinspid uuid, + p_treatmentid uuid, + p_containertype varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.containerrelate lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.inspsampleid IS NOT DISTINCT FROM p_inspsampleid + AND lv.mosquitoinspid IS NOT DISTINCT FROM p_mosquitoinspid + AND lv.treatmentid IS NOT DISTINCT FROM p_treatmentid + AND lv.containertype IS NOT DISTINCT FROM p_containertype + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.containerrelate + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.containerrelate + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.containerrelate ( + objectid, + organization_id, + + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + inspsampleid, + mosquitoinspid, + treatmentid, + containertype, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_inspsampleid, + p_mosquitoinspid, + p_treatmentid, + p_containertype, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_fieldscoutinglog( + p_objectid bigint, + p_organization_id INTEGER, + + p_status smallint, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.fieldscoutinglog lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.status IS NOT DISTINCT FROM p_status + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.fieldscoutinglog + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.fieldscoutinglog + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.fieldscoutinglog ( + objectid, + organization_id, + + status, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_status, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_habitatrelate( + p_objectid bigint, + p_organization_id INTEGER, + + p_foreign_id uuid, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_habitattype varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.habitatrelate lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.foreign_id IS NOT DISTINCT FROM p_foreign_id + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.habitattype IS NOT DISTINCT FROM p_habitattype + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.habitatrelate + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.habitatrelate + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.habitatrelate ( + objectid, + organization_id, + + foreign_id, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + habitattype, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_foreign_id, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_habitattype, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_inspectionsampledetail( + p_objectid bigint, + p_organization_id INTEGER, + + p_inspsample_id uuid, + p_fieldspecies varchar, + p_flarvcount smallint, + p_fpupcount smallint, + p_feggcount smallint, + p_flstages varchar, + p_fdomstage varchar, + p_fadultact varchar, + p_labspecies varchar, + p_llarvcount smallint, + p_lpupcount smallint, + p_leggcount smallint, + p_ldomstage varchar, + p_comments varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_processed smallint, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.inspectionsampledetail lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.inspsample_id IS NOT DISTINCT FROM p_inspsample_id + AND lv.fieldspecies IS NOT DISTINCT FROM p_fieldspecies + AND lv.flarvcount IS NOT DISTINCT FROM p_flarvcount + AND lv.fpupcount IS NOT DISTINCT FROM p_fpupcount + AND lv.feggcount IS NOT DISTINCT FROM p_feggcount + AND lv.flstages IS NOT DISTINCT FROM p_flstages + AND lv.fdomstage IS NOT DISTINCT FROM p_fdomstage + AND lv.fadultact IS NOT DISTINCT FROM p_fadultact + AND lv.labspecies IS NOT DISTINCT FROM p_labspecies + AND lv.llarvcount IS NOT DISTINCT FROM p_llarvcount + AND lv.lpupcount IS NOT DISTINCT FROM p_lpupcount + AND lv.leggcount IS NOT DISTINCT FROM p_leggcount + AND lv.ldomstage IS NOT DISTINCT FROM p_ldomstage + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.processed IS NOT DISTINCT FROM p_processed + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.inspectionsampledetail + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.inspectionsampledetail + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.inspectionsampledetail ( + objectid, + organization_id, + + inspsample_id, + fieldspecies, + flarvcount, + fpupcount, + feggcount, + flstages, + fdomstage, + fadultact, + labspecies, + llarvcount, + lpupcount, + leggcount, + ldomstage, + comments, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + processed, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_inspsample_id, + p_fieldspecies, + p_flarvcount, + p_fpupcount, + p_feggcount, + p_flstages, + p_fdomstage, + p_fadultact, + p_labspecies, + p_llarvcount, + p_lpupcount, + p_leggcount, + p_ldomstage, + p_comments, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_processed, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_inspectionsample( + p_objectid bigint, + p_organization_id INTEGER, + + p_insp_id uuid, + p_sampleid varchar, + p_processed smallint, + p_idbytech varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.inspectionsample lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.insp_id IS NOT DISTINCT FROM p_insp_id + AND lv.sampleid IS NOT DISTINCT FROM p_sampleid + AND lv.processed IS NOT DISTINCT FROM p_processed + AND lv.idbytech IS NOT DISTINCT FROM p_idbytech + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.inspectionsample + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.inspectionsample + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.inspectionsample ( + objectid, + organization_id, + + insp_id, + sampleid, + processed, + idbytech, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_insp_id, + p_sampleid, + p_processed, + p_idbytech, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_linelocation( + p_objectid bigint, + p_organization_id INTEGER, + + p_name varchar, + p_zone varchar, + p_habitat varchar, + p_priority varchar, + p_usetype varchar, + p_active smallint, + p_description varchar, + p_accessdesc varchar, + p_comments varchar, + p_symbology varchar, + p_externalid varchar, + p_acres double precision, + p_nextactiondatescheduled timestamp, + p_larvinspectinterval smallint, + p_length_ft double precision, + p_width_ft double precision, + p_zone2 varchar, + p_locationnumber integer, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_lastinspectdate timestamp, + p_lastinspectbreeding varchar, + p_lastinspectavglarvae double precision, + p_lastinspectavgpupae double precision, + p_lastinspectlstages varchar, + p_lastinspectactiontaken varchar, + p_lastinspectfieldspecies varchar, + p_lasttreatdate timestamp, + p_lasttreatproduct varchar, + p_lasttreatqty double precision, + p_lasttreatqtyunit varchar, + p_hectares double precision, + p_lastinspectactivity varchar, + p_lasttreatactivity varchar, + p_length_meters double precision, + p_width_meters double precision, + p_lastinspectconditions varchar, + p_waterorigin varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_jurisdiction varchar, + p_shape__length double precision, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.linelocation lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.habitat IS NOT DISTINCT FROM p_habitat + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.usetype IS NOT DISTINCT FROM p_usetype + AND lv.active IS NOT DISTINCT FROM p_active + AND lv.description IS NOT DISTINCT FROM p_description + AND lv.accessdesc IS NOT DISTINCT FROM p_accessdesc + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.symbology IS NOT DISTINCT FROM p_symbology + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.acres IS NOT DISTINCT FROM p_acres + AND lv.nextactiondatescheduled IS NOT DISTINCT FROM p_nextactiondatescheduled + AND lv.larvinspectinterval IS NOT DISTINCT FROM p_larvinspectinterval + AND lv.length_ft IS NOT DISTINCT FROM p_length_ft + AND lv.width_ft IS NOT DISTINCT FROM p_width_ft + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.locationnumber IS NOT DISTINCT FROM p_locationnumber + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.lastinspectdate IS NOT DISTINCT FROM p_lastinspectdate + AND lv.lastinspectbreeding IS NOT DISTINCT FROM p_lastinspectbreeding + AND lv.lastinspectavglarvae IS NOT DISTINCT FROM p_lastinspectavglarvae + AND lv.lastinspectavgpupae IS NOT DISTINCT FROM p_lastinspectavgpupae + AND lv.lastinspectlstages IS NOT DISTINCT FROM p_lastinspectlstages + AND lv.lastinspectactiontaken IS NOT DISTINCT FROM p_lastinspectactiontaken + AND lv.lastinspectfieldspecies IS NOT DISTINCT FROM p_lastinspectfieldspecies + AND lv.lasttreatdate IS NOT DISTINCT FROM p_lasttreatdate + AND lv.lasttreatproduct IS NOT DISTINCT FROM p_lasttreatproduct + AND lv.lasttreatqty IS NOT DISTINCT FROM p_lasttreatqty + AND lv.lasttreatqtyunit IS NOT DISTINCT FROM p_lasttreatqtyunit + AND lv.hectares IS NOT DISTINCT FROM p_hectares + AND lv.lastinspectactivity IS NOT DISTINCT FROM p_lastinspectactivity + AND lv.lasttreatactivity IS NOT DISTINCT FROM p_lasttreatactivity + AND lv.length_meters IS NOT DISTINCT FROM p_length_meters + AND lv.width_meters IS NOT DISTINCT FROM p_width_meters + AND lv.lastinspectconditions IS NOT DISTINCT FROM p_lastinspectconditions + AND lv.waterorigin IS NOT DISTINCT FROM p_waterorigin + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.jurisdiction IS NOT DISTINCT FROM p_jurisdiction + AND lv.shape__length IS NOT DISTINCT FROM p_shape__length + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.linelocation + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.linelocation + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.linelocation ( + objectid, + organization_id, + + name, + zone, + habitat, + priority, + usetype, + active, + description, + accessdesc, + comments, + symbology, + externalid, + acres, + nextactiondatescheduled, + larvinspectinterval, + length_ft, + width_ft, + zone2, + locationnumber, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + lastinspectdate, + lastinspectbreeding, + lastinspectavglarvae, + lastinspectavgpupae, + lastinspectlstages, + lastinspectactiontaken, + lastinspectfieldspecies, + lasttreatdate, + lasttreatproduct, + lasttreatqty, + lasttreatqtyunit, + hectares, + lastinspectactivity, + lasttreatactivity, + length_meters, + width_meters, + lastinspectconditions, + waterorigin, + creationdate, + creator, + editdate, + editor, + jurisdiction, + shape__length, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_name, + p_zone, + p_habitat, + p_priority, + p_usetype, + p_active, + p_description, + p_accessdesc, + p_comments, + p_symbology, + p_externalid, + p_acres, + p_nextactiondatescheduled, + p_larvinspectinterval, + p_length_ft, + p_width_ft, + p_zone2, + p_locationnumber, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_lastinspectdate, + p_lastinspectbreeding, + p_lastinspectavglarvae, + p_lastinspectavgpupae, + p_lastinspectlstages, + p_lastinspectactiontaken, + p_lastinspectfieldspecies, + p_lasttreatdate, + p_lasttreatproduct, + p_lasttreatqty, + p_lasttreatqtyunit, + p_hectares, + p_lastinspectactivity, + p_lasttreatactivity, + p_length_meters, + p_width_meters, + p_lastinspectconditions, + p_waterorigin, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_jurisdiction, + p_shape__length, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_locationtracking( + p_objectid bigint, + p_organization_id INTEGER, + + p_accuracy double precision, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_globalid uuid, + p_fieldtech varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.locationtracking lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.accuracy IS NOT DISTINCT FROM p_accuracy + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.fieldtech IS NOT DISTINCT FROM p_fieldtech + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.locationtracking + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.locationtracking + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.locationtracking ( + objectid, + organization_id, + + accuracy, + created_user, + created_date, + last_edited_user, + last_edited_date, + globalid, + fieldtech, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_accuracy, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_globalid, + p_fieldtech, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_mosquitoinspection( + p_objectid bigint, + p_organization_id INTEGER, + + p_numdips smallint, + p_activity varchar, + p_breeding varchar, + p_totlarvae smallint, + p_totpupae smallint, + p_eggs smallint, + p_posdips smallint, + p_adultact varchar, + p_lstages varchar, + p_domstage varchar, + p_actiontaken varchar, + p_comments varchar, + p_avetemp double precision, + p_windspeed double precision, + p_raingauge double precision, + p_startdatetime timestamp, + p_enddatetime timestamp, + p_winddir varchar, + p_avglarvae double precision, + p_avgpupae double precision, + p_reviewed smallint, + p_reviewedby varchar, + p_revieweddate timestamp, + p_locationname varchar, + p_zone varchar, + p_recordstatus smallint, + p_zone2 varchar, + p_personalcontact smallint, + p_tirecount smallint, + p_cbcount smallint, + p_containercount smallint, + p_fieldspecies varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_linelocid uuid, + p_pointlocid uuid, + p_polygonlocid uuid, + p_srid uuid, + p_fieldtech varchar, + p_larvaepresent smallint, + p_pupaepresent smallint, + p_sdid uuid, + p_sitecond varchar, + p_positivecontainercount smallint, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_jurisdiction varchar, + p_visualmonitoring smallint, + p_vmcomments varchar, + p_adminaction varchar, + p_ptaid uuid, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.mosquitoinspection lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.numdips IS NOT DISTINCT FROM p_numdips + AND lv.activity IS NOT DISTINCT FROM p_activity + AND lv.breeding IS NOT DISTINCT FROM p_breeding + AND lv.totlarvae IS NOT DISTINCT FROM p_totlarvae + AND lv.totpupae IS NOT DISTINCT FROM p_totpupae + AND lv.eggs IS NOT DISTINCT FROM p_eggs + AND lv.posdips IS NOT DISTINCT FROM p_posdips + AND lv.adultact IS NOT DISTINCT FROM p_adultact + AND lv.lstages IS NOT DISTINCT FROM p_lstages + AND lv.domstage IS NOT DISTINCT FROM p_domstage + AND lv.actiontaken IS NOT DISTINCT FROM p_actiontaken + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.avetemp IS NOT DISTINCT FROM p_avetemp + AND lv.windspeed IS NOT DISTINCT FROM p_windspeed + AND lv.raingauge IS NOT DISTINCT FROM p_raingauge + AND lv.startdatetime IS NOT DISTINCT FROM p_startdatetime + AND lv.enddatetime IS NOT DISTINCT FROM p_enddatetime + AND lv.winddir IS NOT DISTINCT FROM p_winddir + AND lv.avglarvae IS NOT DISTINCT FROM p_avglarvae + AND lv.avgpupae IS NOT DISTINCT FROM p_avgpupae + AND lv.reviewed IS NOT DISTINCT FROM p_reviewed + AND lv.reviewedby IS NOT DISTINCT FROM p_reviewedby + AND lv.revieweddate IS NOT DISTINCT FROM p_revieweddate + AND lv.locationname IS NOT DISTINCT FROM p_locationname + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.recordstatus IS NOT DISTINCT FROM p_recordstatus + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.personalcontact IS NOT DISTINCT FROM p_personalcontact + AND lv.tirecount IS NOT DISTINCT FROM p_tirecount + AND lv.cbcount IS NOT DISTINCT FROM p_cbcount + AND lv.containercount IS NOT DISTINCT FROM p_containercount + AND lv.fieldspecies IS NOT DISTINCT FROM p_fieldspecies + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.linelocid IS NOT DISTINCT FROM p_linelocid + AND lv.pointlocid IS NOT DISTINCT FROM p_pointlocid + AND lv.polygonlocid IS NOT DISTINCT FROM p_polygonlocid + AND lv.srid IS NOT DISTINCT FROM p_srid + AND lv.fieldtech IS NOT DISTINCT FROM p_fieldtech + AND lv.larvaepresent IS NOT DISTINCT FROM p_larvaepresent + AND lv.pupaepresent IS NOT DISTINCT FROM p_pupaepresent + AND lv.sdid IS NOT DISTINCT FROM p_sdid + AND lv.sitecond IS NOT DISTINCT FROM p_sitecond + AND lv.positivecontainercount IS NOT DISTINCT FROM p_positivecontainercount + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.jurisdiction IS NOT DISTINCT FROM p_jurisdiction + AND lv.visualmonitoring IS NOT DISTINCT FROM p_visualmonitoring + AND lv.vmcomments IS NOT DISTINCT FROM p_vmcomments + AND lv.adminaction IS NOT DISTINCT FROM p_adminaction + AND lv.ptaid IS NOT DISTINCT FROM p_ptaid + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.mosquitoinspection + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.mosquitoinspection + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.mosquitoinspection ( + objectid, + organization_id, + + numdips, + activity, + breeding, + totlarvae, + totpupae, + eggs, + posdips, + adultact, + lstages, + domstage, + actiontaken, + comments, + avetemp, + windspeed, + raingauge, + startdatetime, + enddatetime, + winddir, + avglarvae, + avgpupae, + reviewed, + reviewedby, + revieweddate, + locationname, + zone, + recordstatus, + zone2, + personalcontact, + tirecount, + cbcount, + containercount, + fieldspecies, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + linelocid, + pointlocid, + polygonlocid, + srid, + fieldtech, + larvaepresent, + pupaepresent, + sdid, + sitecond, + positivecontainercount, + creationdate, + creator, + editdate, + editor, + jurisdiction, + visualmonitoring, + vmcomments, + adminaction, + ptaid, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_numdips, + p_activity, + p_breeding, + p_totlarvae, + p_totpupae, + p_eggs, + p_posdips, + p_adultact, + p_lstages, + p_domstage, + p_actiontaken, + p_comments, + p_avetemp, + p_windspeed, + p_raingauge, + p_startdatetime, + p_enddatetime, + p_winddir, + p_avglarvae, + p_avgpupae, + p_reviewed, + p_reviewedby, + p_revieweddate, + p_locationname, + p_zone, + p_recordstatus, + p_zone2, + p_personalcontact, + p_tirecount, + p_cbcount, + p_containercount, + p_fieldspecies, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_linelocid, + p_pointlocid, + p_polygonlocid, + p_srid, + p_fieldtech, + p_larvaepresent, + p_pupaepresent, + p_sdid, + p_sitecond, + p_positivecontainercount, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_jurisdiction, + p_visualmonitoring, + p_vmcomments, + p_adminaction, + p_ptaid, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_pointlocation( + p_objectid bigint, + p_organization_id INTEGER, + + p_name varchar, + p_zone varchar, + p_habitat varchar, + p_priority varchar, + p_usetype varchar, + p_active smallint, + p_description varchar, + p_accessdesc varchar, + p_comments varchar, + p_symbology varchar, + p_externalid varchar, + p_nextactiondatescheduled timestamp, + p_larvinspectinterval smallint, + p_zone2 varchar, + p_locationnumber integer, + p_globalid uuid, + p_stype varchar, + p_lastinspectdate timestamp, + p_lastinspectbreeding varchar, + p_lastinspectavglarvae double precision, + p_lastinspectavgpupae double precision, + p_lastinspectlstages varchar, + p_lastinspectactiontaken varchar, + p_lastinspectfieldspecies varchar, + p_lasttreatdate timestamp, + p_lasttreatproduct varchar, + p_lasttreatqty double precision, + p_lasttreatqtyunit varchar, + p_lastinspectactivity varchar, + p_lasttreatactivity varchar, + p_lastinspectconditions varchar, + p_waterorigin varchar, + p_x double precision, + p_y double precision, + p_assignedtech varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_jurisdiction varchar, + p_deactivate_reason varchar, + p_scalarpriority integer, + p_sourcestatus varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.pointlocation lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.habitat IS NOT DISTINCT FROM p_habitat + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.usetype IS NOT DISTINCT FROM p_usetype + AND lv.active IS NOT DISTINCT FROM p_active + AND lv.description IS NOT DISTINCT FROM p_description + AND lv.accessdesc IS NOT DISTINCT FROM p_accessdesc + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.symbology IS NOT DISTINCT FROM p_symbology + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.nextactiondatescheduled IS NOT DISTINCT FROM p_nextactiondatescheduled + AND lv.larvinspectinterval IS NOT DISTINCT FROM p_larvinspectinterval + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.locationnumber IS NOT DISTINCT FROM p_locationnumber + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.stype IS NOT DISTINCT FROM p_stype + AND lv.lastinspectdate IS NOT DISTINCT FROM p_lastinspectdate + AND lv.lastinspectbreeding IS NOT DISTINCT FROM p_lastinspectbreeding + AND lv.lastinspectavglarvae IS NOT DISTINCT FROM p_lastinspectavglarvae + AND lv.lastinspectavgpupae IS NOT DISTINCT FROM p_lastinspectavgpupae + AND lv.lastinspectlstages IS NOT DISTINCT FROM p_lastinspectlstages + AND lv.lastinspectactiontaken IS NOT DISTINCT FROM p_lastinspectactiontaken + AND lv.lastinspectfieldspecies IS NOT DISTINCT FROM p_lastinspectfieldspecies + AND lv.lasttreatdate IS NOT DISTINCT FROM p_lasttreatdate + AND lv.lasttreatproduct IS NOT DISTINCT FROM p_lasttreatproduct + AND lv.lasttreatqty IS NOT DISTINCT FROM p_lasttreatqty + AND lv.lasttreatqtyunit IS NOT DISTINCT FROM p_lasttreatqtyunit + AND lv.lastinspectactivity IS NOT DISTINCT FROM p_lastinspectactivity + AND lv.lasttreatactivity IS NOT DISTINCT FROM p_lasttreatactivity + AND lv.lastinspectconditions IS NOT DISTINCT FROM p_lastinspectconditions + AND lv.waterorigin IS NOT DISTINCT FROM p_waterorigin + AND lv.x IS NOT DISTINCT FROM p_x + AND lv.y IS NOT DISTINCT FROM p_y + AND lv.assignedtech IS NOT DISTINCT FROM p_assignedtech + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.jurisdiction IS NOT DISTINCT FROM p_jurisdiction + AND lv.deactivate_reason IS NOT DISTINCT FROM p_deactivate_reason + AND lv.scalarpriority IS NOT DISTINCT FROM p_scalarpriority + AND lv.sourcestatus IS NOT DISTINCT FROM p_sourcestatus + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.pointlocation + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.pointlocation + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.pointlocation ( + objectid, + organization_id, + + name, + zone, + habitat, + priority, + usetype, + active, + description, + accessdesc, + comments, + symbology, + externalid, + nextactiondatescheduled, + larvinspectinterval, + zone2, + locationnumber, + globalid, + stype, + lastinspectdate, + lastinspectbreeding, + lastinspectavglarvae, + lastinspectavgpupae, + lastinspectlstages, + lastinspectactiontaken, + lastinspectfieldspecies, + lasttreatdate, + lasttreatproduct, + lasttreatqty, + lasttreatqtyunit, + lastinspectactivity, + lasttreatactivity, + lastinspectconditions, + waterorigin, + x, + y, + assignedtech, + creationdate, + creator, + editdate, + editor, + jurisdiction, + deactivate_reason, + scalarpriority, + sourcestatus, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_name, + p_zone, + p_habitat, + p_priority, + p_usetype, + p_active, + p_description, + p_accessdesc, + p_comments, + p_symbology, + p_externalid, + p_nextactiondatescheduled, + p_larvinspectinterval, + p_zone2, + p_locationnumber, + p_globalid, + p_stype, + p_lastinspectdate, + p_lastinspectbreeding, + p_lastinspectavglarvae, + p_lastinspectavgpupae, + p_lastinspectlstages, + p_lastinspectactiontaken, + p_lastinspectfieldspecies, + p_lasttreatdate, + p_lasttreatproduct, + p_lasttreatqty, + p_lasttreatqtyunit, + p_lastinspectactivity, + p_lasttreatactivity, + p_lastinspectconditions, + p_waterorigin, + p_x, + p_y, + p_assignedtech, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_jurisdiction, + p_deactivate_reason, + p_scalarpriority, + p_sourcestatus, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_polygonlocation( + p_objectid bigint, + p_organization_id INTEGER, + + p_name varchar, + p_zone varchar, + p_habitat varchar, + p_priority varchar, + p_usetype varchar, + p_active smallint, + p_description varchar, + p_accessdesc varchar, + p_comments varchar, + p_symbology varchar, + p_externalid varchar, + p_acres double precision, + p_nextactiondatescheduled timestamp, + p_larvinspectinterval smallint, + p_zone2 varchar, + p_locationnumber integer, + p_globalid uuid, + p_lastinspectdate timestamp, + p_lastinspectbreeding varchar, + p_lastinspectavglarvae double precision, + p_lastinspectavgpupae double precision, + p_lastinspectlstages varchar, + p_lastinspectactiontaken varchar, + p_lastinspectfieldspecies varchar, + p_lasttreatdate timestamp, + p_lasttreatproduct varchar, + p_lasttreatqty double precision, + p_lasttreatqtyunit varchar, + p_hectares double precision, + p_lastinspectactivity varchar, + p_lasttreatactivity varchar, + p_lastinspectconditions varchar, + p_waterorigin varchar, + p_filter varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_jurisdiction varchar, + p_shape__area double precision, + p_shape__length double precision, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.polygonlocation lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.habitat IS NOT DISTINCT FROM p_habitat + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.usetype IS NOT DISTINCT FROM p_usetype + AND lv.active IS NOT DISTINCT FROM p_active + AND lv.description IS NOT DISTINCT FROM p_description + AND lv.accessdesc IS NOT DISTINCT FROM p_accessdesc + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.symbology IS NOT DISTINCT FROM p_symbology + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.acres IS NOT DISTINCT FROM p_acres + AND lv.nextactiondatescheduled IS NOT DISTINCT FROM p_nextactiondatescheduled + AND lv.larvinspectinterval IS NOT DISTINCT FROM p_larvinspectinterval + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.locationnumber IS NOT DISTINCT FROM p_locationnumber + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.lastinspectdate IS NOT DISTINCT FROM p_lastinspectdate + AND lv.lastinspectbreeding IS NOT DISTINCT FROM p_lastinspectbreeding + AND lv.lastinspectavglarvae IS NOT DISTINCT FROM p_lastinspectavglarvae + AND lv.lastinspectavgpupae IS NOT DISTINCT FROM p_lastinspectavgpupae + AND lv.lastinspectlstages IS NOT DISTINCT FROM p_lastinspectlstages + AND lv.lastinspectactiontaken IS NOT DISTINCT FROM p_lastinspectactiontaken + AND lv.lastinspectfieldspecies IS NOT DISTINCT FROM p_lastinspectfieldspecies + AND lv.lasttreatdate IS NOT DISTINCT FROM p_lasttreatdate + AND lv.lasttreatproduct IS NOT DISTINCT FROM p_lasttreatproduct + AND lv.lasttreatqty IS NOT DISTINCT FROM p_lasttreatqty + AND lv.lasttreatqtyunit IS NOT DISTINCT FROM p_lasttreatqtyunit + AND lv.hectares IS NOT DISTINCT FROM p_hectares + AND lv.lastinspectactivity IS NOT DISTINCT FROM p_lastinspectactivity + AND lv.lasttreatactivity IS NOT DISTINCT FROM p_lasttreatactivity + AND lv.lastinspectconditions IS NOT DISTINCT FROM p_lastinspectconditions + AND lv.waterorigin IS NOT DISTINCT FROM p_waterorigin + AND lv.filter IS NOT DISTINCT FROM p_filter + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.jurisdiction IS NOT DISTINCT FROM p_jurisdiction + AND lv.shape__area IS NOT DISTINCT FROM p_shape__area + AND lv.shape__length IS NOT DISTINCT FROM p_shape__length + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.polygonlocation + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.polygonlocation + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.polygonlocation ( + objectid, + organization_id, + + name, + zone, + habitat, + priority, + usetype, + active, + description, + accessdesc, + comments, + symbology, + externalid, + acres, + nextactiondatescheduled, + larvinspectinterval, + zone2, + locationnumber, + globalid, + lastinspectdate, + lastinspectbreeding, + lastinspectavglarvae, + lastinspectavgpupae, + lastinspectlstages, + lastinspectactiontaken, + lastinspectfieldspecies, + lasttreatdate, + lasttreatproduct, + lasttreatqty, + lasttreatqtyunit, + hectares, + lastinspectactivity, + lasttreatactivity, + lastinspectconditions, + waterorigin, + filter, + creationdate, + creator, + editdate, + editor, + jurisdiction, + shape__area, + shape__length, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_name, + p_zone, + p_habitat, + p_priority, + p_usetype, + p_active, + p_description, + p_accessdesc, + p_comments, + p_symbology, + p_externalid, + p_acres, + p_nextactiondatescheduled, + p_larvinspectinterval, + p_zone2, + p_locationnumber, + p_globalid, + p_lastinspectdate, + p_lastinspectbreeding, + p_lastinspectavglarvae, + p_lastinspectavgpupae, + p_lastinspectlstages, + p_lastinspectactiontaken, + p_lastinspectfieldspecies, + p_lasttreatdate, + p_lasttreatproduct, + p_lasttreatqty, + p_lasttreatqtyunit, + p_hectares, + p_lastinspectactivity, + p_lasttreatactivity, + p_lastinspectconditions, + p_waterorigin, + p_filter, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_jurisdiction, + p_shape__area, + p_shape__length, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_pooldetail( + p_objectid bigint, + p_organization_id INTEGER, + + p_trapdata_id uuid, + p_pool_id uuid, + p_species varchar, + p_females smallint, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.pooldetail lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.trapdata_id IS NOT DISTINCT FROM p_trapdata_id + AND lv.pool_id IS NOT DISTINCT FROM p_pool_id + AND lv.species IS NOT DISTINCT FROM p_species + AND lv.females IS NOT DISTINCT FROM p_females + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.pooldetail + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.pooldetail + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.pooldetail ( + objectid, + organization_id, + + trapdata_id, + pool_id, + species, + females, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_trapdata_id, + p_pool_id, + p_species, + p_females, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_pool( + p_objectid bigint, + p_organization_id INTEGER, + + p_trapdata_id uuid, + p_datesent timestamp, + p_survtech varchar, + p_datetested timestamp, + p_testtech varchar, + p_comments varchar, + p_sampleid varchar, + p_processed smallint, + p_lab_id uuid, + p_testmethod varchar, + p_diseasetested varchar, + p_diseasepos varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_lab varchar, + p_poolyear smallint, + p_gatewaysync smallint, + p_vectorsurvcollectionid varchar, + p_vectorsurvpoolid varchar, + p_vectorsurvtrapdataid varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.pool lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.trapdata_id IS NOT DISTINCT FROM p_trapdata_id + AND lv.datesent IS NOT DISTINCT FROM p_datesent + AND lv.survtech IS NOT DISTINCT FROM p_survtech + AND lv.datetested IS NOT DISTINCT FROM p_datetested + AND lv.testtech IS NOT DISTINCT FROM p_testtech + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.sampleid IS NOT DISTINCT FROM p_sampleid + AND lv.processed IS NOT DISTINCT FROM p_processed + AND lv.lab_id IS NOT DISTINCT FROM p_lab_id + AND lv.testmethod IS NOT DISTINCT FROM p_testmethod + AND lv.diseasetested IS NOT DISTINCT FROM p_diseasetested + AND lv.diseasepos IS NOT DISTINCT FROM p_diseasepos + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.lab IS NOT DISTINCT FROM p_lab + AND lv.poolyear IS NOT DISTINCT FROM p_poolyear + AND lv.gatewaysync IS NOT DISTINCT FROM p_gatewaysync + AND lv.vectorsurvcollectionid IS NOT DISTINCT FROM p_vectorsurvcollectionid + AND lv.vectorsurvpoolid IS NOT DISTINCT FROM p_vectorsurvpoolid + AND lv.vectorsurvtrapdataid IS NOT DISTINCT FROM p_vectorsurvtrapdataid + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.pool + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.pool + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.pool ( + objectid, + organization_id, + + trapdata_id, + datesent, + survtech, + datetested, + testtech, + comments, + sampleid, + processed, + lab_id, + testmethod, + diseasetested, + diseasepos, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + lab, + poolyear, + gatewaysync, + vectorsurvcollectionid, + vectorsurvpoolid, + vectorsurvtrapdataid, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_trapdata_id, + p_datesent, + p_survtech, + p_datetested, + p_testtech, + p_comments, + p_sampleid, + p_processed, + p_lab_id, + p_testmethod, + p_diseasetested, + p_diseasepos, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_lab, + p_poolyear, + p_gatewaysync, + p_vectorsurvcollectionid, + p_vectorsurvpoolid, + p_vectorsurvtrapdataid, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_proposedtreatmentarea( + p_objectid bigint, + p_organization_id INTEGER, + + p_method varchar, + p_comments varchar, + p_zone varchar, + p_reviewed smallint, + p_reviewedby varchar, + p_revieweddate timestamp, + p_zone2 varchar, + p_completeddate timestamp, + p_completedby varchar, + p_completed smallint, + p_issprayroute smallint, + p_name varchar, + p_acres double precision, + p_globalid uuid, + p_exported smallint, + p_targetproduct varchar, + p_targetapprate double precision, + p_hectares double precision, + p_lasttreatactivity varchar, + p_lasttreatdate timestamp, + p_lasttreatproduct varchar, + p_lasttreatqty double precision, + p_lasttreatqtyunit varchar, + p_priority varchar, + p_duedate timestamp, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_targetspecies varchar, + p_shape__area double precision, + p_shape__length double precision, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.proposedtreatmentarea lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.method IS NOT DISTINCT FROM p_method + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.reviewed IS NOT DISTINCT FROM p_reviewed + AND lv.reviewedby IS NOT DISTINCT FROM p_reviewedby + AND lv.revieweddate IS NOT DISTINCT FROM p_revieweddate + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.completeddate IS NOT DISTINCT FROM p_completeddate + AND lv.completedby IS NOT DISTINCT FROM p_completedby + AND lv.completed IS NOT DISTINCT FROM p_completed + AND lv.issprayroute IS NOT DISTINCT FROM p_issprayroute + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.acres IS NOT DISTINCT FROM p_acres + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.exported IS NOT DISTINCT FROM p_exported + AND lv.targetproduct IS NOT DISTINCT FROM p_targetproduct + AND lv.targetapprate IS NOT DISTINCT FROM p_targetapprate + AND lv.hectares IS NOT DISTINCT FROM p_hectares + AND lv.lasttreatactivity IS NOT DISTINCT FROM p_lasttreatactivity + AND lv.lasttreatdate IS NOT DISTINCT FROM p_lasttreatdate + AND lv.lasttreatproduct IS NOT DISTINCT FROM p_lasttreatproduct + AND lv.lasttreatqty IS NOT DISTINCT FROM p_lasttreatqty + AND lv.lasttreatqtyunit IS NOT DISTINCT FROM p_lasttreatqtyunit + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.duedate IS NOT DISTINCT FROM p_duedate + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.targetspecies IS NOT DISTINCT FROM p_targetspecies + AND lv.shape__area IS NOT DISTINCT FROM p_shape__area + AND lv.shape__length IS NOT DISTINCT FROM p_shape__length + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.proposedtreatmentarea + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.proposedtreatmentarea + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.proposedtreatmentarea ( + objectid, + organization_id, + + method, + comments, + zone, + reviewed, + reviewedby, + revieweddate, + zone2, + completeddate, + completedby, + completed, + issprayroute, + name, + acres, + globalid, + exported, + targetproduct, + targetapprate, + hectares, + lasttreatactivity, + lasttreatdate, + lasttreatproduct, + lasttreatqty, + lasttreatqtyunit, + priority, + duedate, + creationdate, + creator, + editdate, + editor, + targetspecies, + shape__area, + shape__length, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_method, + p_comments, + p_zone, + p_reviewed, + p_reviewedby, + p_revieweddate, + p_zone2, + p_completeddate, + p_completedby, + p_completed, + p_issprayroute, + p_name, + p_acres, + p_globalid, + p_exported, + p_targetproduct, + p_targetapprate, + p_hectares, + p_lasttreatactivity, + p_lasttreatdate, + p_lasttreatproduct, + p_lasttreatqty, + p_lasttreatqtyunit, + p_priority, + p_duedate, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_targetspecies, + p_shape__area, + p_shape__length, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_qamosquitoinspection( + p_objectid bigint, + p_organization_id INTEGER, + + p_posdips smallint, + p_actiontaken varchar, + p_comments varchar, + p_avetemp double precision, + p_windspeed double precision, + p_raingauge double precision, + p_globalid uuid, + p_startdatetime timestamp, + p_enddatetime timestamp, + p_winddir varchar, + p_reviewed smallint, + p_reviewedby varchar, + p_revieweddate timestamp, + p_locationname varchar, + p_zone varchar, + p_recordstatus smallint, + p_zone2 varchar, + p_lr smallint, + p_negdips smallint, + p_totalacres double precision, + p_acresbreeding double precision, + p_fish smallint, + p_sitetype varchar, + p_breedingpotential varchar, + p_movingwater smallint, + p_nowaterever smallint, + p_mosquitohabitat varchar, + p_habvalue1 smallint, + p_habvalue1percent smallint, + p_habvalue2 smallint, + p_habvalue2percent smallint, + p_potential smallint, + p_larvaepresent smallint, + p_larvaeinsidetreatedarea smallint, + p_larvaeoutsidetreatedarea smallint, + p_larvaereason varchar, + p_aquaticorganisms varchar, + p_vegetation varchar, + p_sourcereduction varchar, + p_waterpresent smallint, + p_watermovement1 varchar, + p_watermovement1percent smallint, + p_watermovement2 varchar, + p_watermovement2percent smallint, + p_soilconditions varchar, + p_waterduration varchar, + p_watersource varchar, + p_waterconditions varchar, + p_adultactivity smallint, + p_linelocid uuid, + p_pointlocid uuid, + p_polygonlocid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_fieldtech varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.qamosquitoinspection lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.posdips IS NOT DISTINCT FROM p_posdips + AND lv.actiontaken IS NOT DISTINCT FROM p_actiontaken + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.avetemp IS NOT DISTINCT FROM p_avetemp + AND lv.windspeed IS NOT DISTINCT FROM p_windspeed + AND lv.raingauge IS NOT DISTINCT FROM p_raingauge + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.startdatetime IS NOT DISTINCT FROM p_startdatetime + AND lv.enddatetime IS NOT DISTINCT FROM p_enddatetime + AND lv.winddir IS NOT DISTINCT FROM p_winddir + AND lv.reviewed IS NOT DISTINCT FROM p_reviewed + AND lv.reviewedby IS NOT DISTINCT FROM p_reviewedby + AND lv.revieweddate IS NOT DISTINCT FROM p_revieweddate + AND lv.locationname IS NOT DISTINCT FROM p_locationname + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.recordstatus IS NOT DISTINCT FROM p_recordstatus + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.lr IS NOT DISTINCT FROM p_lr + AND lv.negdips IS NOT DISTINCT FROM p_negdips + AND lv.totalacres IS NOT DISTINCT FROM p_totalacres + AND lv.acresbreeding IS NOT DISTINCT FROM p_acresbreeding + AND lv.fish IS NOT DISTINCT FROM p_fish + AND lv.sitetype IS NOT DISTINCT FROM p_sitetype + AND lv.breedingpotential IS NOT DISTINCT FROM p_breedingpotential + AND lv.movingwater IS NOT DISTINCT FROM p_movingwater + AND lv.nowaterever IS NOT DISTINCT FROM p_nowaterever + AND lv.mosquitohabitat IS NOT DISTINCT FROM p_mosquitohabitat + AND lv.habvalue1 IS NOT DISTINCT FROM p_habvalue1 + AND lv.habvalue1percent IS NOT DISTINCT FROM p_habvalue1percent + AND lv.habvalue2 IS NOT DISTINCT FROM p_habvalue2 + AND lv.habvalue2percent IS NOT DISTINCT FROM p_habvalue2percent + AND lv.potential IS NOT DISTINCT FROM p_potential + AND lv.larvaepresent IS NOT DISTINCT FROM p_larvaepresent + AND lv.larvaeinsidetreatedarea IS NOT DISTINCT FROM p_larvaeinsidetreatedarea + AND lv.larvaeoutsidetreatedarea IS NOT DISTINCT FROM p_larvaeoutsidetreatedarea + AND lv.larvaereason IS NOT DISTINCT FROM p_larvaereason + AND lv.aquaticorganisms IS NOT DISTINCT FROM p_aquaticorganisms + AND lv.vegetation IS NOT DISTINCT FROM p_vegetation + AND lv.sourcereduction IS NOT DISTINCT FROM p_sourcereduction + AND lv.waterpresent IS NOT DISTINCT FROM p_waterpresent + AND lv.watermovement1 IS NOT DISTINCT FROM p_watermovement1 + AND lv.watermovement1percent IS NOT DISTINCT FROM p_watermovement1percent + AND lv.watermovement2 IS NOT DISTINCT FROM p_watermovement2 + AND lv.watermovement2percent IS NOT DISTINCT FROM p_watermovement2percent + AND lv.soilconditions IS NOT DISTINCT FROM p_soilconditions + AND lv.waterduration IS NOT DISTINCT FROM p_waterduration + AND lv.watersource IS NOT DISTINCT FROM p_watersource + AND lv.waterconditions IS NOT DISTINCT FROM p_waterconditions + AND lv.adultactivity IS NOT DISTINCT FROM p_adultactivity + AND lv.linelocid IS NOT DISTINCT FROM p_linelocid + AND lv.pointlocid IS NOT DISTINCT FROM p_pointlocid + AND lv.polygonlocid IS NOT DISTINCT FROM p_polygonlocid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.fieldtech IS NOT DISTINCT FROM p_fieldtech + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.qamosquitoinspection + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.qamosquitoinspection + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.qamosquitoinspection ( + objectid, + organization_id, + + posdips, + actiontaken, + comments, + avetemp, + windspeed, + raingauge, + globalid, + startdatetime, + enddatetime, + winddir, + reviewed, + reviewedby, + revieweddate, + locationname, + zone, + recordstatus, + zone2, + lr, + negdips, + totalacres, + acresbreeding, + fish, + sitetype, + breedingpotential, + movingwater, + nowaterever, + mosquitohabitat, + habvalue1, + habvalue1percent, + habvalue2, + habvalue2percent, + potential, + larvaepresent, + larvaeinsidetreatedarea, + larvaeoutsidetreatedarea, + larvaereason, + aquaticorganisms, + vegetation, + sourcereduction, + waterpresent, + watermovement1, + watermovement1percent, + watermovement2, + watermovement2percent, + soilconditions, + waterduration, + watersource, + waterconditions, + adultactivity, + linelocid, + pointlocid, + polygonlocid, + created_user, + created_date, + last_edited_user, + last_edited_date, + fieldtech, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_posdips, + p_actiontaken, + p_comments, + p_avetemp, + p_windspeed, + p_raingauge, + p_globalid, + p_startdatetime, + p_enddatetime, + p_winddir, + p_reviewed, + p_reviewedby, + p_revieweddate, + p_locationname, + p_zone, + p_recordstatus, + p_zone2, + p_lr, + p_negdips, + p_totalacres, + p_acresbreeding, + p_fish, + p_sitetype, + p_breedingpotential, + p_movingwater, + p_nowaterever, + p_mosquitohabitat, + p_habvalue1, + p_habvalue1percent, + p_habvalue2, + p_habvalue2percent, + p_potential, + p_larvaepresent, + p_larvaeinsidetreatedarea, + p_larvaeoutsidetreatedarea, + p_larvaereason, + p_aquaticorganisms, + p_vegetation, + p_sourcereduction, + p_waterpresent, + p_watermovement1, + p_watermovement1percent, + p_watermovement2, + p_watermovement2percent, + p_soilconditions, + p_waterduration, + p_watersource, + p_waterconditions, + p_adultactivity, + p_linelocid, + p_pointlocid, + p_polygonlocid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_fieldtech, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_rodentlocation( + p_objectid bigint, + p_organization_id INTEGER, + + p_locationname varchar, + p_zone varchar, + p_zone2 varchar, + p_habitat varchar, + p_priority varchar, + p_usetype varchar, + p_active smallint, + p_description varchar, + p_accessdesc varchar, + p_comments varchar, + p_symbology varchar, + p_externalid varchar, + p_nextactiondatescheduled timestamp, + p_locationnumber integer, + p_lastinspectdate timestamp, + p_lastinspectspecies varchar, + p_lastinspectaction varchar, + p_lastinspectconditions varchar, + p_lastinspectrodentevidence varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_jurisdiction varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.rodentlocation lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.locationname IS NOT DISTINCT FROM p_locationname + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.habitat IS NOT DISTINCT FROM p_habitat + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.usetype IS NOT DISTINCT FROM p_usetype + AND lv.active IS NOT DISTINCT FROM p_active + AND lv.description IS NOT DISTINCT FROM p_description + AND lv.accessdesc IS NOT DISTINCT FROM p_accessdesc + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.symbology IS NOT DISTINCT FROM p_symbology + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.nextactiondatescheduled IS NOT DISTINCT FROM p_nextactiondatescheduled + AND lv.locationnumber IS NOT DISTINCT FROM p_locationnumber + AND lv.lastinspectdate IS NOT DISTINCT FROM p_lastinspectdate + AND lv.lastinspectspecies IS NOT DISTINCT FROM p_lastinspectspecies + AND lv.lastinspectaction IS NOT DISTINCT FROM p_lastinspectaction + AND lv.lastinspectconditions IS NOT DISTINCT FROM p_lastinspectconditions + AND lv.lastinspectrodentevidence IS NOT DISTINCT FROM p_lastinspectrodentevidence + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.jurisdiction IS NOT DISTINCT FROM p_jurisdiction + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.rodentlocation + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.rodentlocation + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.rodentlocation ( + objectid, + organization_id, + + locationname, + zone, + zone2, + habitat, + priority, + usetype, + active, + description, + accessdesc, + comments, + symbology, + externalid, + nextactiondatescheduled, + locationnumber, + lastinspectdate, + lastinspectspecies, + lastinspectaction, + lastinspectconditions, + lastinspectrodentevidence, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + creationdate, + creator, + editdate, + editor, + jurisdiction, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_locationname, + p_zone, + p_zone2, + p_habitat, + p_priority, + p_usetype, + p_active, + p_description, + p_accessdesc, + p_comments, + p_symbology, + p_externalid, + p_nextactiondatescheduled, + p_locationnumber, + p_lastinspectdate, + p_lastinspectspecies, + p_lastinspectaction, + p_lastinspectconditions, + p_lastinspectrodentevidence, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_jurisdiction, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_samplecollection( + p_objectid bigint, + p_organization_id INTEGER, + + p_loc_id uuid, + p_startdatetime timestamp, + p_enddatetime timestamp, + p_sitecond varchar, + p_sampleid varchar, + p_survtech varchar, + p_datesent timestamp, + p_datetested timestamp, + p_testtech varchar, + p_comments varchar, + p_processed smallint, + p_sampletype varchar, + p_samplecond varchar, + p_species varchar, + p_sex varchar, + p_avetemp double precision, + p_windspeed double precision, + p_winddir varchar, + p_raingauge double precision, + p_activity varchar, + p_testmethod varchar, + p_diseasetested varchar, + p_diseasepos varchar, + p_reviewed smallint, + p_reviewedby varchar, + p_revieweddate timestamp, + p_locationname varchar, + p_zone varchar, + p_recordstatus smallint, + p_zone2 varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_lab varchar, + p_fieldtech varchar, + p_flockid uuid, + p_samplecount smallint, + p_chickenid uuid, + p_gatewaysync smallint, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.samplecollection lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.loc_id IS NOT DISTINCT FROM p_loc_id + AND lv.startdatetime IS NOT DISTINCT FROM p_startdatetime + AND lv.enddatetime IS NOT DISTINCT FROM p_enddatetime + AND lv.sitecond IS NOT DISTINCT FROM p_sitecond + AND lv.sampleid IS NOT DISTINCT FROM p_sampleid + AND lv.survtech IS NOT DISTINCT FROM p_survtech + AND lv.datesent IS NOT DISTINCT FROM p_datesent + AND lv.datetested IS NOT DISTINCT FROM p_datetested + AND lv.testtech IS NOT DISTINCT FROM p_testtech + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.processed IS NOT DISTINCT FROM p_processed + AND lv.sampletype IS NOT DISTINCT FROM p_sampletype + AND lv.samplecond IS NOT DISTINCT FROM p_samplecond + AND lv.species IS NOT DISTINCT FROM p_species + AND lv.sex IS NOT DISTINCT FROM p_sex + AND lv.avetemp IS NOT DISTINCT FROM p_avetemp + AND lv.windspeed IS NOT DISTINCT FROM p_windspeed + AND lv.winddir IS NOT DISTINCT FROM p_winddir + AND lv.raingauge IS NOT DISTINCT FROM p_raingauge + AND lv.activity IS NOT DISTINCT FROM p_activity + AND lv.testmethod IS NOT DISTINCT FROM p_testmethod + AND lv.diseasetested IS NOT DISTINCT FROM p_diseasetested + AND lv.diseasepos IS NOT DISTINCT FROM p_diseasepos + AND lv.reviewed IS NOT DISTINCT FROM p_reviewed + AND lv.reviewedby IS NOT DISTINCT FROM p_reviewedby + AND lv.revieweddate IS NOT DISTINCT FROM p_revieweddate + AND lv.locationname IS NOT DISTINCT FROM p_locationname + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.recordstatus IS NOT DISTINCT FROM p_recordstatus + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.lab IS NOT DISTINCT FROM p_lab + AND lv.fieldtech IS NOT DISTINCT FROM p_fieldtech + AND lv.flockid IS NOT DISTINCT FROM p_flockid + AND lv.samplecount IS NOT DISTINCT FROM p_samplecount + AND lv.chickenid IS NOT DISTINCT FROM p_chickenid + AND lv.gatewaysync IS NOT DISTINCT FROM p_gatewaysync + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.samplecollection + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.samplecollection + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.samplecollection ( + objectid, + organization_id, + + loc_id, + startdatetime, + enddatetime, + sitecond, + sampleid, + survtech, + datesent, + datetested, + testtech, + comments, + processed, + sampletype, + samplecond, + species, + sex, + avetemp, + windspeed, + winddir, + raingauge, + activity, + testmethod, + diseasetested, + diseasepos, + reviewed, + reviewedby, + revieweddate, + locationname, + zone, + recordstatus, + zone2, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + lab, + fieldtech, + flockid, + samplecount, + chickenid, + gatewaysync, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_loc_id, + p_startdatetime, + p_enddatetime, + p_sitecond, + p_sampleid, + p_survtech, + p_datesent, + p_datetested, + p_testtech, + p_comments, + p_processed, + p_sampletype, + p_samplecond, + p_species, + p_sex, + p_avetemp, + p_windspeed, + p_winddir, + p_raingauge, + p_activity, + p_testmethod, + p_diseasetested, + p_diseasepos, + p_reviewed, + p_reviewedby, + p_revieweddate, + p_locationname, + p_zone, + p_recordstatus, + p_zone2, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_lab, + p_fieldtech, + p_flockid, + p_samplecount, + p_chickenid, + p_gatewaysync, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_samplelocation( + p_objectid bigint, + p_organization_id INTEGER, + + p_name varchar, + p_zone varchar, + p_habitat varchar, + p_priority varchar, + p_usetype varchar, + p_active smallint, + p_description varchar, + p_accessdesc varchar, + p_comments varchar, + p_externalid varchar, + p_nextactiondatescheduled timestamp, + p_zone2 varchar, + p_locationnumber integer, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_gatewaysync smallint, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.samplelocation lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.habitat IS NOT DISTINCT FROM p_habitat + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.usetype IS NOT DISTINCT FROM p_usetype + AND lv.active IS NOT DISTINCT FROM p_active + AND lv.description IS NOT DISTINCT FROM p_description + AND lv.accessdesc IS NOT DISTINCT FROM p_accessdesc + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.nextactiondatescheduled IS NOT DISTINCT FROM p_nextactiondatescheduled + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.locationnumber IS NOT DISTINCT FROM p_locationnumber + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.gatewaysync IS NOT DISTINCT FROM p_gatewaysync + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.samplelocation + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.samplelocation + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.samplelocation ( + objectid, + organization_id, + + name, + zone, + habitat, + priority, + usetype, + active, + description, + accessdesc, + comments, + externalid, + nextactiondatescheduled, + zone2, + locationnumber, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + gatewaysync, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_name, + p_zone, + p_habitat, + p_priority, + p_usetype, + p_active, + p_description, + p_accessdesc, + p_comments, + p_externalid, + p_nextactiondatescheduled, + p_zone2, + p_locationnumber, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_gatewaysync, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_servicerequest( + p_objectid bigint, + p_organization_id INTEGER, + + p_recdatetime timestamp, + p_source varchar, + p_entrytech varchar, + p_priority varchar, + p_supervisor varchar, + p_assignedtech varchar, + p_status varchar, + p_clranon smallint, + p_clrfname varchar, + p_clrphone1 varchar, + p_clrphone2 varchar, + p_clremail varchar, + p_clrcompany varchar, + p_clraddr1 varchar, + p_clraddr2 varchar, + p_clrcity varchar, + p_clrstate varchar, + p_clrzip varchar, + p_clrother varchar, + p_clrcontpref varchar, + p_reqcompany varchar, + p_reqaddr1 varchar, + p_reqaddr2 varchar, + p_reqcity varchar, + p_reqstate varchar, + p_reqzip varchar, + p_reqcrossst varchar, + p_reqsubdiv varchar, + p_reqmapgrid varchar, + p_reqpermission smallint, + p_reqtarget varchar, + p_reqdescr varchar, + p_reqnotesfortech varchar, + p_reqnotesforcust varchar, + p_reqfldnotes varchar, + p_reqprogramactions varchar, + p_datetimeclosed timestamp, + p_techclosed varchar, + p_sr_number integer, + p_reviewed smallint, + p_reviewedby varchar, + p_revieweddate timestamp, + p_accepted smallint, + p_accepteddate timestamp, + p_rejectedby varchar, + p_rejecteddate timestamp, + p_rejectedreason varchar, + p_duedate timestamp, + p_acceptedby varchar, + p_comments varchar, + p_estcompletedate timestamp, + p_nextaction varchar, + p_recordstatus smallint, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_firstresponsedate timestamp, + p_responsedaycount smallint, + p_allowed varchar, + p_xvalue varchar, + p_yvalue varchar, + p_validx varchar, + p_validy varchar, + p_externalid varchar, + p_externalerror varchar, + p_pointlocid uuid, + p_notified smallint, + p_notifieddate timestamp, + p_scheduled smallint, + p_scheduleddate timestamp, + p_dog integer, + p_schedule_period varchar, + p_schedule_notes varchar, + p_spanish integer, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_issuesreported varchar, + p_jurisdiction varchar, + p_notificationtimestamp varchar, + p_zone varchar, + p_zone2 varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.servicerequest lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.recdatetime IS NOT DISTINCT FROM p_recdatetime + AND lv.source IS NOT DISTINCT FROM p_source + AND lv.entrytech IS NOT DISTINCT FROM p_entrytech + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.supervisor IS NOT DISTINCT FROM p_supervisor + AND lv.assignedtech IS NOT DISTINCT FROM p_assignedtech + AND lv.status IS NOT DISTINCT FROM p_status + AND lv.clranon IS NOT DISTINCT FROM p_clranon + AND lv.clrfname IS NOT DISTINCT FROM p_clrfname + AND lv.clrphone1 IS NOT DISTINCT FROM p_clrphone1 + AND lv.clrphone2 IS NOT DISTINCT FROM p_clrphone2 + AND lv.clremail IS NOT DISTINCT FROM p_clremail + AND lv.clrcompany IS NOT DISTINCT FROM p_clrcompany + AND lv.clraddr1 IS NOT DISTINCT FROM p_clraddr1 + AND lv.clraddr2 IS NOT DISTINCT FROM p_clraddr2 + AND lv.clrcity IS NOT DISTINCT FROM p_clrcity + AND lv.clrstate IS NOT DISTINCT FROM p_clrstate + AND lv.clrzip IS NOT DISTINCT FROM p_clrzip + AND lv.clrother IS NOT DISTINCT FROM p_clrother + AND lv.clrcontpref IS NOT DISTINCT FROM p_clrcontpref + AND lv.reqcompany IS NOT DISTINCT FROM p_reqcompany + AND lv.reqaddr1 IS NOT DISTINCT FROM p_reqaddr1 + AND lv.reqaddr2 IS NOT DISTINCT FROM p_reqaddr2 + AND lv.reqcity IS NOT DISTINCT FROM p_reqcity + AND lv.reqstate IS NOT DISTINCT FROM p_reqstate + AND lv.reqzip IS NOT DISTINCT FROM p_reqzip + AND lv.reqcrossst IS NOT DISTINCT FROM p_reqcrossst + AND lv.reqsubdiv IS NOT DISTINCT FROM p_reqsubdiv + AND lv.reqmapgrid IS NOT DISTINCT FROM p_reqmapgrid + AND lv.reqpermission IS NOT DISTINCT FROM p_reqpermission + AND lv.reqtarget IS NOT DISTINCT FROM p_reqtarget + AND lv.reqdescr IS NOT DISTINCT FROM p_reqdescr + AND lv.reqnotesfortech IS NOT DISTINCT FROM p_reqnotesfortech + AND lv.reqnotesforcust IS NOT DISTINCT FROM p_reqnotesforcust + AND lv.reqfldnotes IS NOT DISTINCT FROM p_reqfldnotes + AND lv.reqprogramactions IS NOT DISTINCT FROM p_reqprogramactions + AND lv.datetimeclosed IS NOT DISTINCT FROM p_datetimeclosed + AND lv.techclosed IS NOT DISTINCT FROM p_techclosed + AND lv.sr_number IS NOT DISTINCT FROM p_sr_number + AND lv.reviewed IS NOT DISTINCT FROM p_reviewed + AND lv.reviewedby IS NOT DISTINCT FROM p_reviewedby + AND lv.revieweddate IS NOT DISTINCT FROM p_revieweddate + AND lv.accepted IS NOT DISTINCT FROM p_accepted + AND lv.accepteddate IS NOT DISTINCT FROM p_accepteddate + AND lv.rejectedby IS NOT DISTINCT FROM p_rejectedby + AND lv.rejecteddate IS NOT DISTINCT FROM p_rejecteddate + AND lv.rejectedreason IS NOT DISTINCT FROM p_rejectedreason + AND lv.duedate IS NOT DISTINCT FROM p_duedate + AND lv.acceptedby IS NOT DISTINCT FROM p_acceptedby + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.estcompletedate IS NOT DISTINCT FROM p_estcompletedate + AND lv.nextaction IS NOT DISTINCT FROM p_nextaction + AND lv.recordstatus IS NOT DISTINCT FROM p_recordstatus + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.firstresponsedate IS NOT DISTINCT FROM p_firstresponsedate + AND lv.responsedaycount IS NOT DISTINCT FROM p_responsedaycount + AND lv.allowed IS NOT DISTINCT FROM p_allowed + AND lv.xvalue IS NOT DISTINCT FROM p_xvalue + AND lv.yvalue IS NOT DISTINCT FROM p_yvalue + AND lv.validx IS NOT DISTINCT FROM p_validx + AND lv.validy IS NOT DISTINCT FROM p_validy + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.externalerror IS NOT DISTINCT FROM p_externalerror + AND lv.pointlocid IS NOT DISTINCT FROM p_pointlocid + AND lv.notified IS NOT DISTINCT FROM p_notified + AND lv.notifieddate IS NOT DISTINCT FROM p_notifieddate + AND lv.scheduled IS NOT DISTINCT FROM p_scheduled + AND lv.scheduleddate IS NOT DISTINCT FROM p_scheduleddate + AND lv.dog IS NOT DISTINCT FROM p_dog + AND lv.schedule_period IS NOT DISTINCT FROM p_schedule_period + AND lv.schedule_notes IS NOT DISTINCT FROM p_schedule_notes + AND lv.spanish IS NOT DISTINCT FROM p_spanish + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.issuesreported IS NOT DISTINCT FROM p_issuesreported + AND lv.jurisdiction IS NOT DISTINCT FROM p_jurisdiction + AND lv.notificationtimestamp IS NOT DISTINCT FROM p_notificationtimestamp + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.servicerequest + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.servicerequest + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.servicerequest ( + objectid, + organization_id, + + recdatetime, + source, + entrytech, + priority, + supervisor, + assignedtech, + status, + clranon, + clrfname, + clrphone1, + clrphone2, + clremail, + clrcompany, + clraddr1, + clraddr2, + clrcity, + clrstate, + clrzip, + clrother, + clrcontpref, + reqcompany, + reqaddr1, + reqaddr2, + reqcity, + reqstate, + reqzip, + reqcrossst, + reqsubdiv, + reqmapgrid, + reqpermission, + reqtarget, + reqdescr, + reqnotesfortech, + reqnotesforcust, + reqfldnotes, + reqprogramactions, + datetimeclosed, + techclosed, + sr_number, + reviewed, + reviewedby, + revieweddate, + accepted, + accepteddate, + rejectedby, + rejecteddate, + rejectedreason, + duedate, + acceptedby, + comments, + estcompletedate, + nextaction, + recordstatus, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + firstresponsedate, + responsedaycount, + allowed, + xvalue, + yvalue, + validx, + validy, + externalid, + externalerror, + pointlocid, + notified, + notifieddate, + scheduled, + scheduleddate, + dog, + schedule_period, + schedule_notes, + spanish, + creationdate, + creator, + editdate, + editor, + issuesreported, + jurisdiction, + notificationtimestamp, + zone, + zone2, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_recdatetime, + p_source, + p_entrytech, + p_priority, + p_supervisor, + p_assignedtech, + p_status, + p_clranon, + p_clrfname, + p_clrphone1, + p_clrphone2, + p_clremail, + p_clrcompany, + p_clraddr1, + p_clraddr2, + p_clrcity, + p_clrstate, + p_clrzip, + p_clrother, + p_clrcontpref, + p_reqcompany, + p_reqaddr1, + p_reqaddr2, + p_reqcity, + p_reqstate, + p_reqzip, + p_reqcrossst, + p_reqsubdiv, + p_reqmapgrid, + p_reqpermission, + p_reqtarget, + p_reqdescr, + p_reqnotesfortech, + p_reqnotesforcust, + p_reqfldnotes, + p_reqprogramactions, + p_datetimeclosed, + p_techclosed, + p_sr_number, + p_reviewed, + p_reviewedby, + p_revieweddate, + p_accepted, + p_accepteddate, + p_rejectedby, + p_rejecteddate, + p_rejectedreason, + p_duedate, + p_acceptedby, + p_comments, + p_estcompletedate, + p_nextaction, + p_recordstatus, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_firstresponsedate, + p_responsedaycount, + p_allowed, + p_xvalue, + p_yvalue, + p_validx, + p_validy, + p_externalid, + p_externalerror, + p_pointlocid, + p_notified, + p_notifieddate, + p_scheduled, + p_scheduleddate, + p_dog, + p_schedule_period, + p_schedule_notes, + p_spanish, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_issuesreported, + p_jurisdiction, + p_notificationtimestamp, + p_zone, + p_zone2, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_speciesabundance( + p_objectid bigint, + p_organization_id INTEGER, + + p_trapdata_id uuid, + p_species varchar, + p_males smallint, + p_unknown smallint, + p_bloodedfem smallint, + p_gravidfem smallint, + p_larvae smallint, + p_poolstogen smallint, + p_processed smallint, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_pupae smallint, + p_eggs smallint, + p_females integer, + p_total integer, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_yearweek integer, + p_globalzscore double precision, + p_r7score double precision, + p_r8score double precision, + p_h3r7 varchar, + p_h3r8 varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.speciesabundance lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.trapdata_id IS NOT DISTINCT FROM p_trapdata_id + AND lv.species IS NOT DISTINCT FROM p_species + AND lv.males IS NOT DISTINCT FROM p_males + AND lv.unknown IS NOT DISTINCT FROM p_unknown + AND lv.bloodedfem IS NOT DISTINCT FROM p_bloodedfem + AND lv.gravidfem IS NOT DISTINCT FROM p_gravidfem + AND lv.larvae IS NOT DISTINCT FROM p_larvae + AND lv.poolstogen IS NOT DISTINCT FROM p_poolstogen + AND lv.processed IS NOT DISTINCT FROM p_processed + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.pupae IS NOT DISTINCT FROM p_pupae + AND lv.eggs IS NOT DISTINCT FROM p_eggs + AND lv.females IS NOT DISTINCT FROM p_females + AND lv.total IS NOT DISTINCT FROM p_total + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.yearweek IS NOT DISTINCT FROM p_yearweek + AND lv.globalzscore IS NOT DISTINCT FROM p_globalzscore + AND lv.r7score IS NOT DISTINCT FROM p_r7score + AND lv.r8score IS NOT DISTINCT FROM p_r8score + AND lv.h3r7 IS NOT DISTINCT FROM p_h3r7 + AND lv.h3r8 IS NOT DISTINCT FROM p_h3r8 + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.speciesabundance + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.speciesabundance + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.speciesabundance ( + objectid, + organization_id, + + trapdata_id, + species, + males, + unknown, + bloodedfem, + gravidfem, + larvae, + poolstogen, + processed, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + pupae, + eggs, + females, + total, + creationdate, + creator, + editdate, + editor, + yearweek, + globalzscore, + r7score, + r8score, + h3r7, + h3r8, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_trapdata_id, + p_species, + p_males, + p_unknown, + p_bloodedfem, + p_gravidfem, + p_larvae, + p_poolstogen, + p_processed, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_pupae, + p_eggs, + p_females, + p_total, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_yearweek, + p_globalzscore, + p_r7score, + p_r8score, + p_h3r7, + p_h3r8, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_stormdrain( + p_objectid bigint, + p_organization_id INTEGER, + + p_nexttreatmentdate timestamp, + p_lasttreatdate timestamp, + p_lastaction varchar, + p_symbology varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_laststatus varchar, + p_zone varchar, + p_zone2 varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_type varchar, + p_jurisdiction varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.stormdrain lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.nexttreatmentdate IS NOT DISTINCT FROM p_nexttreatmentdate + AND lv.lasttreatdate IS NOT DISTINCT FROM p_lasttreatdate + AND lv.lastaction IS NOT DISTINCT FROM p_lastaction + AND lv.symbology IS NOT DISTINCT FROM p_symbology + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.laststatus IS NOT DISTINCT FROM p_laststatus + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.type IS NOT DISTINCT FROM p_type + AND lv.jurisdiction IS NOT DISTINCT FROM p_jurisdiction + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.stormdrain + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.stormdrain + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.stormdrain ( + objectid, + organization_id, + + nexttreatmentdate, + lasttreatdate, + lastaction, + symbology, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + laststatus, + zone, + zone2, + creationdate, + creator, + editdate, + editor, + type, + jurisdiction, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_nexttreatmentdate, + p_lasttreatdate, + p_lastaction, + p_symbology, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_laststatus, + p_zone, + p_zone2, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_type, + p_jurisdiction, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_timecard( + p_objectid bigint, + p_organization_id INTEGER, + + p_activity varchar, + p_startdatetime timestamp, + p_enddatetime timestamp, + p_comments varchar, + p_externalid varchar, + p_equiptype varchar, + p_locationname varchar, + p_zone varchar, + p_zone2 varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_linelocid uuid, + p_pointlocid uuid, + p_polygonlocid uuid, + p_lclocid uuid, + p_samplelocid uuid, + p_srid uuid, + p_traplocid uuid, + p_fieldtech varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_rodentlocid uuid, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.timecard lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.activity IS NOT DISTINCT FROM p_activity + AND lv.startdatetime IS NOT DISTINCT FROM p_startdatetime + AND lv.enddatetime IS NOT DISTINCT FROM p_enddatetime + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.equiptype IS NOT DISTINCT FROM p_equiptype + AND lv.locationname IS NOT DISTINCT FROM p_locationname + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.linelocid IS NOT DISTINCT FROM p_linelocid + AND lv.pointlocid IS NOT DISTINCT FROM p_pointlocid + AND lv.polygonlocid IS NOT DISTINCT FROM p_polygonlocid + AND lv.lclocid IS NOT DISTINCT FROM p_lclocid + AND lv.samplelocid IS NOT DISTINCT FROM p_samplelocid + AND lv.srid IS NOT DISTINCT FROM p_srid + AND lv.traplocid IS NOT DISTINCT FROM p_traplocid + AND lv.fieldtech IS NOT DISTINCT FROM p_fieldtech + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.rodentlocid IS NOT DISTINCT FROM p_rodentlocid + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.timecard + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.timecard + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.timecard ( + objectid, + organization_id, + + activity, + startdatetime, + enddatetime, + comments, + externalid, + equiptype, + locationname, + zone, + zone2, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + linelocid, + pointlocid, + polygonlocid, + lclocid, + samplelocid, + srid, + traplocid, + fieldtech, + creationdate, + creator, + editdate, + editor, + rodentlocid, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_activity, + p_startdatetime, + p_enddatetime, + p_comments, + p_externalid, + p_equiptype, + p_locationname, + p_zone, + p_zone2, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_linelocid, + p_pointlocid, + p_polygonlocid, + p_lclocid, + p_samplelocid, + p_srid, + p_traplocid, + p_fieldtech, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_rodentlocid, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_trapdata( + p_objectid bigint, + p_organization_id INTEGER, + + p_traptype varchar, + p_trapactivitytype varchar, + p_startdatetime timestamp, + p_enddatetime timestamp, + p_comments varchar, + p_idbytech varchar, + p_sortbytech varchar, + p_processed smallint, + p_sitecond varchar, + p_locationname varchar, + p_recordstatus smallint, + p_reviewed smallint, + p_reviewedby varchar, + p_revieweddate timestamp, + p_trapcondition varchar, + p_trapnights smallint, + p_zone varchar, + p_zone2 varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_srid uuid, + p_fieldtech varchar, + p_gatewaysync smallint, + p_loc_id uuid, + p_voltage double precision, + p_winddir varchar, + p_windspeed double precision, + p_avetemp double precision, + p_raingauge double precision, + p_lr smallint, + p_field integer, + p_vectorsurvtrapdataid varchar, + p_vectorsurvtraplocationid varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_lure varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.trapdata lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.traptype IS NOT DISTINCT FROM p_traptype + AND lv.trapactivitytype IS NOT DISTINCT FROM p_trapactivitytype + AND lv.startdatetime IS NOT DISTINCT FROM p_startdatetime + AND lv.enddatetime IS NOT DISTINCT FROM p_enddatetime + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.idbytech IS NOT DISTINCT FROM p_idbytech + AND lv.sortbytech IS NOT DISTINCT FROM p_sortbytech + AND lv.processed IS NOT DISTINCT FROM p_processed + AND lv.sitecond IS NOT DISTINCT FROM p_sitecond + AND lv.locationname IS NOT DISTINCT FROM p_locationname + AND lv.recordstatus IS NOT DISTINCT FROM p_recordstatus + AND lv.reviewed IS NOT DISTINCT FROM p_reviewed + AND lv.reviewedby IS NOT DISTINCT FROM p_reviewedby + AND lv.revieweddate IS NOT DISTINCT FROM p_revieweddate + AND lv.trapcondition IS NOT DISTINCT FROM p_trapcondition + AND lv.trapnights IS NOT DISTINCT FROM p_trapnights + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.srid IS NOT DISTINCT FROM p_srid + AND lv.fieldtech IS NOT DISTINCT FROM p_fieldtech + AND lv.gatewaysync IS NOT DISTINCT FROM p_gatewaysync + AND lv.loc_id IS NOT DISTINCT FROM p_loc_id + AND lv.voltage IS NOT DISTINCT FROM p_voltage + AND lv.winddir IS NOT DISTINCT FROM p_winddir + AND lv.windspeed IS NOT DISTINCT FROM p_windspeed + AND lv.avetemp IS NOT DISTINCT FROM p_avetemp + AND lv.raingauge IS NOT DISTINCT FROM p_raingauge + AND lv.lr IS NOT DISTINCT FROM p_lr + AND lv.field IS NOT DISTINCT FROM p_field + AND lv.vectorsurvtrapdataid IS NOT DISTINCT FROM p_vectorsurvtrapdataid + AND lv.vectorsurvtraplocationid IS NOT DISTINCT FROM p_vectorsurvtraplocationid + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.lure IS NOT DISTINCT FROM p_lure + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.trapdata + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.trapdata + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.trapdata ( + objectid, + organization_id, + + traptype, + trapactivitytype, + startdatetime, + enddatetime, + comments, + idbytech, + sortbytech, + processed, + sitecond, + locationname, + recordstatus, + reviewed, + reviewedby, + revieweddate, + trapcondition, + trapnights, + zone, + zone2, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + srid, + fieldtech, + gatewaysync, + loc_id, + voltage, + winddir, + windspeed, + avetemp, + raingauge, + lr, + field, + vectorsurvtrapdataid, + vectorsurvtraplocationid, + creationdate, + creator, + editdate, + editor, + lure, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_traptype, + p_trapactivitytype, + p_startdatetime, + p_enddatetime, + p_comments, + p_idbytech, + p_sortbytech, + p_processed, + p_sitecond, + p_locationname, + p_recordstatus, + p_reviewed, + p_reviewedby, + p_revieweddate, + p_trapcondition, + p_trapnights, + p_zone, + p_zone2, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_srid, + p_fieldtech, + p_gatewaysync, + p_loc_id, + p_voltage, + p_winddir, + p_windspeed, + p_avetemp, + p_raingauge, + p_lr, + p_field, + p_vectorsurvtrapdataid, + p_vectorsurvtraplocationid, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_lure, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_traplocation( + p_objectid bigint, + p_organization_id INTEGER, + + p_name varchar, + p_zone varchar, + p_habitat varchar, + p_priority varchar, + p_usetype varchar, + p_active smallint, + p_description varchar, + p_accessdesc varchar, + p_comments varchar, + p_externalid varchar, + p_nextactiondatescheduled timestamp, + p_zone2 varchar, + p_locationnumber integer, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_gatewaysync smallint, + p_route integer, + p_set_dow integer, + p_route_order integer, + p_vectorsurvsiteid varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_h3r7 varchar, + p_h3r8 varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.traplocation lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.habitat IS NOT DISTINCT FROM p_habitat + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.usetype IS NOT DISTINCT FROM p_usetype + AND lv.active IS NOT DISTINCT FROM p_active + AND lv.description IS NOT DISTINCT FROM p_description + AND lv.accessdesc IS NOT DISTINCT FROM p_accessdesc + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.nextactiondatescheduled IS NOT DISTINCT FROM p_nextactiondatescheduled + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.locationnumber IS NOT DISTINCT FROM p_locationnumber + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.gatewaysync IS NOT DISTINCT FROM p_gatewaysync + AND lv.route IS NOT DISTINCT FROM p_route + AND lv.set_dow IS NOT DISTINCT FROM p_set_dow + AND lv.route_order IS NOT DISTINCT FROM p_route_order + AND lv.vectorsurvsiteid IS NOT DISTINCT FROM p_vectorsurvsiteid + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.h3r7 IS NOT DISTINCT FROM p_h3r7 + AND lv.h3r8 IS NOT DISTINCT FROM p_h3r8 + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.traplocation + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.traplocation + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.traplocation ( + objectid, + organization_id, + + name, + zone, + habitat, + priority, + usetype, + active, + description, + accessdesc, + comments, + externalid, + nextactiondatescheduled, + zone2, + locationnumber, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + gatewaysync, + route, + set_dow, + route_order, + vectorsurvsiteid, + creationdate, + creator, + editdate, + editor, + h3r7, + h3r8, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_name, + p_zone, + p_habitat, + p_priority, + p_usetype, + p_active, + p_description, + p_accessdesc, + p_comments, + p_externalid, + p_nextactiondatescheduled, + p_zone2, + p_locationnumber, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_gatewaysync, + p_route, + p_set_dow, + p_route_order, + p_vectorsurvsiteid, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_h3r7, + p_h3r8, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_treatmentarea( + p_objectid bigint, + p_organization_id INTEGER, + + p_treat_id uuid, + p_session_id uuid, + p_treatdate timestamp, + p_comments varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_notified smallint, + p_type varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_shape__area double precision, + p_shape__length double precision, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.treatmentarea lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.treat_id IS NOT DISTINCT FROM p_treat_id + AND lv.session_id IS NOT DISTINCT FROM p_session_id + AND lv.treatdate IS NOT DISTINCT FROM p_treatdate + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.notified IS NOT DISTINCT FROM p_notified + AND lv.type IS NOT DISTINCT FROM p_type + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.shape__area IS NOT DISTINCT FROM p_shape__area + AND lv.shape__length IS NOT DISTINCT FROM p_shape__length + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.treatmentarea + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.treatmentarea + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.treatmentarea ( + objectid, + organization_id, + + treat_id, + session_id, + treatdate, + comments, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + notified, + type, + creationdate, + creator, + editdate, + editor, + shape__area, + shape__length, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_treat_id, + p_session_id, + p_treatdate, + p_comments, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_notified, + p_type, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_shape__area, + p_shape__length, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_treatment( + p_objectid bigint, + p_organization_id INTEGER, + + p_activity varchar, + p_treatarea double precision, + p_areaunit varchar, + p_product varchar, + p_qty double precision, + p_qtyunit varchar, + p_method varchar, + p_equiptype varchar, + p_comments varchar, + p_avetemp double precision, + p_windspeed double precision, + p_winddir varchar, + p_raingauge double precision, + p_startdatetime timestamp, + p_enddatetime timestamp, + p_insp_id uuid, + p_reviewed smallint, + p_reviewedby varchar, + p_revieweddate timestamp, + p_locationname varchar, + p_zone varchar, + p_warningoverride smallint, + p_recordstatus smallint, + p_zone2 varchar, + p_treatacres double precision, + p_tirecount smallint, + p_cbcount smallint, + p_containercount smallint, + p_globalid uuid, + p_treatmentlength double precision, + p_treatmenthours double precision, + p_treatmentlengthunits varchar, + p_linelocid uuid, + p_pointlocid uuid, + p_polygonlocid uuid, + p_srid uuid, + p_sdid uuid, + p_barrierrouteid uuid, + p_ulvrouteid uuid, + p_fieldtech varchar, + p_ptaid uuid, + p_flowrate double precision, + p_habitat varchar, + p_treathectares double precision, + p_invloc varchar, + p_temp_sitecond varchar, + p_sitecond varchar, + p_totalcostprodcut double precision, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_targetspecies varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.treatment lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.activity IS NOT DISTINCT FROM p_activity + AND lv.treatarea IS NOT DISTINCT FROM p_treatarea + AND lv.areaunit IS NOT DISTINCT FROM p_areaunit + AND lv.product IS NOT DISTINCT FROM p_product + AND lv.qty IS NOT DISTINCT FROM p_qty + AND lv.qtyunit IS NOT DISTINCT FROM p_qtyunit + AND lv.method IS NOT DISTINCT FROM p_method + AND lv.equiptype IS NOT DISTINCT FROM p_equiptype + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.avetemp IS NOT DISTINCT FROM p_avetemp + AND lv.windspeed IS NOT DISTINCT FROM p_windspeed + AND lv.winddir IS NOT DISTINCT FROM p_winddir + AND lv.raingauge IS NOT DISTINCT FROM p_raingauge + AND lv.startdatetime IS NOT DISTINCT FROM p_startdatetime + AND lv.enddatetime IS NOT DISTINCT FROM p_enddatetime + AND lv.insp_id IS NOT DISTINCT FROM p_insp_id + AND lv.reviewed IS NOT DISTINCT FROM p_reviewed + AND lv.reviewedby IS NOT DISTINCT FROM p_reviewedby + AND lv.revieweddate IS NOT DISTINCT FROM p_revieweddate + AND lv.locationname IS NOT DISTINCT FROM p_locationname + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.warningoverride IS NOT DISTINCT FROM p_warningoverride + AND lv.recordstatus IS NOT DISTINCT FROM p_recordstatus + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.treatacres IS NOT DISTINCT FROM p_treatacres + AND lv.tirecount IS NOT DISTINCT FROM p_tirecount + AND lv.cbcount IS NOT DISTINCT FROM p_cbcount + AND lv.containercount IS NOT DISTINCT FROM p_containercount + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.treatmentlength IS NOT DISTINCT FROM p_treatmentlength + AND lv.treatmenthours IS NOT DISTINCT FROM p_treatmenthours + AND lv.treatmentlengthunits IS NOT DISTINCT FROM p_treatmentlengthunits + AND lv.linelocid IS NOT DISTINCT FROM p_linelocid + AND lv.pointlocid IS NOT DISTINCT FROM p_pointlocid + AND lv.polygonlocid IS NOT DISTINCT FROM p_polygonlocid + AND lv.srid IS NOT DISTINCT FROM p_srid + AND lv.sdid IS NOT DISTINCT FROM p_sdid + AND lv.barrierrouteid IS NOT DISTINCT FROM p_barrierrouteid + AND lv.ulvrouteid IS NOT DISTINCT FROM p_ulvrouteid + AND lv.fieldtech IS NOT DISTINCT FROM p_fieldtech + AND lv.ptaid IS NOT DISTINCT FROM p_ptaid + AND lv.flowrate IS NOT DISTINCT FROM p_flowrate + AND lv.habitat IS NOT DISTINCT FROM p_habitat + AND lv.treathectares IS NOT DISTINCT FROM p_treathectares + AND lv.invloc IS NOT DISTINCT FROM p_invloc + AND lv.temp_sitecond IS NOT DISTINCT FROM p_temp_sitecond + AND lv.sitecond IS NOT DISTINCT FROM p_sitecond + AND lv.totalcostprodcut IS NOT DISTINCT FROM p_totalcostprodcut + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.targetspecies IS NOT DISTINCT FROM p_targetspecies + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.treatment + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.treatment + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.treatment ( + objectid, + organization_id, + + activity, + treatarea, + areaunit, + product, + qty, + qtyunit, + method, + equiptype, + comments, + avetemp, + windspeed, + winddir, + raingauge, + startdatetime, + enddatetime, + insp_id, + reviewed, + reviewedby, + revieweddate, + locationname, + zone, + warningoverride, + recordstatus, + zone2, + treatacres, + tirecount, + cbcount, + containercount, + globalid, + treatmentlength, + treatmenthours, + treatmentlengthunits, + linelocid, + pointlocid, + polygonlocid, + srid, + sdid, + barrierrouteid, + ulvrouteid, + fieldtech, + ptaid, + flowrate, + habitat, + treathectares, + invloc, + temp_sitecond, + sitecond, + totalcostprodcut, + creationdate, + creator, + editdate, + editor, + targetspecies, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_activity, + p_treatarea, + p_areaunit, + p_product, + p_qty, + p_qtyunit, + p_method, + p_equiptype, + p_comments, + p_avetemp, + p_windspeed, + p_winddir, + p_raingauge, + p_startdatetime, + p_enddatetime, + p_insp_id, + p_reviewed, + p_reviewedby, + p_revieweddate, + p_locationname, + p_zone, + p_warningoverride, + p_recordstatus, + p_zone2, + p_treatacres, + p_tirecount, + p_cbcount, + p_containercount, + p_globalid, + p_treatmentlength, + p_treatmenthours, + p_treatmentlengthunits, + p_linelocid, + p_pointlocid, + p_polygonlocid, + p_srid, + p_sdid, + p_barrierrouteid, + p_ulvrouteid, + p_fieldtech, + p_ptaid, + p_flowrate, + p_habitat, + p_treathectares, + p_invloc, + p_temp_sitecond, + p_sitecond, + p_totalcostprodcut, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_targetspecies, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_zones2( + p_objectid bigint, + p_organization_id INTEGER, + + p_name varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_shape__area double precision, + p_shape__length double precision, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.zones2 lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.shape__area IS NOT DISTINCT FROM p_shape__area + AND lv.shape__length IS NOT DISTINCT FROM p_shape__length + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.zones2 + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.zones2 + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.zones2 ( + objectid, + organization_id, + + name, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + creationdate, + creator, + editdate, + editor, + shape__area, + shape__length, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_name, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_shape__area, + p_shape__length, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_zones( + p_objectid bigint, + p_organization_id INTEGER, + + p_name varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_active integer, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_shape__area double precision, + p_shape__length double precision, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.zones lv + WHERE lv.objectid = p_objectid + AND lv.organization_id = p_organization_id + + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.active IS NOT DISTINCT FROM p_active + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.shape__area IS NOT DISTINCT FROM p_shape__area + AND lv.shape__length IS NOT DISTINCT FROM p_shape__length + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.zones + WHERE objectid = p_objectid AND organization_id = p_organization_id ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.zones + WHERE objectid = p_objectid AND organization_id = p_organization_id; + + -- Insert new version + INSERT INTO fieldseeker.zones ( + objectid, + organization_id, + + name, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + active, + creationdate, + creator, + editdate, + editor, + shape__area, + shape__length, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + p_organization_id, + + p_name, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_active, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_shape__area, + p_shape__length, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd +-- +goose Down +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_containerrelate( + p_objectid bigint, + + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_inspsampleid uuid, + p_mosquitoinspid uuid, + p_treatmentid uuid, + p_containertype varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.containerrelate lv + WHERE lv.objectid = p_objectid + + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.inspsampleid IS NOT DISTINCT FROM p_inspsampleid + AND lv.mosquitoinspid IS NOT DISTINCT FROM p_mosquitoinspid + AND lv.treatmentid IS NOT DISTINCT FROM p_treatmentid + AND lv.containertype IS NOT DISTINCT FROM p_containertype + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.containerrelate + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.containerrelate + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.containerrelate ( + objectid, + + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + inspsampleid, + mosquitoinspid, + treatmentid, + containertype, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_inspsampleid, + p_mosquitoinspid, + p_treatmentid, + p_containertype, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_fieldscoutinglog( + p_objectid bigint, + + p_status smallint, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.fieldscoutinglog lv + WHERE lv.objectid = p_objectid + + AND lv.status IS NOT DISTINCT FROM p_status + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.fieldscoutinglog + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.fieldscoutinglog + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.fieldscoutinglog ( + objectid, + + status, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_status, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_habitatrelate( + p_objectid bigint, + + p_foreign_id uuid, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_habitattype varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.habitatrelate lv + WHERE lv.objectid = p_objectid + + AND lv.foreign_id IS NOT DISTINCT FROM p_foreign_id + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.habitattype IS NOT DISTINCT FROM p_habitattype + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.habitatrelate + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.habitatrelate + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.habitatrelate ( + objectid, + + foreign_id, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + habitattype, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_foreign_id, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_habitattype, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_inspectionsampledetail( + p_objectid bigint, + + p_inspsample_id uuid, + p_fieldspecies varchar, + p_flarvcount smallint, + p_fpupcount smallint, + p_feggcount smallint, + p_flstages varchar, + p_fdomstage varchar, + p_fadultact varchar, + p_labspecies varchar, + p_llarvcount smallint, + p_lpupcount smallint, + p_leggcount smallint, + p_ldomstage varchar, + p_comments varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_processed smallint, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.inspectionsampledetail lv + WHERE lv.objectid = p_objectid + + AND lv.inspsample_id IS NOT DISTINCT FROM p_inspsample_id + AND lv.fieldspecies IS NOT DISTINCT FROM p_fieldspecies + AND lv.flarvcount IS NOT DISTINCT FROM p_flarvcount + AND lv.fpupcount IS NOT DISTINCT FROM p_fpupcount + AND lv.feggcount IS NOT DISTINCT FROM p_feggcount + AND lv.flstages IS NOT DISTINCT FROM p_flstages + AND lv.fdomstage IS NOT DISTINCT FROM p_fdomstage + AND lv.fadultact IS NOT DISTINCT FROM p_fadultact + AND lv.labspecies IS NOT DISTINCT FROM p_labspecies + AND lv.llarvcount IS NOT DISTINCT FROM p_llarvcount + AND lv.lpupcount IS NOT DISTINCT FROM p_lpupcount + AND lv.leggcount IS NOT DISTINCT FROM p_leggcount + AND lv.ldomstage IS NOT DISTINCT FROM p_ldomstage + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.processed IS NOT DISTINCT FROM p_processed + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.inspectionsampledetail + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.inspectionsampledetail + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.inspectionsampledetail ( + objectid, + + inspsample_id, + fieldspecies, + flarvcount, + fpupcount, + feggcount, + flstages, + fdomstage, + fadultact, + labspecies, + llarvcount, + lpupcount, + leggcount, + ldomstage, + comments, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + processed, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_inspsample_id, + p_fieldspecies, + p_flarvcount, + p_fpupcount, + p_feggcount, + p_flstages, + p_fdomstage, + p_fadultact, + p_labspecies, + p_llarvcount, + p_lpupcount, + p_leggcount, + p_ldomstage, + p_comments, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_processed, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_inspectionsample( + p_objectid bigint, + + p_insp_id uuid, + p_sampleid varchar, + p_processed smallint, + p_idbytech varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.inspectionsample lv + WHERE lv.objectid = p_objectid + + AND lv.insp_id IS NOT DISTINCT FROM p_insp_id + AND lv.sampleid IS NOT DISTINCT FROM p_sampleid + AND lv.processed IS NOT DISTINCT FROM p_processed + AND lv.idbytech IS NOT DISTINCT FROM p_idbytech + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.inspectionsample + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.inspectionsample + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.inspectionsample ( + objectid, + + insp_id, + sampleid, + processed, + idbytech, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_insp_id, + p_sampleid, + p_processed, + p_idbytech, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_linelocation( + p_objectid bigint, + + p_name varchar, + p_zone varchar, + p_habitat varchar, + p_priority varchar, + p_usetype varchar, + p_active smallint, + p_description varchar, + p_accessdesc varchar, + p_comments varchar, + p_symbology varchar, + p_externalid varchar, + p_acres double precision, + p_nextactiondatescheduled timestamp, + p_larvinspectinterval smallint, + p_length_ft double precision, + p_width_ft double precision, + p_zone2 varchar, + p_locationnumber integer, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_lastinspectdate timestamp, + p_lastinspectbreeding varchar, + p_lastinspectavglarvae double precision, + p_lastinspectavgpupae double precision, + p_lastinspectlstages varchar, + p_lastinspectactiontaken varchar, + p_lastinspectfieldspecies varchar, + p_lasttreatdate timestamp, + p_lasttreatproduct varchar, + p_lasttreatqty double precision, + p_lasttreatqtyunit varchar, + p_hectares double precision, + p_lastinspectactivity varchar, + p_lasttreatactivity varchar, + p_length_meters double precision, + p_width_meters double precision, + p_lastinspectconditions varchar, + p_waterorigin varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_jurisdiction varchar, + p_shape__length double precision, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.linelocation lv + WHERE lv.objectid = p_objectid + + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.habitat IS NOT DISTINCT FROM p_habitat + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.usetype IS NOT DISTINCT FROM p_usetype + AND lv.active IS NOT DISTINCT FROM p_active + AND lv.description IS NOT DISTINCT FROM p_description + AND lv.accessdesc IS NOT DISTINCT FROM p_accessdesc + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.symbology IS NOT DISTINCT FROM p_symbology + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.acres IS NOT DISTINCT FROM p_acres + AND lv.nextactiondatescheduled IS NOT DISTINCT FROM p_nextactiondatescheduled + AND lv.larvinspectinterval IS NOT DISTINCT FROM p_larvinspectinterval + AND lv.length_ft IS NOT DISTINCT FROM p_length_ft + AND lv.width_ft IS NOT DISTINCT FROM p_width_ft + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.locationnumber IS NOT DISTINCT FROM p_locationnumber + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.lastinspectdate IS NOT DISTINCT FROM p_lastinspectdate + AND lv.lastinspectbreeding IS NOT DISTINCT FROM p_lastinspectbreeding + AND lv.lastinspectavglarvae IS NOT DISTINCT FROM p_lastinspectavglarvae + AND lv.lastinspectavgpupae IS NOT DISTINCT FROM p_lastinspectavgpupae + AND lv.lastinspectlstages IS NOT DISTINCT FROM p_lastinspectlstages + AND lv.lastinspectactiontaken IS NOT DISTINCT FROM p_lastinspectactiontaken + AND lv.lastinspectfieldspecies IS NOT DISTINCT FROM p_lastinspectfieldspecies + AND lv.lasttreatdate IS NOT DISTINCT FROM p_lasttreatdate + AND lv.lasttreatproduct IS NOT DISTINCT FROM p_lasttreatproduct + AND lv.lasttreatqty IS NOT DISTINCT FROM p_lasttreatqty + AND lv.lasttreatqtyunit IS NOT DISTINCT FROM p_lasttreatqtyunit + AND lv.hectares IS NOT DISTINCT FROM p_hectares + AND lv.lastinspectactivity IS NOT DISTINCT FROM p_lastinspectactivity + AND lv.lasttreatactivity IS NOT DISTINCT FROM p_lasttreatactivity + AND lv.length_meters IS NOT DISTINCT FROM p_length_meters + AND lv.width_meters IS NOT DISTINCT FROM p_width_meters + AND lv.lastinspectconditions IS NOT DISTINCT FROM p_lastinspectconditions + AND lv.waterorigin IS NOT DISTINCT FROM p_waterorigin + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.jurisdiction IS NOT DISTINCT FROM p_jurisdiction + AND lv.shape__length IS NOT DISTINCT FROM p_shape__length + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.linelocation + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.linelocation + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.linelocation ( + objectid, + + name, + zone, + habitat, + priority, + usetype, + active, + description, + accessdesc, + comments, + symbology, + externalid, + acres, + nextactiondatescheduled, + larvinspectinterval, + length_ft, + width_ft, + zone2, + locationnumber, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + lastinspectdate, + lastinspectbreeding, + lastinspectavglarvae, + lastinspectavgpupae, + lastinspectlstages, + lastinspectactiontaken, + lastinspectfieldspecies, + lasttreatdate, + lasttreatproduct, + lasttreatqty, + lasttreatqtyunit, + hectares, + lastinspectactivity, + lasttreatactivity, + length_meters, + width_meters, + lastinspectconditions, + waterorigin, + creationdate, + creator, + editdate, + editor, + jurisdiction, + shape__length, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_name, + p_zone, + p_habitat, + p_priority, + p_usetype, + p_active, + p_description, + p_accessdesc, + p_comments, + p_symbology, + p_externalid, + p_acres, + p_nextactiondatescheduled, + p_larvinspectinterval, + p_length_ft, + p_width_ft, + p_zone2, + p_locationnumber, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_lastinspectdate, + p_lastinspectbreeding, + p_lastinspectavglarvae, + p_lastinspectavgpupae, + p_lastinspectlstages, + p_lastinspectactiontaken, + p_lastinspectfieldspecies, + p_lasttreatdate, + p_lasttreatproduct, + p_lasttreatqty, + p_lasttreatqtyunit, + p_hectares, + p_lastinspectactivity, + p_lasttreatactivity, + p_length_meters, + p_width_meters, + p_lastinspectconditions, + p_waterorigin, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_jurisdiction, + p_shape__length, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_locationtracking( + p_objectid bigint, + + p_accuracy double precision, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_globalid uuid, + p_fieldtech varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.locationtracking lv + WHERE lv.objectid = p_objectid + + AND lv.accuracy IS NOT DISTINCT FROM p_accuracy + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.fieldtech IS NOT DISTINCT FROM p_fieldtech + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.locationtracking + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.locationtracking + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.locationtracking ( + objectid, + + accuracy, + created_user, + created_date, + last_edited_user, + last_edited_date, + globalid, + fieldtech, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_accuracy, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_globalid, + p_fieldtech, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_mosquitoinspection( + p_objectid bigint, + + p_numdips smallint, + p_activity varchar, + p_breeding varchar, + p_totlarvae smallint, + p_totpupae smallint, + p_eggs smallint, + p_posdips smallint, + p_adultact varchar, + p_lstages varchar, + p_domstage varchar, + p_actiontaken varchar, + p_comments varchar, + p_avetemp double precision, + p_windspeed double precision, + p_raingauge double precision, + p_startdatetime timestamp, + p_enddatetime timestamp, + p_winddir varchar, + p_avglarvae double precision, + p_avgpupae double precision, + p_reviewed smallint, + p_reviewedby varchar, + p_revieweddate timestamp, + p_locationname varchar, + p_zone varchar, + p_recordstatus smallint, + p_zone2 varchar, + p_personalcontact smallint, + p_tirecount smallint, + p_cbcount smallint, + p_containercount smallint, + p_fieldspecies varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_linelocid uuid, + p_pointlocid uuid, + p_polygonlocid uuid, + p_srid uuid, + p_fieldtech varchar, + p_larvaepresent smallint, + p_pupaepresent smallint, + p_sdid uuid, + p_sitecond varchar, + p_positivecontainercount smallint, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_jurisdiction varchar, + p_visualmonitoring smallint, + p_vmcomments varchar, + p_adminaction varchar, + p_ptaid uuid, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.mosquitoinspection lv + WHERE lv.objectid = p_objectid + + AND lv.numdips IS NOT DISTINCT FROM p_numdips + AND lv.activity IS NOT DISTINCT FROM p_activity + AND lv.breeding IS NOT DISTINCT FROM p_breeding + AND lv.totlarvae IS NOT DISTINCT FROM p_totlarvae + AND lv.totpupae IS NOT DISTINCT FROM p_totpupae + AND lv.eggs IS NOT DISTINCT FROM p_eggs + AND lv.posdips IS NOT DISTINCT FROM p_posdips + AND lv.adultact IS NOT DISTINCT FROM p_adultact + AND lv.lstages IS NOT DISTINCT FROM p_lstages + AND lv.domstage IS NOT DISTINCT FROM p_domstage + AND lv.actiontaken IS NOT DISTINCT FROM p_actiontaken + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.avetemp IS NOT DISTINCT FROM p_avetemp + AND lv.windspeed IS NOT DISTINCT FROM p_windspeed + AND lv.raingauge IS NOT DISTINCT FROM p_raingauge + AND lv.startdatetime IS NOT DISTINCT FROM p_startdatetime + AND lv.enddatetime IS NOT DISTINCT FROM p_enddatetime + AND lv.winddir IS NOT DISTINCT FROM p_winddir + AND lv.avglarvae IS NOT DISTINCT FROM p_avglarvae + AND lv.avgpupae IS NOT DISTINCT FROM p_avgpupae + AND lv.reviewed IS NOT DISTINCT FROM p_reviewed + AND lv.reviewedby IS NOT DISTINCT FROM p_reviewedby + AND lv.revieweddate IS NOT DISTINCT FROM p_revieweddate + AND lv.locationname IS NOT DISTINCT FROM p_locationname + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.recordstatus IS NOT DISTINCT FROM p_recordstatus + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.personalcontact IS NOT DISTINCT FROM p_personalcontact + AND lv.tirecount IS NOT DISTINCT FROM p_tirecount + AND lv.cbcount IS NOT DISTINCT FROM p_cbcount + AND lv.containercount IS NOT DISTINCT FROM p_containercount + AND lv.fieldspecies IS NOT DISTINCT FROM p_fieldspecies + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.linelocid IS NOT DISTINCT FROM p_linelocid + AND lv.pointlocid IS NOT DISTINCT FROM p_pointlocid + AND lv.polygonlocid IS NOT DISTINCT FROM p_polygonlocid + AND lv.srid IS NOT DISTINCT FROM p_srid + AND lv.fieldtech IS NOT DISTINCT FROM p_fieldtech + AND lv.larvaepresent IS NOT DISTINCT FROM p_larvaepresent + AND lv.pupaepresent IS NOT DISTINCT FROM p_pupaepresent + AND lv.sdid IS NOT DISTINCT FROM p_sdid + AND lv.sitecond IS NOT DISTINCT FROM p_sitecond + AND lv.positivecontainercount IS NOT DISTINCT FROM p_positivecontainercount + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.jurisdiction IS NOT DISTINCT FROM p_jurisdiction + AND lv.visualmonitoring IS NOT DISTINCT FROM p_visualmonitoring + AND lv.vmcomments IS NOT DISTINCT FROM p_vmcomments + AND lv.adminaction IS NOT DISTINCT FROM p_adminaction + AND lv.ptaid IS NOT DISTINCT FROM p_ptaid + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.mosquitoinspection + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.mosquitoinspection + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.mosquitoinspection ( + objectid, + + numdips, + activity, + breeding, + totlarvae, + totpupae, + eggs, + posdips, + adultact, + lstages, + domstage, + actiontaken, + comments, + avetemp, + windspeed, + raingauge, + startdatetime, + enddatetime, + winddir, + avglarvae, + avgpupae, + reviewed, + reviewedby, + revieweddate, + locationname, + zone, + recordstatus, + zone2, + personalcontact, + tirecount, + cbcount, + containercount, + fieldspecies, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + linelocid, + pointlocid, + polygonlocid, + srid, + fieldtech, + larvaepresent, + pupaepresent, + sdid, + sitecond, + positivecontainercount, + creationdate, + creator, + editdate, + editor, + jurisdiction, + visualmonitoring, + vmcomments, + adminaction, + ptaid, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_numdips, + p_activity, + p_breeding, + p_totlarvae, + p_totpupae, + p_eggs, + p_posdips, + p_adultact, + p_lstages, + p_domstage, + p_actiontaken, + p_comments, + p_avetemp, + p_windspeed, + p_raingauge, + p_startdatetime, + p_enddatetime, + p_winddir, + p_avglarvae, + p_avgpupae, + p_reviewed, + p_reviewedby, + p_revieweddate, + p_locationname, + p_zone, + p_recordstatus, + p_zone2, + p_personalcontact, + p_tirecount, + p_cbcount, + p_containercount, + p_fieldspecies, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_linelocid, + p_pointlocid, + p_polygonlocid, + p_srid, + p_fieldtech, + p_larvaepresent, + p_pupaepresent, + p_sdid, + p_sitecond, + p_positivecontainercount, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_jurisdiction, + p_visualmonitoring, + p_vmcomments, + p_adminaction, + p_ptaid, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_pointlocation( + p_objectid bigint, + + p_name varchar, + p_zone varchar, + p_habitat varchar, + p_priority varchar, + p_usetype varchar, + p_active smallint, + p_description varchar, + p_accessdesc varchar, + p_comments varchar, + p_symbology varchar, + p_externalid varchar, + p_nextactiondatescheduled timestamp, + p_larvinspectinterval smallint, + p_zone2 varchar, + p_locationnumber integer, + p_globalid uuid, + p_stype varchar, + p_lastinspectdate timestamp, + p_lastinspectbreeding varchar, + p_lastinspectavglarvae double precision, + p_lastinspectavgpupae double precision, + p_lastinspectlstages varchar, + p_lastinspectactiontaken varchar, + p_lastinspectfieldspecies varchar, + p_lasttreatdate timestamp, + p_lasttreatproduct varchar, + p_lasttreatqty double precision, + p_lasttreatqtyunit varchar, + p_lastinspectactivity varchar, + p_lasttreatactivity varchar, + p_lastinspectconditions varchar, + p_waterorigin varchar, + p_x double precision, + p_y double precision, + p_assignedtech varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_jurisdiction varchar, + p_deactivate_reason varchar, + p_scalarpriority integer, + p_sourcestatus varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.pointlocation lv + WHERE lv.objectid = p_objectid + + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.habitat IS NOT DISTINCT FROM p_habitat + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.usetype IS NOT DISTINCT FROM p_usetype + AND lv.active IS NOT DISTINCT FROM p_active + AND lv.description IS NOT DISTINCT FROM p_description + AND lv.accessdesc IS NOT DISTINCT FROM p_accessdesc + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.symbology IS NOT DISTINCT FROM p_symbology + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.nextactiondatescheduled IS NOT DISTINCT FROM p_nextactiondatescheduled + AND lv.larvinspectinterval IS NOT DISTINCT FROM p_larvinspectinterval + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.locationnumber IS NOT DISTINCT FROM p_locationnumber + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.stype IS NOT DISTINCT FROM p_stype + AND lv.lastinspectdate IS NOT DISTINCT FROM p_lastinspectdate + AND lv.lastinspectbreeding IS NOT DISTINCT FROM p_lastinspectbreeding + AND lv.lastinspectavglarvae IS NOT DISTINCT FROM p_lastinspectavglarvae + AND lv.lastinspectavgpupae IS NOT DISTINCT FROM p_lastinspectavgpupae + AND lv.lastinspectlstages IS NOT DISTINCT FROM p_lastinspectlstages + AND lv.lastinspectactiontaken IS NOT DISTINCT FROM p_lastinspectactiontaken + AND lv.lastinspectfieldspecies IS NOT DISTINCT FROM p_lastinspectfieldspecies + AND lv.lasttreatdate IS NOT DISTINCT FROM p_lasttreatdate + AND lv.lasttreatproduct IS NOT DISTINCT FROM p_lasttreatproduct + AND lv.lasttreatqty IS NOT DISTINCT FROM p_lasttreatqty + AND lv.lasttreatqtyunit IS NOT DISTINCT FROM p_lasttreatqtyunit + AND lv.lastinspectactivity IS NOT DISTINCT FROM p_lastinspectactivity + AND lv.lasttreatactivity IS NOT DISTINCT FROM p_lasttreatactivity + AND lv.lastinspectconditions IS NOT DISTINCT FROM p_lastinspectconditions + AND lv.waterorigin IS NOT DISTINCT FROM p_waterorigin + AND lv.x IS NOT DISTINCT FROM p_x + AND lv.y IS NOT DISTINCT FROM p_y + AND lv.assignedtech IS NOT DISTINCT FROM p_assignedtech + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.jurisdiction IS NOT DISTINCT FROM p_jurisdiction + AND lv.deactivate_reason IS NOT DISTINCT FROM p_deactivate_reason + AND lv.scalarpriority IS NOT DISTINCT FROM p_scalarpriority + AND lv.sourcestatus IS NOT DISTINCT FROM p_sourcestatus + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.pointlocation + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.pointlocation + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.pointlocation ( + objectid, + + name, + zone, + habitat, + priority, + usetype, + active, + description, + accessdesc, + comments, + symbology, + externalid, + nextactiondatescheduled, + larvinspectinterval, + zone2, + locationnumber, + globalid, + stype, + lastinspectdate, + lastinspectbreeding, + lastinspectavglarvae, + lastinspectavgpupae, + lastinspectlstages, + lastinspectactiontaken, + lastinspectfieldspecies, + lasttreatdate, + lasttreatproduct, + lasttreatqty, + lasttreatqtyunit, + lastinspectactivity, + lasttreatactivity, + lastinspectconditions, + waterorigin, + x, + y, + assignedtech, + creationdate, + creator, + editdate, + editor, + jurisdiction, + deactivate_reason, + scalarpriority, + sourcestatus, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_name, + p_zone, + p_habitat, + p_priority, + p_usetype, + p_active, + p_description, + p_accessdesc, + p_comments, + p_symbology, + p_externalid, + p_nextactiondatescheduled, + p_larvinspectinterval, + p_zone2, + p_locationnumber, + p_globalid, + p_stype, + p_lastinspectdate, + p_lastinspectbreeding, + p_lastinspectavglarvae, + p_lastinspectavgpupae, + p_lastinspectlstages, + p_lastinspectactiontaken, + p_lastinspectfieldspecies, + p_lasttreatdate, + p_lasttreatproduct, + p_lasttreatqty, + p_lasttreatqtyunit, + p_lastinspectactivity, + p_lasttreatactivity, + p_lastinspectconditions, + p_waterorigin, + p_x, + p_y, + p_assignedtech, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_jurisdiction, + p_deactivate_reason, + p_scalarpriority, + p_sourcestatus, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_polygonlocation( + p_objectid bigint, + + p_name varchar, + p_zone varchar, + p_habitat varchar, + p_priority varchar, + p_usetype varchar, + p_active smallint, + p_description varchar, + p_accessdesc varchar, + p_comments varchar, + p_symbology varchar, + p_externalid varchar, + p_acres double precision, + p_nextactiondatescheduled timestamp, + p_larvinspectinterval smallint, + p_zone2 varchar, + p_locationnumber integer, + p_globalid uuid, + p_lastinspectdate timestamp, + p_lastinspectbreeding varchar, + p_lastinspectavglarvae double precision, + p_lastinspectavgpupae double precision, + p_lastinspectlstages varchar, + p_lastinspectactiontaken varchar, + p_lastinspectfieldspecies varchar, + p_lasttreatdate timestamp, + p_lasttreatproduct varchar, + p_lasttreatqty double precision, + p_lasttreatqtyunit varchar, + p_hectares double precision, + p_lastinspectactivity varchar, + p_lasttreatactivity varchar, + p_lastinspectconditions varchar, + p_waterorigin varchar, + p_filter varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_jurisdiction varchar, + p_shape__area double precision, + p_shape__length double precision, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.polygonlocation lv + WHERE lv.objectid = p_objectid + + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.habitat IS NOT DISTINCT FROM p_habitat + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.usetype IS NOT DISTINCT FROM p_usetype + AND lv.active IS NOT DISTINCT FROM p_active + AND lv.description IS NOT DISTINCT FROM p_description + AND lv.accessdesc IS NOT DISTINCT FROM p_accessdesc + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.symbology IS NOT DISTINCT FROM p_symbology + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.acres IS NOT DISTINCT FROM p_acres + AND lv.nextactiondatescheduled IS NOT DISTINCT FROM p_nextactiondatescheduled + AND lv.larvinspectinterval IS NOT DISTINCT FROM p_larvinspectinterval + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.locationnumber IS NOT DISTINCT FROM p_locationnumber + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.lastinspectdate IS NOT DISTINCT FROM p_lastinspectdate + AND lv.lastinspectbreeding IS NOT DISTINCT FROM p_lastinspectbreeding + AND lv.lastinspectavglarvae IS NOT DISTINCT FROM p_lastinspectavglarvae + AND lv.lastinspectavgpupae IS NOT DISTINCT FROM p_lastinspectavgpupae + AND lv.lastinspectlstages IS NOT DISTINCT FROM p_lastinspectlstages + AND lv.lastinspectactiontaken IS NOT DISTINCT FROM p_lastinspectactiontaken + AND lv.lastinspectfieldspecies IS NOT DISTINCT FROM p_lastinspectfieldspecies + AND lv.lasttreatdate IS NOT DISTINCT FROM p_lasttreatdate + AND lv.lasttreatproduct IS NOT DISTINCT FROM p_lasttreatproduct + AND lv.lasttreatqty IS NOT DISTINCT FROM p_lasttreatqty + AND lv.lasttreatqtyunit IS NOT DISTINCT FROM p_lasttreatqtyunit + AND lv.hectares IS NOT DISTINCT FROM p_hectares + AND lv.lastinspectactivity IS NOT DISTINCT FROM p_lastinspectactivity + AND lv.lasttreatactivity IS NOT DISTINCT FROM p_lasttreatactivity + AND lv.lastinspectconditions IS NOT DISTINCT FROM p_lastinspectconditions + AND lv.waterorigin IS NOT DISTINCT FROM p_waterorigin + AND lv.filter IS NOT DISTINCT FROM p_filter + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.jurisdiction IS NOT DISTINCT FROM p_jurisdiction + AND lv.shape__area IS NOT DISTINCT FROM p_shape__area + AND lv.shape__length IS NOT DISTINCT FROM p_shape__length + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.polygonlocation + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.polygonlocation + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.polygonlocation ( + objectid, + + name, + zone, + habitat, + priority, + usetype, + active, + description, + accessdesc, + comments, + symbology, + externalid, + acres, + nextactiondatescheduled, + larvinspectinterval, + zone2, + locationnumber, + globalid, + lastinspectdate, + lastinspectbreeding, + lastinspectavglarvae, + lastinspectavgpupae, + lastinspectlstages, + lastinspectactiontaken, + lastinspectfieldspecies, + lasttreatdate, + lasttreatproduct, + lasttreatqty, + lasttreatqtyunit, + hectares, + lastinspectactivity, + lasttreatactivity, + lastinspectconditions, + waterorigin, + filter, + creationdate, + creator, + editdate, + editor, + jurisdiction, + shape__area, + shape__length, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_name, + p_zone, + p_habitat, + p_priority, + p_usetype, + p_active, + p_description, + p_accessdesc, + p_comments, + p_symbology, + p_externalid, + p_acres, + p_nextactiondatescheduled, + p_larvinspectinterval, + p_zone2, + p_locationnumber, + p_globalid, + p_lastinspectdate, + p_lastinspectbreeding, + p_lastinspectavglarvae, + p_lastinspectavgpupae, + p_lastinspectlstages, + p_lastinspectactiontaken, + p_lastinspectfieldspecies, + p_lasttreatdate, + p_lasttreatproduct, + p_lasttreatqty, + p_lasttreatqtyunit, + p_hectares, + p_lastinspectactivity, + p_lasttreatactivity, + p_lastinspectconditions, + p_waterorigin, + p_filter, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_jurisdiction, + p_shape__area, + p_shape__length, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_pooldetail( + p_objectid bigint, + + p_trapdata_id uuid, + p_pool_id uuid, + p_species varchar, + p_females smallint, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.pooldetail lv + WHERE lv.objectid = p_objectid + + AND lv.trapdata_id IS NOT DISTINCT FROM p_trapdata_id + AND lv.pool_id IS NOT DISTINCT FROM p_pool_id + AND lv.species IS NOT DISTINCT FROM p_species + AND lv.females IS NOT DISTINCT FROM p_females + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.pooldetail + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.pooldetail + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.pooldetail ( + objectid, + + trapdata_id, + pool_id, + species, + females, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_trapdata_id, + p_pool_id, + p_species, + p_females, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_pool( + p_objectid bigint, + + p_trapdata_id uuid, + p_datesent timestamp, + p_survtech varchar, + p_datetested timestamp, + p_testtech varchar, + p_comments varchar, + p_sampleid varchar, + p_processed smallint, + p_lab_id uuid, + p_testmethod varchar, + p_diseasetested varchar, + p_diseasepos varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_lab varchar, + p_poolyear smallint, + p_gatewaysync smallint, + p_vectorsurvcollectionid varchar, + p_vectorsurvpoolid varchar, + p_vectorsurvtrapdataid varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.pool lv + WHERE lv.objectid = p_objectid + + AND lv.trapdata_id IS NOT DISTINCT FROM p_trapdata_id + AND lv.datesent IS NOT DISTINCT FROM p_datesent + AND lv.survtech IS NOT DISTINCT FROM p_survtech + AND lv.datetested IS NOT DISTINCT FROM p_datetested + AND lv.testtech IS NOT DISTINCT FROM p_testtech + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.sampleid IS NOT DISTINCT FROM p_sampleid + AND lv.processed IS NOT DISTINCT FROM p_processed + AND lv.lab_id IS NOT DISTINCT FROM p_lab_id + AND lv.testmethod IS NOT DISTINCT FROM p_testmethod + AND lv.diseasetested IS NOT DISTINCT FROM p_diseasetested + AND lv.diseasepos IS NOT DISTINCT FROM p_diseasepos + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.lab IS NOT DISTINCT FROM p_lab + AND lv.poolyear IS NOT DISTINCT FROM p_poolyear + AND lv.gatewaysync IS NOT DISTINCT FROM p_gatewaysync + AND lv.vectorsurvcollectionid IS NOT DISTINCT FROM p_vectorsurvcollectionid + AND lv.vectorsurvpoolid IS NOT DISTINCT FROM p_vectorsurvpoolid + AND lv.vectorsurvtrapdataid IS NOT DISTINCT FROM p_vectorsurvtrapdataid + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.pool + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.pool + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.pool ( + objectid, + + trapdata_id, + datesent, + survtech, + datetested, + testtech, + comments, + sampleid, + processed, + lab_id, + testmethod, + diseasetested, + diseasepos, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + lab, + poolyear, + gatewaysync, + vectorsurvcollectionid, + vectorsurvpoolid, + vectorsurvtrapdataid, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_trapdata_id, + p_datesent, + p_survtech, + p_datetested, + p_testtech, + p_comments, + p_sampleid, + p_processed, + p_lab_id, + p_testmethod, + p_diseasetested, + p_diseasepos, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_lab, + p_poolyear, + p_gatewaysync, + p_vectorsurvcollectionid, + p_vectorsurvpoolid, + p_vectorsurvtrapdataid, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_proposedtreatmentarea( + p_objectid bigint, + + p_method varchar, + p_comments varchar, + p_zone varchar, + p_reviewed smallint, + p_reviewedby varchar, + p_revieweddate timestamp, + p_zone2 varchar, + p_completeddate timestamp, + p_completedby varchar, + p_completed smallint, + p_issprayroute smallint, + p_name varchar, + p_acres double precision, + p_globalid uuid, + p_exported smallint, + p_targetproduct varchar, + p_targetapprate double precision, + p_hectares double precision, + p_lasttreatactivity varchar, + p_lasttreatdate timestamp, + p_lasttreatproduct varchar, + p_lasttreatqty double precision, + p_lasttreatqtyunit varchar, + p_priority varchar, + p_duedate timestamp, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_targetspecies varchar, + p_shape__area double precision, + p_shape__length double precision, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.proposedtreatmentarea lv + WHERE lv.objectid = p_objectid + + AND lv.method IS NOT DISTINCT FROM p_method + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.reviewed IS NOT DISTINCT FROM p_reviewed + AND lv.reviewedby IS NOT DISTINCT FROM p_reviewedby + AND lv.revieweddate IS NOT DISTINCT FROM p_revieweddate + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.completeddate IS NOT DISTINCT FROM p_completeddate + AND lv.completedby IS NOT DISTINCT FROM p_completedby + AND lv.completed IS NOT DISTINCT FROM p_completed + AND lv.issprayroute IS NOT DISTINCT FROM p_issprayroute + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.acres IS NOT DISTINCT FROM p_acres + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.exported IS NOT DISTINCT FROM p_exported + AND lv.targetproduct IS NOT DISTINCT FROM p_targetproduct + AND lv.targetapprate IS NOT DISTINCT FROM p_targetapprate + AND lv.hectares IS NOT DISTINCT FROM p_hectares + AND lv.lasttreatactivity IS NOT DISTINCT FROM p_lasttreatactivity + AND lv.lasttreatdate IS NOT DISTINCT FROM p_lasttreatdate + AND lv.lasttreatproduct IS NOT DISTINCT FROM p_lasttreatproduct + AND lv.lasttreatqty IS NOT DISTINCT FROM p_lasttreatqty + AND lv.lasttreatqtyunit IS NOT DISTINCT FROM p_lasttreatqtyunit + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.duedate IS NOT DISTINCT FROM p_duedate + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.targetspecies IS NOT DISTINCT FROM p_targetspecies + AND lv.shape__area IS NOT DISTINCT FROM p_shape__area + AND lv.shape__length IS NOT DISTINCT FROM p_shape__length + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.proposedtreatmentarea + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.proposedtreatmentarea + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.proposedtreatmentarea ( + objectid, + + method, + comments, + zone, + reviewed, + reviewedby, + revieweddate, + zone2, + completeddate, + completedby, + completed, + issprayroute, + name, + acres, + globalid, + exported, + targetproduct, + targetapprate, + hectares, + lasttreatactivity, + lasttreatdate, + lasttreatproduct, + lasttreatqty, + lasttreatqtyunit, + priority, + duedate, + creationdate, + creator, + editdate, + editor, + targetspecies, + shape__area, + shape__length, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_method, + p_comments, + p_zone, + p_reviewed, + p_reviewedby, + p_revieweddate, + p_zone2, + p_completeddate, + p_completedby, + p_completed, + p_issprayroute, + p_name, + p_acres, + p_globalid, + p_exported, + p_targetproduct, + p_targetapprate, + p_hectares, + p_lasttreatactivity, + p_lasttreatdate, + p_lasttreatproduct, + p_lasttreatqty, + p_lasttreatqtyunit, + p_priority, + p_duedate, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_targetspecies, + p_shape__area, + p_shape__length, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_qamosquitoinspection( + p_objectid bigint, + + p_posdips smallint, + p_actiontaken varchar, + p_comments varchar, + p_avetemp double precision, + p_windspeed double precision, + p_raingauge double precision, + p_globalid uuid, + p_startdatetime timestamp, + p_enddatetime timestamp, + p_winddir varchar, + p_reviewed smallint, + p_reviewedby varchar, + p_revieweddate timestamp, + p_locationname varchar, + p_zone varchar, + p_recordstatus smallint, + p_zone2 varchar, + p_lr smallint, + p_negdips smallint, + p_totalacres double precision, + p_acresbreeding double precision, + p_fish smallint, + p_sitetype varchar, + p_breedingpotential varchar, + p_movingwater smallint, + p_nowaterever smallint, + p_mosquitohabitat varchar, + p_habvalue1 smallint, + p_habvalue1percent smallint, + p_habvalue2 smallint, + p_habvalue2percent smallint, + p_potential smallint, + p_larvaepresent smallint, + p_larvaeinsidetreatedarea smallint, + p_larvaeoutsidetreatedarea smallint, + p_larvaereason varchar, + p_aquaticorganisms varchar, + p_vegetation varchar, + p_sourcereduction varchar, + p_waterpresent smallint, + p_watermovement1 varchar, + p_watermovement1percent smallint, + p_watermovement2 varchar, + p_watermovement2percent smallint, + p_soilconditions varchar, + p_waterduration varchar, + p_watersource varchar, + p_waterconditions varchar, + p_adultactivity smallint, + p_linelocid uuid, + p_pointlocid uuid, + p_polygonlocid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_fieldtech varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.qamosquitoinspection lv + WHERE lv.objectid = p_objectid + + AND lv.posdips IS NOT DISTINCT FROM p_posdips + AND lv.actiontaken IS NOT DISTINCT FROM p_actiontaken + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.avetemp IS NOT DISTINCT FROM p_avetemp + AND lv.windspeed IS NOT DISTINCT FROM p_windspeed + AND lv.raingauge IS NOT DISTINCT FROM p_raingauge + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.startdatetime IS NOT DISTINCT FROM p_startdatetime + AND lv.enddatetime IS NOT DISTINCT FROM p_enddatetime + AND lv.winddir IS NOT DISTINCT FROM p_winddir + AND lv.reviewed IS NOT DISTINCT FROM p_reviewed + AND lv.reviewedby IS NOT DISTINCT FROM p_reviewedby + AND lv.revieweddate IS NOT DISTINCT FROM p_revieweddate + AND lv.locationname IS NOT DISTINCT FROM p_locationname + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.recordstatus IS NOT DISTINCT FROM p_recordstatus + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.lr IS NOT DISTINCT FROM p_lr + AND lv.negdips IS NOT DISTINCT FROM p_negdips + AND lv.totalacres IS NOT DISTINCT FROM p_totalacres + AND lv.acresbreeding IS NOT DISTINCT FROM p_acresbreeding + AND lv.fish IS NOT DISTINCT FROM p_fish + AND lv.sitetype IS NOT DISTINCT FROM p_sitetype + AND lv.breedingpotential IS NOT DISTINCT FROM p_breedingpotential + AND lv.movingwater IS NOT DISTINCT FROM p_movingwater + AND lv.nowaterever IS NOT DISTINCT FROM p_nowaterever + AND lv.mosquitohabitat IS NOT DISTINCT FROM p_mosquitohabitat + AND lv.habvalue1 IS NOT DISTINCT FROM p_habvalue1 + AND lv.habvalue1percent IS NOT DISTINCT FROM p_habvalue1percent + AND lv.habvalue2 IS NOT DISTINCT FROM p_habvalue2 + AND lv.habvalue2percent IS NOT DISTINCT FROM p_habvalue2percent + AND lv.potential IS NOT DISTINCT FROM p_potential + AND lv.larvaepresent IS NOT DISTINCT FROM p_larvaepresent + AND lv.larvaeinsidetreatedarea IS NOT DISTINCT FROM p_larvaeinsidetreatedarea + AND lv.larvaeoutsidetreatedarea IS NOT DISTINCT FROM p_larvaeoutsidetreatedarea + AND lv.larvaereason IS NOT DISTINCT FROM p_larvaereason + AND lv.aquaticorganisms IS NOT DISTINCT FROM p_aquaticorganisms + AND lv.vegetation IS NOT DISTINCT FROM p_vegetation + AND lv.sourcereduction IS NOT DISTINCT FROM p_sourcereduction + AND lv.waterpresent IS NOT DISTINCT FROM p_waterpresent + AND lv.watermovement1 IS NOT DISTINCT FROM p_watermovement1 + AND lv.watermovement1percent IS NOT DISTINCT FROM p_watermovement1percent + AND lv.watermovement2 IS NOT DISTINCT FROM p_watermovement2 + AND lv.watermovement2percent IS NOT DISTINCT FROM p_watermovement2percent + AND lv.soilconditions IS NOT DISTINCT FROM p_soilconditions + AND lv.waterduration IS NOT DISTINCT FROM p_waterduration + AND lv.watersource IS NOT DISTINCT FROM p_watersource + AND lv.waterconditions IS NOT DISTINCT FROM p_waterconditions + AND lv.adultactivity IS NOT DISTINCT FROM p_adultactivity + AND lv.linelocid IS NOT DISTINCT FROM p_linelocid + AND lv.pointlocid IS NOT DISTINCT FROM p_pointlocid + AND lv.polygonlocid IS NOT DISTINCT FROM p_polygonlocid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.fieldtech IS NOT DISTINCT FROM p_fieldtech + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.qamosquitoinspection + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.qamosquitoinspection + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.qamosquitoinspection ( + objectid, + + posdips, + actiontaken, + comments, + avetemp, + windspeed, + raingauge, + globalid, + startdatetime, + enddatetime, + winddir, + reviewed, + reviewedby, + revieweddate, + locationname, + zone, + recordstatus, + zone2, + lr, + negdips, + totalacres, + acresbreeding, + fish, + sitetype, + breedingpotential, + movingwater, + nowaterever, + mosquitohabitat, + habvalue1, + habvalue1percent, + habvalue2, + habvalue2percent, + potential, + larvaepresent, + larvaeinsidetreatedarea, + larvaeoutsidetreatedarea, + larvaereason, + aquaticorganisms, + vegetation, + sourcereduction, + waterpresent, + watermovement1, + watermovement1percent, + watermovement2, + watermovement2percent, + soilconditions, + waterduration, + watersource, + waterconditions, + adultactivity, + linelocid, + pointlocid, + polygonlocid, + created_user, + created_date, + last_edited_user, + last_edited_date, + fieldtech, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_posdips, + p_actiontaken, + p_comments, + p_avetemp, + p_windspeed, + p_raingauge, + p_globalid, + p_startdatetime, + p_enddatetime, + p_winddir, + p_reviewed, + p_reviewedby, + p_revieweddate, + p_locationname, + p_zone, + p_recordstatus, + p_zone2, + p_lr, + p_negdips, + p_totalacres, + p_acresbreeding, + p_fish, + p_sitetype, + p_breedingpotential, + p_movingwater, + p_nowaterever, + p_mosquitohabitat, + p_habvalue1, + p_habvalue1percent, + p_habvalue2, + p_habvalue2percent, + p_potential, + p_larvaepresent, + p_larvaeinsidetreatedarea, + p_larvaeoutsidetreatedarea, + p_larvaereason, + p_aquaticorganisms, + p_vegetation, + p_sourcereduction, + p_waterpresent, + p_watermovement1, + p_watermovement1percent, + p_watermovement2, + p_watermovement2percent, + p_soilconditions, + p_waterduration, + p_watersource, + p_waterconditions, + p_adultactivity, + p_linelocid, + p_pointlocid, + p_polygonlocid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_fieldtech, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_rodentlocation( + p_objectid bigint, + + p_locationname varchar, + p_zone varchar, + p_zone2 varchar, + p_habitat varchar, + p_priority varchar, + p_usetype varchar, + p_active smallint, + p_description varchar, + p_accessdesc varchar, + p_comments varchar, + p_symbology varchar, + p_externalid varchar, + p_nextactiondatescheduled timestamp, + p_locationnumber integer, + p_lastinspectdate timestamp, + p_lastinspectspecies varchar, + p_lastinspectaction varchar, + p_lastinspectconditions varchar, + p_lastinspectrodentevidence varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_jurisdiction varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.rodentlocation lv + WHERE lv.objectid = p_objectid + + AND lv.locationname IS NOT DISTINCT FROM p_locationname + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.habitat IS NOT DISTINCT FROM p_habitat + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.usetype IS NOT DISTINCT FROM p_usetype + AND lv.active IS NOT DISTINCT FROM p_active + AND lv.description IS NOT DISTINCT FROM p_description + AND lv.accessdesc IS NOT DISTINCT FROM p_accessdesc + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.symbology IS NOT DISTINCT FROM p_symbology + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.nextactiondatescheduled IS NOT DISTINCT FROM p_nextactiondatescheduled + AND lv.locationnumber IS NOT DISTINCT FROM p_locationnumber + AND lv.lastinspectdate IS NOT DISTINCT FROM p_lastinspectdate + AND lv.lastinspectspecies IS NOT DISTINCT FROM p_lastinspectspecies + AND lv.lastinspectaction IS NOT DISTINCT FROM p_lastinspectaction + AND lv.lastinspectconditions IS NOT DISTINCT FROM p_lastinspectconditions + AND lv.lastinspectrodentevidence IS NOT DISTINCT FROM p_lastinspectrodentevidence + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.jurisdiction IS NOT DISTINCT FROM p_jurisdiction + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.rodentlocation + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.rodentlocation + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.rodentlocation ( + objectid, + + locationname, + zone, + zone2, + habitat, + priority, + usetype, + active, + description, + accessdesc, + comments, + symbology, + externalid, + nextactiondatescheduled, + locationnumber, + lastinspectdate, + lastinspectspecies, + lastinspectaction, + lastinspectconditions, + lastinspectrodentevidence, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + creationdate, + creator, + editdate, + editor, + jurisdiction, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_locationname, + p_zone, + p_zone2, + p_habitat, + p_priority, + p_usetype, + p_active, + p_description, + p_accessdesc, + p_comments, + p_symbology, + p_externalid, + p_nextactiondatescheduled, + p_locationnumber, + p_lastinspectdate, + p_lastinspectspecies, + p_lastinspectaction, + p_lastinspectconditions, + p_lastinspectrodentevidence, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_jurisdiction, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_samplecollection( + p_objectid bigint, + + p_loc_id uuid, + p_startdatetime timestamp, + p_enddatetime timestamp, + p_sitecond varchar, + p_sampleid varchar, + p_survtech varchar, + p_datesent timestamp, + p_datetested timestamp, + p_testtech varchar, + p_comments varchar, + p_processed smallint, + p_sampletype varchar, + p_samplecond varchar, + p_species varchar, + p_sex varchar, + p_avetemp double precision, + p_windspeed double precision, + p_winddir varchar, + p_raingauge double precision, + p_activity varchar, + p_testmethod varchar, + p_diseasetested varchar, + p_diseasepos varchar, + p_reviewed smallint, + p_reviewedby varchar, + p_revieweddate timestamp, + p_locationname varchar, + p_zone varchar, + p_recordstatus smallint, + p_zone2 varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_lab varchar, + p_fieldtech varchar, + p_flockid uuid, + p_samplecount smallint, + p_chickenid uuid, + p_gatewaysync smallint, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.samplecollection lv + WHERE lv.objectid = p_objectid + + AND lv.loc_id IS NOT DISTINCT FROM p_loc_id + AND lv.startdatetime IS NOT DISTINCT FROM p_startdatetime + AND lv.enddatetime IS NOT DISTINCT FROM p_enddatetime + AND lv.sitecond IS NOT DISTINCT FROM p_sitecond + AND lv.sampleid IS NOT DISTINCT FROM p_sampleid + AND lv.survtech IS NOT DISTINCT FROM p_survtech + AND lv.datesent IS NOT DISTINCT FROM p_datesent + AND lv.datetested IS NOT DISTINCT FROM p_datetested + AND lv.testtech IS NOT DISTINCT FROM p_testtech + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.processed IS NOT DISTINCT FROM p_processed + AND lv.sampletype IS NOT DISTINCT FROM p_sampletype + AND lv.samplecond IS NOT DISTINCT FROM p_samplecond + AND lv.species IS NOT DISTINCT FROM p_species + AND lv.sex IS NOT DISTINCT FROM p_sex + AND lv.avetemp IS NOT DISTINCT FROM p_avetemp + AND lv.windspeed IS NOT DISTINCT FROM p_windspeed + AND lv.winddir IS NOT DISTINCT FROM p_winddir + AND lv.raingauge IS NOT DISTINCT FROM p_raingauge + AND lv.activity IS NOT DISTINCT FROM p_activity + AND lv.testmethod IS NOT DISTINCT FROM p_testmethod + AND lv.diseasetested IS NOT DISTINCT FROM p_diseasetested + AND lv.diseasepos IS NOT DISTINCT FROM p_diseasepos + AND lv.reviewed IS NOT DISTINCT FROM p_reviewed + AND lv.reviewedby IS NOT DISTINCT FROM p_reviewedby + AND lv.revieweddate IS NOT DISTINCT FROM p_revieweddate + AND lv.locationname IS NOT DISTINCT FROM p_locationname + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.recordstatus IS NOT DISTINCT FROM p_recordstatus + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.lab IS NOT DISTINCT FROM p_lab + AND lv.fieldtech IS NOT DISTINCT FROM p_fieldtech + AND lv.flockid IS NOT DISTINCT FROM p_flockid + AND lv.samplecount IS NOT DISTINCT FROM p_samplecount + AND lv.chickenid IS NOT DISTINCT FROM p_chickenid + AND lv.gatewaysync IS NOT DISTINCT FROM p_gatewaysync + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.samplecollection + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.samplecollection + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.samplecollection ( + objectid, + + loc_id, + startdatetime, + enddatetime, + sitecond, + sampleid, + survtech, + datesent, + datetested, + testtech, + comments, + processed, + sampletype, + samplecond, + species, + sex, + avetemp, + windspeed, + winddir, + raingauge, + activity, + testmethod, + diseasetested, + diseasepos, + reviewed, + reviewedby, + revieweddate, + locationname, + zone, + recordstatus, + zone2, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + lab, + fieldtech, + flockid, + samplecount, + chickenid, + gatewaysync, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_loc_id, + p_startdatetime, + p_enddatetime, + p_sitecond, + p_sampleid, + p_survtech, + p_datesent, + p_datetested, + p_testtech, + p_comments, + p_processed, + p_sampletype, + p_samplecond, + p_species, + p_sex, + p_avetemp, + p_windspeed, + p_winddir, + p_raingauge, + p_activity, + p_testmethod, + p_diseasetested, + p_diseasepos, + p_reviewed, + p_reviewedby, + p_revieweddate, + p_locationname, + p_zone, + p_recordstatus, + p_zone2, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_lab, + p_fieldtech, + p_flockid, + p_samplecount, + p_chickenid, + p_gatewaysync, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_samplelocation( + p_objectid bigint, + + p_name varchar, + p_zone varchar, + p_habitat varchar, + p_priority varchar, + p_usetype varchar, + p_active smallint, + p_description varchar, + p_accessdesc varchar, + p_comments varchar, + p_externalid varchar, + p_nextactiondatescheduled timestamp, + p_zone2 varchar, + p_locationnumber integer, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_gatewaysync smallint, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.samplelocation lv + WHERE lv.objectid = p_objectid + + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.habitat IS NOT DISTINCT FROM p_habitat + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.usetype IS NOT DISTINCT FROM p_usetype + AND lv.active IS NOT DISTINCT FROM p_active + AND lv.description IS NOT DISTINCT FROM p_description + AND lv.accessdesc IS NOT DISTINCT FROM p_accessdesc + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.nextactiondatescheduled IS NOT DISTINCT FROM p_nextactiondatescheduled + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.locationnumber IS NOT DISTINCT FROM p_locationnumber + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.gatewaysync IS NOT DISTINCT FROM p_gatewaysync + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.samplelocation + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.samplelocation + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.samplelocation ( + objectid, + + name, + zone, + habitat, + priority, + usetype, + active, + description, + accessdesc, + comments, + externalid, + nextactiondatescheduled, + zone2, + locationnumber, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + gatewaysync, + creationdate, + creator, + editdate, + editor, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_name, + p_zone, + p_habitat, + p_priority, + p_usetype, + p_active, + p_description, + p_accessdesc, + p_comments, + p_externalid, + p_nextactiondatescheduled, + p_zone2, + p_locationnumber, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_gatewaysync, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_servicerequest( + p_objectid bigint, + + p_recdatetime timestamp, + p_source varchar, + p_entrytech varchar, + p_priority varchar, + p_supervisor varchar, + p_assignedtech varchar, + p_status varchar, + p_clranon smallint, + p_clrfname varchar, + p_clrphone1 varchar, + p_clrphone2 varchar, + p_clremail varchar, + p_clrcompany varchar, + p_clraddr1 varchar, + p_clraddr2 varchar, + p_clrcity varchar, + p_clrstate varchar, + p_clrzip varchar, + p_clrother varchar, + p_clrcontpref varchar, + p_reqcompany varchar, + p_reqaddr1 varchar, + p_reqaddr2 varchar, + p_reqcity varchar, + p_reqstate varchar, + p_reqzip varchar, + p_reqcrossst varchar, + p_reqsubdiv varchar, + p_reqmapgrid varchar, + p_reqpermission smallint, + p_reqtarget varchar, + p_reqdescr varchar, + p_reqnotesfortech varchar, + p_reqnotesforcust varchar, + p_reqfldnotes varchar, + p_reqprogramactions varchar, + p_datetimeclosed timestamp, + p_techclosed varchar, + p_sr_number integer, + p_reviewed smallint, + p_reviewedby varchar, + p_revieweddate timestamp, + p_accepted smallint, + p_accepteddate timestamp, + p_rejectedby varchar, + p_rejecteddate timestamp, + p_rejectedreason varchar, + p_duedate timestamp, + p_acceptedby varchar, + p_comments varchar, + p_estcompletedate timestamp, + p_nextaction varchar, + p_recordstatus smallint, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_firstresponsedate timestamp, + p_responsedaycount smallint, + p_allowed varchar, + p_xvalue varchar, + p_yvalue varchar, + p_validx varchar, + p_validy varchar, + p_externalid varchar, + p_externalerror varchar, + p_pointlocid uuid, + p_notified smallint, + p_notifieddate timestamp, + p_scheduled smallint, + p_scheduleddate timestamp, + p_dog integer, + p_schedule_period varchar, + p_schedule_notes varchar, + p_spanish integer, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_issuesreported varchar, + p_jurisdiction varchar, + p_notificationtimestamp varchar, + p_zone varchar, + p_zone2 varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.servicerequest lv + WHERE lv.objectid = p_objectid + + AND lv.recdatetime IS NOT DISTINCT FROM p_recdatetime + AND lv.source IS NOT DISTINCT FROM p_source + AND lv.entrytech IS NOT DISTINCT FROM p_entrytech + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.supervisor IS NOT DISTINCT FROM p_supervisor + AND lv.assignedtech IS NOT DISTINCT FROM p_assignedtech + AND lv.status IS NOT DISTINCT FROM p_status + AND lv.clranon IS NOT DISTINCT FROM p_clranon + AND lv.clrfname IS NOT DISTINCT FROM p_clrfname + AND lv.clrphone1 IS NOT DISTINCT FROM p_clrphone1 + AND lv.clrphone2 IS NOT DISTINCT FROM p_clrphone2 + AND lv.clremail IS NOT DISTINCT FROM p_clremail + AND lv.clrcompany IS NOT DISTINCT FROM p_clrcompany + AND lv.clraddr1 IS NOT DISTINCT FROM p_clraddr1 + AND lv.clraddr2 IS NOT DISTINCT FROM p_clraddr2 + AND lv.clrcity IS NOT DISTINCT FROM p_clrcity + AND lv.clrstate IS NOT DISTINCT FROM p_clrstate + AND lv.clrzip IS NOT DISTINCT FROM p_clrzip + AND lv.clrother IS NOT DISTINCT FROM p_clrother + AND lv.clrcontpref IS NOT DISTINCT FROM p_clrcontpref + AND lv.reqcompany IS NOT DISTINCT FROM p_reqcompany + AND lv.reqaddr1 IS NOT DISTINCT FROM p_reqaddr1 + AND lv.reqaddr2 IS NOT DISTINCT FROM p_reqaddr2 + AND lv.reqcity IS NOT DISTINCT FROM p_reqcity + AND lv.reqstate IS NOT DISTINCT FROM p_reqstate + AND lv.reqzip IS NOT DISTINCT FROM p_reqzip + AND lv.reqcrossst IS NOT DISTINCT FROM p_reqcrossst + AND lv.reqsubdiv IS NOT DISTINCT FROM p_reqsubdiv + AND lv.reqmapgrid IS NOT DISTINCT FROM p_reqmapgrid + AND lv.reqpermission IS NOT DISTINCT FROM p_reqpermission + AND lv.reqtarget IS NOT DISTINCT FROM p_reqtarget + AND lv.reqdescr IS NOT DISTINCT FROM p_reqdescr + AND lv.reqnotesfortech IS NOT DISTINCT FROM p_reqnotesfortech + AND lv.reqnotesforcust IS NOT DISTINCT FROM p_reqnotesforcust + AND lv.reqfldnotes IS NOT DISTINCT FROM p_reqfldnotes + AND lv.reqprogramactions IS NOT DISTINCT FROM p_reqprogramactions + AND lv.datetimeclosed IS NOT DISTINCT FROM p_datetimeclosed + AND lv.techclosed IS NOT DISTINCT FROM p_techclosed + AND lv.sr_number IS NOT DISTINCT FROM p_sr_number + AND lv.reviewed IS NOT DISTINCT FROM p_reviewed + AND lv.reviewedby IS NOT DISTINCT FROM p_reviewedby + AND lv.revieweddate IS NOT DISTINCT FROM p_revieweddate + AND lv.accepted IS NOT DISTINCT FROM p_accepted + AND lv.accepteddate IS NOT DISTINCT FROM p_accepteddate + AND lv.rejectedby IS NOT DISTINCT FROM p_rejectedby + AND lv.rejecteddate IS NOT DISTINCT FROM p_rejecteddate + AND lv.rejectedreason IS NOT DISTINCT FROM p_rejectedreason + AND lv.duedate IS NOT DISTINCT FROM p_duedate + AND lv.acceptedby IS NOT DISTINCT FROM p_acceptedby + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.estcompletedate IS NOT DISTINCT FROM p_estcompletedate + AND lv.nextaction IS NOT DISTINCT FROM p_nextaction + AND lv.recordstatus IS NOT DISTINCT FROM p_recordstatus + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.firstresponsedate IS NOT DISTINCT FROM p_firstresponsedate + AND lv.responsedaycount IS NOT DISTINCT FROM p_responsedaycount + AND lv.allowed IS NOT DISTINCT FROM p_allowed + AND lv.xvalue IS NOT DISTINCT FROM p_xvalue + AND lv.yvalue IS NOT DISTINCT FROM p_yvalue + AND lv.validx IS NOT DISTINCT FROM p_validx + AND lv.validy IS NOT DISTINCT FROM p_validy + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.externalerror IS NOT DISTINCT FROM p_externalerror + AND lv.pointlocid IS NOT DISTINCT FROM p_pointlocid + AND lv.notified IS NOT DISTINCT FROM p_notified + AND lv.notifieddate IS NOT DISTINCT FROM p_notifieddate + AND lv.scheduled IS NOT DISTINCT FROM p_scheduled + AND lv.scheduleddate IS NOT DISTINCT FROM p_scheduleddate + AND lv.dog IS NOT DISTINCT FROM p_dog + AND lv.schedule_period IS NOT DISTINCT FROM p_schedule_period + AND lv.schedule_notes IS NOT DISTINCT FROM p_schedule_notes + AND lv.spanish IS NOT DISTINCT FROM p_spanish + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.issuesreported IS NOT DISTINCT FROM p_issuesreported + AND lv.jurisdiction IS NOT DISTINCT FROM p_jurisdiction + AND lv.notificationtimestamp IS NOT DISTINCT FROM p_notificationtimestamp + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.servicerequest + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.servicerequest + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.servicerequest ( + objectid, + + recdatetime, + source, + entrytech, + priority, + supervisor, + assignedtech, + status, + clranon, + clrfname, + clrphone1, + clrphone2, + clremail, + clrcompany, + clraddr1, + clraddr2, + clrcity, + clrstate, + clrzip, + clrother, + clrcontpref, + reqcompany, + reqaddr1, + reqaddr2, + reqcity, + reqstate, + reqzip, + reqcrossst, + reqsubdiv, + reqmapgrid, + reqpermission, + reqtarget, + reqdescr, + reqnotesfortech, + reqnotesforcust, + reqfldnotes, + reqprogramactions, + datetimeclosed, + techclosed, + sr_number, + reviewed, + reviewedby, + revieweddate, + accepted, + accepteddate, + rejectedby, + rejecteddate, + rejectedreason, + duedate, + acceptedby, + comments, + estcompletedate, + nextaction, + recordstatus, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + firstresponsedate, + responsedaycount, + allowed, + xvalue, + yvalue, + validx, + validy, + externalid, + externalerror, + pointlocid, + notified, + notifieddate, + scheduled, + scheduleddate, + dog, + schedule_period, + schedule_notes, + spanish, + creationdate, + creator, + editdate, + editor, + issuesreported, + jurisdiction, + notificationtimestamp, + zone, + zone2, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_recdatetime, + p_source, + p_entrytech, + p_priority, + p_supervisor, + p_assignedtech, + p_status, + p_clranon, + p_clrfname, + p_clrphone1, + p_clrphone2, + p_clremail, + p_clrcompany, + p_clraddr1, + p_clraddr2, + p_clrcity, + p_clrstate, + p_clrzip, + p_clrother, + p_clrcontpref, + p_reqcompany, + p_reqaddr1, + p_reqaddr2, + p_reqcity, + p_reqstate, + p_reqzip, + p_reqcrossst, + p_reqsubdiv, + p_reqmapgrid, + p_reqpermission, + p_reqtarget, + p_reqdescr, + p_reqnotesfortech, + p_reqnotesforcust, + p_reqfldnotes, + p_reqprogramactions, + p_datetimeclosed, + p_techclosed, + p_sr_number, + p_reviewed, + p_reviewedby, + p_revieweddate, + p_accepted, + p_accepteddate, + p_rejectedby, + p_rejecteddate, + p_rejectedreason, + p_duedate, + p_acceptedby, + p_comments, + p_estcompletedate, + p_nextaction, + p_recordstatus, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_firstresponsedate, + p_responsedaycount, + p_allowed, + p_xvalue, + p_yvalue, + p_validx, + p_validy, + p_externalid, + p_externalerror, + p_pointlocid, + p_notified, + p_notifieddate, + p_scheduled, + p_scheduleddate, + p_dog, + p_schedule_period, + p_schedule_notes, + p_spanish, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_issuesreported, + p_jurisdiction, + p_notificationtimestamp, + p_zone, + p_zone2, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_speciesabundance( + p_objectid bigint, + + p_trapdata_id uuid, + p_species varchar, + p_males smallint, + p_unknown smallint, + p_bloodedfem smallint, + p_gravidfem smallint, + p_larvae smallint, + p_poolstogen smallint, + p_processed smallint, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_pupae smallint, + p_eggs smallint, + p_females integer, + p_total integer, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_yearweek integer, + p_globalzscore double precision, + p_r7score double precision, + p_r8score double precision, + p_h3r7 varchar, + p_h3r8 varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.speciesabundance lv + WHERE lv.objectid = p_objectid + + AND lv.trapdata_id IS NOT DISTINCT FROM p_trapdata_id + AND lv.species IS NOT DISTINCT FROM p_species + AND lv.males IS NOT DISTINCT FROM p_males + AND lv.unknown IS NOT DISTINCT FROM p_unknown + AND lv.bloodedfem IS NOT DISTINCT FROM p_bloodedfem + AND lv.gravidfem IS NOT DISTINCT FROM p_gravidfem + AND lv.larvae IS NOT DISTINCT FROM p_larvae + AND lv.poolstogen IS NOT DISTINCT FROM p_poolstogen + AND lv.processed IS NOT DISTINCT FROM p_processed + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.pupae IS NOT DISTINCT FROM p_pupae + AND lv.eggs IS NOT DISTINCT FROM p_eggs + AND lv.females IS NOT DISTINCT FROM p_females + AND lv.total IS NOT DISTINCT FROM p_total + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.yearweek IS NOT DISTINCT FROM p_yearweek + AND lv.globalzscore IS NOT DISTINCT FROM p_globalzscore + AND lv.r7score IS NOT DISTINCT FROM p_r7score + AND lv.r8score IS NOT DISTINCT FROM p_r8score + AND lv.h3r7 IS NOT DISTINCT FROM p_h3r7 + AND lv.h3r8 IS NOT DISTINCT FROM p_h3r8 + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.speciesabundance + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.speciesabundance + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.speciesabundance ( + objectid, + + trapdata_id, + species, + males, + unknown, + bloodedfem, + gravidfem, + larvae, + poolstogen, + processed, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + pupae, + eggs, + females, + total, + creationdate, + creator, + editdate, + editor, + yearweek, + globalzscore, + r7score, + r8score, + h3r7, + h3r8, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_trapdata_id, + p_species, + p_males, + p_unknown, + p_bloodedfem, + p_gravidfem, + p_larvae, + p_poolstogen, + p_processed, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_pupae, + p_eggs, + p_females, + p_total, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_yearweek, + p_globalzscore, + p_r7score, + p_r8score, + p_h3r7, + p_h3r8, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_stormdrain( + p_objectid bigint, + + p_nexttreatmentdate timestamp, + p_lasttreatdate timestamp, + p_lastaction varchar, + p_symbology varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_laststatus varchar, + p_zone varchar, + p_zone2 varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_type varchar, + p_jurisdiction varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.stormdrain lv + WHERE lv.objectid = p_objectid + + AND lv.nexttreatmentdate IS NOT DISTINCT FROM p_nexttreatmentdate + AND lv.lasttreatdate IS NOT DISTINCT FROM p_lasttreatdate + AND lv.lastaction IS NOT DISTINCT FROM p_lastaction + AND lv.symbology IS NOT DISTINCT FROM p_symbology + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.laststatus IS NOT DISTINCT FROM p_laststatus + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.type IS NOT DISTINCT FROM p_type + AND lv.jurisdiction IS NOT DISTINCT FROM p_jurisdiction + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.stormdrain + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.stormdrain + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.stormdrain ( + objectid, + + nexttreatmentdate, + lasttreatdate, + lastaction, + symbology, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + laststatus, + zone, + zone2, + creationdate, + creator, + editdate, + editor, + type, + jurisdiction, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_nexttreatmentdate, + p_lasttreatdate, + p_lastaction, + p_symbology, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_laststatus, + p_zone, + p_zone2, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_type, + p_jurisdiction, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_timecard( + p_objectid bigint, + + p_activity varchar, + p_startdatetime timestamp, + p_enddatetime timestamp, + p_comments varchar, + p_externalid varchar, + p_equiptype varchar, + p_locationname varchar, + p_zone varchar, + p_zone2 varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_linelocid uuid, + p_pointlocid uuid, + p_polygonlocid uuid, + p_lclocid uuid, + p_samplelocid uuid, + p_srid uuid, + p_traplocid uuid, + p_fieldtech varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_rodentlocid uuid, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.timecard lv + WHERE lv.objectid = p_objectid + + AND lv.activity IS NOT DISTINCT FROM p_activity + AND lv.startdatetime IS NOT DISTINCT FROM p_startdatetime + AND lv.enddatetime IS NOT DISTINCT FROM p_enddatetime + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.equiptype IS NOT DISTINCT FROM p_equiptype + AND lv.locationname IS NOT DISTINCT FROM p_locationname + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.linelocid IS NOT DISTINCT FROM p_linelocid + AND lv.pointlocid IS NOT DISTINCT FROM p_pointlocid + AND lv.polygonlocid IS NOT DISTINCT FROM p_polygonlocid + AND lv.lclocid IS NOT DISTINCT FROM p_lclocid + AND lv.samplelocid IS NOT DISTINCT FROM p_samplelocid + AND lv.srid IS NOT DISTINCT FROM p_srid + AND lv.traplocid IS NOT DISTINCT FROM p_traplocid + AND lv.fieldtech IS NOT DISTINCT FROM p_fieldtech + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.rodentlocid IS NOT DISTINCT FROM p_rodentlocid + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.timecard + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.timecard + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.timecard ( + objectid, + + activity, + startdatetime, + enddatetime, + comments, + externalid, + equiptype, + locationname, + zone, + zone2, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + linelocid, + pointlocid, + polygonlocid, + lclocid, + samplelocid, + srid, + traplocid, + fieldtech, + creationdate, + creator, + editdate, + editor, + rodentlocid, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_activity, + p_startdatetime, + p_enddatetime, + p_comments, + p_externalid, + p_equiptype, + p_locationname, + p_zone, + p_zone2, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_linelocid, + p_pointlocid, + p_polygonlocid, + p_lclocid, + p_samplelocid, + p_srid, + p_traplocid, + p_fieldtech, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_rodentlocid, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_trapdata( + p_objectid bigint, + + p_traptype varchar, + p_trapactivitytype varchar, + p_startdatetime timestamp, + p_enddatetime timestamp, + p_comments varchar, + p_idbytech varchar, + p_sortbytech varchar, + p_processed smallint, + p_sitecond varchar, + p_locationname varchar, + p_recordstatus smallint, + p_reviewed smallint, + p_reviewedby varchar, + p_revieweddate timestamp, + p_trapcondition varchar, + p_trapnights smallint, + p_zone varchar, + p_zone2 varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_srid uuid, + p_fieldtech varchar, + p_gatewaysync smallint, + p_loc_id uuid, + p_voltage double precision, + p_winddir varchar, + p_windspeed double precision, + p_avetemp double precision, + p_raingauge double precision, + p_lr smallint, + p_field integer, + p_vectorsurvtrapdataid varchar, + p_vectorsurvtraplocationid varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_lure varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.trapdata lv + WHERE lv.objectid = p_objectid + + AND lv.traptype IS NOT DISTINCT FROM p_traptype + AND lv.trapactivitytype IS NOT DISTINCT FROM p_trapactivitytype + AND lv.startdatetime IS NOT DISTINCT FROM p_startdatetime + AND lv.enddatetime IS NOT DISTINCT FROM p_enddatetime + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.idbytech IS NOT DISTINCT FROM p_idbytech + AND lv.sortbytech IS NOT DISTINCT FROM p_sortbytech + AND lv.processed IS NOT DISTINCT FROM p_processed + AND lv.sitecond IS NOT DISTINCT FROM p_sitecond + AND lv.locationname IS NOT DISTINCT FROM p_locationname + AND lv.recordstatus IS NOT DISTINCT FROM p_recordstatus + AND lv.reviewed IS NOT DISTINCT FROM p_reviewed + AND lv.reviewedby IS NOT DISTINCT FROM p_reviewedby + AND lv.revieweddate IS NOT DISTINCT FROM p_revieweddate + AND lv.trapcondition IS NOT DISTINCT FROM p_trapcondition + AND lv.trapnights IS NOT DISTINCT FROM p_trapnights + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.srid IS NOT DISTINCT FROM p_srid + AND lv.fieldtech IS NOT DISTINCT FROM p_fieldtech + AND lv.gatewaysync IS NOT DISTINCT FROM p_gatewaysync + AND lv.loc_id IS NOT DISTINCT FROM p_loc_id + AND lv.voltage IS NOT DISTINCT FROM p_voltage + AND lv.winddir IS NOT DISTINCT FROM p_winddir + AND lv.windspeed IS NOT DISTINCT FROM p_windspeed + AND lv.avetemp IS NOT DISTINCT FROM p_avetemp + AND lv.raingauge IS NOT DISTINCT FROM p_raingauge + AND lv.lr IS NOT DISTINCT FROM p_lr + AND lv.field IS NOT DISTINCT FROM p_field + AND lv.vectorsurvtrapdataid IS NOT DISTINCT FROM p_vectorsurvtrapdataid + AND lv.vectorsurvtraplocationid IS NOT DISTINCT FROM p_vectorsurvtraplocationid + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.lure IS NOT DISTINCT FROM p_lure + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.trapdata + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.trapdata + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.trapdata ( + objectid, + + traptype, + trapactivitytype, + startdatetime, + enddatetime, + comments, + idbytech, + sortbytech, + processed, + sitecond, + locationname, + recordstatus, + reviewed, + reviewedby, + revieweddate, + trapcondition, + trapnights, + zone, + zone2, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + srid, + fieldtech, + gatewaysync, + loc_id, + voltage, + winddir, + windspeed, + avetemp, + raingauge, + lr, + field, + vectorsurvtrapdataid, + vectorsurvtraplocationid, + creationdate, + creator, + editdate, + editor, + lure, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_traptype, + p_trapactivitytype, + p_startdatetime, + p_enddatetime, + p_comments, + p_idbytech, + p_sortbytech, + p_processed, + p_sitecond, + p_locationname, + p_recordstatus, + p_reviewed, + p_reviewedby, + p_revieweddate, + p_trapcondition, + p_trapnights, + p_zone, + p_zone2, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_srid, + p_fieldtech, + p_gatewaysync, + p_loc_id, + p_voltage, + p_winddir, + p_windspeed, + p_avetemp, + p_raingauge, + p_lr, + p_field, + p_vectorsurvtrapdataid, + p_vectorsurvtraplocationid, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_lure, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_traplocation( + p_objectid bigint, + + p_name varchar, + p_zone varchar, + p_habitat varchar, + p_priority varchar, + p_usetype varchar, + p_active smallint, + p_description varchar, + p_accessdesc varchar, + p_comments varchar, + p_externalid varchar, + p_nextactiondatescheduled timestamp, + p_zone2 varchar, + p_locationnumber integer, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_gatewaysync smallint, + p_route integer, + p_set_dow integer, + p_route_order integer, + p_vectorsurvsiteid varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_h3r7 varchar, + p_h3r8 varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.traplocation lv + WHERE lv.objectid = p_objectid + + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.habitat IS NOT DISTINCT FROM p_habitat + AND lv.priority IS NOT DISTINCT FROM p_priority + AND lv.usetype IS NOT DISTINCT FROM p_usetype + AND lv.active IS NOT DISTINCT FROM p_active + AND lv.description IS NOT DISTINCT FROM p_description + AND lv.accessdesc IS NOT DISTINCT FROM p_accessdesc + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.externalid IS NOT DISTINCT FROM p_externalid + AND lv.nextactiondatescheduled IS NOT DISTINCT FROM p_nextactiondatescheduled + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.locationnumber IS NOT DISTINCT FROM p_locationnumber + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.gatewaysync IS NOT DISTINCT FROM p_gatewaysync + AND lv.route IS NOT DISTINCT FROM p_route + AND lv.set_dow IS NOT DISTINCT FROM p_set_dow + AND lv.route_order IS NOT DISTINCT FROM p_route_order + AND lv.vectorsurvsiteid IS NOT DISTINCT FROM p_vectorsurvsiteid + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.h3r7 IS NOT DISTINCT FROM p_h3r7 + AND lv.h3r8 IS NOT DISTINCT FROM p_h3r8 + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.traplocation + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.traplocation + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.traplocation ( + objectid, + + name, + zone, + habitat, + priority, + usetype, + active, + description, + accessdesc, + comments, + externalid, + nextactiondatescheduled, + zone2, + locationnumber, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + gatewaysync, + route, + set_dow, + route_order, + vectorsurvsiteid, + creationdate, + creator, + editdate, + editor, + h3r7, + h3r8, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_name, + p_zone, + p_habitat, + p_priority, + p_usetype, + p_active, + p_description, + p_accessdesc, + p_comments, + p_externalid, + p_nextactiondatescheduled, + p_zone2, + p_locationnumber, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_gatewaysync, + p_route, + p_set_dow, + p_route_order, + p_vectorsurvsiteid, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_h3r7, + p_h3r8, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_treatmentarea( + p_objectid bigint, + + p_treat_id uuid, + p_session_id uuid, + p_treatdate timestamp, + p_comments varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_notified smallint, + p_type varchar, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_shape__area double precision, + p_shape__length double precision, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.treatmentarea lv + WHERE lv.objectid = p_objectid + + AND lv.treat_id IS NOT DISTINCT FROM p_treat_id + AND lv.session_id IS NOT DISTINCT FROM p_session_id + AND lv.treatdate IS NOT DISTINCT FROM p_treatdate + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.notified IS NOT DISTINCT FROM p_notified + AND lv.type IS NOT DISTINCT FROM p_type + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.shape__area IS NOT DISTINCT FROM p_shape__area + AND lv.shape__length IS NOT DISTINCT FROM p_shape__length + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.treatmentarea + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.treatmentarea + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.treatmentarea ( + objectid, + + treat_id, + session_id, + treatdate, + comments, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + notified, + type, + creationdate, + creator, + editdate, + editor, + shape__area, + shape__length, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_treat_id, + p_session_id, + p_treatdate, + p_comments, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_notified, + p_type, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_shape__area, + p_shape__length, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_treatment( + p_objectid bigint, + + p_activity varchar, + p_treatarea double precision, + p_areaunit varchar, + p_product varchar, + p_qty double precision, + p_qtyunit varchar, + p_method varchar, + p_equiptype varchar, + p_comments varchar, + p_avetemp double precision, + p_windspeed double precision, + p_winddir varchar, + p_raingauge double precision, + p_startdatetime timestamp, + p_enddatetime timestamp, + p_insp_id uuid, + p_reviewed smallint, + p_reviewedby varchar, + p_revieweddate timestamp, + p_locationname varchar, + p_zone varchar, + p_warningoverride smallint, + p_recordstatus smallint, + p_zone2 varchar, + p_treatacres double precision, + p_tirecount smallint, + p_cbcount smallint, + p_containercount smallint, + p_globalid uuid, + p_treatmentlength double precision, + p_treatmenthours double precision, + p_treatmentlengthunits varchar, + p_linelocid uuid, + p_pointlocid uuid, + p_polygonlocid uuid, + p_srid uuid, + p_sdid uuid, + p_barrierrouteid uuid, + p_ulvrouteid uuid, + p_fieldtech varchar, + p_ptaid uuid, + p_flowrate double precision, + p_habitat varchar, + p_treathectares double precision, + p_invloc varchar, + p_temp_sitecond varchar, + p_sitecond varchar, + p_totalcostprodcut double precision, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_targetspecies varchar, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.treatment lv + WHERE lv.objectid = p_objectid + + AND lv.activity IS NOT DISTINCT FROM p_activity + AND lv.treatarea IS NOT DISTINCT FROM p_treatarea + AND lv.areaunit IS NOT DISTINCT FROM p_areaunit + AND lv.product IS NOT DISTINCT FROM p_product + AND lv.qty IS NOT DISTINCT FROM p_qty + AND lv.qtyunit IS NOT DISTINCT FROM p_qtyunit + AND lv.method IS NOT DISTINCT FROM p_method + AND lv.equiptype IS NOT DISTINCT FROM p_equiptype + AND lv.comments IS NOT DISTINCT FROM p_comments + AND lv.avetemp IS NOT DISTINCT FROM p_avetemp + AND lv.windspeed IS NOT DISTINCT FROM p_windspeed + AND lv.winddir IS NOT DISTINCT FROM p_winddir + AND lv.raingauge IS NOT DISTINCT FROM p_raingauge + AND lv.startdatetime IS NOT DISTINCT FROM p_startdatetime + AND lv.enddatetime IS NOT DISTINCT FROM p_enddatetime + AND lv.insp_id IS NOT DISTINCT FROM p_insp_id + AND lv.reviewed IS NOT DISTINCT FROM p_reviewed + AND lv.reviewedby IS NOT DISTINCT FROM p_reviewedby + AND lv.revieweddate IS NOT DISTINCT FROM p_revieweddate + AND lv.locationname IS NOT DISTINCT FROM p_locationname + AND lv.zone IS NOT DISTINCT FROM p_zone + AND lv.warningoverride IS NOT DISTINCT FROM p_warningoverride + AND lv.recordstatus IS NOT DISTINCT FROM p_recordstatus + AND lv.zone2 IS NOT DISTINCT FROM p_zone2 + AND lv.treatacres IS NOT DISTINCT FROM p_treatacres + AND lv.tirecount IS NOT DISTINCT FROM p_tirecount + AND lv.cbcount IS NOT DISTINCT FROM p_cbcount + AND lv.containercount IS NOT DISTINCT FROM p_containercount + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.treatmentlength IS NOT DISTINCT FROM p_treatmentlength + AND lv.treatmenthours IS NOT DISTINCT FROM p_treatmenthours + AND lv.treatmentlengthunits IS NOT DISTINCT FROM p_treatmentlengthunits + AND lv.linelocid IS NOT DISTINCT FROM p_linelocid + AND lv.pointlocid IS NOT DISTINCT FROM p_pointlocid + AND lv.polygonlocid IS NOT DISTINCT FROM p_polygonlocid + AND lv.srid IS NOT DISTINCT FROM p_srid + AND lv.sdid IS NOT DISTINCT FROM p_sdid + AND lv.barrierrouteid IS NOT DISTINCT FROM p_barrierrouteid + AND lv.ulvrouteid IS NOT DISTINCT FROM p_ulvrouteid + AND lv.fieldtech IS NOT DISTINCT FROM p_fieldtech + AND lv.ptaid IS NOT DISTINCT FROM p_ptaid + AND lv.flowrate IS NOT DISTINCT FROM p_flowrate + AND lv.habitat IS NOT DISTINCT FROM p_habitat + AND lv.treathectares IS NOT DISTINCT FROM p_treathectares + AND lv.invloc IS NOT DISTINCT FROM p_invloc + AND lv.temp_sitecond IS NOT DISTINCT FROM p_temp_sitecond + AND lv.sitecond IS NOT DISTINCT FROM p_sitecond + AND lv.totalcostprodcut IS NOT DISTINCT FROM p_totalcostprodcut + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.targetspecies IS NOT DISTINCT FROM p_targetspecies + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.treatment + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.treatment + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.treatment ( + objectid, + + activity, + treatarea, + areaunit, + product, + qty, + qtyunit, + method, + equiptype, + comments, + avetemp, + windspeed, + winddir, + raingauge, + startdatetime, + enddatetime, + insp_id, + reviewed, + reviewedby, + revieweddate, + locationname, + zone, + warningoverride, + recordstatus, + zone2, + treatacres, + tirecount, + cbcount, + containercount, + globalid, + treatmentlength, + treatmenthours, + treatmentlengthunits, + linelocid, + pointlocid, + polygonlocid, + srid, + sdid, + barrierrouteid, + ulvrouteid, + fieldtech, + ptaid, + flowrate, + habitat, + treathectares, + invloc, + temp_sitecond, + sitecond, + totalcostprodcut, + creationdate, + creator, + editdate, + editor, + targetspecies, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_activity, + p_treatarea, + p_areaunit, + p_product, + p_qty, + p_qtyunit, + p_method, + p_equiptype, + p_comments, + p_avetemp, + p_windspeed, + p_winddir, + p_raingauge, + p_startdatetime, + p_enddatetime, + p_insp_id, + p_reviewed, + p_reviewedby, + p_revieweddate, + p_locationname, + p_zone, + p_warningoverride, + p_recordstatus, + p_zone2, + p_treatacres, + p_tirecount, + p_cbcount, + p_containercount, + p_globalid, + p_treatmentlength, + p_treatmenthours, + p_treatmentlengthunits, + p_linelocid, + p_pointlocid, + p_polygonlocid, + p_srid, + p_sdid, + p_barrierrouteid, + p_ulvrouteid, + p_fieldtech, + p_ptaid, + p_flowrate, + p_habitat, + p_treathectares, + p_invloc, + p_temp_sitecond, + p_sitecond, + p_totalcostprodcut, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_targetspecies, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_zones2( + p_objectid bigint, + + p_name varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_shape__area double precision, + p_shape__length double precision, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.zones2 lv + WHERE lv.objectid = p_objectid + + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.shape__area IS NOT DISTINCT FROM p_shape__area + AND lv.shape__length IS NOT DISTINCT FROM p_shape__length + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.zones2 + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.zones2 + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.zones2 ( + objectid, + + name, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + creationdate, + creator, + editdate, + editor, + shape__area, + shape__length, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_name, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_shape__area, + p_shape__length, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd + +-- +goose StatementBegin +CREATE OR REPLACE FUNCTION fieldseeker.insert_zones( + p_objectid bigint, + + p_name varchar, + p_globalid uuid, + p_created_user varchar, + p_created_date timestamp, + p_last_edited_user varchar, + p_last_edited_date timestamp, + p_active integer, + p_creationdate timestamp, + p_creator varchar, + p_editdate timestamp, + p_editor varchar, + p_shape__area double precision, + p_shape__length double precision, + p_geometry jsonb, + p_geospatial geometry +) RETURNS TABLE(row_inserted boolean, version_num integer) AS $$ +DECLARE + v_next_version integer; + v_changes_exist boolean; +BEGIN + -- Check if changes exist + SELECT NOT EXISTS ( + SELECT 1 FROM fieldseeker.zones lv + WHERE lv.objectid = p_objectid + + AND lv.name IS NOT DISTINCT FROM p_name + AND lv.globalid IS NOT DISTINCT FROM p_globalid + AND lv.created_user IS NOT DISTINCT FROM p_created_user + AND lv.created_date IS NOT DISTINCT FROM p_created_date + AND lv.last_edited_user IS NOT DISTINCT FROM p_last_edited_user + AND lv.last_edited_date IS NOT DISTINCT FROM p_last_edited_date + AND lv.active IS NOT DISTINCT FROM p_active + AND lv.creationdate IS NOT DISTINCT FROM p_creationdate + AND lv.creator IS NOT DISTINCT FROM p_creator + AND lv.editdate IS NOT DISTINCT FROM p_editdate + AND lv.editor IS NOT DISTINCT FROM p_editor + AND lv.shape__area IS NOT DISTINCT FROM p_shape__area + AND lv.shape__length IS NOT DISTINCT FROM p_shape__length + AND lv.geometry IS NOT DISTINCT FROM p_geometry + AND lv.geospatial IS NOT DISTINCT FROM p_geospatial + ORDER BY VERSION DESC LIMIT 1 + ) INTO v_changes_exist; + + -- If no changes, return false with current version + IF NOT v_changes_exist THEN + RETURN QUERY + SELECT + FALSE AS row_inserted, + (SELECT VERSION FROM fieldseeker.zones + WHERE objectid = p_objectid ORDER BY VERSION DESC LIMIT 1) AS version_num; + RETURN; + END IF; + + -- Calculate next version + SELECT COALESCE(MAX(VERSION) + 1, 1) INTO v_next_version + FROM fieldseeker.zones + WHERE objectid = p_objectid; + + -- Insert new version + INSERT INTO fieldseeker.zones ( + objectid, + + name, + globalid, + created_user, + created_date, + last_edited_user, + last_edited_date, + active, + creationdate, + creator, + editdate, + editor, + shape__area, + shape__length, + geometry, + geospatial, + VERSION + ) VALUES ( + p_objectid, + + p_name, + p_globalid, + p_created_user, + p_created_date, + p_last_edited_user, + p_last_edited_date, + p_active, + p_creationdate, + p_creator, + p_editdate, + p_editor, + p_shape__area, + p_shape__length, + p_geometry, + p_geospatial, + v_next_version + ); + + -- Return success with new version + RETURN QUERY SELECT TRUE AS row_inserted, v_next_version AS version_num; +END; +$$ LANGUAGE plpgsql; +-- +goose StatementEnd +ALTER TABLE fieldseeker.containerrelate DROP COLUMN organization_id; +ALTER TABLE fieldseeker.fieldscoutinglog DROP COLUMN organization_id; +ALTER TABLE fieldseeker.habitatrelate DROP COLUMN organization_id; +ALTER TABLE fieldseeker.inspectionsample DROP COLUMN organization_id; +ALTER TABLE fieldseeker.inspectionsampledetail DROP COLUMN organization_id; +ALTER TABLE fieldseeker.linelocation DROP COLUMN organization_id; +ALTER TABLE fieldseeker.locationtracking DROP COLUMN organization_id; +ALTER TABLE fieldseeker.mosquitoinspection DROP COLUMN organization_id; +ALTER TABLE fieldseeker.pointlocation DROP COLUMN organization_id; +ALTER TABLE fieldseeker.polygonlocation DROP COLUMN organization_id; +ALTER TABLE fieldseeker.pool DROP COLUMN organization_id; +ALTER TABLE fieldseeker.pooldetail DROP COLUMN organization_id; +ALTER TABLE fieldseeker.proposedtreatmentarea DROP COLUMN organization_id; +ALTER TABLE fieldseeker.qamosquitoinspection DROP COLUMN organization_id; +ALTER TABLE fieldseeker.rodentlocation DROP COLUMN organization_id; +ALTER TABLE fieldseeker.samplecollection DROP COLUMN organization_id; +ALTER TABLE fieldseeker.samplelocation DROP COLUMN organization_id; +ALTER TABLE fieldseeker.servicerequest DROP COLUMN organization_id; +ALTER TABLE fieldseeker.speciesabundance DROP COLUMN organization_id; +ALTER TABLE fieldseeker.stormdrain DROP COLUMN organization_id; +ALTER TABLE fieldseeker.timecard DROP COLUMN organization_id; +ALTER TABLE fieldseeker.trapdata DROP COLUMN organization_id; +ALTER TABLE fieldseeker.traplocation DROP COLUMN organization_id; +ALTER TABLE fieldseeker.treatment DROP COLUMN organization_id; +ALTER TABLE fieldseeker.treatmentarea DROP COLUMN organization_id; +ALTER TABLE fieldseeker.zones DROP COLUMN organization_id; +ALTER TABLE fieldseeker.zones2 DROP COLUMN organization_id; diff --git a/db/models/bob_joins.bob.go b/db/models/bob_joins.bob.go index d6a5fdd0..9eef4569 100644 --- a/db/models/bob_joins.bob.go +++ b/db/models/bob_joins.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models @@ -32,66 +32,45 @@ func (j joinSet[Q]) AliasedAs(alias string) joinSet[Q] { } type joins[Q dialect.Joinable] struct { - FieldseekerSyncs joinSet[fieldseekerSyncJoins[Q]] - FSContainerrelates joinSet[fsContainerrelateJoins[Q]] - FSFieldscoutinglogs joinSet[fsFieldscoutinglogJoins[Q]] - FSHabitatrelates joinSet[fsHabitatrelateJoins[Q]] - FSInspectionsamples joinSet[fsInspectionsampleJoins[Q]] - FSInspectionsampledetails joinSet[fsInspectionsampledetailJoins[Q]] - FSLinelocations joinSet[fsLinelocationJoins[Q]] - FSLocationtrackings joinSet[fsLocationtrackingJoins[Q]] - FSMosquitoinspections joinSet[fsMosquitoinspectionJoins[Q]] - FSPointlocations joinSet[fsPointlocationJoins[Q]] - FSPolygonlocations joinSet[fsPolygonlocationJoins[Q]] - FSPools joinSet[fsPoolJoins[Q]] - FSPooldetails joinSet[fsPooldetailJoins[Q]] - FSProposedtreatmentareas joinSet[fsProposedtreatmentareaJoins[Q]] - FSQamosquitoinspections joinSet[fsQamosquitoinspectionJoins[Q]] - FSRodentlocations joinSet[fsRodentlocationJoins[Q]] - FSSamplecollections joinSet[fsSamplecollectionJoins[Q]] - FSSamplelocations joinSet[fsSamplelocationJoins[Q]] - FSServicerequests joinSet[fsServicerequestJoins[Q]] - FSSpeciesabundances joinSet[fsSpeciesabundanceJoins[Q]] - FSStormdrains joinSet[fsStormdrainJoins[Q]] - FSTimecards joinSet[fsTimecardJoins[Q]] - FSTrapdata joinSet[fsTrapdatumJoins[Q]] - FSTraplocations joinSet[fsTraplocationJoins[Q]] - FSTreatments joinSet[fsTreatmentJoins[Q]] - 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]] - HistoryInspectionsamples joinSet[historyInspectionsampleJoins[Q]] - HistoryInspectionsampledetails joinSet[historyInspectionsampledetailJoins[Q]] - HistoryLinelocations joinSet[historyLinelocationJoins[Q]] - HistoryLocationtrackings joinSet[historyLocationtrackingJoins[Q]] - HistoryMosquitoinspections joinSet[historyMosquitoinspectionJoins[Q]] - HistoryPointlocations joinSet[historyPointlocationJoins[Q]] - HistoryPolygonlocations joinSet[historyPolygonlocationJoins[Q]] - HistoryPools joinSet[historyPoolJoins[Q]] - HistoryPooldetails joinSet[historyPooldetailJoins[Q]] - HistoryProposedtreatmentareas joinSet[historyProposedtreatmentareaJoins[Q]] - HistoryQamosquitoinspections joinSet[historyQamosquitoinspectionJoins[Q]] - HistoryRodentlocations joinSet[historyRodentlocationJoins[Q]] - HistorySamplecollections joinSet[historySamplecollectionJoins[Q]] - HistorySamplelocations joinSet[historySamplelocationJoins[Q]] - HistoryServicerequests joinSet[historyServicerequestJoins[Q]] - HistorySpeciesabundances joinSet[historySpeciesabundanceJoins[Q]] - HistoryStormdrains joinSet[historyStormdrainJoins[Q]] - HistoryTimecards joinSet[historyTimecardJoins[Q]] - HistoryTrapdata joinSet[historyTrapdatumJoins[Q]] - HistoryTraplocations joinSet[historyTraplocationJoins[Q]] - HistoryTreatments joinSet[historyTreatmentJoins[Q]] - HistoryTreatmentareas joinSet[historyTreatmentareaJoins[Q]] - HistoryZones joinSet[historyZoneJoins[Q]] - HistoryZones2s joinSet[historyZones2Joins[Q]] - Notifications joinSet[notificationJoins[Q]] - OauthTokens joinSet[oauthTokenJoins[Q]] - Organizations joinSet[organizationJoins[Q]] - Users joinSet[userJoins[Q]] + FieldseekerContainerrelates joinSet[fieldseekerContainerrelateJoins[Q]] + FieldseekerFieldscoutinglogs joinSet[fieldseekerFieldscoutinglogJoins[Q]] + FieldseekerHabitatrelates joinSet[fieldseekerHabitatrelateJoins[Q]] + FieldseekerInspectionsamples joinSet[fieldseekerInspectionsampleJoins[Q]] + FieldseekerInspectionsampledetails joinSet[fieldseekerInspectionsampledetailJoins[Q]] + FieldseekerLinelocations joinSet[fieldseekerLinelocationJoins[Q]] + FieldseekerLocationtrackings joinSet[fieldseekerLocationtrackingJoins[Q]] + FieldseekerMosquitoinspections joinSet[fieldseekerMosquitoinspectionJoins[Q]] + FieldseekerPointlocations joinSet[fieldseekerPointlocationJoins[Q]] + FieldseekerPolygonlocations joinSet[fieldseekerPolygonlocationJoins[Q]] + FieldseekerPools joinSet[fieldseekerPoolJoins[Q]] + FieldseekerPooldetails joinSet[fieldseekerPooldetailJoins[Q]] + FieldseekerProposedtreatmentareas joinSet[fieldseekerProposedtreatmentareaJoins[Q]] + FieldseekerQamosquitoinspections joinSet[fieldseekerQamosquitoinspectionJoins[Q]] + FieldseekerRodentlocations joinSet[fieldseekerRodentlocationJoins[Q]] + FieldseekerSamplecollections joinSet[fieldseekerSamplecollectionJoins[Q]] + FieldseekerSamplelocations joinSet[fieldseekerSamplelocationJoins[Q]] + FieldseekerServicerequests joinSet[fieldseekerServicerequestJoins[Q]] + FieldseekerSpeciesabundances joinSet[fieldseekerSpeciesabundanceJoins[Q]] + FieldseekerStormdrains joinSet[fieldseekerStormdrainJoins[Q]] + FieldseekerTimecards joinSet[fieldseekerTimecardJoins[Q]] + FieldseekerTrapdata joinSet[fieldseekerTrapdatumJoins[Q]] + FieldseekerTraplocations joinSet[fieldseekerTraplocationJoins[Q]] + FieldseekerTreatments joinSet[fieldseekerTreatmentJoins[Q]] + FieldseekerTreatmentareas joinSet[fieldseekerTreatmentareaJoins[Q]] + FieldseekerZones joinSet[fieldseekerZoneJoins[Q]] + FieldseekerZones2s joinSet[fieldseekerZones2Joins[Q]] + FieldseekerSyncs joinSet[fieldseekerSyncJoins[Q]] + H3Aggregations joinSet[h3AggregationJoins[Q]] + NoteAudios joinSet[noteAudioJoins[Q]] + NoteAudioBreadcrumbs joinSet[noteAudioBreadcrumbJoins[Q]] + NoteAudioData joinSet[noteAudioDatumJoins[Q]] + NoteImages joinSet[noteImageJoins[Q]] + NoteImageBreadcrumbs joinSet[noteImageBreadcrumbJoins[Q]] + NoteImageData joinSet[noteImageDatumJoins[Q]] + Notifications joinSet[notificationJoins[Q]] + OauthTokens joinSet[oauthTokenJoins[Q]] + Organizations joinSet[organizationJoins[Q]] + Users joinSet[userJoins[Q]] } func buildJoinSet[Q interface{ aliasedAs(string) Q }, C any, F func(C, string) Q](c C, f F) joinSet[Q] { @@ -104,66 +83,45 @@ func buildJoinSet[Q interface{ aliasedAs(string) Q }, C any, F func(C, string) Q func getJoins[Q dialect.Joinable]() joins[Q] { return joins[Q]{ - FieldseekerSyncs: buildJoinSet[fieldseekerSyncJoins[Q]](FieldseekerSyncs.Columns, buildFieldseekerSyncJoins), - FSContainerrelates: buildJoinSet[fsContainerrelateJoins[Q]](FSContainerrelates.Columns, buildFSContainerrelateJoins), - FSFieldscoutinglogs: buildJoinSet[fsFieldscoutinglogJoins[Q]](FSFieldscoutinglogs.Columns, buildFSFieldscoutinglogJoins), - FSHabitatrelates: buildJoinSet[fsHabitatrelateJoins[Q]](FSHabitatrelates.Columns, buildFSHabitatrelateJoins), - FSInspectionsamples: buildJoinSet[fsInspectionsampleJoins[Q]](FSInspectionsamples.Columns, buildFSInspectionsampleJoins), - FSInspectionsampledetails: buildJoinSet[fsInspectionsampledetailJoins[Q]](FSInspectionsampledetails.Columns, buildFSInspectionsampledetailJoins), - FSLinelocations: buildJoinSet[fsLinelocationJoins[Q]](FSLinelocations.Columns, buildFSLinelocationJoins), - FSLocationtrackings: buildJoinSet[fsLocationtrackingJoins[Q]](FSLocationtrackings.Columns, buildFSLocationtrackingJoins), - FSMosquitoinspections: buildJoinSet[fsMosquitoinspectionJoins[Q]](FSMosquitoinspections.Columns, buildFSMosquitoinspectionJoins), - FSPointlocations: buildJoinSet[fsPointlocationJoins[Q]](FSPointlocations.Columns, buildFSPointlocationJoins), - FSPolygonlocations: buildJoinSet[fsPolygonlocationJoins[Q]](FSPolygonlocations.Columns, buildFSPolygonlocationJoins), - FSPools: buildJoinSet[fsPoolJoins[Q]](FSPools.Columns, buildFSPoolJoins), - FSPooldetails: buildJoinSet[fsPooldetailJoins[Q]](FSPooldetails.Columns, buildFSPooldetailJoins), - FSProposedtreatmentareas: buildJoinSet[fsProposedtreatmentareaJoins[Q]](FSProposedtreatmentareas.Columns, buildFSProposedtreatmentareaJoins), - FSQamosquitoinspections: buildJoinSet[fsQamosquitoinspectionJoins[Q]](FSQamosquitoinspections.Columns, buildFSQamosquitoinspectionJoins), - FSRodentlocations: buildJoinSet[fsRodentlocationJoins[Q]](FSRodentlocations.Columns, buildFSRodentlocationJoins), - FSSamplecollections: buildJoinSet[fsSamplecollectionJoins[Q]](FSSamplecollections.Columns, buildFSSamplecollectionJoins), - FSSamplelocations: buildJoinSet[fsSamplelocationJoins[Q]](FSSamplelocations.Columns, buildFSSamplelocationJoins), - FSServicerequests: buildJoinSet[fsServicerequestJoins[Q]](FSServicerequests.Columns, buildFSServicerequestJoins), - FSSpeciesabundances: buildJoinSet[fsSpeciesabundanceJoins[Q]](FSSpeciesabundances.Columns, buildFSSpeciesabundanceJoins), - FSStormdrains: buildJoinSet[fsStormdrainJoins[Q]](FSStormdrains.Columns, buildFSStormdrainJoins), - FSTimecards: buildJoinSet[fsTimecardJoins[Q]](FSTimecards.Columns, buildFSTimecardJoins), - FSTrapdata: buildJoinSet[fsTrapdatumJoins[Q]](FSTrapdata.Columns, buildFSTrapdatumJoins), - FSTraplocations: buildJoinSet[fsTraplocationJoins[Q]](FSTraplocations.Columns, buildFSTraplocationJoins), - FSTreatments: buildJoinSet[fsTreatmentJoins[Q]](FSTreatments.Columns, buildFSTreatmentJoins), - 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), - HistoryInspectionsamples: buildJoinSet[historyInspectionsampleJoins[Q]](HistoryInspectionsamples.Columns, buildHistoryInspectionsampleJoins), - HistoryInspectionsampledetails: buildJoinSet[historyInspectionsampledetailJoins[Q]](HistoryInspectionsampledetails.Columns, buildHistoryInspectionsampledetailJoins), - HistoryLinelocations: buildJoinSet[historyLinelocationJoins[Q]](HistoryLinelocations.Columns, buildHistoryLinelocationJoins), - HistoryLocationtrackings: buildJoinSet[historyLocationtrackingJoins[Q]](HistoryLocationtrackings.Columns, buildHistoryLocationtrackingJoins), - HistoryMosquitoinspections: buildJoinSet[historyMosquitoinspectionJoins[Q]](HistoryMosquitoinspections.Columns, buildHistoryMosquitoinspectionJoins), - HistoryPointlocations: buildJoinSet[historyPointlocationJoins[Q]](HistoryPointlocations.Columns, buildHistoryPointlocationJoins), - HistoryPolygonlocations: buildJoinSet[historyPolygonlocationJoins[Q]](HistoryPolygonlocations.Columns, buildHistoryPolygonlocationJoins), - HistoryPools: buildJoinSet[historyPoolJoins[Q]](HistoryPools.Columns, buildHistoryPoolJoins), - HistoryPooldetails: buildJoinSet[historyPooldetailJoins[Q]](HistoryPooldetails.Columns, buildHistoryPooldetailJoins), - HistoryProposedtreatmentareas: buildJoinSet[historyProposedtreatmentareaJoins[Q]](HistoryProposedtreatmentareas.Columns, buildHistoryProposedtreatmentareaJoins), - HistoryQamosquitoinspections: buildJoinSet[historyQamosquitoinspectionJoins[Q]](HistoryQamosquitoinspections.Columns, buildHistoryQamosquitoinspectionJoins), - HistoryRodentlocations: buildJoinSet[historyRodentlocationJoins[Q]](HistoryRodentlocations.Columns, buildHistoryRodentlocationJoins), - HistorySamplecollections: buildJoinSet[historySamplecollectionJoins[Q]](HistorySamplecollections.Columns, buildHistorySamplecollectionJoins), - HistorySamplelocations: buildJoinSet[historySamplelocationJoins[Q]](HistorySamplelocations.Columns, buildHistorySamplelocationJoins), - HistoryServicerequests: buildJoinSet[historyServicerequestJoins[Q]](HistoryServicerequests.Columns, buildHistoryServicerequestJoins), - HistorySpeciesabundances: buildJoinSet[historySpeciesabundanceJoins[Q]](HistorySpeciesabundances.Columns, buildHistorySpeciesabundanceJoins), - HistoryStormdrains: buildJoinSet[historyStormdrainJoins[Q]](HistoryStormdrains.Columns, buildHistoryStormdrainJoins), - HistoryTimecards: buildJoinSet[historyTimecardJoins[Q]](HistoryTimecards.Columns, buildHistoryTimecardJoins), - HistoryTrapdata: buildJoinSet[historyTrapdatumJoins[Q]](HistoryTrapdata.Columns, buildHistoryTrapdatumJoins), - HistoryTraplocations: buildJoinSet[historyTraplocationJoins[Q]](HistoryTraplocations.Columns, buildHistoryTraplocationJoins), - HistoryTreatments: buildJoinSet[historyTreatmentJoins[Q]](HistoryTreatments.Columns, buildHistoryTreatmentJoins), - HistoryTreatmentareas: buildJoinSet[historyTreatmentareaJoins[Q]](HistoryTreatmentareas.Columns, buildHistoryTreatmentareaJoins), - HistoryZones: buildJoinSet[historyZoneJoins[Q]](HistoryZones.Columns, buildHistoryZoneJoins), - HistoryZones2s: buildJoinSet[historyZones2Joins[Q]](HistoryZones2s.Columns, buildHistoryZones2Joins), - Notifications: buildJoinSet[notificationJoins[Q]](Notifications.Columns, buildNotificationJoins), - OauthTokens: buildJoinSet[oauthTokenJoins[Q]](OauthTokens.Columns, buildOauthTokenJoins), - Organizations: buildJoinSet[organizationJoins[Q]](Organizations.Columns, buildOrganizationJoins), - Users: buildJoinSet[userJoins[Q]](Users.Columns, buildUserJoins), + FieldseekerContainerrelates: buildJoinSet[fieldseekerContainerrelateJoins[Q]](FieldseekerContainerrelates.Columns, buildFieldseekerContainerrelateJoins), + FieldseekerFieldscoutinglogs: buildJoinSet[fieldseekerFieldscoutinglogJoins[Q]](FieldseekerFieldscoutinglogs.Columns, buildFieldseekerFieldscoutinglogJoins), + FieldseekerHabitatrelates: buildJoinSet[fieldseekerHabitatrelateJoins[Q]](FieldseekerHabitatrelates.Columns, buildFieldseekerHabitatrelateJoins), + FieldseekerInspectionsamples: buildJoinSet[fieldseekerInspectionsampleJoins[Q]](FieldseekerInspectionsamples.Columns, buildFieldseekerInspectionsampleJoins), + FieldseekerInspectionsampledetails: buildJoinSet[fieldseekerInspectionsampledetailJoins[Q]](FieldseekerInspectionsampledetails.Columns, buildFieldseekerInspectionsampledetailJoins), + FieldseekerLinelocations: buildJoinSet[fieldseekerLinelocationJoins[Q]](FieldseekerLinelocations.Columns, buildFieldseekerLinelocationJoins), + FieldseekerLocationtrackings: buildJoinSet[fieldseekerLocationtrackingJoins[Q]](FieldseekerLocationtrackings.Columns, buildFieldseekerLocationtrackingJoins), + FieldseekerMosquitoinspections: buildJoinSet[fieldseekerMosquitoinspectionJoins[Q]](FieldseekerMosquitoinspections.Columns, buildFieldseekerMosquitoinspectionJoins), + FieldseekerPointlocations: buildJoinSet[fieldseekerPointlocationJoins[Q]](FieldseekerPointlocations.Columns, buildFieldseekerPointlocationJoins), + FieldseekerPolygonlocations: buildJoinSet[fieldseekerPolygonlocationJoins[Q]](FieldseekerPolygonlocations.Columns, buildFieldseekerPolygonlocationJoins), + FieldseekerPools: buildJoinSet[fieldseekerPoolJoins[Q]](FieldseekerPools.Columns, buildFieldseekerPoolJoins), + FieldseekerPooldetails: buildJoinSet[fieldseekerPooldetailJoins[Q]](FieldseekerPooldetails.Columns, buildFieldseekerPooldetailJoins), + FieldseekerProposedtreatmentareas: buildJoinSet[fieldseekerProposedtreatmentareaJoins[Q]](FieldseekerProposedtreatmentareas.Columns, buildFieldseekerProposedtreatmentareaJoins), + FieldseekerQamosquitoinspections: buildJoinSet[fieldseekerQamosquitoinspectionJoins[Q]](FieldseekerQamosquitoinspections.Columns, buildFieldseekerQamosquitoinspectionJoins), + FieldseekerRodentlocations: buildJoinSet[fieldseekerRodentlocationJoins[Q]](FieldseekerRodentlocations.Columns, buildFieldseekerRodentlocationJoins), + FieldseekerSamplecollections: buildJoinSet[fieldseekerSamplecollectionJoins[Q]](FieldseekerSamplecollections.Columns, buildFieldseekerSamplecollectionJoins), + FieldseekerSamplelocations: buildJoinSet[fieldseekerSamplelocationJoins[Q]](FieldseekerSamplelocations.Columns, buildFieldseekerSamplelocationJoins), + FieldseekerServicerequests: buildJoinSet[fieldseekerServicerequestJoins[Q]](FieldseekerServicerequests.Columns, buildFieldseekerServicerequestJoins), + FieldseekerSpeciesabundances: buildJoinSet[fieldseekerSpeciesabundanceJoins[Q]](FieldseekerSpeciesabundances.Columns, buildFieldseekerSpeciesabundanceJoins), + FieldseekerStormdrains: buildJoinSet[fieldseekerStormdrainJoins[Q]](FieldseekerStormdrains.Columns, buildFieldseekerStormdrainJoins), + FieldseekerTimecards: buildJoinSet[fieldseekerTimecardJoins[Q]](FieldseekerTimecards.Columns, buildFieldseekerTimecardJoins), + FieldseekerTrapdata: buildJoinSet[fieldseekerTrapdatumJoins[Q]](FieldseekerTrapdata.Columns, buildFieldseekerTrapdatumJoins), + FieldseekerTraplocations: buildJoinSet[fieldseekerTraplocationJoins[Q]](FieldseekerTraplocations.Columns, buildFieldseekerTraplocationJoins), + FieldseekerTreatments: buildJoinSet[fieldseekerTreatmentJoins[Q]](FieldseekerTreatments.Columns, buildFieldseekerTreatmentJoins), + FieldseekerTreatmentareas: buildJoinSet[fieldseekerTreatmentareaJoins[Q]](FieldseekerTreatmentareas.Columns, buildFieldseekerTreatmentareaJoins), + FieldseekerZones: buildJoinSet[fieldseekerZoneJoins[Q]](FieldseekerZones.Columns, buildFieldseekerZoneJoins), + FieldseekerZones2s: buildJoinSet[fieldseekerZones2Joins[Q]](FieldseekerZones2s.Columns, buildFieldseekerZones2Joins), + FieldseekerSyncs: buildJoinSet[fieldseekerSyncJoins[Q]](FieldseekerSyncs.Columns, buildFieldseekerSyncJoins), + H3Aggregations: buildJoinSet[h3AggregationJoins[Q]](H3Aggregations.Columns, buildH3AggregationJoins), + NoteAudios: buildJoinSet[noteAudioJoins[Q]](NoteAudios.Columns, buildNoteAudioJoins), + NoteAudioBreadcrumbs: buildJoinSet[noteAudioBreadcrumbJoins[Q]](NoteAudioBreadcrumbs.Columns, buildNoteAudioBreadcrumbJoins), + NoteAudioData: buildJoinSet[noteAudioDatumJoins[Q]](NoteAudioData.Columns, buildNoteAudioDatumJoins), + NoteImages: buildJoinSet[noteImageJoins[Q]](NoteImages.Columns, buildNoteImageJoins), + NoteImageBreadcrumbs: buildJoinSet[noteImageBreadcrumbJoins[Q]](NoteImageBreadcrumbs.Columns, buildNoteImageBreadcrumbJoins), + NoteImageData: buildJoinSet[noteImageDatumJoins[Q]](NoteImageData.Columns, buildNoteImageDatumJoins), + Notifications: buildJoinSet[notificationJoins[Q]](Notifications.Columns, buildNotificationJoins), + OauthTokens: buildJoinSet[oauthTokenJoins[Q]](OauthTokens.Columns, buildOauthTokenJoins), + Organizations: buildJoinSet[organizationJoins[Q]](Organizations.Columns, buildOrganizationJoins), + Users: buildJoinSet[userJoins[Q]](Users.Columns, buildUserJoins), } } diff --git a/db/models/bob_loaders.bob.go b/db/models/bob_loaders.bob.go index 2fe41202..173d4a96 100644 --- a/db/models/bob_loaders.bob.go +++ b/db/models/bob_loaders.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models @@ -17,130 +17,88 @@ import ( var Preload = getPreloaders() type preloaders struct { - FieldseekerSync fieldseekerSyncPreloader - FSContainerrelate fsContainerrelatePreloader - FSFieldscoutinglog fsFieldscoutinglogPreloader - FSHabitatrelate fsHabitatrelatePreloader - FSInspectionsample fsInspectionsamplePreloader - FSInspectionsampledetail fsInspectionsampledetailPreloader - FSLinelocation fsLinelocationPreloader - FSLocationtracking fsLocationtrackingPreloader - FSMosquitoinspection fsMosquitoinspectionPreloader - FSPointlocation fsPointlocationPreloader - FSPolygonlocation fsPolygonlocationPreloader - FSPool fsPoolPreloader - FSPooldetail fsPooldetailPreloader - FSProposedtreatmentarea fsProposedtreatmentareaPreloader - FSQamosquitoinspection fsQamosquitoinspectionPreloader - FSRodentlocation fsRodentlocationPreloader - FSSamplecollection fsSamplecollectionPreloader - FSSamplelocation fsSamplelocationPreloader - FSServicerequest fsServicerequestPreloader - FSSpeciesabundance fsSpeciesabundancePreloader - FSStormdrain fsStormdrainPreloader - FSTimecard fsTimecardPreloader - FSTrapdatum fsTrapdatumPreloader - FSTraplocation fsTraplocationPreloader - FSTreatment fsTreatmentPreloader - FSTreatmentarea fsTreatmentareaPreloader - FSZone fsZonePreloader - FSZones2 fsZones2Preloader - H3Aggregation h3AggregationPreloader - HistoryContainerrelate historyContainerrelatePreloader - HistoryFieldscoutinglog historyFieldscoutinglogPreloader - HistoryHabitatrelate historyHabitatrelatePreloader - HistoryInspectionsample historyInspectionsamplePreloader - HistoryInspectionsampledetail historyInspectionsampledetailPreloader - HistoryLinelocation historyLinelocationPreloader - HistoryLocationtracking historyLocationtrackingPreloader - HistoryMosquitoinspection historyMosquitoinspectionPreloader - HistoryPointlocation historyPointlocationPreloader - HistoryPolygonlocation historyPolygonlocationPreloader - HistoryPool historyPoolPreloader - HistoryPooldetail historyPooldetailPreloader - HistoryProposedtreatmentarea historyProposedtreatmentareaPreloader - HistoryQamosquitoinspection historyQamosquitoinspectionPreloader - HistoryRodentlocation historyRodentlocationPreloader - HistorySamplecollection historySamplecollectionPreloader - HistorySamplelocation historySamplelocationPreloader - HistoryServicerequest historyServicerequestPreloader - HistorySpeciesabundance historySpeciesabundancePreloader - HistoryStormdrain historyStormdrainPreloader - HistoryTimecard historyTimecardPreloader - HistoryTrapdatum historyTrapdatumPreloader - HistoryTraplocation historyTraplocationPreloader - HistoryTreatment historyTreatmentPreloader - HistoryTreatmentarea historyTreatmentareaPreloader - HistoryZone historyZonePreloader - HistoryZones2 historyZones2Preloader - Notification notificationPreloader - OauthToken oauthTokenPreloader - Organization organizationPreloader - User userPreloader + FieldseekerContainerrelate fieldseekerContainerrelatePreloader + FieldseekerFieldscoutinglog fieldseekerFieldscoutinglogPreloader + FieldseekerHabitatrelate fieldseekerHabitatrelatePreloader + FieldseekerInspectionsample fieldseekerInspectionsamplePreloader + FieldseekerInspectionsampledetail fieldseekerInspectionsampledetailPreloader + FieldseekerLinelocation fieldseekerLinelocationPreloader + FieldseekerLocationtracking fieldseekerLocationtrackingPreloader + FieldseekerMosquitoinspection fieldseekerMosquitoinspectionPreloader + FieldseekerPointlocation fieldseekerPointlocationPreloader + FieldseekerPolygonlocation fieldseekerPolygonlocationPreloader + FieldseekerPool fieldseekerPoolPreloader + FieldseekerPooldetail fieldseekerPooldetailPreloader + FieldseekerProposedtreatmentarea fieldseekerProposedtreatmentareaPreloader + FieldseekerQamosquitoinspection fieldseekerQamosquitoinspectionPreloader + FieldseekerRodentlocation fieldseekerRodentlocationPreloader + FieldseekerSamplecollection fieldseekerSamplecollectionPreloader + FieldseekerSamplelocation fieldseekerSamplelocationPreloader + FieldseekerServicerequest fieldseekerServicerequestPreloader + FieldseekerSpeciesabundance fieldseekerSpeciesabundancePreloader + FieldseekerStormdrain fieldseekerStormdrainPreloader + FieldseekerTimecard fieldseekerTimecardPreloader + FieldseekerTrapdatum fieldseekerTrapdatumPreloader + FieldseekerTraplocation fieldseekerTraplocationPreloader + FieldseekerTreatment fieldseekerTreatmentPreloader + FieldseekerTreatmentarea fieldseekerTreatmentareaPreloader + FieldseekerZone fieldseekerZonePreloader + FieldseekerZones2 fieldseekerZones2Preloader + FieldseekerSync fieldseekerSyncPreloader + H3Aggregation h3AggregationPreloader + NoteAudio noteAudioPreloader + NoteAudioBreadcrumb noteAudioBreadcrumbPreloader + NoteAudioDatum noteAudioDatumPreloader + NoteImage noteImagePreloader + NoteImageBreadcrumb noteImageBreadcrumbPreloader + NoteImageDatum noteImageDatumPreloader + Notification notificationPreloader + OauthToken oauthTokenPreloader + Organization organizationPreloader + User userPreloader } func getPreloaders() preloaders { return preloaders{ - FieldseekerSync: buildFieldseekerSyncPreloader(), - FSContainerrelate: buildFSContainerrelatePreloader(), - FSFieldscoutinglog: buildFSFieldscoutinglogPreloader(), - FSHabitatrelate: buildFSHabitatrelatePreloader(), - FSInspectionsample: buildFSInspectionsamplePreloader(), - FSInspectionsampledetail: buildFSInspectionsampledetailPreloader(), - FSLinelocation: buildFSLinelocationPreloader(), - FSLocationtracking: buildFSLocationtrackingPreloader(), - FSMosquitoinspection: buildFSMosquitoinspectionPreloader(), - FSPointlocation: buildFSPointlocationPreloader(), - FSPolygonlocation: buildFSPolygonlocationPreloader(), - FSPool: buildFSPoolPreloader(), - FSPooldetail: buildFSPooldetailPreloader(), - FSProposedtreatmentarea: buildFSProposedtreatmentareaPreloader(), - FSQamosquitoinspection: buildFSQamosquitoinspectionPreloader(), - FSRodentlocation: buildFSRodentlocationPreloader(), - FSSamplecollection: buildFSSamplecollectionPreloader(), - FSSamplelocation: buildFSSamplelocationPreloader(), - FSServicerequest: buildFSServicerequestPreloader(), - FSSpeciesabundance: buildFSSpeciesabundancePreloader(), - FSStormdrain: buildFSStormdrainPreloader(), - FSTimecard: buildFSTimecardPreloader(), - FSTrapdatum: buildFSTrapdatumPreloader(), - FSTraplocation: buildFSTraplocationPreloader(), - FSTreatment: buildFSTreatmentPreloader(), - FSTreatmentarea: buildFSTreatmentareaPreloader(), - FSZone: buildFSZonePreloader(), - FSZones2: buildFSZones2Preloader(), - H3Aggregation: buildH3AggregationPreloader(), - HistoryContainerrelate: buildHistoryContainerrelatePreloader(), - HistoryFieldscoutinglog: buildHistoryFieldscoutinglogPreloader(), - HistoryHabitatrelate: buildHistoryHabitatrelatePreloader(), - HistoryInspectionsample: buildHistoryInspectionsamplePreloader(), - HistoryInspectionsampledetail: buildHistoryInspectionsampledetailPreloader(), - HistoryLinelocation: buildHistoryLinelocationPreloader(), - HistoryLocationtracking: buildHistoryLocationtrackingPreloader(), - HistoryMosquitoinspection: buildHistoryMosquitoinspectionPreloader(), - HistoryPointlocation: buildHistoryPointlocationPreloader(), - HistoryPolygonlocation: buildHistoryPolygonlocationPreloader(), - HistoryPool: buildHistoryPoolPreloader(), - HistoryPooldetail: buildHistoryPooldetailPreloader(), - HistoryProposedtreatmentarea: buildHistoryProposedtreatmentareaPreloader(), - HistoryQamosquitoinspection: buildHistoryQamosquitoinspectionPreloader(), - HistoryRodentlocation: buildHistoryRodentlocationPreloader(), - HistorySamplecollection: buildHistorySamplecollectionPreloader(), - HistorySamplelocation: buildHistorySamplelocationPreloader(), - HistoryServicerequest: buildHistoryServicerequestPreloader(), - HistorySpeciesabundance: buildHistorySpeciesabundancePreloader(), - HistoryStormdrain: buildHistoryStormdrainPreloader(), - HistoryTimecard: buildHistoryTimecardPreloader(), - HistoryTrapdatum: buildHistoryTrapdatumPreloader(), - HistoryTraplocation: buildHistoryTraplocationPreloader(), - HistoryTreatment: buildHistoryTreatmentPreloader(), - HistoryTreatmentarea: buildHistoryTreatmentareaPreloader(), - HistoryZone: buildHistoryZonePreloader(), - HistoryZones2: buildHistoryZones2Preloader(), - Notification: buildNotificationPreloader(), - OauthToken: buildOauthTokenPreloader(), - Organization: buildOrganizationPreloader(), - User: buildUserPreloader(), + FieldseekerContainerrelate: buildFieldseekerContainerrelatePreloader(), + FieldseekerFieldscoutinglog: buildFieldseekerFieldscoutinglogPreloader(), + FieldseekerHabitatrelate: buildFieldseekerHabitatrelatePreloader(), + FieldseekerInspectionsample: buildFieldseekerInspectionsamplePreloader(), + FieldseekerInspectionsampledetail: buildFieldseekerInspectionsampledetailPreloader(), + FieldseekerLinelocation: buildFieldseekerLinelocationPreloader(), + FieldseekerLocationtracking: buildFieldseekerLocationtrackingPreloader(), + FieldseekerMosquitoinspection: buildFieldseekerMosquitoinspectionPreloader(), + FieldseekerPointlocation: buildFieldseekerPointlocationPreloader(), + FieldseekerPolygonlocation: buildFieldseekerPolygonlocationPreloader(), + FieldseekerPool: buildFieldseekerPoolPreloader(), + FieldseekerPooldetail: buildFieldseekerPooldetailPreloader(), + FieldseekerProposedtreatmentarea: buildFieldseekerProposedtreatmentareaPreloader(), + FieldseekerQamosquitoinspection: buildFieldseekerQamosquitoinspectionPreloader(), + FieldseekerRodentlocation: buildFieldseekerRodentlocationPreloader(), + FieldseekerSamplecollection: buildFieldseekerSamplecollectionPreloader(), + FieldseekerSamplelocation: buildFieldseekerSamplelocationPreloader(), + FieldseekerServicerequest: buildFieldseekerServicerequestPreloader(), + FieldseekerSpeciesabundance: buildFieldseekerSpeciesabundancePreloader(), + FieldseekerStormdrain: buildFieldseekerStormdrainPreloader(), + FieldseekerTimecard: buildFieldseekerTimecardPreloader(), + FieldseekerTrapdatum: buildFieldseekerTrapdatumPreloader(), + FieldseekerTraplocation: buildFieldseekerTraplocationPreloader(), + FieldseekerTreatment: buildFieldseekerTreatmentPreloader(), + FieldseekerTreatmentarea: buildFieldseekerTreatmentareaPreloader(), + FieldseekerZone: buildFieldseekerZonePreloader(), + FieldseekerZones2: buildFieldseekerZones2Preloader(), + FieldseekerSync: buildFieldseekerSyncPreloader(), + H3Aggregation: buildH3AggregationPreloader(), + NoteAudio: buildNoteAudioPreloader(), + NoteAudioBreadcrumb: buildNoteAudioBreadcrumbPreloader(), + NoteAudioDatum: buildNoteAudioDatumPreloader(), + NoteImage: buildNoteImagePreloader(), + NoteImageBreadcrumb: buildNoteImageBreadcrumbPreloader(), + NoteImageDatum: buildNoteImageDatumPreloader(), + Notification: buildNotificationPreloader(), + OauthToken: buildOauthTokenPreloader(), + Organization: buildOrganizationPreloader(), + User: buildUserPreloader(), } } @@ -151,130 +109,88 @@ var ( ) type thenLoaders[Q orm.Loadable] struct { - FieldseekerSync fieldseekerSyncThenLoader[Q] - FSContainerrelate fsContainerrelateThenLoader[Q] - FSFieldscoutinglog fsFieldscoutinglogThenLoader[Q] - FSHabitatrelate fsHabitatrelateThenLoader[Q] - FSInspectionsample fsInspectionsampleThenLoader[Q] - FSInspectionsampledetail fsInspectionsampledetailThenLoader[Q] - FSLinelocation fsLinelocationThenLoader[Q] - FSLocationtracking fsLocationtrackingThenLoader[Q] - FSMosquitoinspection fsMosquitoinspectionThenLoader[Q] - FSPointlocation fsPointlocationThenLoader[Q] - FSPolygonlocation fsPolygonlocationThenLoader[Q] - FSPool fsPoolThenLoader[Q] - FSPooldetail fsPooldetailThenLoader[Q] - FSProposedtreatmentarea fsProposedtreatmentareaThenLoader[Q] - FSQamosquitoinspection fsQamosquitoinspectionThenLoader[Q] - FSRodentlocation fsRodentlocationThenLoader[Q] - FSSamplecollection fsSamplecollectionThenLoader[Q] - FSSamplelocation fsSamplelocationThenLoader[Q] - FSServicerequest fsServicerequestThenLoader[Q] - FSSpeciesabundance fsSpeciesabundanceThenLoader[Q] - FSStormdrain fsStormdrainThenLoader[Q] - FSTimecard fsTimecardThenLoader[Q] - FSTrapdatum fsTrapdatumThenLoader[Q] - FSTraplocation fsTraplocationThenLoader[Q] - FSTreatment fsTreatmentThenLoader[Q] - FSTreatmentarea fsTreatmentareaThenLoader[Q] - FSZone fsZoneThenLoader[Q] - FSZones2 fsZones2ThenLoader[Q] - H3Aggregation h3AggregationThenLoader[Q] - HistoryContainerrelate historyContainerrelateThenLoader[Q] - HistoryFieldscoutinglog historyFieldscoutinglogThenLoader[Q] - HistoryHabitatrelate historyHabitatrelateThenLoader[Q] - HistoryInspectionsample historyInspectionsampleThenLoader[Q] - HistoryInspectionsampledetail historyInspectionsampledetailThenLoader[Q] - HistoryLinelocation historyLinelocationThenLoader[Q] - HistoryLocationtracking historyLocationtrackingThenLoader[Q] - HistoryMosquitoinspection historyMosquitoinspectionThenLoader[Q] - HistoryPointlocation historyPointlocationThenLoader[Q] - HistoryPolygonlocation historyPolygonlocationThenLoader[Q] - HistoryPool historyPoolThenLoader[Q] - HistoryPooldetail historyPooldetailThenLoader[Q] - HistoryProposedtreatmentarea historyProposedtreatmentareaThenLoader[Q] - HistoryQamosquitoinspection historyQamosquitoinspectionThenLoader[Q] - HistoryRodentlocation historyRodentlocationThenLoader[Q] - HistorySamplecollection historySamplecollectionThenLoader[Q] - HistorySamplelocation historySamplelocationThenLoader[Q] - HistoryServicerequest historyServicerequestThenLoader[Q] - HistorySpeciesabundance historySpeciesabundanceThenLoader[Q] - HistoryStormdrain historyStormdrainThenLoader[Q] - HistoryTimecard historyTimecardThenLoader[Q] - HistoryTrapdatum historyTrapdatumThenLoader[Q] - HistoryTraplocation historyTraplocationThenLoader[Q] - HistoryTreatment historyTreatmentThenLoader[Q] - HistoryTreatmentarea historyTreatmentareaThenLoader[Q] - HistoryZone historyZoneThenLoader[Q] - HistoryZones2 historyZones2ThenLoader[Q] - Notification notificationThenLoader[Q] - OauthToken oauthTokenThenLoader[Q] - Organization organizationThenLoader[Q] - User userThenLoader[Q] + FieldseekerContainerrelate fieldseekerContainerrelateThenLoader[Q] + FieldseekerFieldscoutinglog fieldseekerFieldscoutinglogThenLoader[Q] + FieldseekerHabitatrelate fieldseekerHabitatrelateThenLoader[Q] + FieldseekerInspectionsample fieldseekerInspectionsampleThenLoader[Q] + FieldseekerInspectionsampledetail fieldseekerInspectionsampledetailThenLoader[Q] + FieldseekerLinelocation fieldseekerLinelocationThenLoader[Q] + FieldseekerLocationtracking fieldseekerLocationtrackingThenLoader[Q] + FieldseekerMosquitoinspection fieldseekerMosquitoinspectionThenLoader[Q] + FieldseekerPointlocation fieldseekerPointlocationThenLoader[Q] + FieldseekerPolygonlocation fieldseekerPolygonlocationThenLoader[Q] + FieldseekerPool fieldseekerPoolThenLoader[Q] + FieldseekerPooldetail fieldseekerPooldetailThenLoader[Q] + FieldseekerProposedtreatmentarea fieldseekerProposedtreatmentareaThenLoader[Q] + FieldseekerQamosquitoinspection fieldseekerQamosquitoinspectionThenLoader[Q] + FieldseekerRodentlocation fieldseekerRodentlocationThenLoader[Q] + FieldseekerSamplecollection fieldseekerSamplecollectionThenLoader[Q] + FieldseekerSamplelocation fieldseekerSamplelocationThenLoader[Q] + FieldseekerServicerequest fieldseekerServicerequestThenLoader[Q] + FieldseekerSpeciesabundance fieldseekerSpeciesabundanceThenLoader[Q] + FieldseekerStormdrain fieldseekerStormdrainThenLoader[Q] + FieldseekerTimecard fieldseekerTimecardThenLoader[Q] + FieldseekerTrapdatum fieldseekerTrapdatumThenLoader[Q] + FieldseekerTraplocation fieldseekerTraplocationThenLoader[Q] + FieldseekerTreatment fieldseekerTreatmentThenLoader[Q] + FieldseekerTreatmentarea fieldseekerTreatmentareaThenLoader[Q] + FieldseekerZone fieldseekerZoneThenLoader[Q] + FieldseekerZones2 fieldseekerZones2ThenLoader[Q] + FieldseekerSync fieldseekerSyncThenLoader[Q] + H3Aggregation h3AggregationThenLoader[Q] + NoteAudio noteAudioThenLoader[Q] + NoteAudioBreadcrumb noteAudioBreadcrumbThenLoader[Q] + NoteAudioDatum noteAudioDatumThenLoader[Q] + NoteImage noteImageThenLoader[Q] + NoteImageBreadcrumb noteImageBreadcrumbThenLoader[Q] + NoteImageDatum noteImageDatumThenLoader[Q] + Notification notificationThenLoader[Q] + OauthToken oauthTokenThenLoader[Q] + Organization organizationThenLoader[Q] + User userThenLoader[Q] } func getThenLoaders[Q orm.Loadable]() thenLoaders[Q] { return thenLoaders[Q]{ - FieldseekerSync: buildFieldseekerSyncThenLoader[Q](), - FSContainerrelate: buildFSContainerrelateThenLoader[Q](), - FSFieldscoutinglog: buildFSFieldscoutinglogThenLoader[Q](), - FSHabitatrelate: buildFSHabitatrelateThenLoader[Q](), - FSInspectionsample: buildFSInspectionsampleThenLoader[Q](), - FSInspectionsampledetail: buildFSInspectionsampledetailThenLoader[Q](), - FSLinelocation: buildFSLinelocationThenLoader[Q](), - FSLocationtracking: buildFSLocationtrackingThenLoader[Q](), - FSMosquitoinspection: buildFSMosquitoinspectionThenLoader[Q](), - FSPointlocation: buildFSPointlocationThenLoader[Q](), - FSPolygonlocation: buildFSPolygonlocationThenLoader[Q](), - FSPool: buildFSPoolThenLoader[Q](), - FSPooldetail: buildFSPooldetailThenLoader[Q](), - FSProposedtreatmentarea: buildFSProposedtreatmentareaThenLoader[Q](), - FSQamosquitoinspection: buildFSQamosquitoinspectionThenLoader[Q](), - FSRodentlocation: buildFSRodentlocationThenLoader[Q](), - FSSamplecollection: buildFSSamplecollectionThenLoader[Q](), - FSSamplelocation: buildFSSamplelocationThenLoader[Q](), - FSServicerequest: buildFSServicerequestThenLoader[Q](), - FSSpeciesabundance: buildFSSpeciesabundanceThenLoader[Q](), - FSStormdrain: buildFSStormdrainThenLoader[Q](), - FSTimecard: buildFSTimecardThenLoader[Q](), - FSTrapdatum: buildFSTrapdatumThenLoader[Q](), - FSTraplocation: buildFSTraplocationThenLoader[Q](), - FSTreatment: buildFSTreatmentThenLoader[Q](), - FSTreatmentarea: buildFSTreatmentareaThenLoader[Q](), - FSZone: buildFSZoneThenLoader[Q](), - FSZones2: buildFSZones2ThenLoader[Q](), - H3Aggregation: buildH3AggregationThenLoader[Q](), - HistoryContainerrelate: buildHistoryContainerrelateThenLoader[Q](), - HistoryFieldscoutinglog: buildHistoryFieldscoutinglogThenLoader[Q](), - HistoryHabitatrelate: buildHistoryHabitatrelateThenLoader[Q](), - HistoryInspectionsample: buildHistoryInspectionsampleThenLoader[Q](), - HistoryInspectionsampledetail: buildHistoryInspectionsampledetailThenLoader[Q](), - HistoryLinelocation: buildHistoryLinelocationThenLoader[Q](), - HistoryLocationtracking: buildHistoryLocationtrackingThenLoader[Q](), - HistoryMosquitoinspection: buildHistoryMosquitoinspectionThenLoader[Q](), - HistoryPointlocation: buildHistoryPointlocationThenLoader[Q](), - HistoryPolygonlocation: buildHistoryPolygonlocationThenLoader[Q](), - HistoryPool: buildHistoryPoolThenLoader[Q](), - HistoryPooldetail: buildHistoryPooldetailThenLoader[Q](), - HistoryProposedtreatmentarea: buildHistoryProposedtreatmentareaThenLoader[Q](), - HistoryQamosquitoinspection: buildHistoryQamosquitoinspectionThenLoader[Q](), - HistoryRodentlocation: buildHistoryRodentlocationThenLoader[Q](), - HistorySamplecollection: buildHistorySamplecollectionThenLoader[Q](), - HistorySamplelocation: buildHistorySamplelocationThenLoader[Q](), - HistoryServicerequest: buildHistoryServicerequestThenLoader[Q](), - HistorySpeciesabundance: buildHistorySpeciesabundanceThenLoader[Q](), - HistoryStormdrain: buildHistoryStormdrainThenLoader[Q](), - HistoryTimecard: buildHistoryTimecardThenLoader[Q](), - HistoryTrapdatum: buildHistoryTrapdatumThenLoader[Q](), - HistoryTraplocation: buildHistoryTraplocationThenLoader[Q](), - HistoryTreatment: buildHistoryTreatmentThenLoader[Q](), - HistoryTreatmentarea: buildHistoryTreatmentareaThenLoader[Q](), - HistoryZone: buildHistoryZoneThenLoader[Q](), - HistoryZones2: buildHistoryZones2ThenLoader[Q](), - Notification: buildNotificationThenLoader[Q](), - OauthToken: buildOauthTokenThenLoader[Q](), - Organization: buildOrganizationThenLoader[Q](), - User: buildUserThenLoader[Q](), + FieldseekerContainerrelate: buildFieldseekerContainerrelateThenLoader[Q](), + FieldseekerFieldscoutinglog: buildFieldseekerFieldscoutinglogThenLoader[Q](), + FieldseekerHabitatrelate: buildFieldseekerHabitatrelateThenLoader[Q](), + FieldseekerInspectionsample: buildFieldseekerInspectionsampleThenLoader[Q](), + FieldseekerInspectionsampledetail: buildFieldseekerInspectionsampledetailThenLoader[Q](), + FieldseekerLinelocation: buildFieldseekerLinelocationThenLoader[Q](), + FieldseekerLocationtracking: buildFieldseekerLocationtrackingThenLoader[Q](), + FieldseekerMosquitoinspection: buildFieldseekerMosquitoinspectionThenLoader[Q](), + FieldseekerPointlocation: buildFieldseekerPointlocationThenLoader[Q](), + FieldseekerPolygonlocation: buildFieldseekerPolygonlocationThenLoader[Q](), + FieldseekerPool: buildFieldseekerPoolThenLoader[Q](), + FieldseekerPooldetail: buildFieldseekerPooldetailThenLoader[Q](), + FieldseekerProposedtreatmentarea: buildFieldseekerProposedtreatmentareaThenLoader[Q](), + FieldseekerQamosquitoinspection: buildFieldseekerQamosquitoinspectionThenLoader[Q](), + FieldseekerRodentlocation: buildFieldseekerRodentlocationThenLoader[Q](), + FieldseekerSamplecollection: buildFieldseekerSamplecollectionThenLoader[Q](), + FieldseekerSamplelocation: buildFieldseekerSamplelocationThenLoader[Q](), + FieldseekerServicerequest: buildFieldseekerServicerequestThenLoader[Q](), + FieldseekerSpeciesabundance: buildFieldseekerSpeciesabundanceThenLoader[Q](), + FieldseekerStormdrain: buildFieldseekerStormdrainThenLoader[Q](), + FieldseekerTimecard: buildFieldseekerTimecardThenLoader[Q](), + FieldseekerTrapdatum: buildFieldseekerTrapdatumThenLoader[Q](), + FieldseekerTraplocation: buildFieldseekerTraplocationThenLoader[Q](), + FieldseekerTreatment: buildFieldseekerTreatmentThenLoader[Q](), + FieldseekerTreatmentarea: buildFieldseekerTreatmentareaThenLoader[Q](), + FieldseekerZone: buildFieldseekerZoneThenLoader[Q](), + FieldseekerZones2: buildFieldseekerZones2ThenLoader[Q](), + FieldseekerSync: buildFieldseekerSyncThenLoader[Q](), + H3Aggregation: buildH3AggregationThenLoader[Q](), + NoteAudio: buildNoteAudioThenLoader[Q](), + NoteAudioBreadcrumb: buildNoteAudioBreadcrumbThenLoader[Q](), + NoteAudioDatum: buildNoteAudioDatumThenLoader[Q](), + NoteImage: buildNoteImageThenLoader[Q](), + NoteImageBreadcrumb: buildNoteImageBreadcrumbThenLoader[Q](), + NoteImageDatum: buildNoteImageDatumThenLoader[Q](), + Notification: buildNotificationThenLoader[Q](), + OauthToken: buildOauthTokenThenLoader[Q](), + Organization: buildOrganizationThenLoader[Q](), + User: buildUserThenLoader[Q](), } } diff --git a/db/models/bob_types.bob_test.go b/db/models/bob_types.bob_test.go index 2d097340..6ac1e790 100644 --- a/db/models/bob_types.bob_test.go +++ b/db/models/bob_types.bob_test.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models @@ -6,11 +6,13 @@ package models import ( "database/sql" "database/sql/driver" + "encoding/json" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/lib/pq" "github.com/stephenafamo/bob" + "github.com/stephenafamo/bob/types" ) // Set the testDB to enable tests that use the database @@ -100,87 +102,6 @@ var _ bob.HookableType = &FieldseekerZones2{} // Make sure the type FieldseekerSync runs hooks after queries var _ bob.HookableType = &FieldseekerSync{} -// Make sure the type FSContainerrelate runs hooks after queries -var _ bob.HookableType = &FSContainerrelate{} - -// Make sure the type FSFieldscoutinglog runs hooks after queries -var _ bob.HookableType = &FSFieldscoutinglog{} - -// Make sure the type FSHabitatrelate runs hooks after queries -var _ bob.HookableType = &FSHabitatrelate{} - -// Make sure the type FSInspectionsample runs hooks after queries -var _ bob.HookableType = &FSInspectionsample{} - -// Make sure the type FSInspectionsampledetail runs hooks after queries -var _ bob.HookableType = &FSInspectionsampledetail{} - -// Make sure the type FSLinelocation runs hooks after queries -var _ bob.HookableType = &FSLinelocation{} - -// Make sure the type FSLocationtracking runs hooks after queries -var _ bob.HookableType = &FSLocationtracking{} - -// Make sure the type FSMosquitoinspection runs hooks after queries -var _ bob.HookableType = &FSMosquitoinspection{} - -// Make sure the type FSPointlocation runs hooks after queries -var _ bob.HookableType = &FSPointlocation{} - -// Make sure the type FSPolygonlocation runs hooks after queries -var _ bob.HookableType = &FSPolygonlocation{} - -// Make sure the type FSPool runs hooks after queries -var _ bob.HookableType = &FSPool{} - -// Make sure the type FSPooldetail runs hooks after queries -var _ bob.HookableType = &FSPooldetail{} - -// Make sure the type FSProposedtreatmentarea runs hooks after queries -var _ bob.HookableType = &FSProposedtreatmentarea{} - -// Make sure the type FSQamosquitoinspection runs hooks after queries -var _ bob.HookableType = &FSQamosquitoinspection{} - -// Make sure the type FSRodentlocation runs hooks after queries -var _ bob.HookableType = &FSRodentlocation{} - -// Make sure the type FSSamplecollection runs hooks after queries -var _ bob.HookableType = &FSSamplecollection{} - -// Make sure the type FSSamplelocation runs hooks after queries -var _ bob.HookableType = &FSSamplelocation{} - -// Make sure the type FSServicerequest runs hooks after queries -var _ bob.HookableType = &FSServicerequest{} - -// Make sure the type FSSpeciesabundance runs hooks after queries -var _ bob.HookableType = &FSSpeciesabundance{} - -// Make sure the type FSStormdrain runs hooks after queries -var _ bob.HookableType = &FSStormdrain{} - -// Make sure the type FSTimecard runs hooks after queries -var _ bob.HookableType = &FSTimecard{} - -// Make sure the type FSTrapdatum runs hooks after queries -var _ bob.HookableType = &FSTrapdatum{} - -// Make sure the type FSTraplocation runs hooks after queries -var _ bob.HookableType = &FSTraplocation{} - -// Make sure the type FSTreatment runs hooks after queries -var _ bob.HookableType = &FSTreatment{} - -// Make sure the type FSTreatmentarea runs hooks after queries -var _ bob.HookableType = &FSTreatmentarea{} - -// Make sure the type FSZone runs hooks after queries -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{} @@ -193,86 +114,23 @@ 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{} +// Make sure the type NoteAudio runs hooks after queries +var _ bob.HookableType = &NoteAudio{} -// Make sure the type HistoryFieldscoutinglog runs hooks after queries -var _ bob.HookableType = &HistoryFieldscoutinglog{} +// Make sure the type NoteAudioBreadcrumb runs hooks after queries +var _ bob.HookableType = &NoteAudioBreadcrumb{} -// Make sure the type HistoryHabitatrelate runs hooks after queries -var _ bob.HookableType = &HistoryHabitatrelate{} +// Make sure the type NoteAudioDatum runs hooks after queries +var _ bob.HookableType = &NoteAudioDatum{} -// Make sure the type HistoryInspectionsample runs hooks after queries -var _ bob.HookableType = &HistoryInspectionsample{} +// Make sure the type NoteImage runs hooks after queries +var _ bob.HookableType = &NoteImage{} -// Make sure the type HistoryInspectionsampledetail runs hooks after queries -var _ bob.HookableType = &HistoryInspectionsampledetail{} +// Make sure the type NoteImageBreadcrumb runs hooks after queries +var _ bob.HookableType = &NoteImageBreadcrumb{} -// Make sure the type HistoryLinelocation runs hooks after queries -var _ bob.HookableType = &HistoryLinelocation{} - -// Make sure the type HistoryLocationtracking runs hooks after queries -var _ bob.HookableType = &HistoryLocationtracking{} - -// Make sure the type HistoryMosquitoinspection runs hooks after queries -var _ bob.HookableType = &HistoryMosquitoinspection{} - -// Make sure the type HistoryPointlocation runs hooks after queries -var _ bob.HookableType = &HistoryPointlocation{} - -// Make sure the type HistoryPolygonlocation runs hooks after queries -var _ bob.HookableType = &HistoryPolygonlocation{} - -// Make sure the type HistoryPool runs hooks after queries -var _ bob.HookableType = &HistoryPool{} - -// Make sure the type HistoryPooldetail runs hooks after queries -var _ bob.HookableType = &HistoryPooldetail{} - -// Make sure the type HistoryProposedtreatmentarea runs hooks after queries -var _ bob.HookableType = &HistoryProposedtreatmentarea{} - -// Make sure the type HistoryQamosquitoinspection runs hooks after queries -var _ bob.HookableType = &HistoryQamosquitoinspection{} - -// Make sure the type HistoryRodentlocation runs hooks after queries -var _ bob.HookableType = &HistoryRodentlocation{} - -// Make sure the type HistorySamplecollection runs hooks after queries -var _ bob.HookableType = &HistorySamplecollection{} - -// Make sure the type HistorySamplelocation runs hooks after queries -var _ bob.HookableType = &HistorySamplelocation{} - -// Make sure the type HistoryServicerequest runs hooks after queries -var _ bob.HookableType = &HistoryServicerequest{} - -// Make sure the type HistorySpeciesabundance runs hooks after queries -var _ bob.HookableType = &HistorySpeciesabundance{} - -// Make sure the type HistoryStormdrain runs hooks after queries -var _ bob.HookableType = &HistoryStormdrain{} - -// Make sure the type HistoryTimecard runs hooks after queries -var _ bob.HookableType = &HistoryTimecard{} - -// Make sure the type HistoryTrapdatum runs hooks after queries -var _ bob.HookableType = &HistoryTrapdatum{} - -// Make sure the type HistoryTraplocation runs hooks after queries -var _ bob.HookableType = &HistoryTraplocation{} - -// Make sure the type HistoryTreatment runs hooks after queries -var _ bob.HookableType = &HistoryTreatment{} - -// Make sure the type HistoryTreatmentarea runs hooks after queries -var _ bob.HookableType = &HistoryTreatmentarea{} - -// Make sure the type HistoryZone runs hooks after queries -var _ bob.HookableType = &HistoryZone{} - -// Make sure the type HistoryZones2 runs hooks after queries -var _ bob.HookableType = &HistoryZones2{} +// Make sure the type NoteImageDatum runs hooks after queries +var _ bob.HookableType = &NoteImageDatum{} // Make sure the type Notification runs hooks after queries var _ bob.HookableType = &Notification{} @@ -304,725 +162,11 @@ var _ sql.Scanner = (*uuid.UUID)(nil) // Make sure the type uuid.UUID satisfies database/sql/driver.Valuer var _ driver.Valuer = *new(uuid.UUID) -// Make sure the type enums.FieldseekerContainerrelateMosquitocontainertypeEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerContainerrelateMosquitocontainertypeEnum)(nil) +// Make sure the type types.JSON[json.RawMessage] satisfies database/sql.Scanner +var _ sql.Scanner = (*types.JSON[json.RawMessage])(nil) -// Make sure the type enums.FieldseekerContainerrelateMosquitocontainertypeEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerContainerrelateMosquitocontainertypeEnum) - -// Make sure the type enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum)(nil) - -// Make sure the type enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum) - -// Make sure the type enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284)(nil) - -// Make sure the type enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284) - -// Make sure the type enums.FieldseekerInspectionsampleNotinuitFEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerInspectionsampleNotinuitFEnum)(nil) - -// Make sure the type enums.FieldseekerInspectionsampleNotinuitFEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerInspectionsampleNotinuitFEnum) - -// Make sure the type enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum)(nil) - -// Make sure the type enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum) - -// Make sure the type enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum)(nil) - -// Make sure the type enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum) - -// Make sure the type enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum)(nil) - -// Make sure the type enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum) - -// Make sure the type enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418)(nil) - -// Make sure the type enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418) - -// Make sure the type enums.FieldseekerLinelocationLocationpriorityEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerLinelocationLocationpriorityEnum)(nil) - -// Make sure the type enums.FieldseekerLinelocationLocationpriorityEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerLinelocationLocationpriorityEnum) - -// Make sure the type enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80)(nil) - -// Make sure the type enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80) - -// Make sure the type enums.FieldseekerLinelocationNotinuitFEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerLinelocationNotinuitFEnum)(nil) - -// Make sure the type enums.FieldseekerLinelocationNotinuitFEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerLinelocationNotinuitFEnum) - -// Make sure the type enums.FieldseekerLinelocationLocationsymbologyEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerLinelocationLocationsymbologyEnum)(nil) - -// Make sure the type enums.FieldseekerLinelocationLocationsymbologyEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerLinelocationLocationsymbologyEnum) - -// Make sure the type enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16)(nil) - -// Make sure the type enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitoactivityEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerMosquitoinspectionMosquitoactivityEnum)(nil) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitoactivityEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerMosquitoinspectionMosquitoactivityEnum) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitobreedingEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerMosquitoinspectionMosquitobreedingEnum)(nil) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitobreedingEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerMosquitoinspectionMosquitobreedingEnum) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum)(nil) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2)(nil) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4)(nil) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4) - -// Make sure the type enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum)(nil) - -// Make sure the type enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum) - -// Make sure the type enums.FieldseekerMosquitoinspectionNotinuitFEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerMosquitoinspectionNotinuitFEnum)(nil) - -// Make sure the type enums.FieldseekerMosquitoinspectionNotinuitFEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerMosquitoinspectionNotinuitFEnum) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum)(nil) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540)(nil) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B)(nil) - -// Make sure the type enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B) - -// Make sure the type enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e)(nil) - -// Make sure the type enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e) - -// Make sure the type enums.FieldseekerPointlocationLocationpriorityEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPointlocationLocationpriorityEnum)(nil) - -// Make sure the type enums.FieldseekerPointlocationLocationpriorityEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPointlocationLocationpriorityEnum) - -// Make sure the type enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86)(nil) - -// Make sure the type enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86) - -// Make sure the type enums.FieldseekerPointlocationNotinuitFEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPointlocationNotinuitFEnum)(nil) - -// Make sure the type enums.FieldseekerPointlocationNotinuitFEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPointlocationNotinuitFEnum) - -// Make sure the type enums.FieldseekerPointlocationLocationsymbologyEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPointlocationLocationsymbologyEnum)(nil) - -// Make sure the type enums.FieldseekerPointlocationLocationsymbologyEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPointlocationLocationsymbologyEnum) - -// Make sure the type enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899)(nil) - -// Make sure the type enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899) - -// Make sure the type enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B)(nil) - -// Make sure the type enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B) - -// Make sure the type enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489)(nil) - -// Make sure the type enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489) - -// Make sure the type enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65)(nil) - -// Make sure the type enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65) - -// Make sure the type enums.FieldseekerPolygonlocationLocationpriorityEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPolygonlocationLocationpriorityEnum)(nil) - -// Make sure the type enums.FieldseekerPolygonlocationLocationpriorityEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPolygonlocationLocationpriorityEnum) - -// Make sure the type enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13)(nil) - -// Make sure the type enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13) - -// Make sure the type enums.FieldseekerPolygonlocationNotinuitFEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPolygonlocationNotinuitFEnum)(nil) - -// Make sure the type enums.FieldseekerPolygonlocationNotinuitFEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPolygonlocationNotinuitFEnum) - -// Make sure the type enums.FieldseekerPolygonlocationLocationsymbologyEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPolygonlocationLocationsymbologyEnum)(nil) - -// Make sure the type enums.FieldseekerPolygonlocationLocationsymbologyEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPolygonlocationLocationsymbologyEnum) - -// Make sure the type enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9)(nil) - -// Make sure the type enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9) - -// Make sure the type enums.FieldseekerPoolNotinuitFEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPoolNotinuitFEnum)(nil) - -// Make sure the type enums.FieldseekerPoolNotinuitFEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPoolNotinuitFEnum) - -// Make sure the type enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum)(nil) - -// Make sure the type enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum) - -// Make sure the type enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum)(nil) - -// Make sure the type enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum) - -// Make sure the type enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum)(nil) - -// Make sure the type enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum) - -// Make sure the type enums.FieldseekerPoolMosquitolabnameEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerPoolMosquitolabnameEnum)(nil) - -// Make sure the type enums.FieldseekerPoolMosquitolabnameEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerPoolMosquitolabnameEnum) - -// Make sure the type enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum)(nil) - -// Make sure the type enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum) - -// Make sure the type enums.FieldseekerProposedtreatmentareaNotinuitFEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerProposedtreatmentareaNotinuitFEnum)(nil) - -// Make sure the type enums.FieldseekerProposedtreatmentareaNotinuitFEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerProposedtreatmentareaNotinuitFEnum) - -// Make sure the type enums.FieldseekerProposedtreatmentareaLocationpriorityEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerProposedtreatmentareaLocationpriorityEnum)(nil) - -// Make sure the type enums.FieldseekerProposedtreatmentareaLocationpriorityEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerProposedtreatmentareaLocationpriorityEnum) - -// Make sure the type enums.FieldseekerQamosquitoinspectionMosquitoactionEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerQamosquitoinspectionMosquitoactionEnum)(nil) - -// Make sure the type enums.FieldseekerQamosquitoinspectionMosquitoactionEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerQamosquitoinspectionMosquitoactionEnum) - -// Make sure the type enums.FieldseekerQamosquitoinspectionNotinuitFEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerQamosquitoinspectionNotinuitFEnum)(nil) - -// Make sure the type enums.FieldseekerQamosquitoinspectionNotinuitFEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerQamosquitoinspectionNotinuitFEnum) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQasitetypeEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerQamosquitoinspectionQasitetypeEnum)(nil) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQasitetypeEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerQamosquitoinspectionQasitetypeEnum) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum)(nil) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum)(nil) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum)(nil) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum)(nil) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQavegetationEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerQamosquitoinspectionQavegetationEnum)(nil) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQavegetationEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerQamosquitoinspectionQavegetationEnum) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQasourcereductionEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerQamosquitoinspectionQasourcereductionEnum)(nil) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQasourcereductionEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerQamosquitoinspectionQasourcereductionEnum) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQawatermovementEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerQamosquitoinspectionQawatermovementEnum)(nil) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQawatermovementEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerQamosquitoinspectionQawatermovementEnum) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQasoilconditionEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerQamosquitoinspectionQasoilconditionEnum)(nil) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQasoilconditionEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerQamosquitoinspectionQasoilconditionEnum) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQawaterdurationEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerQamosquitoinspectionQawaterdurationEnum)(nil) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQawaterdurationEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerQamosquitoinspectionQawaterdurationEnum) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQawatersourceEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerQamosquitoinspectionQawatersourceEnum)(nil) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQawatersourceEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerQamosquitoinspectionQawatersourceEnum) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum)(nil) - -// Make sure the type enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum) - -// Make sure the type enums.FieldseekerRodentlocationRodentlocationhabitatEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerRodentlocationRodentlocationhabitatEnum)(nil) - -// Make sure the type enums.FieldseekerRodentlocationRodentlocationhabitatEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerRodentlocationRodentlocationhabitatEnum) - -// Make sure the type enums.FieldseekerRodentlocationLocationpriority1Enum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerRodentlocationLocationpriority1Enum)(nil) - -// Make sure the type enums.FieldseekerRodentlocationLocationpriority1Enum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerRodentlocationLocationpriority1Enum) - -// Make sure the type enums.FieldseekerRodentlocationLocationusetype1Enum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerRodentlocationLocationusetype1Enum)(nil) - -// Make sure the type enums.FieldseekerRodentlocationLocationusetype1Enum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerRodentlocationLocationusetype1Enum) - -// Make sure the type enums.FieldseekerRodentlocationNotinuitF1Enum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerRodentlocationNotinuitF1Enum)(nil) - -// Make sure the type enums.FieldseekerRodentlocationNotinuitF1Enum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerRodentlocationNotinuitF1Enum) - -// Make sure the type enums.FieldseekerRodentlocationRodentlocationSymbologyEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerRodentlocationRodentlocationSymbologyEnum)(nil) - -// Make sure the type enums.FieldseekerRodentlocationRodentlocationSymbologyEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerRodentlocationRodentlocationSymbologyEnum) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitositeconditionEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSamplecollectionMosquitositeconditionEnum)(nil) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitositeconditionEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSamplecollectionMosquitositeconditionEnum) - -// Make sure the type enums.FieldseekerSamplecollectionNotinuitFEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSamplecollectionNotinuitFEnum)(nil) - -// Make sure the type enums.FieldseekerSamplecollectionNotinuitFEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSamplecollectionNotinuitFEnum) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitosampletypeEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSamplecollectionMosquitosampletypeEnum)(nil) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitosampletypeEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSamplecollectionMosquitosampletypeEnum) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitosampleconditionEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSamplecollectionMosquitosampleconditionEnum)(nil) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitosampleconditionEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSamplecollectionMosquitosampleconditionEnum) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum)(nil) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum) - -// Make sure the type enums.FieldseekerSamplecollectionNotinuisexEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSamplecollectionNotinuisexEnum)(nil) - -// Make sure the type enums.FieldseekerSamplecollectionNotinuisexEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSamplecollectionNotinuisexEnum) - -// Make sure the type enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum)(nil) - -// Make sure the type enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitoactivityEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSamplecollectionMosquitoactivityEnum)(nil) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitoactivityEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSamplecollectionMosquitoactivityEnum) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitotestmethodEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSamplecollectionMosquitotestmethodEnum)(nil) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitotestmethodEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSamplecollectionMosquitotestmethodEnum) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitodiseaseEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSamplecollectionMosquitodiseaseEnum)(nil) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitodiseaseEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSamplecollectionMosquitodiseaseEnum) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitolabnameEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSamplecollectionMosquitolabnameEnum)(nil) - -// Make sure the type enums.FieldseekerSamplecollectionMosquitolabnameEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSamplecollectionMosquitolabnameEnum) - -// Make sure the type enums.FieldseekerSamplelocationLocationhabitattypeEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSamplelocationLocationhabitattypeEnum)(nil) - -// Make sure the type enums.FieldseekerSamplelocationLocationhabitattypeEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSamplelocationLocationhabitattypeEnum) - -// Make sure the type enums.FieldseekerSamplelocationLocationpriorityEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSamplelocationLocationpriorityEnum)(nil) - -// Make sure the type enums.FieldseekerSamplelocationLocationpriorityEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSamplelocationLocationpriorityEnum) - -// Make sure the type enums.FieldseekerSamplelocationSamplelocationusetypeEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSamplelocationSamplelocationusetypeEnum)(nil) - -// Make sure the type enums.FieldseekerSamplelocationSamplelocationusetypeEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSamplelocationSamplelocationusetypeEnum) - -// Make sure the type enums.FieldseekerSamplelocationNotinuitFEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSamplelocationNotinuitFEnum)(nil) - -// Make sure the type enums.FieldseekerSamplelocationNotinuitFEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSamplelocationNotinuitFEnum) - -// Make sure the type enums.FieldseekerServicerequestServicerequestsourceEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerServicerequestServicerequestsourceEnum)(nil) - -// Make sure the type enums.FieldseekerServicerequestServicerequestsourceEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerServicerequestServicerequestsourceEnum) - -// Make sure the type enums.FieldseekerServicerequestServicerequestpriorityEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerServicerequestServicerequestpriorityEnum)(nil) - -// Make sure the type enums.FieldseekerServicerequestServicerequestpriorityEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerServicerequestServicerequestpriorityEnum) - -// Make sure the type enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808)(nil) - -// Make sure the type enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808) - -// Make sure the type enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8)(nil) - -// Make sure the type enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8) - -// Make sure the type enums.FieldseekerServicerequestServicerequeststatusEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerServicerequestServicerequeststatusEnum)(nil) - -// Make sure the type enums.FieldseekerServicerequestServicerequeststatusEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerServicerequestServicerequeststatusEnum) - -// Make sure the type enums.FieldseekerServicerequestNotinuitFEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerServicerequestNotinuitFEnum)(nil) - -// Make sure the type enums.FieldseekerServicerequestNotinuitFEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerServicerequestNotinuitFEnum) - -// Make sure the type enums.FieldseekerServicerequestServicerequestregionEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerServicerequestServicerequestregionEnum)(nil) - -// Make sure the type enums.FieldseekerServicerequestServicerequestregionEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerServicerequestServicerequestregionEnum) - -// Make sure the type enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum)(nil) - -// Make sure the type enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum) - -// Make sure the type enums.FieldseekerServicerequestServicerequesttargetEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerServicerequestServicerequesttargetEnum)(nil) - -// Make sure the type enums.FieldseekerServicerequestServicerequesttargetEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerServicerequestServicerequesttargetEnum) - -// Make sure the type enums.FieldseekerServicerequestServicerequestrejectedreasonEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerServicerequestServicerequestrejectedreasonEnum)(nil) - -// Make sure the type enums.FieldseekerServicerequestServicerequestrejectedreasonEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerServicerequestServicerequestrejectedreasonEnum) - -// Make sure the type enums.FieldseekerServicerequestServicerequestnextactionEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerServicerequestServicerequestnextactionEnum)(nil) - -// Make sure the type enums.FieldseekerServicerequestServicerequestnextactionEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerServicerequestServicerequestnextactionEnum) - -// Make sure the type enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31)(nil) - -// Make sure the type enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31) - -// Make sure the type enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab)(nil) - -// Make sure the type enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab) - -// Make sure the type enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC)(nil) - -// Make sure the type enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC) - -// Make sure the type enums.FieldseekerServicerequestServicerequestissuesEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerServicerequestServicerequestissuesEnum)(nil) - -// Make sure the type enums.FieldseekerServicerequestServicerequestissuesEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerServicerequestServicerequestissuesEnum) - -// Make sure the type enums.FieldseekerSpeciesabundanceNotinuitFEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerSpeciesabundanceNotinuitFEnum)(nil) - -// Make sure the type enums.FieldseekerSpeciesabundanceNotinuitFEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerSpeciesabundanceNotinuitFEnum) - -// Make sure the type enums.FieldseekerStormdrainStormdrainsymbologyEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerStormdrainStormdrainsymbologyEnum)(nil) - -// Make sure the type enums.FieldseekerStormdrainStormdrainsymbologyEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerStormdrainStormdrainsymbologyEnum) - -// Make sure the type enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu)(nil) - -// Make sure the type enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu) - -// Make sure the type enums.FieldseekerTimecardTimecardequipmenttypeEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTimecardTimecardequipmenttypeEnum)(nil) - -// Make sure the type enums.FieldseekerTimecardTimecardequipmenttypeEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTimecardTimecardequipmenttypeEnum) - -// Make sure the type enums.FieldseekerTrapdataMosquitotraptypeEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTrapdataMosquitotraptypeEnum)(nil) - -// Make sure the type enums.FieldseekerTrapdataMosquitotraptypeEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTrapdataMosquitotraptypeEnum) - -// Make sure the type enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum)(nil) - -// Make sure the type enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum) - -// Make sure the type enums.FieldseekerTrapdataNotinuitFEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTrapdataNotinuitFEnum)(nil) - -// Make sure the type enums.FieldseekerTrapdataNotinuitFEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTrapdataNotinuitFEnum) - -// Make sure the type enums.FieldseekerTrapdataMosquitositeconditionEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTrapdataMosquitositeconditionEnum)(nil) - -// Make sure the type enums.FieldseekerTrapdataMosquitositeconditionEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTrapdataMosquitositeconditionEnum) - -// Make sure the type enums.FieldseekerTrapdataMosquitotrapconditionEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTrapdataMosquitotrapconditionEnum)(nil) - -// Make sure the type enums.FieldseekerTrapdataMosquitotrapconditionEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTrapdataMosquitotrapconditionEnum) - -// Make sure the type enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166)(nil) - -// Make sure the type enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166) - -// Make sure the type enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu)(nil) - -// Make sure the type enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu) - -// Make sure the type enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e)(nil) - -// Make sure the type enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e) - -// Make sure the type enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B)(nil) - -// Make sure the type enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B) - -// Make sure the type enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2)(nil) - -// Make sure the type enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2) - -// Make sure the type enums.FieldseekerTraplocationNotinuitFEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTraplocationNotinuitFEnum)(nil) - -// Make sure the type enums.FieldseekerTraplocationNotinuitFEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTraplocationNotinuitFEnum) - -// Make sure the type enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0)(nil) - -// Make sure the type enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0) - -// Make sure the type enums.FieldseekerTreatmentMosquitoactivityEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTreatmentMosquitoactivityEnum)(nil) - -// Make sure the type enums.FieldseekerTreatmentMosquitoactivityEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTreatmentMosquitoactivityEnum) - -// Make sure the type enums.FieldseekerTreatmentMosquitoproductareaunitEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTreatmentMosquitoproductareaunitEnum)(nil) - -// Make sure the type enums.FieldseekerTreatmentMosquitoproductareaunitEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTreatmentMosquitoproductareaunitEnum) - -// Make sure the type enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum)(nil) - -// Make sure the type enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum) - -// Make sure the type enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu)(nil) - -// Make sure the type enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu) - -// Make sure the type enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f)(nil) - -// Make sure the type enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f) - -// Make sure the type enums.FieldseekerTreatmentNotinuiwinddirectionEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTreatmentNotinuiwinddirectionEnum)(nil) - -// Make sure the type enums.FieldseekerTreatmentNotinuiwinddirectionEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTreatmentNotinuiwinddirectionEnum) - -// Make sure the type enums.FieldseekerTreatmentNotinuitFEnum satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTreatmentNotinuitFEnum)(nil) - -// Make sure the type enums.FieldseekerTreatmentNotinuitFEnum satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTreatmentNotinuitFEnum) - -// Make sure the type enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1 satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1)(nil) - -// Make sure the type enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1 satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1) - -// Make sure the type enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E)(nil) - -// Make sure the type enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E) - -// Make sure the type enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E satisfies database/sql.Scanner -var _ sql.Scanner = (*enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E)(nil) - -// Make sure the type enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E satisfies database/sql/driver.Valuer -var _ driver.Valuer = *new(enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E) +// Make sure the type types.JSON[json.RawMessage] satisfies database/sql/driver.Valuer +var _ driver.Valuer = *new(types.JSON[json.RawMessage]) // Make sure the type enums.H3aggregationtype satisfies database/sql.Scanner var _ sql.Scanner = (*enums.H3aggregationtype)(nil) @@ -1030,6 +174,12 @@ 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.Audiodatatype satisfies database/sql.Scanner +var _ sql.Scanner = (*enums.Audiodatatype)(nil) + +// Make sure the type enums.Audiodatatype satisfies database/sql/driver.Valuer +var _ driver.Valuer = *new(enums.Audiodatatype) + // Make sure the type enums.Notificationtype satisfies database/sql.Scanner var _ sql.Scanner = (*enums.Notificationtype)(nil) diff --git a/db/models/bob_where.bob.go b/db/models/bob_where.bob.go index 888a7988..454d2d3e 100644 --- a/db/models/bob_where.bob.go +++ b/db/models/bob_where.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models @@ -45,64 +45,16 @@ func Where[Q psql.Filterable]() struct { FieldseekerZones fieldseekerZoneWhere[Q] FieldseekerZones2s fieldseekerZones2Where[Q] FieldseekerSyncs fieldseekerSyncWhere[Q] - FSContainerrelates fsContainerrelateWhere[Q] - FSFieldscoutinglogs fsFieldscoutinglogWhere[Q] - FSHabitatrelates fsHabitatrelateWhere[Q] - FSInspectionsamples fsInspectionsampleWhere[Q] - FSInspectionsampledetails fsInspectionsampledetailWhere[Q] - FSLinelocations fsLinelocationWhere[Q] - FSLocationtrackings fsLocationtrackingWhere[Q] - FSMosquitoinspections fsMosquitoinspectionWhere[Q] - FSPointlocations fsPointlocationWhere[Q] - FSPolygonlocations fsPolygonlocationWhere[Q] - FSPools fsPoolWhere[Q] - FSPooldetails fsPooldetailWhere[Q] - FSProposedtreatmentareas fsProposedtreatmentareaWhere[Q] - FSQamosquitoinspections fsQamosquitoinspectionWhere[Q] - FSRodentlocations fsRodentlocationWhere[Q] - FSSamplecollections fsSamplecollectionWhere[Q] - FSSamplelocations fsSamplelocationWhere[Q] - FSServicerequests fsServicerequestWhere[Q] - FSSpeciesabundances fsSpeciesabundanceWhere[Q] - FSStormdrains fsStormdrainWhere[Q] - FSTimecards fsTimecardWhere[Q] - FSTrapdata fsTrapdatumWhere[Q] - FSTraplocations fsTraplocationWhere[Q] - FSTreatments fsTreatmentWhere[Q] - 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] - HistoryInspectionsamples historyInspectionsampleWhere[Q] - HistoryInspectionsampledetails historyInspectionsampledetailWhere[Q] - HistoryLinelocations historyLinelocationWhere[Q] - HistoryLocationtrackings historyLocationtrackingWhere[Q] - HistoryMosquitoinspections historyMosquitoinspectionWhere[Q] - HistoryPointlocations historyPointlocationWhere[Q] - HistoryPolygonlocations historyPolygonlocationWhere[Q] - HistoryPools historyPoolWhere[Q] - HistoryPooldetails historyPooldetailWhere[Q] - HistoryProposedtreatmentareas historyProposedtreatmentareaWhere[Q] - HistoryQamosquitoinspections historyQamosquitoinspectionWhere[Q] - HistoryRodentlocations historyRodentlocationWhere[Q] - HistorySamplecollections historySamplecollectionWhere[Q] - HistorySamplelocations historySamplelocationWhere[Q] - HistoryServicerequests historyServicerequestWhere[Q] - HistorySpeciesabundances historySpeciesabundanceWhere[Q] - HistoryStormdrains historyStormdrainWhere[Q] - HistoryTimecards historyTimecardWhere[Q] - HistoryTrapdata historyTrapdatumWhere[Q] - HistoryTraplocations historyTraplocationWhere[Q] - HistoryTreatments historyTreatmentWhere[Q] - HistoryTreatmentareas historyTreatmentareaWhere[Q] - HistoryZones historyZoneWhere[Q] - HistoryZones2s historyZones2Where[Q] + NoteAudios noteAudioWhere[Q] + NoteAudioBreadcrumbs noteAudioBreadcrumbWhere[Q] + NoteAudioData noteAudioDatumWhere[Q] + NoteImages noteImageWhere[Q] + NoteImageBreadcrumbs noteImageBreadcrumbWhere[Q] + NoteImageData noteImageDatumWhere[Q] Notifications notificationWhere[Q] OauthTokens oauthTokenWhere[Q] Organizations organizationWhere[Q] @@ -141,64 +93,16 @@ func Where[Q psql.Filterable]() struct { FieldseekerZones fieldseekerZoneWhere[Q] FieldseekerZones2s fieldseekerZones2Where[Q] FieldseekerSyncs fieldseekerSyncWhere[Q] - FSContainerrelates fsContainerrelateWhere[Q] - FSFieldscoutinglogs fsFieldscoutinglogWhere[Q] - FSHabitatrelates fsHabitatrelateWhere[Q] - FSInspectionsamples fsInspectionsampleWhere[Q] - FSInspectionsampledetails fsInspectionsampledetailWhere[Q] - FSLinelocations fsLinelocationWhere[Q] - FSLocationtrackings fsLocationtrackingWhere[Q] - FSMosquitoinspections fsMosquitoinspectionWhere[Q] - FSPointlocations fsPointlocationWhere[Q] - FSPolygonlocations fsPolygonlocationWhere[Q] - FSPools fsPoolWhere[Q] - FSPooldetails fsPooldetailWhere[Q] - FSProposedtreatmentareas fsProposedtreatmentareaWhere[Q] - FSQamosquitoinspections fsQamosquitoinspectionWhere[Q] - FSRodentlocations fsRodentlocationWhere[Q] - FSSamplecollections fsSamplecollectionWhere[Q] - FSSamplelocations fsSamplelocationWhere[Q] - FSServicerequests fsServicerequestWhere[Q] - FSSpeciesabundances fsSpeciesabundanceWhere[Q] - FSStormdrains fsStormdrainWhere[Q] - FSTimecards fsTimecardWhere[Q] - FSTrapdata fsTrapdatumWhere[Q] - FSTraplocations fsTraplocationWhere[Q] - FSTreatments fsTreatmentWhere[Q] - 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] - HistoryInspectionsamples historyInspectionsampleWhere[Q] - HistoryInspectionsampledetails historyInspectionsampledetailWhere[Q] - HistoryLinelocations historyLinelocationWhere[Q] - HistoryLocationtrackings historyLocationtrackingWhere[Q] - HistoryMosquitoinspections historyMosquitoinspectionWhere[Q] - HistoryPointlocations historyPointlocationWhere[Q] - HistoryPolygonlocations historyPolygonlocationWhere[Q] - HistoryPools historyPoolWhere[Q] - HistoryPooldetails historyPooldetailWhere[Q] - HistoryProposedtreatmentareas historyProposedtreatmentareaWhere[Q] - HistoryQamosquitoinspections historyQamosquitoinspectionWhere[Q] - HistoryRodentlocations historyRodentlocationWhere[Q] - HistorySamplecollections historySamplecollectionWhere[Q] - HistorySamplelocations historySamplelocationWhere[Q] - HistoryServicerequests historyServicerequestWhere[Q] - HistorySpeciesabundances historySpeciesabundanceWhere[Q] - HistoryStormdrains historyStormdrainWhere[Q] - HistoryTimecards historyTimecardWhere[Q] - HistoryTrapdata historyTrapdatumWhere[Q] - HistoryTraplocations historyTraplocationWhere[Q] - HistoryTreatments historyTreatmentWhere[Q] - HistoryTreatmentareas historyTreatmentareaWhere[Q] - HistoryZones historyZoneWhere[Q] - HistoryZones2s historyZones2Where[Q] + NoteAudios noteAudioWhere[Q] + NoteAudioBreadcrumbs noteAudioBreadcrumbWhere[Q] + NoteAudioData noteAudioDatumWhere[Q] + NoteImages noteImageWhere[Q] + NoteImageBreadcrumbs noteImageBreadcrumbWhere[Q] + NoteImageData noteImageDatumWhere[Q] Notifications notificationWhere[Q] OauthTokens oauthTokenWhere[Q] Organizations organizationWhere[Q] @@ -236,64 +140,16 @@ func Where[Q psql.Filterable]() struct { FieldseekerZones: buildFieldseekerZoneWhere[Q](FieldseekerZones.Columns), FieldseekerZones2s: buildFieldseekerZones2Where[Q](FieldseekerZones2s.Columns), FieldseekerSyncs: buildFieldseekerSyncWhere[Q](FieldseekerSyncs.Columns), - FSContainerrelates: buildFSContainerrelateWhere[Q](FSContainerrelates.Columns), - FSFieldscoutinglogs: buildFSFieldscoutinglogWhere[Q](FSFieldscoutinglogs.Columns), - FSHabitatrelates: buildFSHabitatrelateWhere[Q](FSHabitatrelates.Columns), - FSInspectionsamples: buildFSInspectionsampleWhere[Q](FSInspectionsamples.Columns), - FSInspectionsampledetails: buildFSInspectionsampledetailWhere[Q](FSInspectionsampledetails.Columns), - FSLinelocations: buildFSLinelocationWhere[Q](FSLinelocations.Columns), - FSLocationtrackings: buildFSLocationtrackingWhere[Q](FSLocationtrackings.Columns), - FSMosquitoinspections: buildFSMosquitoinspectionWhere[Q](FSMosquitoinspections.Columns), - FSPointlocations: buildFSPointlocationWhere[Q](FSPointlocations.Columns), - FSPolygonlocations: buildFSPolygonlocationWhere[Q](FSPolygonlocations.Columns), - FSPools: buildFSPoolWhere[Q](FSPools.Columns), - FSPooldetails: buildFSPooldetailWhere[Q](FSPooldetails.Columns), - FSProposedtreatmentareas: buildFSProposedtreatmentareaWhere[Q](FSProposedtreatmentareas.Columns), - FSQamosquitoinspections: buildFSQamosquitoinspectionWhere[Q](FSQamosquitoinspections.Columns), - FSRodentlocations: buildFSRodentlocationWhere[Q](FSRodentlocations.Columns), - FSSamplecollections: buildFSSamplecollectionWhere[Q](FSSamplecollections.Columns), - FSSamplelocations: buildFSSamplelocationWhere[Q](FSSamplelocations.Columns), - FSServicerequests: buildFSServicerequestWhere[Q](FSServicerequests.Columns), - FSSpeciesabundances: buildFSSpeciesabundanceWhere[Q](FSSpeciesabundances.Columns), - FSStormdrains: buildFSStormdrainWhere[Q](FSStormdrains.Columns), - FSTimecards: buildFSTimecardWhere[Q](FSTimecards.Columns), - FSTrapdata: buildFSTrapdatumWhere[Q](FSTrapdata.Columns), - FSTraplocations: buildFSTraplocationWhere[Q](FSTraplocations.Columns), - FSTreatments: buildFSTreatmentWhere[Q](FSTreatments.Columns), - 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), - HistoryInspectionsamples: buildHistoryInspectionsampleWhere[Q](HistoryInspectionsamples.Columns), - HistoryInspectionsampledetails: buildHistoryInspectionsampledetailWhere[Q](HistoryInspectionsampledetails.Columns), - HistoryLinelocations: buildHistoryLinelocationWhere[Q](HistoryLinelocations.Columns), - HistoryLocationtrackings: buildHistoryLocationtrackingWhere[Q](HistoryLocationtrackings.Columns), - HistoryMosquitoinspections: buildHistoryMosquitoinspectionWhere[Q](HistoryMosquitoinspections.Columns), - HistoryPointlocations: buildHistoryPointlocationWhere[Q](HistoryPointlocations.Columns), - HistoryPolygonlocations: buildHistoryPolygonlocationWhere[Q](HistoryPolygonlocations.Columns), - HistoryPools: buildHistoryPoolWhere[Q](HistoryPools.Columns), - HistoryPooldetails: buildHistoryPooldetailWhere[Q](HistoryPooldetails.Columns), - HistoryProposedtreatmentareas: buildHistoryProposedtreatmentareaWhere[Q](HistoryProposedtreatmentareas.Columns), - HistoryQamosquitoinspections: buildHistoryQamosquitoinspectionWhere[Q](HistoryQamosquitoinspections.Columns), - HistoryRodentlocations: buildHistoryRodentlocationWhere[Q](HistoryRodentlocations.Columns), - HistorySamplecollections: buildHistorySamplecollectionWhere[Q](HistorySamplecollections.Columns), - HistorySamplelocations: buildHistorySamplelocationWhere[Q](HistorySamplelocations.Columns), - HistoryServicerequests: buildHistoryServicerequestWhere[Q](HistoryServicerequests.Columns), - HistorySpeciesabundances: buildHistorySpeciesabundanceWhere[Q](HistorySpeciesabundances.Columns), - HistoryStormdrains: buildHistoryStormdrainWhere[Q](HistoryStormdrains.Columns), - HistoryTimecards: buildHistoryTimecardWhere[Q](HistoryTimecards.Columns), - HistoryTrapdata: buildHistoryTrapdatumWhere[Q](HistoryTrapdata.Columns), - HistoryTraplocations: buildHistoryTraplocationWhere[Q](HistoryTraplocations.Columns), - HistoryTreatments: buildHistoryTreatmentWhere[Q](HistoryTreatments.Columns), - HistoryTreatmentareas: buildHistoryTreatmentareaWhere[Q](HistoryTreatmentareas.Columns), - HistoryZones: buildHistoryZoneWhere[Q](HistoryZones.Columns), - HistoryZones2s: buildHistoryZones2Where[Q](HistoryZones2s.Columns), + NoteAudios: buildNoteAudioWhere[Q](NoteAudios.Columns), + NoteAudioBreadcrumbs: buildNoteAudioBreadcrumbWhere[Q](NoteAudioBreadcrumbs.Columns), + NoteAudioData: buildNoteAudioDatumWhere[Q](NoteAudioData.Columns), + NoteImages: buildNoteImageWhere[Q](NoteImages.Columns), + NoteImageBreadcrumbs: buildNoteImageBreadcrumbWhere[Q](NoteImageBreadcrumbs.Columns), + NoteImageData: buildNoteImageDatumWhere[Q](NoteImageData.Columns), Notifications: buildNotificationWhere[Q](Notifications.Columns), OauthTokens: buildOauthTokenWhere[Q](OauthTokens.Columns), Organizations: buildOrganizationWhere[Q](Organizations.Columns), diff --git a/db/models/fieldseeker.containerrelate.bob.go b/db/models/fieldseeker.containerrelate.bob.go index dab4cec1..db65c3da 100644 --- a/db/models/fieldseeker.containerrelate.bob.go +++ b/db/models/fieldseeker.containerrelate.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,27 +21,47 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerContainerrelate is an object representing the database table. type FieldseekerContainerrelate struct { - Objectid int64 `db:"objectid,pk" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + Objectid int64 `db:"objectid,pk" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - Inspsampleid null.Val[uuid.UUID] `db:"inspsampleid" ` + // Original attribute from ArcGIS API is INSPSAMPLEID + Inspsampleid null.Val[uuid.UUID] `db:"inspsampleid" ` + // Original attribute from ArcGIS API is MOSQUITOINSPID Mosquitoinspid null.Val[uuid.UUID] `db:"mosquitoinspid" ` - Treatmentid null.Val[uuid.UUID] `db:"treatmentid" ` - // Container Type - Containertype null.Val[enums.FieldseekerContainerrelateMosquitocontainertypeEnum] `db:"containertype" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is TREATMENTID + Treatmentid null.Val[uuid.UUID] `db:"treatmentid" ` + // Original attribute from ArcGIS API is CONTAINERTYPE + Containertype null.Val[string] `db:"containertype" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerContainerrelateR `db:"-" ` } // FieldseekerContainerrelateSlice is an alias for a slice of pointers to FieldseekerContainerrelate. @@ -53,10 +74,15 @@ var FieldseekerContainerrelates = psql.NewTablex[*FieldseekerContainerrelate, Fi // FieldseekerContainerrelatesQuery is a query on the containerrelate table type FieldseekerContainerrelatesQuery = *psql.ViewQuery[*FieldseekerContainerrelate, FieldseekerContainerrelateSlice] +// fieldseekerContainerrelateR is where relationships are stored. +type fieldseekerContainerrelateR struct { + Organization *Organization // fieldseeker.containerrelate.containerrelate_organization_id_fkey +} + func buildFieldseekerContainerrelateColumns(alias string) fieldseekerContainerrelateColumns { return fieldseekerContainerrelateColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "inspsampleid", "mosquitoinspid", "treatmentid", "containertype", "creationdate", "creator", "editdate", "editor", "version", + "objectid", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "inspsampleid", "mosquitoinspid", "treatmentid", "containertype", "creationdate", "creator", "editdate", "editor", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.containerrelate"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -73,7 +99,10 @@ func buildFieldseekerContainerrelateColumns(alias string) fieldseekerContainerre Creator: psql.Quote(alias, "creator"), Editdate: psql.Quote(alias, "editdate"), Editor: psql.Quote(alias, "editor"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -94,7 +123,10 @@ type fieldseekerContainerrelateColumns struct { Creator psql.Expression Editdate psql.Expression Editor psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerContainerrelateColumns) Alias() string { @@ -109,25 +141,28 @@ func (fieldseekerContainerrelateColumns) AliasedAs(alias string) fieldseekerCont // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerContainerrelateSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Inspsampleid omitnull.Val[uuid.UUID] `db:"inspsampleid" ` - Mosquitoinspid omitnull.Val[uuid.UUID] `db:"mosquitoinspid" ` - Treatmentid omitnull.Val[uuid.UUID] `db:"treatmentid" ` - Containertype omitnull.Val[enums.FieldseekerContainerrelateMosquitocontainertypeEnum] `db:"containertype" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Inspsampleid omitnull.Val[uuid.UUID] `db:"inspsampleid" ` + Mosquitoinspid omitnull.Val[uuid.UUID] `db:"mosquitoinspid" ` + Treatmentid omitnull.Val[uuid.UUID] `db:"treatmentid" ` + Containertype omitnull.Val[string] `db:"containertype" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerContainerrelateSetter) SetColumns() []string { - vals := make([]string, 0, 15) + vals := make([]string, 0, 18) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -170,9 +205,18 @@ func (s FieldseekerContainerrelateSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -219,9 +263,18 @@ func (s FieldseekerContainerrelateSetter) Overwrite(t *FieldseekerContainerrelat if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerContainerrelateSetter) Apply(q *dialect.InsertQuery) { @@ -230,7 +283,7 @@ func (s *FieldseekerContainerrelateSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 15) + vals := make([]bob.Expression, 18) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -315,12 +368,30 @@ func (s *FieldseekerContainerrelateSetter) Apply(q *dialect.InsertQuery) { vals[13] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[14] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[14] = psql.Arg(s.Geometry.MustGet()) } else { vals[14] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[15] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[16] = psql.Arg(s.Version.MustGet()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[17] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -330,7 +401,7 @@ func (s FieldseekerContainerrelateSetter) UpdateMod() bob.Mod[*dialect.UpdateQue } func (s FieldseekerContainerrelateSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 15) + exprs := make([]bob.Expression, 0, 18) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -430,6 +501,20 @@ func (s FieldseekerContainerrelateSetter) Expressions(prefix ...string) []bob.Ex }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -437,6 +522,13 @@ func (s FieldseekerContainerrelateSetter) Expressions(prefix ...string) []bob.Ex }}) } + 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 } @@ -504,6 +596,7 @@ func (o *FieldseekerContainerrelate) Update(ctx context.Context, exec bob.Execut return err } + o.R = v.R *o = *v return nil @@ -524,7 +617,7 @@ func (o *FieldseekerContainerrelate) Reload(ctx context.Context, exec bob.Execut if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -574,7 +667,7 @@ func (o FieldseekerContainerrelateSlice) copyMatchingRows(from ...*FieldseekerCo if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -672,6 +765,78 @@ func (o FieldseekerContainerrelateSlice) ReloadAll(ctx context.Context, exec bob return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerContainerrelate) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerContainerrelateSlice) 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 attachFieldseekerContainerrelateOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerContainerrelate0 *FieldseekerContainerrelate, organization1 *Organization) (*FieldseekerContainerrelate, error) { + setter := &FieldseekerContainerrelateSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerContainerrelate0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerContainerrelateOrganization0: %w", err) + } + + return fieldseekerContainerrelate0, nil +} + +func (fieldseekerContainerrelate0 *FieldseekerContainerrelate) 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 = attachFieldseekerContainerrelateOrganization0(ctx, exec, 1, fieldseekerContainerrelate0, organization1) + if err != nil { + return err + } + + fieldseekerContainerrelate0.R.Organization = organization1 + + organization1.R.Containerrelates = append(organization1.R.Containerrelates, fieldseekerContainerrelate0) + + return nil +} + +func (fieldseekerContainerrelate0 *FieldseekerContainerrelate) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerContainerrelateOrganization0(ctx, exec, 1, fieldseekerContainerrelate0, organization1) + if err != nil { + return err + } + + fieldseekerContainerrelate0.R.Organization = organization1 + + organization1.R.Containerrelates = append(organization1.R.Containerrelates, fieldseekerContainerrelate0) + + return nil +} + type fieldseekerContainerrelateWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] Globalid psql.WhereNullMod[Q, uuid.UUID] @@ -682,12 +847,15 @@ type fieldseekerContainerrelateWhere[Q psql.Filterable] struct { Inspsampleid psql.WhereNullMod[Q, uuid.UUID] Mosquitoinspid psql.WhereNullMod[Q, uuid.UUID] Treatmentid psql.WhereNullMod[Q, uuid.UUID] - Containertype psql.WhereNullMod[Q, enums.FieldseekerContainerrelateMosquitocontainertypeEnum] + Containertype psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, time.Time] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerContainerrelateWhere[Q]) AliasedAs(alias string) fieldseekerContainerrelateWhere[Q] { @@ -705,11 +873,159 @@ func buildFieldseekerContainerrelateWhere[Q psql.Filterable](cols fieldseekerCon Inspsampleid: psql.WhereNull[Q, uuid.UUID](cols.Inspsampleid), Mosquitoinspid: psql.WhereNull[Q, uuid.UUID](cols.Mosquitoinspid), Treatmentid: psql.WhereNull[Q, uuid.UUID](cols.Treatmentid), - Containertype: psql.WhereNull[Q, enums.FieldseekerContainerrelateMosquitocontainertypeEnum](cols.Containertype), + Containertype: psql.WhereNull[Q, string](cols.Containertype), Creationdate: psql.WhereNull[Q, time.Time](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerContainerrelate) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerContainerrelate cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Containerrelates = FieldseekerContainerrelateSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerContainerrelate has no relationship %q", name) + } +} + +type fieldseekerContainerrelatePreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerContainerrelatePreloader() fieldseekerContainerrelatePreloader { + return fieldseekerContainerrelatePreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerContainerrelates, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerContainerrelateThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerContainerrelateThenLoader[Q orm.Loadable]() fieldseekerContainerrelateThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerContainerrelateThenLoader[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 fieldseekerContainerrelate's Organization into the .R struct +func (o *FieldseekerContainerrelate) 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.Containerrelates = FieldseekerContainerrelateSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerContainerrelate's Organization into the .R struct +func (os FieldseekerContainerrelateSlice) 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.Containerrelates = append(rel.R.Containerrelates, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerContainerrelateJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerContainerrelateJoins[Q]) aliasedAs(alias string) fieldseekerContainerrelateJoins[Q] { + return buildFieldseekerContainerrelateJoins[Q](buildFieldseekerContainerrelateColumns(alias), j.typ) +} + +func buildFieldseekerContainerrelateJoins[Q dialect.Joinable](cols fieldseekerContainerrelateColumns, typ string) fieldseekerContainerrelateJoins[Q] { + return fieldseekerContainerrelateJoins[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/db/models/fieldseeker.fieldscoutinglog.bob.go b/db/models/fieldseeker.fieldscoutinglog.bob.go index 0e582dab..d0b8b358 100644 --- a/db/models/fieldseeker.fieldscoutinglog.bob.go +++ b/db/models/fieldseeker.fieldscoutinglog.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,24 +21,41 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerFieldscoutinglog is an object representing the database table. type FieldseekerFieldscoutinglog struct { Objectid int64 `db:"objectid,pk" ` - // Status - Status null.Val[enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum] `db:"status" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is STATUS + Status null.Val[int16] `db:"status" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date + LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerFieldscoutinglogR `db:"-" ` } // FieldseekerFieldscoutinglogSlice is an alias for a slice of pointers to FieldseekerFieldscoutinglog. @@ -50,10 +68,15 @@ var FieldseekerFieldscoutinglogs = psql.NewTablex[*FieldseekerFieldscoutinglog, // FieldseekerFieldscoutinglogsQuery is a query on the fieldscoutinglog table type FieldseekerFieldscoutinglogsQuery = *psql.ViewQuery[*FieldseekerFieldscoutinglog, FieldseekerFieldscoutinglogSlice] +// fieldseekerFieldscoutinglogR is where relationships are stored. +type fieldseekerFieldscoutinglogR struct { + Organization *Organization // fieldseeker.fieldscoutinglog.fieldscoutinglog_organization_id_fkey +} + func buildFieldseekerFieldscoutinglogColumns(alias string) fieldseekerFieldscoutinglogColumns { return fieldseekerFieldscoutinglogColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "status", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "creationdate", "creator", "editdate", "editor", "version", + "objectid", "status", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "creationdate", "creator", "editdate", "editor", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.fieldscoutinglog"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -67,7 +90,10 @@ func buildFieldseekerFieldscoutinglogColumns(alias string) fieldseekerFieldscout Creator: psql.Quote(alias, "creator"), Editdate: psql.Quote(alias, "editdate"), Editor: psql.Quote(alias, "editor"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -85,7 +111,10 @@ type fieldseekerFieldscoutinglogColumns struct { Creator psql.Expression Editdate psql.Expression Editor psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerFieldscoutinglogColumns) Alias() string { @@ -100,22 +129,25 @@ func (fieldseekerFieldscoutinglogColumns) AliasedAs(alias string) fieldseekerFie // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerFieldscoutinglogSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Status omitnull.Val[enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum] `db:"status" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Status omitnull.Val[int16] `db:"status" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerFieldscoutinglogSetter) SetColumns() []string { - vals := make([]string, 0, 12) + vals := make([]string, 0, 15) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -149,9 +181,18 @@ func (s FieldseekerFieldscoutinglogSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -189,9 +230,18 @@ func (s FieldseekerFieldscoutinglogSetter) Overwrite(t *FieldseekerFieldscouting if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerFieldscoutinglogSetter) Apply(q *dialect.InsertQuery) { @@ -200,7 +250,7 @@ func (s *FieldseekerFieldscoutinglogSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 12) + vals := make([]bob.Expression, 15) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -267,12 +317,30 @@ func (s *FieldseekerFieldscoutinglogSetter) Apply(q *dialect.InsertQuery) { vals[10] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[11] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[11] = psql.Arg(s.Geometry.MustGet()) } else { vals[11] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[12] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[12] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[13] = psql.Arg(s.Version.MustGet()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[14] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -282,7 +350,7 @@ func (s FieldseekerFieldscoutinglogSetter) UpdateMod() bob.Mod[*dialect.UpdateQu } func (s FieldseekerFieldscoutinglogSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 12) + exprs := make([]bob.Expression, 0, 15) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -361,6 +429,20 @@ func (s FieldseekerFieldscoutinglogSetter) Expressions(prefix ...string) []bob.E }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -368,6 +450,13 @@ func (s FieldseekerFieldscoutinglogSetter) Expressions(prefix ...string) []bob.E }}) } + 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 } @@ -435,6 +524,7 @@ func (o *FieldseekerFieldscoutinglog) Update(ctx context.Context, exec bob.Execu return err } + o.R = v.R *o = *v return nil @@ -455,7 +545,7 @@ func (o *FieldseekerFieldscoutinglog) Reload(ctx context.Context, exec bob.Execu if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -505,7 +595,7 @@ func (o FieldseekerFieldscoutinglogSlice) copyMatchingRows(from ...*FieldseekerF if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -603,9 +693,81 @@ func (o FieldseekerFieldscoutinglogSlice) ReloadAll(ctx context.Context, exec bo return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerFieldscoutinglog) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerFieldscoutinglogSlice) 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 attachFieldseekerFieldscoutinglogOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerFieldscoutinglog0 *FieldseekerFieldscoutinglog, organization1 *Organization) (*FieldseekerFieldscoutinglog, error) { + setter := &FieldseekerFieldscoutinglogSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerFieldscoutinglog0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerFieldscoutinglogOrganization0: %w", err) + } + + return fieldseekerFieldscoutinglog0, nil +} + +func (fieldseekerFieldscoutinglog0 *FieldseekerFieldscoutinglog) 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 = attachFieldseekerFieldscoutinglogOrganization0(ctx, exec, 1, fieldseekerFieldscoutinglog0, organization1) + if err != nil { + return err + } + + fieldseekerFieldscoutinglog0.R.Organization = organization1 + + organization1.R.Fieldscoutinglogs = append(organization1.R.Fieldscoutinglogs, fieldseekerFieldscoutinglog0) + + return nil +} + +func (fieldseekerFieldscoutinglog0 *FieldseekerFieldscoutinglog) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerFieldscoutinglogOrganization0(ctx, exec, 1, fieldseekerFieldscoutinglog0, organization1) + if err != nil { + return err + } + + fieldseekerFieldscoutinglog0.R.Organization = organization1 + + organization1.R.Fieldscoutinglogs = append(organization1.R.Fieldscoutinglogs, fieldseekerFieldscoutinglog0) + + return nil +} + type fieldseekerFieldscoutinglogWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] - Status psql.WhereNullMod[Q, enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum] + Status psql.WhereNullMod[Q, int16] Globalid psql.WhereNullMod[Q, uuid.UUID] CreatedUser psql.WhereNullMod[Q, string] CreatedDate psql.WhereNullMod[Q, time.Time] @@ -615,7 +777,10 @@ type fieldseekerFieldscoutinglogWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerFieldscoutinglogWhere[Q]) AliasedAs(alias string) fieldseekerFieldscoutinglogWhere[Q] { @@ -625,7 +790,7 @@ func (fieldseekerFieldscoutinglogWhere[Q]) AliasedAs(alias string) fieldseekerFi func buildFieldseekerFieldscoutinglogWhere[Q psql.Filterable](cols fieldseekerFieldscoutinglogColumns) fieldseekerFieldscoutinglogWhere[Q] { return fieldseekerFieldscoutinglogWhere[Q]{ Objectid: psql.Where[Q, int64](cols.Objectid), - Status: psql.WhereNull[Q, enums.FieldseekerFieldscoutinglogFieldscoutingsymbologyEnum](cols.Status), + Status: psql.WhereNull[Q, int16](cols.Status), Globalid: psql.WhereNull[Q, uuid.UUID](cols.Globalid), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), CreatedDate: psql.WhereNull[Q, time.Time](cols.CreatedDate), @@ -635,6 +800,154 @@ func buildFieldseekerFieldscoutinglogWhere[Q psql.Filterable](cols fieldseekerFi Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerFieldscoutinglog) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerFieldscoutinglog cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Fieldscoutinglogs = FieldseekerFieldscoutinglogSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerFieldscoutinglog has no relationship %q", name) + } +} + +type fieldseekerFieldscoutinglogPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerFieldscoutinglogPreloader() fieldseekerFieldscoutinglogPreloader { + return fieldseekerFieldscoutinglogPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerFieldscoutinglogs, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerFieldscoutinglogThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerFieldscoutinglogThenLoader[Q orm.Loadable]() fieldseekerFieldscoutinglogThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerFieldscoutinglogThenLoader[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 fieldseekerFieldscoutinglog's Organization into the .R struct +func (o *FieldseekerFieldscoutinglog) 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.Fieldscoutinglogs = FieldseekerFieldscoutinglogSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerFieldscoutinglog's Organization into the .R struct +func (os FieldseekerFieldscoutinglogSlice) 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.Fieldscoutinglogs = append(rel.R.Fieldscoutinglogs, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerFieldscoutinglogJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerFieldscoutinglogJoins[Q]) aliasedAs(alias string) fieldseekerFieldscoutinglogJoins[Q] { + return buildFieldseekerFieldscoutinglogJoins[Q](buildFieldseekerFieldscoutinglogColumns(alias), j.typ) +} + +func buildFieldseekerFieldscoutinglogJoins[Q dialect.Joinable](cols fieldseekerFieldscoutinglogColumns, typ string) fieldseekerFieldscoutinglogJoins[Q] { + return fieldseekerFieldscoutinglogJoins[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/db/models/fieldseeker.habitatrelate.bob.go b/db/models/fieldseeker.habitatrelate.bob.go index 5630ec64..c972fab2 100644 --- a/db/models/fieldseeker.habitatrelate.bob.go +++ b/db/models/fieldseeker.habitatrelate.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,25 +21,43 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerHabitatrelate is an object representing the database table. type FieldseekerHabitatrelate struct { - Objectid int64 `db:"objectid,pk" ` - ForeignID null.Val[uuid.UUID] `db:"foreign_id" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + Objectid int64 `db:"objectid,pk" ` + // Original attribute from ArcGIS API is FOREIGN_ID + ForeignID null.Val[uuid.UUID] `db:"foreign_id" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - // Habitat Type - Habitattype null.Val[enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284] `db:"habitattype" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is HABITATTYPE + Habitattype null.Val[string] `db:"habitattype" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerHabitatrelateR `db:"-" ` } // FieldseekerHabitatrelateSlice is an alias for a slice of pointers to FieldseekerHabitatrelate. @@ -51,10 +70,15 @@ var FieldseekerHabitatrelates = psql.NewTablex[*FieldseekerHabitatrelate, Fields // FieldseekerHabitatrelatesQuery is a query on the habitatrelate table type FieldseekerHabitatrelatesQuery = *psql.ViewQuery[*FieldseekerHabitatrelate, FieldseekerHabitatrelateSlice] +// fieldseekerHabitatrelateR is where relationships are stored. +type fieldseekerHabitatrelateR struct { + Organization *Organization // fieldseeker.habitatrelate.habitatrelate_organization_id_fkey +} + func buildFieldseekerHabitatrelateColumns(alias string) fieldseekerHabitatrelateColumns { return fieldseekerHabitatrelateColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "foreign_id", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "habitattype", "creationdate", "creator", "editdate", "editor", "version", + "objectid", "foreign_id", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "habitattype", "creationdate", "creator", "editdate", "editor", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.habitatrelate"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -69,7 +93,10 @@ func buildFieldseekerHabitatrelateColumns(alias string) fieldseekerHabitatrelate Creator: psql.Quote(alias, "creator"), Editdate: psql.Quote(alias, "editdate"), Editor: psql.Quote(alias, "editor"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -88,7 +115,10 @@ type fieldseekerHabitatrelateColumns struct { Creator psql.Expression Editdate psql.Expression Editor psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerHabitatrelateColumns) Alias() string { @@ -103,23 +133,26 @@ func (fieldseekerHabitatrelateColumns) AliasedAs(alias string) fieldseekerHabita // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerHabitatrelateSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - ForeignID omitnull.Val[uuid.UUID] `db:"foreign_id" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Habitattype omitnull.Val[enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284] `db:"habitattype" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + ForeignID omitnull.Val[uuid.UUID] `db:"foreign_id" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Habitattype omitnull.Val[string] `db:"habitattype" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerHabitatrelateSetter) SetColumns() []string { - vals := make([]string, 0, 13) + vals := make([]string, 0, 16) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -156,9 +189,18 @@ func (s FieldseekerHabitatrelateSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -199,9 +241,18 @@ func (s FieldseekerHabitatrelateSetter) Overwrite(t *FieldseekerHabitatrelate) { if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerHabitatrelateSetter) Apply(q *dialect.InsertQuery) { @@ -210,7 +261,7 @@ func (s *FieldseekerHabitatrelateSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 13) + vals := make([]bob.Expression, 16) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -283,12 +334,30 @@ func (s *FieldseekerHabitatrelateSetter) Apply(q *dialect.InsertQuery) { vals[11] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[12] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[12] = psql.Arg(s.Geometry.MustGet()) } else { vals[12] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[13] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[14] = psql.Arg(s.Version.MustGet()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[15] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -298,7 +367,7 @@ func (s FieldseekerHabitatrelateSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery } func (s FieldseekerHabitatrelateSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 13) + exprs := make([]bob.Expression, 0, 16) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -384,6 +453,20 @@ func (s FieldseekerHabitatrelateSetter) Expressions(prefix ...string) []bob.Expr }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -391,6 +474,13 @@ func (s FieldseekerHabitatrelateSetter) Expressions(prefix ...string) []bob.Expr }}) } + 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 } @@ -458,6 +548,7 @@ func (o *FieldseekerHabitatrelate) Update(ctx context.Context, exec bob.Executor return err } + o.R = v.R *o = *v return nil @@ -478,7 +569,7 @@ func (o *FieldseekerHabitatrelate) Reload(ctx context.Context, exec bob.Executor if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -528,7 +619,7 @@ func (o FieldseekerHabitatrelateSlice) copyMatchingRows(from ...*FieldseekerHabi if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -626,6 +717,78 @@ func (o FieldseekerHabitatrelateSlice) ReloadAll(ctx context.Context, exec bob.E return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerHabitatrelate) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerHabitatrelateSlice) 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 attachFieldseekerHabitatrelateOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerHabitatrelate0 *FieldseekerHabitatrelate, organization1 *Organization) (*FieldseekerHabitatrelate, error) { + setter := &FieldseekerHabitatrelateSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerHabitatrelate0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerHabitatrelateOrganization0: %w", err) + } + + return fieldseekerHabitatrelate0, nil +} + +func (fieldseekerHabitatrelate0 *FieldseekerHabitatrelate) 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 = attachFieldseekerHabitatrelateOrganization0(ctx, exec, 1, fieldseekerHabitatrelate0, organization1) + if err != nil { + return err + } + + fieldseekerHabitatrelate0.R.Organization = organization1 + + organization1.R.Habitatrelates = append(organization1.R.Habitatrelates, fieldseekerHabitatrelate0) + + return nil +} + +func (fieldseekerHabitatrelate0 *FieldseekerHabitatrelate) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerHabitatrelateOrganization0(ctx, exec, 1, fieldseekerHabitatrelate0, organization1) + if err != nil { + return err + } + + fieldseekerHabitatrelate0.R.Organization = organization1 + + organization1.R.Habitatrelates = append(organization1.R.Habitatrelates, fieldseekerHabitatrelate0) + + return nil +} + type fieldseekerHabitatrelateWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] ForeignID psql.WhereNullMod[Q, uuid.UUID] @@ -634,12 +797,15 @@ type fieldseekerHabitatrelateWhere[Q psql.Filterable] struct { CreatedDate psql.WhereNullMod[Q, time.Time] LastEditedUser psql.WhereNullMod[Q, string] LastEditedDate psql.WhereNullMod[Q, time.Time] - Habitattype psql.WhereNullMod[Q, enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284] + Habitattype psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, time.Time] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerHabitatrelateWhere[Q]) AliasedAs(alias string) fieldseekerHabitatrelateWhere[Q] { @@ -655,11 +821,159 @@ func buildFieldseekerHabitatrelateWhere[Q psql.Filterable](cols fieldseekerHabit CreatedDate: psql.WhereNull[Q, time.Time](cols.CreatedDate), LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), LastEditedDate: psql.WhereNull[Q, time.Time](cols.LastEditedDate), - Habitattype: psql.WhereNull[Q, enums.FieldseekerHabitatrelateHabitatrelateHabitattype2e81cf2f550e400783cf284](cols.Habitattype), + Habitattype: psql.WhereNull[Q, string](cols.Habitattype), Creationdate: psql.WhereNull[Q, time.Time](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerHabitatrelate) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerHabitatrelate cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Habitatrelates = FieldseekerHabitatrelateSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerHabitatrelate has no relationship %q", name) + } +} + +type fieldseekerHabitatrelatePreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerHabitatrelatePreloader() fieldseekerHabitatrelatePreloader { + return fieldseekerHabitatrelatePreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerHabitatrelates, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerHabitatrelateThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerHabitatrelateThenLoader[Q orm.Loadable]() fieldseekerHabitatrelateThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerHabitatrelateThenLoader[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 fieldseekerHabitatrelate's Organization into the .R struct +func (o *FieldseekerHabitatrelate) 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.Habitatrelates = FieldseekerHabitatrelateSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerHabitatrelate's Organization into the .R struct +func (os FieldseekerHabitatrelateSlice) 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.Habitatrelates = append(rel.R.Habitatrelates, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerHabitatrelateJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerHabitatrelateJoins[Q]) aliasedAs(alias string) fieldseekerHabitatrelateJoins[Q] { + return buildFieldseekerHabitatrelateJoins[Q](buildFieldseekerHabitatrelateColumns(alias), j.typ) +} + +func buildFieldseekerHabitatrelateJoins[Q dialect.Joinable](cols fieldseekerHabitatrelateColumns, typ string) fieldseekerHabitatrelateJoins[Q] { + return fieldseekerHabitatrelateJoins[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/db/models/fieldseeker.inspectionsample.bob.go b/db/models/fieldseeker.inspectionsample.bob.go index 809aab0b..6358c928 100644 --- a/db/models/fieldseeker.inspectionsample.bob.go +++ b/db/models/fieldseeker.inspectionsample.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,29 +21,47 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerInspectionsample is an object representing the database table. type FieldseekerInspectionsample struct { - Objectid int64 `db:"objectid,pk" ` - InspID null.Val[uuid.UUID] `db:"insp_id" ` - // Sample ID + Objectid int64 `db:"objectid,pk" ` + // Original attribute from ArcGIS API is INSP_ID + InspID null.Val[uuid.UUID] `db:"insp_id" ` + // Original attribute from ArcGIS API is SAMPLEID Sampleid null.Val[string] `db:"sampleid" ` - // Processed - Processed null.Val[enums.FieldseekerInspectionsampleNotinuitFEnum] `db:"processed" ` - // Tech Identifying Species in Lab - Idbytech null.Val[string] `db:"idbytech" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is PROCESSED + Processed null.Val[int16] `db:"processed" ` + // Original attribute from ArcGIS API is IDBYTECH + Idbytech null.Val[string] `db:"idbytech" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerInspectionsampleR `db:"-" ` } // FieldseekerInspectionsampleSlice is an alias for a slice of pointers to FieldseekerInspectionsample. @@ -55,10 +74,15 @@ var FieldseekerInspectionsamples = psql.NewTablex[*FieldseekerInspectionsample, // FieldseekerInspectionsamplesQuery is a query on the inspectionsample table type FieldseekerInspectionsamplesQuery = *psql.ViewQuery[*FieldseekerInspectionsample, FieldseekerInspectionsampleSlice] +// fieldseekerInspectionsampleR is where relationships are stored. +type fieldseekerInspectionsampleR struct { + Organization *Organization // fieldseeker.inspectionsample.inspectionsample_organization_id_fkey +} + func buildFieldseekerInspectionsampleColumns(alias string) fieldseekerInspectionsampleColumns { return fieldseekerInspectionsampleColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "insp_id", "sampleid", "processed", "idbytech", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "creationdate", "creator", "editdate", "editor", "version", + "objectid", "insp_id", "sampleid", "processed", "idbytech", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "creationdate", "creator", "editdate", "editor", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.inspectionsample"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -75,7 +99,10 @@ func buildFieldseekerInspectionsampleColumns(alias string) fieldseekerInspection Creator: psql.Quote(alias, "creator"), Editdate: psql.Quote(alias, "editdate"), Editor: psql.Quote(alias, "editor"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -96,7 +123,10 @@ type fieldseekerInspectionsampleColumns struct { Creator psql.Expression Editdate psql.Expression Editor psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerInspectionsampleColumns) Alias() string { @@ -111,25 +141,28 @@ func (fieldseekerInspectionsampleColumns) AliasedAs(alias string) fieldseekerIns // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerInspectionsampleSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - InspID omitnull.Val[uuid.UUID] `db:"insp_id" ` - Sampleid omitnull.Val[string] `db:"sampleid" ` - Processed omitnull.Val[enums.FieldseekerInspectionsampleNotinuitFEnum] `db:"processed" ` - Idbytech omitnull.Val[string] `db:"idbytech" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + InspID omitnull.Val[uuid.UUID] `db:"insp_id" ` + Sampleid omitnull.Val[string] `db:"sampleid" ` + Processed omitnull.Val[int16] `db:"processed" ` + Idbytech omitnull.Val[string] `db:"idbytech" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerInspectionsampleSetter) SetColumns() []string { - vals := make([]string, 0, 15) + vals := make([]string, 0, 18) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -172,9 +205,18 @@ func (s FieldseekerInspectionsampleSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -221,9 +263,18 @@ func (s FieldseekerInspectionsampleSetter) Overwrite(t *FieldseekerInspectionsam if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerInspectionsampleSetter) Apply(q *dialect.InsertQuery) { @@ -232,7 +283,7 @@ func (s *FieldseekerInspectionsampleSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 15) + vals := make([]bob.Expression, 18) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -317,12 +368,30 @@ func (s *FieldseekerInspectionsampleSetter) Apply(q *dialect.InsertQuery) { vals[13] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[14] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[14] = psql.Arg(s.Geometry.MustGet()) } else { vals[14] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[15] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[16] = psql.Arg(s.Version.MustGet()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[17] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -332,7 +401,7 @@ func (s FieldseekerInspectionsampleSetter) UpdateMod() bob.Mod[*dialect.UpdateQu } func (s FieldseekerInspectionsampleSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 15) + exprs := make([]bob.Expression, 0, 18) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -432,6 +501,20 @@ func (s FieldseekerInspectionsampleSetter) Expressions(prefix ...string) []bob.E }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -439,6 +522,13 @@ func (s FieldseekerInspectionsampleSetter) Expressions(prefix ...string) []bob.E }}) } + 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 } @@ -506,6 +596,7 @@ func (o *FieldseekerInspectionsample) Update(ctx context.Context, exec bob.Execu return err } + o.R = v.R *o = *v return nil @@ -526,7 +617,7 @@ func (o *FieldseekerInspectionsample) Reload(ctx context.Context, exec bob.Execu if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -576,7 +667,7 @@ func (o FieldseekerInspectionsampleSlice) copyMatchingRows(from ...*FieldseekerI if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -674,11 +765,83 @@ func (o FieldseekerInspectionsampleSlice) ReloadAll(ctx context.Context, exec bo return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerInspectionsample) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerInspectionsampleSlice) 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 attachFieldseekerInspectionsampleOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerInspectionsample0 *FieldseekerInspectionsample, organization1 *Organization) (*FieldseekerInspectionsample, error) { + setter := &FieldseekerInspectionsampleSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerInspectionsample0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerInspectionsampleOrganization0: %w", err) + } + + return fieldseekerInspectionsample0, nil +} + +func (fieldseekerInspectionsample0 *FieldseekerInspectionsample) 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 = attachFieldseekerInspectionsampleOrganization0(ctx, exec, 1, fieldseekerInspectionsample0, organization1) + if err != nil { + return err + } + + fieldseekerInspectionsample0.R.Organization = organization1 + + organization1.R.Inspectionsamples = append(organization1.R.Inspectionsamples, fieldseekerInspectionsample0) + + return nil +} + +func (fieldseekerInspectionsample0 *FieldseekerInspectionsample) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerInspectionsampleOrganization0(ctx, exec, 1, fieldseekerInspectionsample0, organization1) + if err != nil { + return err + } + + fieldseekerInspectionsample0.R.Organization = organization1 + + organization1.R.Inspectionsamples = append(organization1.R.Inspectionsamples, fieldseekerInspectionsample0) + + return nil +} + type fieldseekerInspectionsampleWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] InspID psql.WhereNullMod[Q, uuid.UUID] Sampleid psql.WhereNullMod[Q, string] - Processed psql.WhereNullMod[Q, enums.FieldseekerInspectionsampleNotinuitFEnum] + Processed psql.WhereNullMod[Q, int16] Idbytech psql.WhereNullMod[Q, string] Globalid psql.WhereNullMod[Q, uuid.UUID] CreatedUser psql.WhereNullMod[Q, string] @@ -689,7 +852,10 @@ type fieldseekerInspectionsampleWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerInspectionsampleWhere[Q]) AliasedAs(alias string) fieldseekerInspectionsampleWhere[Q] { @@ -701,7 +867,7 @@ func buildFieldseekerInspectionsampleWhere[Q psql.Filterable](cols fieldseekerIn Objectid: psql.Where[Q, int64](cols.Objectid), InspID: psql.WhereNull[Q, uuid.UUID](cols.InspID), Sampleid: psql.WhereNull[Q, string](cols.Sampleid), - Processed: psql.WhereNull[Q, enums.FieldseekerInspectionsampleNotinuitFEnum](cols.Processed), + Processed: psql.WhereNull[Q, int16](cols.Processed), Idbytech: psql.WhereNull[Q, string](cols.Idbytech), Globalid: psql.WhereNull[Q, uuid.UUID](cols.Globalid), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), @@ -712,6 +878,154 @@ func buildFieldseekerInspectionsampleWhere[Q psql.Filterable](cols fieldseekerIn Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerInspectionsample) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerInspectionsample cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Inspectionsamples = FieldseekerInspectionsampleSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerInspectionsample has no relationship %q", name) + } +} + +type fieldseekerInspectionsamplePreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerInspectionsamplePreloader() fieldseekerInspectionsamplePreloader { + return fieldseekerInspectionsamplePreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerInspectionsamples, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerInspectionsampleThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerInspectionsampleThenLoader[Q orm.Loadable]() fieldseekerInspectionsampleThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerInspectionsampleThenLoader[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 fieldseekerInspectionsample's Organization into the .R struct +func (o *FieldseekerInspectionsample) 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.Inspectionsamples = FieldseekerInspectionsampleSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerInspectionsample's Organization into the .R struct +func (os FieldseekerInspectionsampleSlice) 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.Inspectionsamples = append(rel.R.Inspectionsamples, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerInspectionsampleJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerInspectionsampleJoins[Q]) aliasedAs(alias string) fieldseekerInspectionsampleJoins[Q] { + return buildFieldseekerInspectionsampleJoins[Q](buildFieldseekerInspectionsampleColumns(alias), j.typ) +} + +func buildFieldseekerInspectionsampleJoins[Q dialect.Joinable](cols fieldseekerInspectionsampleColumns, typ string) fieldseekerInspectionsampleJoins[Q] { + return fieldseekerInspectionsampleJoins[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/db/models/fieldseeker.inspectionsampledetail.bob.go b/db/models/fieldseeker.inspectionsampledetail.bob.go index fe7d8446..c6ce5421 100644 --- a/db/models/fieldseeker.inspectionsampledetail.bob.go +++ b/db/models/fieldseeker.inspectionsampledetail.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,50 +21,69 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerInspectionsampledetail is an object representing the database table. type FieldseekerInspectionsampledetail struct { - Objectid int64 `db:"objectid,pk" ` + Objectid int64 `db:"objectid,pk" ` + // Original attribute from ArcGIS API is INSPSAMPLE_ID InspsampleID null.Val[uuid.UUID] `db:"inspsample_id" ` - // Field Species - Fieldspecies null.Val[enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum] `db:"fieldspecies" ` - // Field Larva Count + // Original attribute from ArcGIS API is FIELDSPECIES + Fieldspecies null.Val[string] `db:"fieldspecies" ` + // Original attribute from ArcGIS API is FLARVCOUNT Flarvcount null.Val[int16] `db:"flarvcount" ` - // Field Pupa Count + // Original attribute from ArcGIS API is FPUPCOUNT Fpupcount null.Val[int16] `db:"fpupcount" ` - // Field Egg Count + // Original attribute from ArcGIS API is FEGGCOUNT Feggcount null.Val[int16] `db:"feggcount" ` - // Field Larval Stages + // Original attribute from ArcGIS API is FLSTAGES Flstages null.Val[string] `db:"flstages" ` - // Field Dominant Stage - Fdomstage null.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum] `db:"fdomstage" ` - // Field Adult Activity - Fadultact null.Val[enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum] `db:"fadultact" ` - // Lab Species + // Original attribute from ArcGIS API is FDOMSTAGE + Fdomstage null.Val[string] `db:"fdomstage" ` + // Original attribute from ArcGIS API is FADULTACT + Fadultact null.Val[string] `db:"fadultact" ` + // Original attribute from ArcGIS API is LABSPECIES Labspecies null.Val[string] `db:"labspecies" ` - // Lab Larva Count + // Original attribute from ArcGIS API is LLARVCOUNT Llarvcount null.Val[int16] `db:"llarvcount" ` - // Lab Pupa Count + // Original attribute from ArcGIS API is LPUPCOUNT Lpupcount null.Val[int16] `db:"lpupcount" ` - // Lab Egg Count + // Original attribute from ArcGIS API is LEGGCOUNT Leggcount null.Val[int16] `db:"leggcount" ` - // Lab Dominant Stage - Ldomstage null.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum] `db:"ldomstage" ` - // Comments - Comments null.Val[string] `db:"comments" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is LDOMSTAGE + Ldomstage null.Val[string] `db:"ldomstage" ` + // Original attribute from ArcGIS API is COMMENTS + Comments null.Val[string] `db:"comments" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - Processed null.Val[int16] `db:"processed" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is PROCESSED + Processed null.Val[int16] `db:"processed" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerInspectionsampledetailR `db:"-" ` } // FieldseekerInspectionsampledetailSlice is an alias for a slice of pointers to FieldseekerInspectionsampledetail. @@ -76,10 +96,15 @@ var FieldseekerInspectionsampledetails = psql.NewTablex[*FieldseekerInspectionsa // FieldseekerInspectionsampledetailsQuery is a query on the inspectionsampledetail table type FieldseekerInspectionsampledetailsQuery = *psql.ViewQuery[*FieldseekerInspectionsampledetail, FieldseekerInspectionsampledetailSlice] +// fieldseekerInspectionsampledetailR is where relationships are stored. +type fieldseekerInspectionsampledetailR struct { + Organization *Organization // fieldseeker.inspectionsampledetail.inspectionsampledetail_organization_id_fkey +} + func buildFieldseekerInspectionsampledetailColumns(alias string) fieldseekerInspectionsampledetailColumns { return fieldseekerInspectionsampledetailColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "inspsample_id", "fieldspecies", "flarvcount", "fpupcount", "feggcount", "flstages", "fdomstage", "fadultact", "labspecies", "llarvcount", "lpupcount", "leggcount", "ldomstage", "comments", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "processed", "creationdate", "creator", "editdate", "editor", "version", + "objectid", "inspsample_id", "fieldspecies", "flarvcount", "fpupcount", "feggcount", "flstages", "fdomstage", "fadultact", "labspecies", "llarvcount", "lpupcount", "leggcount", "ldomstage", "comments", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "processed", "creationdate", "creator", "editdate", "editor", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.inspectionsampledetail"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -107,7 +132,10 @@ func buildFieldseekerInspectionsampledetailColumns(alias string) fieldseekerInsp Creator: psql.Quote(alias, "creator"), Editdate: psql.Quote(alias, "editdate"), Editor: psql.Quote(alias, "editor"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -139,7 +167,10 @@ type fieldseekerInspectionsampledetailColumns struct { Creator psql.Expression Editdate psql.Expression Editor psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerInspectionsampledetailColumns) Alias() string { @@ -154,36 +185,39 @@ func (fieldseekerInspectionsampledetailColumns) AliasedAs(alias string) fieldsee // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerInspectionsampledetailSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - InspsampleID omitnull.Val[uuid.UUID] `db:"inspsample_id" ` - Fieldspecies omitnull.Val[enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum] `db:"fieldspecies" ` - Flarvcount omitnull.Val[int16] `db:"flarvcount" ` - Fpupcount omitnull.Val[int16] `db:"fpupcount" ` - Feggcount omitnull.Val[int16] `db:"feggcount" ` - Flstages omitnull.Val[string] `db:"flstages" ` - Fdomstage omitnull.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum] `db:"fdomstage" ` - Fadultact omitnull.Val[enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum] `db:"fadultact" ` - Labspecies omitnull.Val[string] `db:"labspecies" ` - Llarvcount omitnull.Val[int16] `db:"llarvcount" ` - Lpupcount omitnull.Val[int16] `db:"lpupcount" ` - Leggcount omitnull.Val[int16] `db:"leggcount" ` - Ldomstage omitnull.Val[enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum] `db:"ldomstage" ` - Comments omitnull.Val[string] `db:"comments" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Processed omitnull.Val[int16] `db:"processed" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + InspsampleID omitnull.Val[uuid.UUID] `db:"inspsample_id" ` + Fieldspecies omitnull.Val[string] `db:"fieldspecies" ` + Flarvcount omitnull.Val[int16] `db:"flarvcount" ` + Fpupcount omitnull.Val[int16] `db:"fpupcount" ` + Feggcount omitnull.Val[int16] `db:"feggcount" ` + Flstages omitnull.Val[string] `db:"flstages" ` + Fdomstage omitnull.Val[string] `db:"fdomstage" ` + Fadultact omitnull.Val[string] `db:"fadultact" ` + Labspecies omitnull.Val[string] `db:"labspecies" ` + Llarvcount omitnull.Val[int16] `db:"llarvcount" ` + Lpupcount omitnull.Val[int16] `db:"lpupcount" ` + Leggcount omitnull.Val[int16] `db:"leggcount" ` + Ldomstage omitnull.Val[string] `db:"ldomstage" ` + Comments omitnull.Val[string] `db:"comments" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Processed omitnull.Val[int16] `db:"processed" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerInspectionsampledetailSetter) SetColumns() []string { - vals := make([]string, 0, 26) + vals := make([]string, 0, 29) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -259,9 +293,18 @@ func (s FieldseekerInspectionsampledetailSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -341,9 +384,18 @@ func (s FieldseekerInspectionsampledetailSetter) Overwrite(t *FieldseekerInspect if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerInspectionsampledetailSetter) Apply(q *dialect.InsertQuery) { @@ -352,7 +404,7 @@ func (s *FieldseekerInspectionsampledetailSetter) Apply(q *dialect.InsertQuery) }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 26) + vals := make([]bob.Expression, 29) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -503,12 +555,30 @@ func (s *FieldseekerInspectionsampledetailSetter) Apply(q *dialect.InsertQuery) vals[24] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[25] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[25] = psql.Arg(s.Geometry.MustGet()) } else { vals[25] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[26] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[27] = psql.Arg(s.Version.MustGet()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[28] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[28] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -518,7 +588,7 @@ func (s FieldseekerInspectionsampledetailSetter) UpdateMod() bob.Mod[*dialect.Up } func (s FieldseekerInspectionsampledetailSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 26) + exprs := make([]bob.Expression, 0, 29) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -695,6 +765,20 @@ func (s FieldseekerInspectionsampledetailSetter) Expressions(prefix ...string) [ }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -702,6 +786,13 @@ func (s FieldseekerInspectionsampledetailSetter) Expressions(prefix ...string) [ }}) } + 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 } @@ -769,6 +860,7 @@ func (o *FieldseekerInspectionsampledetail) Update(ctx context.Context, exec bob return err } + o.R = v.R *o = *v return nil @@ -789,7 +881,7 @@ func (o *FieldseekerInspectionsampledetail) Reload(ctx context.Context, exec bob if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -839,7 +931,7 @@ func (o FieldseekerInspectionsampledetailSlice) copyMatchingRows(from ...*Fields if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -937,21 +1029,93 @@ func (o FieldseekerInspectionsampledetailSlice) ReloadAll(ctx context.Context, e return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerInspectionsampledetail) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerInspectionsampledetailSlice) 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 attachFieldseekerInspectionsampledetailOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerInspectionsampledetail0 *FieldseekerInspectionsampledetail, organization1 *Organization) (*FieldseekerInspectionsampledetail, error) { + setter := &FieldseekerInspectionsampledetailSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerInspectionsampledetail0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerInspectionsampledetailOrganization0: %w", err) + } + + return fieldseekerInspectionsampledetail0, nil +} + +func (fieldseekerInspectionsampledetail0 *FieldseekerInspectionsampledetail) 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 = attachFieldseekerInspectionsampledetailOrganization0(ctx, exec, 1, fieldseekerInspectionsampledetail0, organization1) + if err != nil { + return err + } + + fieldseekerInspectionsampledetail0.R.Organization = organization1 + + organization1.R.Inspectionsampledetails = append(organization1.R.Inspectionsampledetails, fieldseekerInspectionsampledetail0) + + return nil +} + +func (fieldseekerInspectionsampledetail0 *FieldseekerInspectionsampledetail) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerInspectionsampledetailOrganization0(ctx, exec, 1, fieldseekerInspectionsampledetail0, organization1) + if err != nil { + return err + } + + fieldseekerInspectionsampledetail0.R.Organization = organization1 + + organization1.R.Inspectionsampledetails = append(organization1.R.Inspectionsampledetails, fieldseekerInspectionsampledetail0) + + return nil +} + type fieldseekerInspectionsampledetailWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] InspsampleID psql.WhereNullMod[Q, uuid.UUID] - Fieldspecies psql.WhereNullMod[Q, enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum] + Fieldspecies psql.WhereNullMod[Q, string] Flarvcount psql.WhereNullMod[Q, int16] Fpupcount psql.WhereNullMod[Q, int16] Feggcount psql.WhereNullMod[Q, int16] Flstages psql.WhereNullMod[Q, string] - Fdomstage psql.WhereNullMod[Q, enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum] - Fadultact psql.WhereNullMod[Q, enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum] + Fdomstage psql.WhereNullMod[Q, string] + Fadultact psql.WhereNullMod[Q, string] Labspecies psql.WhereNullMod[Q, string] Llarvcount psql.WhereNullMod[Q, int16] Lpupcount psql.WhereNullMod[Q, int16] Leggcount psql.WhereNullMod[Q, int16] - Ldomstage psql.WhereNullMod[Q, enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum] + Ldomstage psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] Globalid psql.WhereNullMod[Q, uuid.UUID] CreatedUser psql.WhereNullMod[Q, string] @@ -963,7 +1127,10 @@ type fieldseekerInspectionsampledetailWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerInspectionsampledetailWhere[Q]) AliasedAs(alias string) fieldseekerInspectionsampledetailWhere[Q] { @@ -974,18 +1141,18 @@ func buildFieldseekerInspectionsampledetailWhere[Q psql.Filterable](cols fieldse return fieldseekerInspectionsampledetailWhere[Q]{ Objectid: psql.Where[Q, int64](cols.Objectid), InspsampleID: psql.WhereNull[Q, uuid.UUID](cols.InspsampleID), - Fieldspecies: psql.WhereNull[Q, enums.FieldseekerInspectionsampledetailMosquitofieldspeciesEnum](cols.Fieldspecies), + Fieldspecies: psql.WhereNull[Q, string](cols.Fieldspecies), Flarvcount: psql.WhereNull[Q, int16](cols.Flarvcount), Fpupcount: psql.WhereNull[Q, int16](cols.Fpupcount), Feggcount: psql.WhereNull[Q, int16](cols.Feggcount), Flstages: psql.WhereNull[Q, string](cols.Flstages), - Fdomstage: psql.WhereNull[Q, enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum](cols.Fdomstage), - Fadultact: psql.WhereNull[Q, enums.FieldseekerInspectionsampledetailMosquitoadultactivityEnum](cols.Fadultact), + Fdomstage: psql.WhereNull[Q, string](cols.Fdomstage), + Fadultact: psql.WhereNull[Q, string](cols.Fadultact), Labspecies: psql.WhereNull[Q, string](cols.Labspecies), Llarvcount: psql.WhereNull[Q, int16](cols.Llarvcount), Lpupcount: psql.WhereNull[Q, int16](cols.Lpupcount), Leggcount: psql.WhereNull[Q, int16](cols.Leggcount), - Ldomstage: psql.WhereNull[Q, enums.FieldseekerInspectionsampledetailMosquitodominantstageEnum](cols.Ldomstage), + Ldomstage: psql.WhereNull[Q, string](cols.Ldomstage), Comments: psql.WhereNull[Q, string](cols.Comments), Globalid: psql.WhereNull[Q, uuid.UUID](cols.Globalid), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), @@ -997,6 +1164,154 @@ func buildFieldseekerInspectionsampledetailWhere[Q psql.Filterable](cols fieldse Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerInspectionsampledetail) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerInspectionsampledetail cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Inspectionsampledetails = FieldseekerInspectionsampledetailSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerInspectionsampledetail has no relationship %q", name) + } +} + +type fieldseekerInspectionsampledetailPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerInspectionsampledetailPreloader() fieldseekerInspectionsampledetailPreloader { + return fieldseekerInspectionsampledetailPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerInspectionsampledetails, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerInspectionsampledetailThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerInspectionsampledetailThenLoader[Q orm.Loadable]() fieldseekerInspectionsampledetailThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerInspectionsampledetailThenLoader[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 fieldseekerInspectionsampledetail's Organization into the .R struct +func (o *FieldseekerInspectionsampledetail) 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.Inspectionsampledetails = FieldseekerInspectionsampledetailSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerInspectionsampledetail's Organization into the .R struct +func (os FieldseekerInspectionsampledetailSlice) 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.Inspectionsampledetails = append(rel.R.Inspectionsampledetails, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerInspectionsampledetailJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerInspectionsampledetailJoins[Q]) aliasedAs(alias string) fieldseekerInspectionsampledetailJoins[Q] { + return buildFieldseekerInspectionsampledetailJoins[Q](buildFieldseekerInspectionsampledetailColumns(alias), j.typ) +} + +func buildFieldseekerInspectionsampledetailJoins[Q dialect.Joinable](cols fieldseekerInspectionsampledetailColumns, typ string) fieldseekerInspectionsampledetailJoins[Q] { + return fieldseekerInspectionsampledetailJoins[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/db/models/fieldseeker.linelocation.bob.go b/db/models/fieldseeker.linelocation.bob.go index 0c970fde..747e14bd 100644 --- a/db/models/fieldseeker.linelocation.bob.go +++ b/db/models/fieldseeker.linelocation.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,96 +21,115 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerLinelocation is an object representing the database table. type FieldseekerLinelocation struct { Objectid int64 `db:"objectid,pk" ` - // Name + // Original attribute from ArcGIS API is NAME Name null.Val[string] `db:"name" ` - // Zone + // Original attribute from ArcGIS API is ZONE Zone null.Val[string] `db:"zone" ` - // Habitat - Habitat null.Val[enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418] `db:"habitat" ` - // Priority - Priority null.Val[enums.FieldseekerLinelocationLocationpriorityEnum] `db:"priority" ` - // Use Type - Usetype null.Val[enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80] `db:"usetype" ` - // Active - Active null.Val[enums.FieldseekerLinelocationNotinuitFEnum] `db:"active" ` - // Description + // Original attribute from ArcGIS API is HABITAT + Habitat null.Val[string] `db:"habitat" ` + // Original attribute from ArcGIS API is PRIORITY + Priority null.Val[string] `db:"priority" ` + // Original attribute from ArcGIS API is USETYPE + Usetype null.Val[string] `db:"usetype" ` + // Original attribute from ArcGIS API is ACTIVE + Active null.Val[int16] `db:"active" ` + // Original attribute from ArcGIS API is DESCRIPTION Description null.Val[string] `db:"description" ` - // Access Description + // Original attribute from ArcGIS API is ACCESSDESC Accessdesc null.Val[string] `db:"accessdesc" ` - // Comments + // Original attribute from ArcGIS API is COMMENTS Comments null.Val[string] `db:"comments" ` - // Symbology - Symbology null.Val[enums.FieldseekerLinelocationLocationsymbologyEnum] `db:"symbology" ` - // External ID + // Original attribute from ArcGIS API is SYMBOLOGY + Symbology null.Val[string] `db:"symbology" ` + // Original attribute from ArcGIS API is EXTERNALID Externalid null.Val[string] `db:"externalid" ` - // Acres + // Original attribute from ArcGIS API is ACRES Acres null.Val[float64] `db:"acres" ` - // Next Scheduled Action + // Original attribute from ArcGIS API is NEXTACTIONDATESCHEDULED Nextactiondatescheduled null.Val[time.Time] `db:"nextactiondatescheduled" ` - // Larval Inspection Interval + // Original attribute from ArcGIS API is LARVINSPECTINTERVAL Larvinspectinterval null.Val[int16] `db:"larvinspectinterval" ` - // Length + // Original attribute from ArcGIS API is LENGTH_FT LengthFT null.Val[float64] `db:"length_ft" ` - // Width + // Original attribute from ArcGIS API is WIDTH_FT WidthFT null.Val[float64] `db:"width_ft" ` - // Zone2 - Zone2 null.Val[string] `db:"zone2" ` - Locationnumber null.Val[int32] `db:"locationnumber" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is ZONE2 + Zone2 null.Val[string] `db:"zone2" ` + // Original attribute from ArcGIS API is LOCATIONNUMBER + Locationnumber null.Val[int32] `db:"locationnumber" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - // Last Inspection Date + // Original attribute from ArcGIS API is LASTINSPECTDATE Lastinspectdate null.Val[time.Time] `db:"lastinspectdate" ` - // Last Inspection Breeding + // Original attribute from ArcGIS API is LASTINSPECTBREEDING Lastinspectbreeding null.Val[string] `db:"lastinspectbreeding" ` - // Last Inspection Average Larvae + // Original attribute from ArcGIS API is LASTINSPECTAVGLARVAE Lastinspectavglarvae null.Val[float64] `db:"lastinspectavglarvae" ` - // Last Inspection Average Pupae + // Original attribute from ArcGIS API is LASTINSPECTAVGPUPAE Lastinspectavgpupae null.Val[float64] `db:"lastinspectavgpupae" ` - // Last Inspection Larval Stages + // Original attribute from ArcGIS API is LASTINSPECTLSTAGES Lastinspectlstages null.Val[string] `db:"lastinspectlstages" ` - // Last Inspection Action + // Original attribute from ArcGIS API is LASTINSPECTACTIONTAKEN Lastinspectactiontaken null.Val[string] `db:"lastinspectactiontaken" ` - // Last Inspection Field Species + // Original attribute from ArcGIS API is LASTINSPECTFIELDSPECIES Lastinspectfieldspecies null.Val[string] `db:"lastinspectfieldspecies" ` - // Last Treatment Date + // Original attribute from ArcGIS API is LASTTREATDATE Lasttreatdate null.Val[time.Time] `db:"lasttreatdate" ` - // Last Treatment Product + // Original attribute from ArcGIS API is LASTTREATPRODUCT Lasttreatproduct null.Val[string] `db:"lasttreatproduct" ` - // Last Treatment Quantity + // Original attribute from ArcGIS API is LASTTREATQTY Lasttreatqty null.Val[float64] `db:"lasttreatqty" ` - // Last Treatment Quantity Unit + // Original attribute from ArcGIS API is LASTTREATQTYUNIT Lasttreatqtyunit null.Val[string] `db:"lasttreatqtyunit" ` - // Hectares + // Original attribute from ArcGIS API is HECTARES Hectares null.Val[float64] `db:"hectares" ` - // Last Inspection Activity + // Original attribute from ArcGIS API is LASTINSPECTACTIVITY Lastinspectactivity null.Val[string] `db:"lastinspectactivity" ` - // Last Treatment Activity + // Original attribute from ArcGIS API is LASTTREATACTIVITY Lasttreatactivity null.Val[string] `db:"lasttreatactivity" ` - // Length Meters + // Original attribute from ArcGIS API is LENGTH_METERS LengthMeters null.Val[float64] `db:"length_meters" ` - // Width Meters + // Original attribute from ArcGIS API is WIDTH_METERS WidthMeters null.Val[float64] `db:"width_meters" ` - // Last Inspection Conditions + // Original attribute from ArcGIS API is LASTINSPECTCONDITIONS Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` - // Water Origin - Waterorigin null.Val[enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16] `db:"waterorigin" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Jurisdiction - Jurisdiction null.Val[string] `db:"jurisdiction" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is WATERORIGIN + Waterorigin null.Val[string] `db:"waterorigin" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is JURISDICTION + Jurisdiction null.Val[string] `db:"jurisdiction" ` + // Original attribute from ArcGIS API is Shape__Length + ShapeLength null.Val[float64] `db:"shape__length" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerLinelocationR `db:"-" ` } // FieldseekerLinelocationSlice is an alias for a slice of pointers to FieldseekerLinelocation. @@ -122,10 +142,15 @@ var FieldseekerLinelocations = psql.NewTablex[*FieldseekerLinelocation, Fieldsee // FieldseekerLinelocationsQuery is a query on the linelocation table type FieldseekerLinelocationsQuery = *psql.ViewQuery[*FieldseekerLinelocation, FieldseekerLinelocationSlice] +// fieldseekerLinelocationR is where relationships are stored. +type fieldseekerLinelocationR struct { + Organization *Organization // fieldseeker.linelocation.linelocation_organization_id_fkey +} + func buildFieldseekerLinelocationColumns(alias string) fieldseekerLinelocationColumns { return fieldseekerLinelocationColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "name", "zone", "habitat", "priority", "usetype", "active", "description", "accessdesc", "comments", "symbology", "externalid", "acres", "nextactiondatescheduled", "larvinspectinterval", "length_ft", "width_ft", "zone2", "locationnumber", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "lastinspectdate", "lastinspectbreeding", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectlstages", "lastinspectactiontaken", "lastinspectfieldspecies", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "hectares", "lastinspectactivity", "lasttreatactivity", "length_meters", "width_meters", "lastinspectconditions", "waterorigin", "creationdate", "creator", "editdate", "editor", "jurisdiction", "shape__length", "version", + "objectid", "name", "zone", "habitat", "priority", "usetype", "active", "description", "accessdesc", "comments", "symbology", "externalid", "acres", "nextactiondatescheduled", "larvinspectinterval", "length_ft", "width_ft", "zone2", "locationnumber", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "lastinspectdate", "lastinspectbreeding", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectlstages", "lastinspectactiontaken", "lastinspectfieldspecies", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "hectares", "lastinspectactivity", "lasttreatactivity", "length_meters", "width_meters", "lastinspectconditions", "waterorigin", "creationdate", "creator", "editdate", "editor", "jurisdiction", "shape__length", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.linelocation"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -176,7 +201,10 @@ func buildFieldseekerLinelocationColumns(alias string) fieldseekerLinelocationCo Editor: psql.Quote(alias, "editor"), Jurisdiction: psql.Quote(alias, "jurisdiction"), ShapeLength: psql.Quote(alias, "shape__length"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -231,7 +259,10 @@ type fieldseekerLinelocationColumns struct { Editor psql.Expression Jurisdiction psql.Expression ShapeLength psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerLinelocationColumns) Alias() string { @@ -246,59 +277,62 @@ func (fieldseekerLinelocationColumns) AliasedAs(alias string) fieldseekerLineloc // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerLinelocationSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Name omitnull.Val[string] `db:"name" ` - Zone omitnull.Val[string] `db:"zone" ` - Habitat omitnull.Val[enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418] `db:"habitat" ` - Priority omitnull.Val[enums.FieldseekerLinelocationLocationpriorityEnum] `db:"priority" ` - Usetype omitnull.Val[enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80] `db:"usetype" ` - Active omitnull.Val[enums.FieldseekerLinelocationNotinuitFEnum] `db:"active" ` - Description omitnull.Val[string] `db:"description" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Comments omitnull.Val[string] `db:"comments" ` - Symbology omitnull.Val[enums.FieldseekerLinelocationLocationsymbologyEnum] `db:"symbology" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Acres omitnull.Val[float64] `db:"acres" ` - Nextactiondatescheduled omitnull.Val[time.Time] `db:"nextactiondatescheduled" ` - Larvinspectinterval omitnull.Val[int16] `db:"larvinspectinterval" ` - LengthFT omitnull.Val[float64] `db:"length_ft" ` - WidthFT omitnull.Val[float64] `db:"width_ft" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Locationnumber omitnull.Val[int32] `db:"locationnumber" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Lastinspectdate omitnull.Val[time.Time] `db:"lastinspectdate" ` - Lastinspectbreeding omitnull.Val[string] `db:"lastinspectbreeding" ` - Lastinspectavglarvae omitnull.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae omitnull.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectlstages omitnull.Val[string] `db:"lastinspectlstages" ` - Lastinspectactiontaken omitnull.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectfieldspecies omitnull.Val[string] `db:"lastinspectfieldspecies" ` - Lasttreatdate omitnull.Val[time.Time] `db:"lasttreatdate" ` - Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` - Hectares omitnull.Val[float64] `db:"hectares" ` - Lastinspectactivity omitnull.Val[string] `db:"lastinspectactivity" ` - Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` - LengthMeters omitnull.Val[float64] `db:"length_meters" ` - WidthMeters omitnull.Val[float64] `db:"width_meters" ` - Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` - Waterorigin omitnull.Val[enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16] `db:"waterorigin" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Name omitnull.Val[string] `db:"name" ` + Zone omitnull.Val[string] `db:"zone" ` + Habitat omitnull.Val[string] `db:"habitat" ` + Priority omitnull.Val[string] `db:"priority" ` + Usetype omitnull.Val[string] `db:"usetype" ` + Active omitnull.Val[int16] `db:"active" ` + Description omitnull.Val[string] `db:"description" ` + Accessdesc omitnull.Val[string] `db:"accessdesc" ` + Comments omitnull.Val[string] `db:"comments" ` + Symbology omitnull.Val[string] `db:"symbology" ` + Externalid omitnull.Val[string] `db:"externalid" ` + Acres omitnull.Val[float64] `db:"acres" ` + Nextactiondatescheduled omitnull.Val[time.Time] `db:"nextactiondatescheduled" ` + Larvinspectinterval omitnull.Val[int16] `db:"larvinspectinterval" ` + LengthFT omitnull.Val[float64] `db:"length_ft" ` + WidthFT omitnull.Val[float64] `db:"width_ft" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Locationnumber omitnull.Val[int32] `db:"locationnumber" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Lastinspectdate omitnull.Val[time.Time] `db:"lastinspectdate" ` + Lastinspectbreeding omitnull.Val[string] `db:"lastinspectbreeding" ` + Lastinspectavglarvae omitnull.Val[float64] `db:"lastinspectavglarvae" ` + Lastinspectavgpupae omitnull.Val[float64] `db:"lastinspectavgpupae" ` + Lastinspectlstages omitnull.Val[string] `db:"lastinspectlstages" ` + Lastinspectactiontaken omitnull.Val[string] `db:"lastinspectactiontaken" ` + Lastinspectfieldspecies omitnull.Val[string] `db:"lastinspectfieldspecies" ` + Lasttreatdate omitnull.Val[time.Time] `db:"lasttreatdate" ` + Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` + Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` + Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` + Hectares omitnull.Val[float64] `db:"hectares" ` + Lastinspectactivity omitnull.Val[string] `db:"lastinspectactivity" ` + Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` + LengthMeters omitnull.Val[float64] `db:"length_meters" ` + WidthMeters omitnull.Val[float64] `db:"width_meters" ` + Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` + Waterorigin omitnull.Val[string] `db:"waterorigin" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` + ShapeLength omitnull.Val[float64] `db:"shape__length" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerLinelocationSetter) SetColumns() []string { - vals := make([]string, 0, 49) + vals := make([]string, 0, 52) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -443,9 +477,18 @@ func (s FieldseekerLinelocationSetter) SetColumns() []string { if !s.ShapeLength.IsUnset() { vals = append(vals, "shape__length") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -594,9 +637,18 @@ func (s FieldseekerLinelocationSetter) Overwrite(t *FieldseekerLinelocation) { if !s.ShapeLength.IsUnset() { t.ShapeLength = s.ShapeLength.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerLinelocationSetter) Apply(q *dialect.InsertQuery) { @@ -605,7 +657,7 @@ func (s *FieldseekerLinelocationSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 49) + vals := make([]bob.Expression, 52) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -894,12 +946,30 @@ func (s *FieldseekerLinelocationSetter) Apply(q *dialect.InsertQuery) { vals[47] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[48] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[48] = psql.Arg(s.Geometry.MustGet()) } else { vals[48] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[49] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[49] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[50] = psql.Arg(s.Version.MustGet()) + } else { + vals[50] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[51] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[51] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -909,7 +979,7 @@ func (s FieldseekerLinelocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] } func (s FieldseekerLinelocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 49) + exprs := make([]bob.Expression, 0, 52) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -1247,6 +1317,20 @@ func (s FieldseekerLinelocationSetter) Expressions(prefix ...string) []bob.Expre }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -1254,6 +1338,13 @@ func (s FieldseekerLinelocationSetter) Expressions(prefix ...string) []bob.Expre }}) } + 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 } @@ -1321,6 +1412,7 @@ func (o *FieldseekerLinelocation) Update(ctx context.Context, exec bob.Executor, return err } + o.R = v.R *o = *v return nil @@ -1341,7 +1433,7 @@ func (o *FieldseekerLinelocation) Reload(ctx context.Context, exec bob.Executor) if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -1391,7 +1483,7 @@ func (o FieldseekerLinelocationSlice) copyMatchingRows(from ...*FieldseekerLinel if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -1489,18 +1581,90 @@ func (o FieldseekerLinelocationSlice) ReloadAll(ctx context.Context, exec bob.Ex return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerLinelocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerLinelocationSlice) 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 attachFieldseekerLinelocationOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerLinelocation0 *FieldseekerLinelocation, organization1 *Organization) (*FieldseekerLinelocation, error) { + setter := &FieldseekerLinelocationSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerLinelocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerLinelocationOrganization0: %w", err) + } + + return fieldseekerLinelocation0, nil +} + +func (fieldseekerLinelocation0 *FieldseekerLinelocation) 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 = attachFieldseekerLinelocationOrganization0(ctx, exec, 1, fieldseekerLinelocation0, organization1) + if err != nil { + return err + } + + fieldseekerLinelocation0.R.Organization = organization1 + + organization1.R.Linelocations = append(organization1.R.Linelocations, fieldseekerLinelocation0) + + return nil +} + +func (fieldseekerLinelocation0 *FieldseekerLinelocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerLinelocationOrganization0(ctx, exec, 1, fieldseekerLinelocation0, organization1) + if err != nil { + return err + } + + fieldseekerLinelocation0.R.Organization = organization1 + + organization1.R.Linelocations = append(organization1.R.Linelocations, fieldseekerLinelocation0) + + return nil +} + type fieldseekerLinelocationWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] Name psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] - Habitat psql.WhereNullMod[Q, enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418] - Priority psql.WhereNullMod[Q, enums.FieldseekerLinelocationLocationpriorityEnum] - Usetype psql.WhereNullMod[Q, enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80] - Active psql.WhereNullMod[Q, enums.FieldseekerLinelocationNotinuitFEnum] + Habitat psql.WhereNullMod[Q, string] + Priority psql.WhereNullMod[Q, string] + Usetype psql.WhereNullMod[Q, string] + Active psql.WhereNullMod[Q, int16] Description psql.WhereNullMod[Q, string] Accessdesc psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] - Symbology psql.WhereNullMod[Q, enums.FieldseekerLinelocationLocationsymbologyEnum] + Symbology psql.WhereNullMod[Q, string] Externalid psql.WhereNullMod[Q, string] Acres psql.WhereNullMod[Q, float64] Nextactiondatescheduled psql.WhereNullMod[Q, time.Time] @@ -1531,14 +1695,17 @@ type fieldseekerLinelocationWhere[Q psql.Filterable] struct { LengthMeters psql.WhereNullMod[Q, float64] WidthMeters psql.WhereNullMod[Q, float64] Lastinspectconditions psql.WhereNullMod[Q, string] - Waterorigin psql.WhereNullMod[Q, enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16] + Waterorigin psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, time.Time] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] Jurisdiction psql.WhereNullMod[Q, string] ShapeLength psql.WhereNullMod[Q, float64] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerLinelocationWhere[Q]) AliasedAs(alias string) fieldseekerLinelocationWhere[Q] { @@ -1550,14 +1717,14 @@ func buildFieldseekerLinelocationWhere[Q psql.Filterable](cols fieldseekerLinelo Objectid: psql.Where[Q, int64](cols.Objectid), Name: psql.WhereNull[Q, string](cols.Name), Zone: psql.WhereNull[Q, string](cols.Zone), - Habitat: psql.WhereNull[Q, enums.FieldseekerLinelocationLinelocationHabitatFc51bdc4f1954df58206d69ce1418](cols.Habitat), - Priority: psql.WhereNull[Q, enums.FieldseekerLinelocationLocationpriorityEnum](cols.Priority), - Usetype: psql.WhereNull[Q, enums.FieldseekerLinelocationLinelocationUsetype2aeca2e60d2f455c86fc34895dc80](cols.Usetype), - Active: psql.WhereNull[Q, enums.FieldseekerLinelocationNotinuitFEnum](cols.Active), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Priority: psql.WhereNull[Q, string](cols.Priority), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Active: psql.WhereNull[Q, int16](cols.Active), Description: psql.WhereNull[Q, string](cols.Description), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Comments: psql.WhereNull[Q, string](cols.Comments), - Symbology: psql.WhereNull[Q, enums.FieldseekerLinelocationLocationsymbologyEnum](cols.Symbology), + Symbology: psql.WhereNull[Q, string](cols.Symbology), Externalid: psql.WhereNull[Q, string](cols.Externalid), Acres: psql.WhereNull[Q, float64](cols.Acres), Nextactiondatescheduled: psql.WhereNull[Q, time.Time](cols.Nextactiondatescheduled), @@ -1588,13 +1755,161 @@ func buildFieldseekerLinelocationWhere[Q psql.Filterable](cols fieldseekerLinelo LengthMeters: psql.WhereNull[Q, float64](cols.LengthMeters), WidthMeters: psql.WhereNull[Q, float64](cols.WidthMeters), Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), - Waterorigin: psql.WhereNull[Q, enums.FieldseekerLinelocationLinelocationWaterorigin84723D92306a46F48ef16](cols.Waterorigin), + Waterorigin: psql.WhereNull[Q, string](cols.Waterorigin), Creationdate: psql.WhereNull[Q, time.Time](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerLinelocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerLinelocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Linelocations = FieldseekerLinelocationSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerLinelocation has no relationship %q", name) + } +} + +type fieldseekerLinelocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerLinelocationPreloader() fieldseekerLinelocationPreloader { + return fieldseekerLinelocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerLinelocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerLinelocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerLinelocationThenLoader[Q orm.Loadable]() fieldseekerLinelocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerLinelocationThenLoader[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 fieldseekerLinelocation's Organization into the .R struct +func (o *FieldseekerLinelocation) 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.Linelocations = FieldseekerLinelocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerLinelocation's Organization into the .R struct +func (os FieldseekerLinelocationSlice) 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.Linelocations = append(rel.R.Linelocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerLinelocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerLinelocationJoins[Q]) aliasedAs(alias string) fieldseekerLinelocationJoins[Q] { + return buildFieldseekerLinelocationJoins[Q](buildFieldseekerLinelocationColumns(alias), j.typ) +} + +func buildFieldseekerLinelocationJoins[Q dialect.Joinable](cols fieldseekerLinelocationColumns, typ string) fieldseekerLinelocationJoins[Q] { + return fieldseekerLinelocationJoins[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/db/models/fieldseeker.locationtracking.bob.go b/db/models/fieldseeker.locationtracking.bob.go index 5843927b..2a99be4f 100644 --- a/db/models/fieldseeker.locationtracking.bob.go +++ b/db/models/fieldseeker.locationtracking.bob.go @@ -1,17 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -19,26 +21,43 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerLocationtracking is an object representing the database table. type FieldseekerLocationtracking struct { Objectid int64 `db:"objectid,pk" ` - // Accuracy(m) - Accuracy null.Val[float64] `db:"accuracy" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is Accuracy + Accuracy null.Val[float64] `db:"accuracy" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - // Field Tech - Fieldtech null.Val[string] `db:"fieldtech" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is FIELDTECH + Fieldtech null.Val[string] `db:"fieldtech" ` + // Original attribute from ArcGIS API is CreationDate Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerLocationtrackingR `db:"-" ` } // FieldseekerLocationtrackingSlice is an alias for a slice of pointers to FieldseekerLocationtracking. @@ -51,10 +70,15 @@ var FieldseekerLocationtrackings = psql.NewTablex[*FieldseekerLocationtracking, // FieldseekerLocationtrackingsQuery is a query on the locationtracking table type FieldseekerLocationtrackingsQuery = *psql.ViewQuery[*FieldseekerLocationtracking, FieldseekerLocationtrackingSlice] +// fieldseekerLocationtrackingR is where relationships are stored. +type fieldseekerLocationtrackingR struct { + Organization *Organization // fieldseeker.locationtracking.locationtracking_organization_id_fkey +} + func buildFieldseekerLocationtrackingColumns(alias string) fieldseekerLocationtrackingColumns { return fieldseekerLocationtrackingColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "accuracy", "created_user", "created_date", "last_edited_user", "last_edited_date", "globalid", "fieldtech", "creationdate", "creator", "editdate", "editor", "version", + "objectid", "accuracy", "created_user", "created_date", "last_edited_user", "last_edited_date", "globalid", "fieldtech", "creationdate", "creator", "editdate", "editor", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.locationtracking"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -69,7 +93,10 @@ func buildFieldseekerLocationtrackingColumns(alias string) fieldseekerLocationtr Creator: psql.Quote(alias, "creator"), Editdate: psql.Quote(alias, "editdate"), Editor: psql.Quote(alias, "editor"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -88,7 +115,10 @@ type fieldseekerLocationtrackingColumns struct { Creator psql.Expression Editdate psql.Expression Editor psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerLocationtrackingColumns) Alias() string { @@ -103,23 +133,26 @@ func (fieldseekerLocationtrackingColumns) AliasedAs(alias string) fieldseekerLoc // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerLocationtrackingSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Accuracy omitnull.Val[float64] `db:"accuracy" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Accuracy omitnull.Val[float64] `db:"accuracy" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + Fieldtech omitnull.Val[string] `db:"fieldtech" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerLocationtrackingSetter) SetColumns() []string { - vals := make([]string, 0, 13) + vals := make([]string, 0, 16) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -156,9 +189,18 @@ func (s FieldseekerLocationtrackingSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -199,9 +241,18 @@ func (s FieldseekerLocationtrackingSetter) Overwrite(t *FieldseekerLocationtrack if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerLocationtrackingSetter) Apply(q *dialect.InsertQuery) { @@ -210,7 +261,7 @@ func (s *FieldseekerLocationtrackingSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 13) + vals := make([]bob.Expression, 16) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -283,12 +334,30 @@ func (s *FieldseekerLocationtrackingSetter) Apply(q *dialect.InsertQuery) { vals[11] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[12] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[12] = psql.Arg(s.Geometry.MustGet()) } else { vals[12] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[13] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[13] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[14] = psql.Arg(s.Version.MustGet()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[15] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -298,7 +367,7 @@ func (s FieldseekerLocationtrackingSetter) UpdateMod() bob.Mod[*dialect.UpdateQu } func (s FieldseekerLocationtrackingSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 13) + exprs := make([]bob.Expression, 0, 16) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -384,6 +453,20 @@ func (s FieldseekerLocationtrackingSetter) Expressions(prefix ...string) []bob.E }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -391,6 +474,13 @@ func (s FieldseekerLocationtrackingSetter) Expressions(prefix ...string) []bob.E }}) } + 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 } @@ -458,6 +548,7 @@ func (o *FieldseekerLocationtracking) Update(ctx context.Context, exec bob.Execu return err } + o.R = v.R *o = *v return nil @@ -478,7 +569,7 @@ func (o *FieldseekerLocationtracking) Reload(ctx context.Context, exec bob.Execu if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -528,7 +619,7 @@ func (o FieldseekerLocationtrackingSlice) copyMatchingRows(from ...*FieldseekerL if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -626,6 +717,78 @@ func (o FieldseekerLocationtrackingSlice) ReloadAll(ctx context.Context, exec bo return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerLocationtracking) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerLocationtrackingSlice) 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 attachFieldseekerLocationtrackingOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerLocationtracking0 *FieldseekerLocationtracking, organization1 *Organization) (*FieldseekerLocationtracking, error) { + setter := &FieldseekerLocationtrackingSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerLocationtracking0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerLocationtrackingOrganization0: %w", err) + } + + return fieldseekerLocationtracking0, nil +} + +func (fieldseekerLocationtracking0 *FieldseekerLocationtracking) 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 = attachFieldseekerLocationtrackingOrganization0(ctx, exec, 1, fieldseekerLocationtracking0, organization1) + if err != nil { + return err + } + + fieldseekerLocationtracking0.R.Organization = organization1 + + organization1.R.Locationtrackings = append(organization1.R.Locationtrackings, fieldseekerLocationtracking0) + + return nil +} + +func (fieldseekerLocationtracking0 *FieldseekerLocationtracking) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerLocationtrackingOrganization0(ctx, exec, 1, fieldseekerLocationtracking0, organization1) + if err != nil { + return err + } + + fieldseekerLocationtracking0.R.Organization = organization1 + + organization1.R.Locationtrackings = append(organization1.R.Locationtrackings, fieldseekerLocationtracking0) + + return nil +} + type fieldseekerLocationtrackingWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] Accuracy psql.WhereNullMod[Q, float64] @@ -639,7 +802,10 @@ type fieldseekerLocationtrackingWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerLocationtrackingWhere[Q]) AliasedAs(alias string) fieldseekerLocationtrackingWhere[Q] { @@ -660,6 +826,154 @@ func buildFieldseekerLocationtrackingWhere[Q psql.Filterable](cols fieldseekerLo Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerLocationtracking) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerLocationtracking cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Locationtrackings = FieldseekerLocationtrackingSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerLocationtracking has no relationship %q", name) + } +} + +type fieldseekerLocationtrackingPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerLocationtrackingPreloader() fieldseekerLocationtrackingPreloader { + return fieldseekerLocationtrackingPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerLocationtrackings, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerLocationtrackingThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerLocationtrackingThenLoader[Q orm.Loadable]() fieldseekerLocationtrackingThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerLocationtrackingThenLoader[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 fieldseekerLocationtracking's Organization into the .R struct +func (o *FieldseekerLocationtracking) 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.Locationtrackings = FieldseekerLocationtrackingSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerLocationtracking's Organization into the .R struct +func (os FieldseekerLocationtrackingSlice) 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.Locationtrackings = append(rel.R.Locationtrackings, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerLocationtrackingJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerLocationtrackingJoins[Q]) aliasedAs(alias string) fieldseekerLocationtrackingJoins[Q] { + return buildFieldseekerLocationtrackingJoins[Q](buildFieldseekerLocationtrackingColumns(alias), j.typ) +} + +func buildFieldseekerLocationtrackingJoins[Q dialect.Joinable](cols fieldseekerLocationtrackingColumns, typ string) fieldseekerLocationtrackingJoins[Q] { + return fieldseekerLocationtrackingJoins[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/db/models/fieldseeker.mosquitoinspection.bob.go b/db/models/fieldseeker.mosquitoinspection.bob.go index c126e367..bcd2cbd4 100644 --- a/db/models/fieldseeker.mosquitoinspection.bob.go +++ b/db/models/fieldseeker.mosquitoinspection.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,110 +21,133 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerMosquitoinspection is an object representing the database table. type FieldseekerMosquitoinspection struct { Objectid int64 `db:"objectid,pk" ` - // # Dips + // Original attribute from ArcGIS API is NUMDIPS Numdips null.Val[int16] `db:"numdips" ` - // Activity - Activity null.Val[enums.FieldseekerMosquitoinspectionMosquitoactivityEnum] `db:"activity" ` - // Breeding - Breeding null.Val[enums.FieldseekerMosquitoinspectionMosquitobreedingEnum] `db:"breeding" ` - // Total Larvae + // Original attribute from ArcGIS API is ACTIVITY + Activity null.Val[string] `db:"activity" ` + // Original attribute from ArcGIS API is BREEDING + Breeding null.Val[string] `db:"breeding" ` + // Original attribute from ArcGIS API is TOTLARVAE Totlarvae null.Val[int16] `db:"totlarvae" ` - // Total Pupae + // Original attribute from ArcGIS API is TOTPUPAE Totpupae null.Val[int16] `db:"totpupae" ` - // Eggs + // Original attribute from ArcGIS API is EGGS Eggs null.Val[int16] `db:"eggs" ` - // Positive Dips + // Original attribute from ArcGIS API is POSDIPS Posdips null.Val[int16] `db:"posdips" ` - // Adult Activity - Adultact null.Val[enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum] `db:"adultact" ` - // Larval Stages + // Original attribute from ArcGIS API is ADULTACT + Adultact null.Val[string] `db:"adultact" ` + // Original attribute from ArcGIS API is LSTAGES Lstages null.Val[string] `db:"lstages" ` - // Dominant Stage - Domstage null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2] `db:"domstage" ` - // Action - Actiontaken null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4] `db:"actiontaken" ` - // Comments + // Original attribute from ArcGIS API is DOMSTAGE + Domstage null.Val[string] `db:"domstage" ` + // Original attribute from ArcGIS API is ACTIONTAKEN + Actiontaken null.Val[string] `db:"actiontaken" ` + // Original attribute from ArcGIS API is COMMENTS Comments null.Val[string] `db:"comments" ` - // Average Temperature + // Original attribute from ArcGIS API is AVETEMP Avetemp null.Val[float64] `db:"avetemp" ` - // Wind Speed + // Original attribute from ArcGIS API is WINDSPEED Windspeed null.Val[float64] `db:"windspeed" ` - // Rain Gauge + // Original attribute from ArcGIS API is RAINGAUGE Raingauge null.Val[float64] `db:"raingauge" ` - // Start + // Original attribute from ArcGIS API is STARTDATETIME Startdatetime null.Val[time.Time] `db:"startdatetime" ` - // Finish + // Original attribute from ArcGIS API is ENDDATETIME Enddatetime null.Val[time.Time] `db:"enddatetime" ` - // Wind Direction - Winddir null.Val[enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum] `db:"winddir" ` - // Average Larvae + // Original attribute from ArcGIS API is WINDDIR + Winddir null.Val[string] `db:"winddir" ` + // Original attribute from ArcGIS API is AVGLARVAE Avglarvae null.Val[float64] `db:"avglarvae" ` - // Average Pupae + // Original attribute from ArcGIS API is AVGPUPAE Avgpupae null.Val[float64] `db:"avgpupae" ` - // Reviewed - Reviewed null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] `db:"reviewed" ` - // Reviewed By + // Original attribute from ArcGIS API is REVIEWED + Reviewed null.Val[int16] `db:"reviewed" ` + // Original attribute from ArcGIS API is REVIEWEDBY Reviewedby null.Val[string] `db:"reviewedby" ` - // Reviewed Date + // Original attribute from ArcGIS API is REVIEWEDDATE Revieweddate null.Val[time.Time] `db:"revieweddate" ` - // Location Name + // Original attribute from ArcGIS API is LOCATIONNAME Locationname null.Val[string] `db:"locationname" ` - // Zone + // Original attribute from ArcGIS API is ZONE Zone null.Val[string] `db:"zone" ` - // RecordStatus + // Original attribute from ArcGIS API is RECORDSTATUS Recordstatus null.Val[int16] `db:"recordstatus" ` - // Zone2 + // Original attribute from ArcGIS API is ZONE2 Zone2 null.Val[string] `db:"zone2" ` - // Personal Contact - Personalcontact null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] `db:"personalcontact" ` - // Tire Count + // Original attribute from ArcGIS API is PERSONALCONTACT + Personalcontact null.Val[int16] `db:"personalcontact" ` + // Original attribute from ArcGIS API is TIRECOUNT Tirecount null.Val[int16] `db:"tirecount" ` - // Catch Basin Count + // Original attribute from ArcGIS API is CBCOUNT Cbcount null.Val[int16] `db:"cbcount" ` - // Container Count + // Original attribute from ArcGIS API is CONTAINERCOUNT Containercount null.Val[int16] `db:"containercount" ` - // Field Species - Fieldspecies null.Val[enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum] `db:"fieldspecies" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - Linelocid null.Val[uuid.UUID] `db:"linelocid" ` - Pointlocid null.Val[uuid.UUID] `db:"pointlocid" ` - Polygonlocid null.Val[uuid.UUID] `db:"polygonlocid" ` - Srid null.Val[uuid.UUID] `db:"srid" ` - // Field Tech + // Original attribute from ArcGIS API is FIELDSPECIES + Fieldspecies null.Val[string] `db:"fieldspecies" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date + LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` + // Original attribute from ArcGIS API is LINELOCID + Linelocid null.Val[uuid.UUID] `db:"linelocid" ` + // Original attribute from ArcGIS API is POINTLOCID + Pointlocid null.Val[uuid.UUID] `db:"pointlocid" ` + // Original attribute from ArcGIS API is POLYGONLOCID + Polygonlocid null.Val[uuid.UUID] `db:"polygonlocid" ` + // Original attribute from ArcGIS API is SRID + Srid null.Val[uuid.UUID] `db:"srid" ` + // Original attribute from ArcGIS API is FIELDTECH Fieldtech null.Val[string] `db:"fieldtech" ` - // Larvae Present - Larvaepresent null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] `db:"larvaepresent" ` - // Pupae Present - Pupaepresent null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] `db:"pupaepresent" ` - // Storm Drain ID + // Original attribute from ArcGIS API is LARVAEPRESENT + Larvaepresent null.Val[int16] `db:"larvaepresent" ` + // Original attribute from ArcGIS API is PUPAEPRESENT + Pupaepresent null.Val[int16] `db:"pupaepresent" ` + // Original attribute from ArcGIS API is SDID Sdid null.Val[uuid.UUID] `db:"sdid" ` - // Conditions - Sitecond null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540] `db:"sitecond" ` - // Positive Container Count - Positivecontainercount null.Val[int16] `db:"positivecontainercount" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Jurisdiction + // Original attribute from ArcGIS API is SITECOND + Sitecond null.Val[string] `db:"sitecond" ` + // Original attribute from ArcGIS API is POSITIVECONTAINERCOUNT + Positivecontainercount null.Val[int16] `db:"positivecontainercount" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is JURISDICTION Jurisdiction null.Val[string] `db:"jurisdiction" ` - // Visual Monitoring - Visualmonitoring null.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] `db:"visualmonitoring" ` - // VM Comments - Vmcomments null.Val[string] `db:"vmcomments" ` - Adminaction null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B] `db:"adminaction" ` - Ptaid null.Val[uuid.UUID] `db:"ptaid" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is VISUALMONITORING + Visualmonitoring null.Val[int16] `db:"visualmonitoring" ` + // Original attribute from ArcGIS API is VMCOMMENTS + Vmcomments null.Val[string] `db:"vmcomments" ` + // Original attribute from ArcGIS API is adminAction + Adminaction null.Val[string] `db:"adminaction" ` + // Original attribute from ArcGIS API is PTAID + Ptaid null.Val[uuid.UUID] `db:"ptaid" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerMosquitoinspectionR `db:"-" ` } // FieldseekerMosquitoinspectionSlice is an alias for a slice of pointers to FieldseekerMosquitoinspection. @@ -136,10 +160,15 @@ var FieldseekerMosquitoinspections = psql.NewTablex[*FieldseekerMosquitoinspecti // FieldseekerMosquitoinspectionsQuery is a query on the mosquitoinspection table type FieldseekerMosquitoinspectionsQuery = *psql.ViewQuery[*FieldseekerMosquitoinspection, FieldseekerMosquitoinspectionSlice] +// fieldseekerMosquitoinspectionR is where relationships are stored. +type fieldseekerMosquitoinspectionR struct { + Organization *Organization // fieldseeker.mosquitoinspection.mosquitoinspection_organization_id_fkey +} + func buildFieldseekerMosquitoinspectionColumns(alias string) fieldseekerMosquitoinspectionColumns { return fieldseekerMosquitoinspectionColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "numdips", "activity", "breeding", "totlarvae", "totpupae", "eggs", "posdips", "adultact", "lstages", "domstage", "actiontaken", "comments", "avetemp", "windspeed", "raingauge", "startdatetime", "enddatetime", "winddir", "avglarvae", "avgpupae", "reviewed", "reviewedby", "revieweddate", "locationname", "zone", "recordstatus", "zone2", "personalcontact", "tirecount", "cbcount", "containercount", "fieldspecies", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "linelocid", "pointlocid", "polygonlocid", "srid", "fieldtech", "larvaepresent", "pupaepresent", "sdid", "sitecond", "positivecontainercount", "creationdate", "creator", "editdate", "editor", "jurisdiction", "visualmonitoring", "vmcomments", "adminaction", "ptaid", "version", + "objectid", "numdips", "activity", "breeding", "totlarvae", "totpupae", "eggs", "posdips", "adultact", "lstages", "domstage", "actiontaken", "comments", "avetemp", "windspeed", "raingauge", "startdatetime", "enddatetime", "winddir", "avglarvae", "avgpupae", "reviewed", "reviewedby", "revieweddate", "locationname", "zone", "recordstatus", "zone2", "personalcontact", "tirecount", "cbcount", "containercount", "fieldspecies", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "linelocid", "pointlocid", "polygonlocid", "srid", "fieldtech", "larvaepresent", "pupaepresent", "sdid", "sitecond", "positivecontainercount", "creationdate", "creator", "editdate", "editor", "jurisdiction", "visualmonitoring", "vmcomments", "adminaction", "ptaid", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.mosquitoinspection"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -199,7 +228,10 @@ func buildFieldseekerMosquitoinspectionColumns(alias string) fieldseekerMosquito Vmcomments: psql.Quote(alias, "vmcomments"), Adminaction: psql.Quote(alias, "adminaction"), Ptaid: psql.Quote(alias, "ptaid"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -263,7 +295,10 @@ type fieldseekerMosquitoinspectionColumns struct { Vmcomments psql.Expression Adminaction psql.Expression Ptaid psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerMosquitoinspectionColumns) Alias() string { @@ -278,68 +313,71 @@ func (fieldseekerMosquitoinspectionColumns) AliasedAs(alias string) fieldseekerM // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerMosquitoinspectionSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Numdips omitnull.Val[int16] `db:"numdips" ` - Activity omitnull.Val[enums.FieldseekerMosquitoinspectionMosquitoactivityEnum] `db:"activity" ` - Breeding omitnull.Val[enums.FieldseekerMosquitoinspectionMosquitobreedingEnum] `db:"breeding" ` - Totlarvae omitnull.Val[int16] `db:"totlarvae" ` - Totpupae omitnull.Val[int16] `db:"totpupae" ` - Eggs omitnull.Val[int16] `db:"eggs" ` - Posdips omitnull.Val[int16] `db:"posdips" ` - Adultact omitnull.Val[enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum] `db:"adultact" ` - Lstages omitnull.Val[string] `db:"lstages" ` - Domstage omitnull.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2] `db:"domstage" ` - Actiontaken omitnull.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4] `db:"actiontaken" ` - Comments omitnull.Val[string] `db:"comments" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Startdatetime omitnull.Val[time.Time] `db:"startdatetime" ` - Enddatetime omitnull.Val[time.Time] `db:"enddatetime" ` - Winddir omitnull.Val[enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum] `db:"winddir" ` - Avglarvae omitnull.Val[float64] `db:"avglarvae" ` - Avgpupae omitnull.Val[float64] `db:"avgpupae" ` - Reviewed omitnull.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[time.Time] `db:"revieweddate" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Zone omitnull.Val[string] `db:"zone" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Personalcontact omitnull.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] `db:"personalcontact" ` - Tirecount omitnull.Val[int16] `db:"tirecount" ` - Cbcount omitnull.Val[int16] `db:"cbcount" ` - Containercount omitnull.Val[int16] `db:"containercount" ` - Fieldspecies omitnull.Val[enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum] `db:"fieldspecies" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Linelocid omitnull.Val[uuid.UUID] `db:"linelocid" ` - Pointlocid omitnull.Val[uuid.UUID] `db:"pointlocid" ` - Polygonlocid omitnull.Val[uuid.UUID] `db:"polygonlocid" ` - Srid omitnull.Val[uuid.UUID] `db:"srid" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Larvaepresent omitnull.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] `db:"larvaepresent" ` - Pupaepresent omitnull.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] `db:"pupaepresent" ` - Sdid omitnull.Val[uuid.UUID] `db:"sdid" ` - Sitecond omitnull.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540] `db:"sitecond" ` - Positivecontainercount omitnull.Val[int16] `db:"positivecontainercount" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Visualmonitoring omitnull.Val[enums.FieldseekerMosquitoinspectionNotinuitFEnum] `db:"visualmonitoring" ` - Vmcomments omitnull.Val[string] `db:"vmcomments" ` - Adminaction omitnull.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B] `db:"adminaction" ` - Ptaid omitnull.Val[uuid.UUID] `db:"ptaid" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Numdips omitnull.Val[int16] `db:"numdips" ` + Activity omitnull.Val[string] `db:"activity" ` + Breeding omitnull.Val[string] `db:"breeding" ` + Totlarvae omitnull.Val[int16] `db:"totlarvae" ` + Totpupae omitnull.Val[int16] `db:"totpupae" ` + Eggs omitnull.Val[int16] `db:"eggs" ` + Posdips omitnull.Val[int16] `db:"posdips" ` + Adultact omitnull.Val[string] `db:"adultact" ` + Lstages omitnull.Val[string] `db:"lstages" ` + Domstage omitnull.Val[string] `db:"domstage" ` + Actiontaken omitnull.Val[string] `db:"actiontaken" ` + Comments omitnull.Val[string] `db:"comments" ` + Avetemp omitnull.Val[float64] `db:"avetemp" ` + Windspeed omitnull.Val[float64] `db:"windspeed" ` + Raingauge omitnull.Val[float64] `db:"raingauge" ` + Startdatetime omitnull.Val[time.Time] `db:"startdatetime" ` + Enddatetime omitnull.Val[time.Time] `db:"enddatetime" ` + Winddir omitnull.Val[string] `db:"winddir" ` + Avglarvae omitnull.Val[float64] `db:"avglarvae" ` + Avgpupae omitnull.Val[float64] `db:"avgpupae" ` + Reviewed omitnull.Val[int16] `db:"reviewed" ` + Reviewedby omitnull.Val[string] `db:"reviewedby" ` + Revieweddate omitnull.Val[time.Time] `db:"revieweddate" ` + Locationname omitnull.Val[string] `db:"locationname" ` + Zone omitnull.Val[string] `db:"zone" ` + Recordstatus omitnull.Val[int16] `db:"recordstatus" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Personalcontact omitnull.Val[int16] `db:"personalcontact" ` + Tirecount omitnull.Val[int16] `db:"tirecount" ` + Cbcount omitnull.Val[int16] `db:"cbcount" ` + Containercount omitnull.Val[int16] `db:"containercount" ` + Fieldspecies omitnull.Val[string] `db:"fieldspecies" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Linelocid omitnull.Val[uuid.UUID] `db:"linelocid" ` + Pointlocid omitnull.Val[uuid.UUID] `db:"pointlocid" ` + Polygonlocid omitnull.Val[uuid.UUID] `db:"polygonlocid" ` + Srid omitnull.Val[uuid.UUID] `db:"srid" ` + Fieldtech omitnull.Val[string] `db:"fieldtech" ` + Larvaepresent omitnull.Val[int16] `db:"larvaepresent" ` + Pupaepresent omitnull.Val[int16] `db:"pupaepresent" ` + Sdid omitnull.Val[uuid.UUID] `db:"sdid" ` + Sitecond omitnull.Val[string] `db:"sitecond" ` + Positivecontainercount omitnull.Val[int16] `db:"positivecontainercount" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` + Visualmonitoring omitnull.Val[int16] `db:"visualmonitoring" ` + Vmcomments omitnull.Val[string] `db:"vmcomments" ` + Adminaction omitnull.Val[string] `db:"adminaction" ` + Ptaid omitnull.Val[uuid.UUID] `db:"ptaid" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerMosquitoinspectionSetter) SetColumns() []string { - vals := make([]string, 0, 58) + vals := make([]string, 0, 61) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -511,9 +549,18 @@ func (s FieldseekerMosquitoinspectionSetter) SetColumns() []string { if !s.Ptaid.IsUnset() { vals = append(vals, "ptaid") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -689,9 +736,18 @@ func (s FieldseekerMosquitoinspectionSetter) Overwrite(t *FieldseekerMosquitoins if !s.Ptaid.IsUnset() { t.Ptaid = s.Ptaid.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerMosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { @@ -700,7 +756,7 @@ func (s *FieldseekerMosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 58) + vals := make([]bob.Expression, 61) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -1043,12 +1099,30 @@ func (s *FieldseekerMosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { vals[56] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[57] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[57] = psql.Arg(s.Geometry.MustGet()) } else { vals[57] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[58] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[58] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[59] = psql.Arg(s.Version.MustGet()) + } else { + vals[59] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[60] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[60] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -1058,7 +1132,7 @@ func (s FieldseekerMosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.Update } func (s FieldseekerMosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 58) + exprs := make([]bob.Expression, 0, 61) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -1459,6 +1533,20 @@ func (s FieldseekerMosquitoinspectionSetter) Expressions(prefix ...string) []bob }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -1466,6 +1554,13 @@ func (s FieldseekerMosquitoinspectionSetter) Expressions(prefix ...string) []bob }}) } + 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 } @@ -1533,6 +1628,7 @@ func (o *FieldseekerMosquitoinspection) Update(ctx context.Context, exec bob.Exe return err } + o.R = v.R *o = *v return nil @@ -1553,7 +1649,7 @@ func (o *FieldseekerMosquitoinspection) Reload(ctx context.Context, exec bob.Exe if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -1603,7 +1699,7 @@ func (o FieldseekerMosquitoinspectionSlice) copyMatchingRows(from ...*Fieldseeke if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -1701,40 +1797,112 @@ func (o FieldseekerMosquitoinspectionSlice) ReloadAll(ctx context.Context, exec return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerMosquitoinspection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerMosquitoinspectionSlice) 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 attachFieldseekerMosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerMosquitoinspection0 *FieldseekerMosquitoinspection, organization1 *Organization) (*FieldseekerMosquitoinspection, error) { + setter := &FieldseekerMosquitoinspectionSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerMosquitoinspection0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerMosquitoinspectionOrganization0: %w", err) + } + + return fieldseekerMosquitoinspection0, nil +} + +func (fieldseekerMosquitoinspection0 *FieldseekerMosquitoinspection) 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 = attachFieldseekerMosquitoinspectionOrganization0(ctx, exec, 1, fieldseekerMosquitoinspection0, organization1) + if err != nil { + return err + } + + fieldseekerMosquitoinspection0.R.Organization = organization1 + + organization1.R.Mosquitoinspections = append(organization1.R.Mosquitoinspections, fieldseekerMosquitoinspection0) + + return nil +} + +func (fieldseekerMosquitoinspection0 *FieldseekerMosquitoinspection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerMosquitoinspectionOrganization0(ctx, exec, 1, fieldseekerMosquitoinspection0, organization1) + if err != nil { + return err + } + + fieldseekerMosquitoinspection0.R.Organization = organization1 + + organization1.R.Mosquitoinspections = append(organization1.R.Mosquitoinspections, fieldseekerMosquitoinspection0) + + return nil +} + type fieldseekerMosquitoinspectionWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] Numdips psql.WhereNullMod[Q, int16] - Activity psql.WhereNullMod[Q, enums.FieldseekerMosquitoinspectionMosquitoactivityEnum] - Breeding psql.WhereNullMod[Q, enums.FieldseekerMosquitoinspectionMosquitobreedingEnum] + Activity psql.WhereNullMod[Q, string] + Breeding psql.WhereNullMod[Q, string] Totlarvae psql.WhereNullMod[Q, int16] Totpupae psql.WhereNullMod[Q, int16] Eggs psql.WhereNullMod[Q, int16] Posdips psql.WhereNullMod[Q, int16] - Adultact psql.WhereNullMod[Q, enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum] + Adultact psql.WhereNullMod[Q, string] Lstages psql.WhereNullMod[Q, string] - Domstage psql.WhereNullMod[Q, enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2] - Actiontaken psql.WhereNullMod[Q, enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4] + Domstage psql.WhereNullMod[Q, string] + Actiontaken psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] Avetemp psql.WhereNullMod[Q, float64] Windspeed psql.WhereNullMod[Q, float64] Raingauge psql.WhereNullMod[Q, float64] Startdatetime psql.WhereNullMod[Q, time.Time] Enddatetime psql.WhereNullMod[Q, time.Time] - Winddir psql.WhereNullMod[Q, enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum] + Winddir psql.WhereNullMod[Q, string] Avglarvae psql.WhereNullMod[Q, float64] Avgpupae psql.WhereNullMod[Q, float64] - Reviewed psql.WhereNullMod[Q, enums.FieldseekerMosquitoinspectionNotinuitFEnum] + Reviewed psql.WhereNullMod[Q, int16] Reviewedby psql.WhereNullMod[Q, string] Revieweddate psql.WhereNullMod[Q, time.Time] Locationname psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] Recordstatus psql.WhereNullMod[Q, int16] Zone2 psql.WhereNullMod[Q, string] - Personalcontact psql.WhereNullMod[Q, enums.FieldseekerMosquitoinspectionNotinuitFEnum] + Personalcontact psql.WhereNullMod[Q, int16] Tirecount psql.WhereNullMod[Q, int16] Cbcount psql.WhereNullMod[Q, int16] Containercount psql.WhereNullMod[Q, int16] - Fieldspecies psql.WhereNullMod[Q, enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum] + Fieldspecies psql.WhereNullMod[Q, string] Globalid psql.WhereNullMod[Q, uuid.UUID] CreatedUser psql.WhereNullMod[Q, string] CreatedDate psql.WhereNullMod[Q, time.Time] @@ -1745,21 +1913,24 @@ type fieldseekerMosquitoinspectionWhere[Q psql.Filterable] struct { Polygonlocid psql.WhereNullMod[Q, uuid.UUID] Srid psql.WhereNullMod[Q, uuid.UUID] Fieldtech psql.WhereNullMod[Q, string] - Larvaepresent psql.WhereNullMod[Q, enums.FieldseekerMosquitoinspectionNotinuitFEnum] - Pupaepresent psql.WhereNullMod[Q, enums.FieldseekerMosquitoinspectionNotinuitFEnum] + Larvaepresent psql.WhereNullMod[Q, int16] + Pupaepresent psql.WhereNullMod[Q, int16] Sdid psql.WhereNullMod[Q, uuid.UUID] - Sitecond psql.WhereNullMod[Q, enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540] + Sitecond psql.WhereNullMod[Q, string] Positivecontainercount psql.WhereNullMod[Q, int16] Creationdate psql.WhereNullMod[Q, time.Time] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] Jurisdiction psql.WhereNullMod[Q, string] - Visualmonitoring psql.WhereNullMod[Q, enums.FieldseekerMosquitoinspectionNotinuitFEnum] + Visualmonitoring psql.WhereNullMod[Q, int16] Vmcomments psql.WhereNullMod[Q, string] - Adminaction psql.WhereNullMod[Q, enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B] + Adminaction psql.WhereNullMod[Q, string] Ptaid psql.WhereNullMod[Q, uuid.UUID] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerMosquitoinspectionWhere[Q]) AliasedAs(alias string) fieldseekerMosquitoinspectionWhere[Q] { @@ -1770,37 +1941,37 @@ func buildFieldseekerMosquitoinspectionWhere[Q psql.Filterable](cols fieldseeker return fieldseekerMosquitoinspectionWhere[Q]{ Objectid: psql.Where[Q, int64](cols.Objectid), Numdips: psql.WhereNull[Q, int16](cols.Numdips), - Activity: psql.WhereNull[Q, enums.FieldseekerMosquitoinspectionMosquitoactivityEnum](cols.Activity), - Breeding: psql.WhereNull[Q, enums.FieldseekerMosquitoinspectionMosquitobreedingEnum](cols.Breeding), + Activity: psql.WhereNull[Q, string](cols.Activity), + Breeding: psql.WhereNull[Q, string](cols.Breeding), Totlarvae: psql.WhereNull[Q, int16](cols.Totlarvae), Totpupae: psql.WhereNull[Q, int16](cols.Totpupae), Eggs: psql.WhereNull[Q, int16](cols.Eggs), Posdips: psql.WhereNull[Q, int16](cols.Posdips), - Adultact: psql.WhereNull[Q, enums.FieldseekerMosquitoinspectionMosquitoadultactivityEnum](cols.Adultact), + Adultact: psql.WhereNull[Q, string](cols.Adultact), Lstages: psql.WhereNull[Q, string](cols.Lstages), - Domstage: psql.WhereNull[Q, enums.FieldseekerMosquitoinspectionMosquitoinspectionDomstageB7a6c36bccde49a2](cols.Domstage), - Actiontaken: psql.WhereNull[Q, enums.FieldseekerMosquitoinspectionMosquitoinspectionActiontaken252243D69B0B4](cols.Actiontaken), + Domstage: psql.WhereNull[Q, string](cols.Domstage), + Actiontaken: psql.WhereNull[Q, string](cols.Actiontaken), Comments: psql.WhereNull[Q, string](cols.Comments), Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), Startdatetime: psql.WhereNull[Q, time.Time](cols.Startdatetime), Enddatetime: psql.WhereNull[Q, time.Time](cols.Enddatetime), - Winddir: psql.WhereNull[Q, enums.FieldseekerMosquitoinspectionNotinuiwinddirectionEnum](cols.Winddir), + Winddir: psql.WhereNull[Q, string](cols.Winddir), Avglarvae: psql.WhereNull[Q, float64](cols.Avglarvae), Avgpupae: psql.WhereNull[Q, float64](cols.Avgpupae), - Reviewed: psql.WhereNull[Q, enums.FieldseekerMosquitoinspectionNotinuitFEnum](cols.Reviewed), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), Revieweddate: psql.WhereNull[Q, time.Time](cols.Revieweddate), Locationname: psql.WhereNull[Q, string](cols.Locationname), Zone: psql.WhereNull[Q, string](cols.Zone), Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), Zone2: psql.WhereNull[Q, string](cols.Zone2), - Personalcontact: psql.WhereNull[Q, enums.FieldseekerMosquitoinspectionNotinuitFEnum](cols.Personalcontact), + Personalcontact: psql.WhereNull[Q, int16](cols.Personalcontact), Tirecount: psql.WhereNull[Q, int16](cols.Tirecount), Cbcount: psql.WhereNull[Q, int16](cols.Cbcount), Containercount: psql.WhereNull[Q, int16](cols.Containercount), - Fieldspecies: psql.WhereNull[Q, enums.FieldseekerMosquitoinspectionMosquitofieldspeciesEnum](cols.Fieldspecies), + Fieldspecies: psql.WhereNull[Q, string](cols.Fieldspecies), Globalid: psql.WhereNull[Q, uuid.UUID](cols.Globalid), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), CreatedDate: psql.WhereNull[Q, time.Time](cols.CreatedDate), @@ -1811,20 +1982,168 @@ func buildFieldseekerMosquitoinspectionWhere[Q psql.Filterable](cols fieldseeker Polygonlocid: psql.WhereNull[Q, uuid.UUID](cols.Polygonlocid), Srid: psql.WhereNull[Q, uuid.UUID](cols.Srid), Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), - Larvaepresent: psql.WhereNull[Q, enums.FieldseekerMosquitoinspectionNotinuitFEnum](cols.Larvaepresent), - Pupaepresent: psql.WhereNull[Q, enums.FieldseekerMosquitoinspectionNotinuitFEnum](cols.Pupaepresent), + Larvaepresent: psql.WhereNull[Q, int16](cols.Larvaepresent), + Pupaepresent: psql.WhereNull[Q, int16](cols.Pupaepresent), Sdid: psql.WhereNull[Q, uuid.UUID](cols.Sdid), - Sitecond: psql.WhereNull[Q, enums.FieldseekerMosquitoinspectionMosquitoinspectionSitecondDB7350BC81e540](cols.Sitecond), + Sitecond: psql.WhereNull[Q, string](cols.Sitecond), Positivecontainercount: psql.WhereNull[Q, int16](cols.Positivecontainercount), Creationdate: psql.WhereNull[Q, time.Time](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), - Visualmonitoring: psql.WhereNull[Q, enums.FieldseekerMosquitoinspectionNotinuitFEnum](cols.Visualmonitoring), + Visualmonitoring: psql.WhereNull[Q, int16](cols.Visualmonitoring), Vmcomments: psql.WhereNull[Q, string](cols.Vmcomments), - Adminaction: psql.WhereNull[Q, enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B](cols.Adminaction), + Adminaction: psql.WhereNull[Q, string](cols.Adminaction), Ptaid: psql.WhereNull[Q, uuid.UUID](cols.Ptaid), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerMosquitoinspection) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerMosquitoinspection cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Mosquitoinspections = FieldseekerMosquitoinspectionSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerMosquitoinspection has no relationship %q", name) + } +} + +type fieldseekerMosquitoinspectionPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerMosquitoinspectionPreloader() fieldseekerMosquitoinspectionPreloader { + return fieldseekerMosquitoinspectionPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerMosquitoinspections, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerMosquitoinspectionThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerMosquitoinspectionThenLoader[Q orm.Loadable]() fieldseekerMosquitoinspectionThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerMosquitoinspectionThenLoader[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 fieldseekerMosquitoinspection's Organization into the .R struct +func (o *FieldseekerMosquitoinspection) 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.Mosquitoinspections = FieldseekerMosquitoinspectionSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerMosquitoinspection's Organization into the .R struct +func (os FieldseekerMosquitoinspectionSlice) 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.Mosquitoinspections = append(rel.R.Mosquitoinspections, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerMosquitoinspectionJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerMosquitoinspectionJoins[Q]) aliasedAs(alias string) fieldseekerMosquitoinspectionJoins[Q] { + return buildFieldseekerMosquitoinspectionJoins[Q](buildFieldseekerMosquitoinspectionColumns(alias), j.typ) +} + +func buildFieldseekerMosquitoinspectionJoins[Q dialect.Joinable](cols fieldseekerMosquitoinspectionColumns, typ string) fieldseekerMosquitoinspectionJoins[Q] { + return fieldseekerMosquitoinspectionJoins[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/db/models/fieldseeker.pointlocation.bob.go b/db/models/fieldseeker.pointlocation.bob.go index 44cc29d6..9dedd1f7 100644 --- a/db/models/fieldseeker.pointlocation.bob.go +++ b/db/models/fieldseeker.pointlocation.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,89 +21,107 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerPointlocation is an object representing the database table. type FieldseekerPointlocation struct { Objectid int64 `db:"objectid,pk" ` - // Name + // Original attribute from ArcGIS API is NAME Name null.Val[string] `db:"name" ` - // Zone + // Original attribute from ArcGIS API is ZONE Zone null.Val[string] `db:"zone" ` - // Habitat - Habitat null.Val[enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e] `db:"habitat" ` - // Priority - Priority null.Val[enums.FieldseekerPointlocationLocationpriorityEnum] `db:"priority" ` - // Use Type - Usetype null.Val[enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86] `db:"usetype" ` - // Active - Active null.Val[enums.FieldseekerPointlocationNotinuitFEnum] `db:"active" ` - // Description + // Original attribute from ArcGIS API is HABITAT + Habitat null.Val[string] `db:"habitat" ` + // Original attribute from ArcGIS API is PRIORITY + Priority null.Val[string] `db:"priority" ` + // Original attribute from ArcGIS API is USETYPE + Usetype null.Val[string] `db:"usetype" ` + // Original attribute from ArcGIS API is ACTIVE + Active null.Val[int16] `db:"active" ` + // Original attribute from ArcGIS API is DESCRIPTION Description null.Val[string] `db:"description" ` - // Access Description + // Original attribute from ArcGIS API is ACCESSDESC Accessdesc null.Val[string] `db:"accessdesc" ` - // Comments + // Original attribute from ArcGIS API is COMMENTS Comments null.Val[string] `db:"comments" ` - // Symbology - Symbology null.Val[enums.FieldseekerPointlocationLocationsymbologyEnum] `db:"symbology" ` - // External ID + // Original attribute from ArcGIS API is SYMBOLOGY + Symbology null.Val[string] `db:"symbology" ` + // Original attribute from ArcGIS API is EXTERNALID Externalid null.Val[string] `db:"externalid" ` - // Next Scheduled Action + // Original attribute from ArcGIS API is NEXTACTIONDATESCHEDULED Nextactiondatescheduled null.Val[time.Time] `db:"nextactiondatescheduled" ` - // Larval Inspection Interval + // Original attribute from ArcGIS API is LARVINSPECTINTERVAL Larvinspectinterval null.Val[int16] `db:"larvinspectinterval" ` - // Zone2 - Zone2 null.Val[string] `db:"zone2" ` - Locationnumber null.Val[int32] `db:"locationnumber" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - // SourceType + // Original attribute from ArcGIS API is ZONE2 + Zone2 null.Val[string] `db:"zone2" ` + // Original attribute from ArcGIS API is LOCATIONNUMBER + Locationnumber null.Val[int32] `db:"locationnumber" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is STYPE Stype null.Val[string] `db:"stype" ` - // Last Inspection Date + // Original attribute from ArcGIS API is LASTINSPECTDATE Lastinspectdate null.Val[time.Time] `db:"lastinspectdate" ` - // Last Inspection Breeding + // Original attribute from ArcGIS API is LASTINSPECTBREEDING Lastinspectbreeding null.Val[string] `db:"lastinspectbreeding" ` - // Last Inspection Average Larvae + // Original attribute from ArcGIS API is LASTINSPECTAVGLARVAE Lastinspectavglarvae null.Val[float64] `db:"lastinspectavglarvae" ` - // Last Inspection Average Pupae + // Original attribute from ArcGIS API is LASTINSPECTAVGPUPAE Lastinspectavgpupae null.Val[float64] `db:"lastinspectavgpupae" ` - // Last Inspection Larval Stages + // Original attribute from ArcGIS API is LASTINSPECTLSTAGES Lastinspectlstages null.Val[string] `db:"lastinspectlstages" ` - // Last Inspection Action + // Original attribute from ArcGIS API is LASTINSPECTACTIONTAKEN Lastinspectactiontaken null.Val[string] `db:"lastinspectactiontaken" ` - // Last Inspection Field Species + // Original attribute from ArcGIS API is LASTINSPECTFIELDSPECIES Lastinspectfieldspecies null.Val[string] `db:"lastinspectfieldspecies" ` - // Last Treatment Date + // Original attribute from ArcGIS API is LASTTREATDATE Lasttreatdate null.Val[time.Time] `db:"lasttreatdate" ` - // Last Treatment Product + // Original attribute from ArcGIS API is LASTTREATPRODUCT Lasttreatproduct null.Val[string] `db:"lasttreatproduct" ` - // Last Treatment Quantity + // Original attribute from ArcGIS API is LASTTREATQTY Lasttreatqty null.Val[float64] `db:"lasttreatqty" ` - // Last Treatment Quantity Unit + // Original attribute from ArcGIS API is LASTTREATQTYUNIT Lasttreatqtyunit null.Val[string] `db:"lasttreatqtyunit" ` - // Last Inspection Activity + // Original attribute from ArcGIS API is LASTINSPECTACTIVITY Lastinspectactivity null.Val[string] `db:"lastinspectactivity" ` - // Last Treatment Activity + // Original attribute from ArcGIS API is LASTTREATACTIVITY Lasttreatactivity null.Val[string] `db:"lasttreatactivity" ` - // Last Inspection Conditions + // Original attribute from ArcGIS API is LASTINSPECTCONDITIONS Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` - // Water Origin - Waterorigin null.Val[enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899] `db:"waterorigin" ` - X null.Val[float64] `db:"x" ` - Y null.Val[float64] `db:"y" ` - // Assigned Tech - Assignedtech null.Val[enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B] `db:"assignedtech" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Jurisdiction + // Original attribute from ArcGIS API is WATERORIGIN + Waterorigin null.Val[string] `db:"waterorigin" ` + // Original attribute from ArcGIS API is X + X null.Val[float64] `db:"x" ` + // Original attribute from ArcGIS API is Y + Y null.Val[float64] `db:"y" ` + // Original attribute from ArcGIS API is ASSIGNEDTECH + Assignedtech null.Val[string] `db:"assignedtech" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is JURISDICTION Jurisdiction null.Val[string] `db:"jurisdiction" ` - // Reason for Deactivation - DeactivateReason null.Val[enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489] `db:"deactivate_reason" ` - Scalarpriority null.Val[int32] `db:"scalarpriority" ` - Sourcestatus null.Val[string] `db:"sourcestatus" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is deactivate_reason + DeactivateReason null.Val[string] `db:"deactivate_reason" ` + // Original attribute from ArcGIS API is scalarPriority + Scalarpriority null.Val[int32] `db:"scalarpriority" ` + // Original attribute from ArcGIS API is sourceStatus + Sourcestatus null.Val[string] `db:"sourcestatus" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerPointlocationR `db:"-" ` } // FieldseekerPointlocationSlice is an alias for a slice of pointers to FieldseekerPointlocation. @@ -115,10 +134,15 @@ var FieldseekerPointlocations = psql.NewTablex[*FieldseekerPointlocation, Fields // FieldseekerPointlocationsQuery is a query on the pointlocation table type FieldseekerPointlocationsQuery = *psql.ViewQuery[*FieldseekerPointlocation, FieldseekerPointlocationSlice] +// fieldseekerPointlocationR is where relationships are stored. +type fieldseekerPointlocationR struct { + Organization *Organization // fieldseeker.pointlocation.pointlocation_organization_id_fkey +} + func buildFieldseekerPointlocationColumns(alias string) fieldseekerPointlocationColumns { return fieldseekerPointlocationColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "name", "zone", "habitat", "priority", "usetype", "active", "description", "accessdesc", "comments", "symbology", "externalid", "nextactiondatescheduled", "larvinspectinterval", "zone2", "locationnumber", "globalid", "stype", "lastinspectdate", "lastinspectbreeding", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectlstages", "lastinspectactiontaken", "lastinspectfieldspecies", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "lastinspectactivity", "lasttreatactivity", "lastinspectconditions", "waterorigin", "x", "y", "assignedtech", "creationdate", "creator", "editdate", "editor", "jurisdiction", "deactivate_reason", "scalarpriority", "sourcestatus", "version", + "objectid", "name", "zone", "habitat", "priority", "usetype", "active", "description", "accessdesc", "comments", "symbology", "externalid", "nextactiondatescheduled", "larvinspectinterval", "zone2", "locationnumber", "globalid", "stype", "lastinspectdate", "lastinspectbreeding", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectlstages", "lastinspectactiontaken", "lastinspectfieldspecies", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "lastinspectactivity", "lasttreatactivity", "lastinspectconditions", "waterorigin", "x", "y", "assignedtech", "creationdate", "creator", "editdate", "editor", "jurisdiction", "deactivate_reason", "scalarpriority", "sourcestatus", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.pointlocation"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -165,7 +189,10 @@ func buildFieldseekerPointlocationColumns(alias string) fieldseekerPointlocation DeactivateReason: psql.Quote(alias, "deactivate_reason"), Scalarpriority: psql.Quote(alias, "scalarpriority"), Sourcestatus: psql.Quote(alias, "sourcestatus"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -216,7 +243,10 @@ type fieldseekerPointlocationColumns struct { DeactivateReason psql.Expression Scalarpriority psql.Expression Sourcestatus psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerPointlocationColumns) Alias() string { @@ -231,55 +261,58 @@ func (fieldseekerPointlocationColumns) AliasedAs(alias string) fieldseekerPointl // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerPointlocationSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Name omitnull.Val[string] `db:"name" ` - Zone omitnull.Val[string] `db:"zone" ` - Habitat omitnull.Val[enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e] `db:"habitat" ` - Priority omitnull.Val[enums.FieldseekerPointlocationLocationpriorityEnum] `db:"priority" ` - Usetype omitnull.Val[enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86] `db:"usetype" ` - Active omitnull.Val[enums.FieldseekerPointlocationNotinuitFEnum] `db:"active" ` - Description omitnull.Val[string] `db:"description" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Comments omitnull.Val[string] `db:"comments" ` - Symbology omitnull.Val[enums.FieldseekerPointlocationLocationsymbologyEnum] `db:"symbology" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Nextactiondatescheduled omitnull.Val[time.Time] `db:"nextactiondatescheduled" ` - Larvinspectinterval omitnull.Val[int16] `db:"larvinspectinterval" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Locationnumber omitnull.Val[int32] `db:"locationnumber" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - Stype omitnull.Val[string] `db:"stype" ` - Lastinspectdate omitnull.Val[time.Time] `db:"lastinspectdate" ` - Lastinspectbreeding omitnull.Val[string] `db:"lastinspectbreeding" ` - Lastinspectavglarvae omitnull.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae omitnull.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectlstages omitnull.Val[string] `db:"lastinspectlstages" ` - Lastinspectactiontaken omitnull.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectfieldspecies omitnull.Val[string] `db:"lastinspectfieldspecies" ` - Lasttreatdate omitnull.Val[time.Time] `db:"lasttreatdate" ` - Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` - Lastinspectactivity omitnull.Val[string] `db:"lastinspectactivity" ` - Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` - Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` - Waterorigin omitnull.Val[enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899] `db:"waterorigin" ` - X omitnull.Val[float64] `db:"x" ` - Y omitnull.Val[float64] `db:"y" ` - Assignedtech omitnull.Val[enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B] `db:"assignedtech" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - DeactivateReason omitnull.Val[enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489] `db:"deactivate_reason" ` - Scalarpriority omitnull.Val[int32] `db:"scalarpriority" ` - Sourcestatus omitnull.Val[string] `db:"sourcestatus" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Name omitnull.Val[string] `db:"name" ` + Zone omitnull.Val[string] `db:"zone" ` + Habitat omitnull.Val[string] `db:"habitat" ` + Priority omitnull.Val[string] `db:"priority" ` + Usetype omitnull.Val[string] `db:"usetype" ` + Active omitnull.Val[int16] `db:"active" ` + Description omitnull.Val[string] `db:"description" ` + Accessdesc omitnull.Val[string] `db:"accessdesc" ` + Comments omitnull.Val[string] `db:"comments" ` + Symbology omitnull.Val[string] `db:"symbology" ` + Externalid omitnull.Val[string] `db:"externalid" ` + Nextactiondatescheduled omitnull.Val[time.Time] `db:"nextactiondatescheduled" ` + Larvinspectinterval omitnull.Val[int16] `db:"larvinspectinterval" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Locationnumber omitnull.Val[int32] `db:"locationnumber" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + Stype omitnull.Val[string] `db:"stype" ` + Lastinspectdate omitnull.Val[time.Time] `db:"lastinspectdate" ` + Lastinspectbreeding omitnull.Val[string] `db:"lastinspectbreeding" ` + Lastinspectavglarvae omitnull.Val[float64] `db:"lastinspectavglarvae" ` + Lastinspectavgpupae omitnull.Val[float64] `db:"lastinspectavgpupae" ` + Lastinspectlstages omitnull.Val[string] `db:"lastinspectlstages" ` + Lastinspectactiontaken omitnull.Val[string] `db:"lastinspectactiontaken" ` + Lastinspectfieldspecies omitnull.Val[string] `db:"lastinspectfieldspecies" ` + Lasttreatdate omitnull.Val[time.Time] `db:"lasttreatdate" ` + Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` + Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` + Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` + Lastinspectactivity omitnull.Val[string] `db:"lastinspectactivity" ` + Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` + Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` + Waterorigin omitnull.Val[string] `db:"waterorigin" ` + X omitnull.Val[float64] `db:"x" ` + Y omitnull.Val[float64] `db:"y" ` + Assignedtech omitnull.Val[string] `db:"assignedtech" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` + DeactivateReason omitnull.Val[string] `db:"deactivate_reason" ` + Scalarpriority omitnull.Val[int32] `db:"scalarpriority" ` + Sourcestatus omitnull.Val[string] `db:"sourcestatus" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerPointlocationSetter) SetColumns() []string { - vals := make([]string, 0, 45) + vals := make([]string, 0, 48) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -412,9 +445,18 @@ func (s FieldseekerPointlocationSetter) SetColumns() []string { if !s.Sourcestatus.IsUnset() { vals = append(vals, "sourcestatus") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -551,9 +593,18 @@ func (s FieldseekerPointlocationSetter) Overwrite(t *FieldseekerPointlocation) { if !s.Sourcestatus.IsUnset() { t.Sourcestatus = s.Sourcestatus.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerPointlocationSetter) Apply(q *dialect.InsertQuery) { @@ -562,7 +613,7 @@ func (s *FieldseekerPointlocationSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 45) + vals := make([]bob.Expression, 48) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -827,12 +878,30 @@ func (s *FieldseekerPointlocationSetter) Apply(q *dialect.InsertQuery) { vals[43] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[44] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[44] = psql.Arg(s.Geometry.MustGet()) } else { vals[44] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[45] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[46] = psql.Arg(s.Version.MustGet()) + } else { + vals[46] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[47] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -842,7 +911,7 @@ func (s FieldseekerPointlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery } func (s FieldseekerPointlocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 45) + exprs := make([]bob.Expression, 0, 48) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -1152,6 +1221,20 @@ func (s FieldseekerPointlocationSetter) Expressions(prefix ...string) []bob.Expr }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -1159,6 +1242,13 @@ func (s FieldseekerPointlocationSetter) Expressions(prefix ...string) []bob.Expr }}) } + 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 } @@ -1226,6 +1316,7 @@ func (o *FieldseekerPointlocation) Update(ctx context.Context, exec bob.Executor return err } + o.R = v.R *o = *v return nil @@ -1246,7 +1337,7 @@ func (o *FieldseekerPointlocation) Reload(ctx context.Context, exec bob.Executor if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -1296,7 +1387,7 @@ func (o FieldseekerPointlocationSlice) copyMatchingRows(from ...*FieldseekerPoin if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -1394,18 +1485,90 @@ func (o FieldseekerPointlocationSlice) ReloadAll(ctx context.Context, exec bob.E return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerPointlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerPointlocationSlice) 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 attachFieldseekerPointlocationOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerPointlocation0 *FieldseekerPointlocation, organization1 *Organization) (*FieldseekerPointlocation, error) { + setter := &FieldseekerPointlocationSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerPointlocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerPointlocationOrganization0: %w", err) + } + + return fieldseekerPointlocation0, nil +} + +func (fieldseekerPointlocation0 *FieldseekerPointlocation) 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 = attachFieldseekerPointlocationOrganization0(ctx, exec, 1, fieldseekerPointlocation0, organization1) + if err != nil { + return err + } + + fieldseekerPointlocation0.R.Organization = organization1 + + organization1.R.Pointlocations = append(organization1.R.Pointlocations, fieldseekerPointlocation0) + + return nil +} + +func (fieldseekerPointlocation0 *FieldseekerPointlocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerPointlocationOrganization0(ctx, exec, 1, fieldseekerPointlocation0, organization1) + if err != nil { + return err + } + + fieldseekerPointlocation0.R.Organization = organization1 + + organization1.R.Pointlocations = append(organization1.R.Pointlocations, fieldseekerPointlocation0) + + return nil +} + type fieldseekerPointlocationWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] Name psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] - Habitat psql.WhereNullMod[Q, enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e] - Priority psql.WhereNullMod[Q, enums.FieldseekerPointlocationLocationpriorityEnum] - Usetype psql.WhereNullMod[Q, enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86] - Active psql.WhereNullMod[Q, enums.FieldseekerPointlocationNotinuitFEnum] + Habitat psql.WhereNullMod[Q, string] + Priority psql.WhereNullMod[Q, string] + Usetype psql.WhereNullMod[Q, string] + Active psql.WhereNullMod[Q, int16] Description psql.WhereNullMod[Q, string] Accessdesc psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] - Symbology psql.WhereNullMod[Q, enums.FieldseekerPointlocationLocationsymbologyEnum] + Symbology psql.WhereNullMod[Q, string] Externalid psql.WhereNullMod[Q, string] Nextactiondatescheduled psql.WhereNullMod[Q, time.Time] Larvinspectinterval psql.WhereNullMod[Q, int16] @@ -1427,19 +1590,22 @@ type fieldseekerPointlocationWhere[Q psql.Filterable] struct { Lastinspectactivity psql.WhereNullMod[Q, string] Lasttreatactivity psql.WhereNullMod[Q, string] Lastinspectconditions psql.WhereNullMod[Q, string] - Waterorigin psql.WhereNullMod[Q, enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899] + Waterorigin psql.WhereNullMod[Q, string] X psql.WhereNullMod[Q, float64] Y psql.WhereNullMod[Q, float64] - Assignedtech psql.WhereNullMod[Q, enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B] + Assignedtech psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, time.Time] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] Jurisdiction psql.WhereNullMod[Q, string] - DeactivateReason psql.WhereNullMod[Q, enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489] + DeactivateReason psql.WhereNullMod[Q, string] Scalarpriority psql.WhereNullMod[Q, int32] Sourcestatus psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerPointlocationWhere[Q]) AliasedAs(alias string) fieldseekerPointlocationWhere[Q] { @@ -1451,14 +1617,14 @@ func buildFieldseekerPointlocationWhere[Q psql.Filterable](cols fieldseekerPoint Objectid: psql.Where[Q, int64](cols.Objectid), Name: psql.WhereNull[Q, string](cols.Name), Zone: psql.WhereNull[Q, string](cols.Zone), - Habitat: psql.WhereNull[Q, enums.FieldseekerPointlocationPointlocationHabitatB4d8135a497949C88BB367e](cols.Habitat), - Priority: psql.WhereNull[Q, enums.FieldseekerPointlocationLocationpriorityEnum](cols.Priority), - Usetype: psql.WhereNull[Q, enums.FieldseekerPointlocationPointlocationUsetype58d62d18ef4f47fc8cb9874df86](cols.Usetype), - Active: psql.WhereNull[Q, enums.FieldseekerPointlocationNotinuitFEnum](cols.Active), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Priority: psql.WhereNull[Q, string](cols.Priority), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Active: psql.WhereNull[Q, int16](cols.Active), Description: psql.WhereNull[Q, string](cols.Description), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Comments: psql.WhereNull[Q, string](cols.Comments), - Symbology: psql.WhereNull[Q, enums.FieldseekerPointlocationLocationsymbologyEnum](cols.Symbology), + Symbology: psql.WhereNull[Q, string](cols.Symbology), Externalid: psql.WhereNull[Q, string](cols.Externalid), Nextactiondatescheduled: psql.WhereNull[Q, time.Time](cols.Nextactiondatescheduled), Larvinspectinterval: psql.WhereNull[Q, int16](cols.Larvinspectinterval), @@ -1480,18 +1646,166 @@ func buildFieldseekerPointlocationWhere[Q psql.Filterable](cols fieldseekerPoint Lastinspectactivity: psql.WhereNull[Q, string](cols.Lastinspectactivity), Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), - Waterorigin: psql.WhereNull[Q, enums.FieldseekerPointlocationPointlocationWaterorigin197B22BFF3eb4dad8899](cols.Waterorigin), + Waterorigin: psql.WhereNull[Q, string](cols.Waterorigin), X: psql.WhereNull[Q, float64](cols.X), Y: psql.WhereNull[Q, float64](cols.Y), - Assignedtech: psql.WhereNull[Q, enums.FieldseekerPointlocationPointlocationAssignedtech9393a1622474429D85B](cols.Assignedtech), + Assignedtech: psql.WhereNull[Q, string](cols.Assignedtech), Creationdate: psql.WhereNull[Q, time.Time](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), - DeactivateReason: psql.WhereNull[Q, enums.FieldseekerPointlocationPointlocationDeactivateReasonDD303085B33C489](cols.DeactivateReason), + DeactivateReason: psql.WhereNull[Q, string](cols.DeactivateReason), Scalarpriority: psql.WhereNull[Q, int32](cols.Scalarpriority), Sourcestatus: psql.WhereNull[Q, string](cols.Sourcestatus), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerPointlocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerPointlocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Pointlocations = FieldseekerPointlocationSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerPointlocation has no relationship %q", name) + } +} + +type fieldseekerPointlocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerPointlocationPreloader() fieldseekerPointlocationPreloader { + return fieldseekerPointlocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerPointlocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerPointlocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerPointlocationThenLoader[Q orm.Loadable]() fieldseekerPointlocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerPointlocationThenLoader[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 fieldseekerPointlocation's Organization into the .R struct +func (o *FieldseekerPointlocation) 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.Pointlocations = FieldseekerPointlocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerPointlocation's Organization into the .R struct +func (os FieldseekerPointlocationSlice) 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.Pointlocations = append(rel.R.Pointlocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerPointlocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerPointlocationJoins[Q]) aliasedAs(alias string) fieldseekerPointlocationJoins[Q] { + return buildFieldseekerPointlocationJoins[Q](buildFieldseekerPointlocationColumns(alias), j.typ) +} + +func buildFieldseekerPointlocationJoins[Q dialect.Joinable](cols fieldseekerPointlocationColumns, typ string) fieldseekerPointlocationJoins[Q] { + return fieldseekerPointlocationJoins[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/db/models/fieldseeker.polygonlocation.bob.go b/db/models/fieldseeker.polygonlocation.bob.go index 72e67361..84c3b5ef 100644 --- a/db/models/fieldseeker.polygonlocation.bob.go +++ b/db/models/fieldseeker.polygonlocation.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,86 +21,103 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerPolygonlocation is an object representing the database table. type FieldseekerPolygonlocation struct { Objectid int64 `db:"objectid,pk" ` - // Name + // Original attribute from ArcGIS API is NAME Name null.Val[string] `db:"name" ` - // Zone + // Original attribute from ArcGIS API is ZONE Zone null.Val[string] `db:"zone" ` - // Habitat - Habitat null.Val[enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65] `db:"habitat" ` - // Priority - Priority null.Val[enums.FieldseekerPolygonlocationLocationpriorityEnum] `db:"priority" ` - // Use Type - Usetype null.Val[enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13] `db:"usetype" ` - // Active - Active null.Val[enums.FieldseekerPolygonlocationNotinuitFEnum] `db:"active" ` - // Description + // Original attribute from ArcGIS API is HABITAT + Habitat null.Val[string] `db:"habitat" ` + // Original attribute from ArcGIS API is PRIORITY + Priority null.Val[string] `db:"priority" ` + // Original attribute from ArcGIS API is USETYPE + Usetype null.Val[string] `db:"usetype" ` + // Original attribute from ArcGIS API is ACTIVE + Active null.Val[int16] `db:"active" ` + // Original attribute from ArcGIS API is DESCRIPTION Description null.Val[string] `db:"description" ` - // Access Description + // Original attribute from ArcGIS API is ACCESSDESC Accessdesc null.Val[string] `db:"accessdesc" ` - // Comments + // Original attribute from ArcGIS API is COMMENTS Comments null.Val[string] `db:"comments" ` - // Symbology - Symbology null.Val[enums.FieldseekerPolygonlocationLocationsymbologyEnum] `db:"symbology" ` - // External ID + // Original attribute from ArcGIS API is SYMBOLOGY + Symbology null.Val[string] `db:"symbology" ` + // Original attribute from ArcGIS API is EXTERNALID Externalid null.Val[string] `db:"externalid" ` - // Acres + // Original attribute from ArcGIS API is ACRES Acres null.Val[float64] `db:"acres" ` - // Next Scheduled Action + // Original attribute from ArcGIS API is NEXTACTIONDATESCHEDULED Nextactiondatescheduled null.Val[time.Time] `db:"nextactiondatescheduled" ` - // Larval Inspection Interval + // Original attribute from ArcGIS API is LARVINSPECTINTERVAL Larvinspectinterval null.Val[int16] `db:"larvinspectinterval" ` - // Zone2 - Zone2 null.Val[string] `db:"zone2" ` - Locationnumber null.Val[int32] `db:"locationnumber" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - // Last Inspection Date + // Original attribute from ArcGIS API is ZONE2 + Zone2 null.Val[string] `db:"zone2" ` + // Original attribute from ArcGIS API is LOCATIONNUMBER + Locationnumber null.Val[int32] `db:"locationnumber" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is LASTINSPECTDATE Lastinspectdate null.Val[time.Time] `db:"lastinspectdate" ` - // Last Inspection Breeding + // Original attribute from ArcGIS API is LASTINSPECTBREEDING Lastinspectbreeding null.Val[string] `db:"lastinspectbreeding" ` - // Last Inspection Average Larvae + // Original attribute from ArcGIS API is LASTINSPECTAVGLARVAE Lastinspectavglarvae null.Val[float64] `db:"lastinspectavglarvae" ` - // Last Inspection Average Pupae + // Original attribute from ArcGIS API is LASTINSPECTAVGPUPAE Lastinspectavgpupae null.Val[float64] `db:"lastinspectavgpupae" ` - // Last Inspection Larval Stages + // Original attribute from ArcGIS API is LASTINSPECTLSTAGES Lastinspectlstages null.Val[string] `db:"lastinspectlstages" ` - // Last Inspection Action + // Original attribute from ArcGIS API is LASTINSPECTACTIONTAKEN Lastinspectactiontaken null.Val[string] `db:"lastinspectactiontaken" ` - // Last Inspection Field Species + // Original attribute from ArcGIS API is LASTINSPECTFIELDSPECIES Lastinspectfieldspecies null.Val[string] `db:"lastinspectfieldspecies" ` - // Last Treatment Date + // Original attribute from ArcGIS API is LASTTREATDATE Lasttreatdate null.Val[time.Time] `db:"lasttreatdate" ` - // Last Treatment Product + // Original attribute from ArcGIS API is LASTTREATPRODUCT Lasttreatproduct null.Val[string] `db:"lasttreatproduct" ` - // Last Treatment Quantity + // Original attribute from ArcGIS API is LASTTREATQTY Lasttreatqty null.Val[float64] `db:"lasttreatqty" ` - // Last Treatment Quantity Unit + // Original attribute from ArcGIS API is LASTTREATQTYUNIT Lasttreatqtyunit null.Val[string] `db:"lasttreatqtyunit" ` - // Hectares + // Original attribute from ArcGIS API is HECTARES Hectares null.Val[float64] `db:"hectares" ` - // Last Inspection Activity + // Original attribute from ArcGIS API is LASTINSPECTACTIVITY Lastinspectactivity null.Val[string] `db:"lastinspectactivity" ` - // Last Treatment Activity + // Original attribute from ArcGIS API is LASTTREATACTIVITY Lasttreatactivity null.Val[string] `db:"lasttreatactivity" ` - // Last Inspection Conditions + // Original attribute from ArcGIS API is LASTINSPECTCONDITIONS Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` - // Water Origin - Waterorigin null.Val[enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9] `db:"waterorigin" ` - Filter null.Val[string] `db:"filter" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Jurisdiction - Jurisdiction null.Val[string] `db:"jurisdiction" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is WATERORIGIN + Waterorigin null.Val[string] `db:"waterorigin" ` + // Original attribute from ArcGIS API is Filter + Filter null.Val[string] `db:"filter" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is JURISDICTION + Jurisdiction null.Val[string] `db:"jurisdiction" ` + // Original attribute from ArcGIS API is Shape__Area + ShapeArea null.Val[float64] `db:"shape__area" ` + // Original attribute from ArcGIS API is Shape__Length + ShapeLength null.Val[float64] `db:"shape__length" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerPolygonlocationR `db:"-" ` } // FieldseekerPolygonlocationSlice is an alias for a slice of pointers to FieldseekerPolygonlocation. @@ -112,10 +130,15 @@ var FieldseekerPolygonlocations = psql.NewTablex[*FieldseekerPolygonlocation, Fi // FieldseekerPolygonlocationsQuery is a query on the polygonlocation table type FieldseekerPolygonlocationsQuery = *psql.ViewQuery[*FieldseekerPolygonlocation, FieldseekerPolygonlocationSlice] +// fieldseekerPolygonlocationR is where relationships are stored. +type fieldseekerPolygonlocationR struct { + Organization *Organization // fieldseeker.polygonlocation.polygonlocation_organization_id_fkey +} + func buildFieldseekerPolygonlocationColumns(alias string) fieldseekerPolygonlocationColumns { return fieldseekerPolygonlocationColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "name", "zone", "habitat", "priority", "usetype", "active", "description", "accessdesc", "comments", "symbology", "externalid", "acres", "nextactiondatescheduled", "larvinspectinterval", "zone2", "locationnumber", "globalid", "lastinspectdate", "lastinspectbreeding", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectlstages", "lastinspectactiontaken", "lastinspectfieldspecies", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "hectares", "lastinspectactivity", "lasttreatactivity", "lastinspectconditions", "waterorigin", "filter", "creationdate", "creator", "editdate", "editor", "jurisdiction", "shape__area", "shape__length", "version", + "objectid", "name", "zone", "habitat", "priority", "usetype", "active", "description", "accessdesc", "comments", "symbology", "externalid", "acres", "nextactiondatescheduled", "larvinspectinterval", "zone2", "locationnumber", "globalid", "lastinspectdate", "lastinspectbreeding", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectlstages", "lastinspectactiontaken", "lastinspectfieldspecies", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "hectares", "lastinspectactivity", "lasttreatactivity", "lastinspectconditions", "waterorigin", "filter", "creationdate", "creator", "editdate", "editor", "jurisdiction", "shape__area", "shape__length", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.polygonlocation"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -160,7 +183,10 @@ func buildFieldseekerPolygonlocationColumns(alias string) fieldseekerPolygonloca Jurisdiction: psql.Quote(alias, "jurisdiction"), ShapeArea: psql.Quote(alias, "shape__area"), ShapeLength: psql.Quote(alias, "shape__length"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -209,7 +235,10 @@ type fieldseekerPolygonlocationColumns struct { Jurisdiction psql.Expression ShapeArea psql.Expression ShapeLength psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerPolygonlocationColumns) Alias() string { @@ -224,53 +253,56 @@ func (fieldseekerPolygonlocationColumns) AliasedAs(alias string) fieldseekerPoly // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerPolygonlocationSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Name omitnull.Val[string] `db:"name" ` - Zone omitnull.Val[string] `db:"zone" ` - Habitat omitnull.Val[enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65] `db:"habitat" ` - Priority omitnull.Val[enums.FieldseekerPolygonlocationLocationpriorityEnum] `db:"priority" ` - Usetype omitnull.Val[enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13] `db:"usetype" ` - Active omitnull.Val[enums.FieldseekerPolygonlocationNotinuitFEnum] `db:"active" ` - Description omitnull.Val[string] `db:"description" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Comments omitnull.Val[string] `db:"comments" ` - Symbology omitnull.Val[enums.FieldseekerPolygonlocationLocationsymbologyEnum] `db:"symbology" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Acres omitnull.Val[float64] `db:"acres" ` - Nextactiondatescheduled omitnull.Val[time.Time] `db:"nextactiondatescheduled" ` - Larvinspectinterval omitnull.Val[int16] `db:"larvinspectinterval" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Locationnumber omitnull.Val[int32] `db:"locationnumber" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - Lastinspectdate omitnull.Val[time.Time] `db:"lastinspectdate" ` - Lastinspectbreeding omitnull.Val[string] `db:"lastinspectbreeding" ` - Lastinspectavglarvae omitnull.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae omitnull.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectlstages omitnull.Val[string] `db:"lastinspectlstages" ` - Lastinspectactiontaken omitnull.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectfieldspecies omitnull.Val[string] `db:"lastinspectfieldspecies" ` - Lasttreatdate omitnull.Val[time.Time] `db:"lasttreatdate" ` - Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` - Hectares omitnull.Val[float64] `db:"hectares" ` - Lastinspectactivity omitnull.Val[string] `db:"lastinspectactivity" ` - Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` - Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` - Waterorigin omitnull.Val[enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9] `db:"waterorigin" ` - Filter omitnull.Val[string] `db:"filter" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Name omitnull.Val[string] `db:"name" ` + Zone omitnull.Val[string] `db:"zone" ` + Habitat omitnull.Val[string] `db:"habitat" ` + Priority omitnull.Val[string] `db:"priority" ` + Usetype omitnull.Val[string] `db:"usetype" ` + Active omitnull.Val[int16] `db:"active" ` + Description omitnull.Val[string] `db:"description" ` + Accessdesc omitnull.Val[string] `db:"accessdesc" ` + Comments omitnull.Val[string] `db:"comments" ` + Symbology omitnull.Val[string] `db:"symbology" ` + Externalid omitnull.Val[string] `db:"externalid" ` + Acres omitnull.Val[float64] `db:"acres" ` + Nextactiondatescheduled omitnull.Val[time.Time] `db:"nextactiondatescheduled" ` + Larvinspectinterval omitnull.Val[int16] `db:"larvinspectinterval" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Locationnumber omitnull.Val[int32] `db:"locationnumber" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + Lastinspectdate omitnull.Val[time.Time] `db:"lastinspectdate" ` + Lastinspectbreeding omitnull.Val[string] `db:"lastinspectbreeding" ` + Lastinspectavglarvae omitnull.Val[float64] `db:"lastinspectavglarvae" ` + Lastinspectavgpupae omitnull.Val[float64] `db:"lastinspectavgpupae" ` + Lastinspectlstages omitnull.Val[string] `db:"lastinspectlstages" ` + Lastinspectactiontaken omitnull.Val[string] `db:"lastinspectactiontaken" ` + Lastinspectfieldspecies omitnull.Val[string] `db:"lastinspectfieldspecies" ` + Lasttreatdate omitnull.Val[time.Time] `db:"lasttreatdate" ` + Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` + Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` + Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` + Hectares omitnull.Val[float64] `db:"hectares" ` + Lastinspectactivity omitnull.Val[string] `db:"lastinspectactivity" ` + Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` + Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` + Waterorigin omitnull.Val[string] `db:"waterorigin" ` + Filter omitnull.Val[string] `db:"filter" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` + ShapeArea omitnull.Val[float64] `db:"shape__area" ` + ShapeLength omitnull.Val[float64] `db:"shape__length" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerPolygonlocationSetter) SetColumns() []string { - vals := make([]string, 0, 43) + vals := make([]string, 0, 46) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -397,9 +429,18 @@ func (s FieldseekerPolygonlocationSetter) SetColumns() []string { if !s.ShapeLength.IsUnset() { vals = append(vals, "shape__length") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -530,9 +571,18 @@ func (s FieldseekerPolygonlocationSetter) Overwrite(t *FieldseekerPolygonlocatio if !s.ShapeLength.IsUnset() { t.ShapeLength = s.ShapeLength.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerPolygonlocationSetter) Apply(q *dialect.InsertQuery) { @@ -541,7 +591,7 @@ func (s *FieldseekerPolygonlocationSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 43) + vals := make([]bob.Expression, 46) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -794,12 +844,30 @@ func (s *FieldseekerPolygonlocationSetter) Apply(q *dialect.InsertQuery) { vals[41] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[42] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[42] = psql.Arg(s.Geometry.MustGet()) } else { vals[42] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[43] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[44] = psql.Arg(s.Version.MustGet()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[45] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -809,7 +877,7 @@ func (s FieldseekerPolygonlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQue } func (s FieldseekerPolygonlocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 43) + exprs := make([]bob.Expression, 0, 46) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -1105,6 +1173,20 @@ func (s FieldseekerPolygonlocationSetter) Expressions(prefix ...string) []bob.Ex }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -1112,6 +1194,13 @@ func (s FieldseekerPolygonlocationSetter) Expressions(prefix ...string) []bob.Ex }}) } + 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 } @@ -1179,6 +1268,7 @@ func (o *FieldseekerPolygonlocation) Update(ctx context.Context, exec bob.Execut return err } + o.R = v.R *o = *v return nil @@ -1199,7 +1289,7 @@ func (o *FieldseekerPolygonlocation) Reload(ctx context.Context, exec bob.Execut if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -1249,7 +1339,7 @@ func (o FieldseekerPolygonlocationSlice) copyMatchingRows(from ...*FieldseekerPo if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -1347,18 +1437,90 @@ func (o FieldseekerPolygonlocationSlice) ReloadAll(ctx context.Context, exec bob return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerPolygonlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerPolygonlocationSlice) 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 attachFieldseekerPolygonlocationOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerPolygonlocation0 *FieldseekerPolygonlocation, organization1 *Organization) (*FieldseekerPolygonlocation, error) { + setter := &FieldseekerPolygonlocationSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerPolygonlocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerPolygonlocationOrganization0: %w", err) + } + + return fieldseekerPolygonlocation0, nil +} + +func (fieldseekerPolygonlocation0 *FieldseekerPolygonlocation) 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 = attachFieldseekerPolygonlocationOrganization0(ctx, exec, 1, fieldseekerPolygonlocation0, organization1) + if err != nil { + return err + } + + fieldseekerPolygonlocation0.R.Organization = organization1 + + organization1.R.Polygonlocations = append(organization1.R.Polygonlocations, fieldseekerPolygonlocation0) + + return nil +} + +func (fieldseekerPolygonlocation0 *FieldseekerPolygonlocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerPolygonlocationOrganization0(ctx, exec, 1, fieldseekerPolygonlocation0, organization1) + if err != nil { + return err + } + + fieldseekerPolygonlocation0.R.Organization = organization1 + + organization1.R.Polygonlocations = append(organization1.R.Polygonlocations, fieldseekerPolygonlocation0) + + return nil +} + type fieldseekerPolygonlocationWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] Name psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] - Habitat psql.WhereNullMod[Q, enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65] - Priority psql.WhereNullMod[Q, enums.FieldseekerPolygonlocationLocationpriorityEnum] - Usetype psql.WhereNullMod[Q, enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13] - Active psql.WhereNullMod[Q, enums.FieldseekerPolygonlocationNotinuitFEnum] + Habitat psql.WhereNullMod[Q, string] + Priority psql.WhereNullMod[Q, string] + Usetype psql.WhereNullMod[Q, string] + Active psql.WhereNullMod[Q, int16] Description psql.WhereNullMod[Q, string] Accessdesc psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] - Symbology psql.WhereNullMod[Q, enums.FieldseekerPolygonlocationLocationsymbologyEnum] + Symbology psql.WhereNullMod[Q, string] Externalid psql.WhereNullMod[Q, string] Acres psql.WhereNullMod[Q, float64] Nextactiondatescheduled psql.WhereNullMod[Q, time.Time] @@ -1381,7 +1543,7 @@ type fieldseekerPolygonlocationWhere[Q psql.Filterable] struct { Lastinspectactivity psql.WhereNullMod[Q, string] Lasttreatactivity psql.WhereNullMod[Q, string] Lastinspectconditions psql.WhereNullMod[Q, string] - Waterorigin psql.WhereNullMod[Q, enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9] + Waterorigin psql.WhereNullMod[Q, string] Filter psql.WhereNullMod[Q, string] Creationdate psql.WhereNullMod[Q, time.Time] Creator psql.WhereNullMod[Q, string] @@ -1390,7 +1552,10 @@ type fieldseekerPolygonlocationWhere[Q psql.Filterable] struct { Jurisdiction psql.WhereNullMod[Q, string] ShapeArea psql.WhereNullMod[Q, float64] ShapeLength psql.WhereNullMod[Q, float64] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerPolygonlocationWhere[Q]) AliasedAs(alias string) fieldseekerPolygonlocationWhere[Q] { @@ -1402,14 +1567,14 @@ func buildFieldseekerPolygonlocationWhere[Q psql.Filterable](cols fieldseekerPol Objectid: psql.Where[Q, int64](cols.Objectid), Name: psql.WhereNull[Q, string](cols.Name), Zone: psql.WhereNull[Q, string](cols.Zone), - Habitat: psql.WhereNull[Q, enums.FieldseekerPolygonlocationPolygonlocationHabitat45e9dde79ac84d959df8b65](cols.Habitat), - Priority: psql.WhereNull[Q, enums.FieldseekerPolygonlocationLocationpriorityEnum](cols.Priority), - Usetype: psql.WhereNull[Q, enums.FieldseekerPolygonlocationPolygonlocationUsetypeE546154cb9544b9aa8e7b13](cols.Usetype), - Active: psql.WhereNull[Q, enums.FieldseekerPolygonlocationNotinuitFEnum](cols.Active), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Priority: psql.WhereNull[Q, string](cols.Priority), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Active: psql.WhereNull[Q, int16](cols.Active), Description: psql.WhereNull[Q, string](cols.Description), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Comments: psql.WhereNull[Q, string](cols.Comments), - Symbology: psql.WhereNull[Q, enums.FieldseekerPolygonlocationLocationsymbologyEnum](cols.Symbology), + Symbology: psql.WhereNull[Q, string](cols.Symbology), Externalid: psql.WhereNull[Q, string](cols.Externalid), Acres: psql.WhereNull[Q, float64](cols.Acres), Nextactiondatescheduled: psql.WhereNull[Q, time.Time](cols.Nextactiondatescheduled), @@ -1432,7 +1597,7 @@ func buildFieldseekerPolygonlocationWhere[Q psql.Filterable](cols fieldseekerPol Lastinspectactivity: psql.WhereNull[Q, string](cols.Lastinspectactivity), Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), - Waterorigin: psql.WhereNull[Q, enums.FieldseekerPolygonlocationPolygonlocationWateroriginE9018e925F474FF9](cols.Waterorigin), + Waterorigin: psql.WhereNull[Q, string](cols.Waterorigin), Filter: psql.WhereNull[Q, string](cols.Filter), Creationdate: psql.WhereNull[Q, time.Time](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -1441,6 +1606,154 @@ func buildFieldseekerPolygonlocationWhere[Q psql.Filterable](cols fieldseekerPol Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerPolygonlocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerPolygonlocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Polygonlocations = FieldseekerPolygonlocationSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerPolygonlocation has no relationship %q", name) + } +} + +type fieldseekerPolygonlocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerPolygonlocationPreloader() fieldseekerPolygonlocationPreloader { + return fieldseekerPolygonlocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerPolygonlocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerPolygonlocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerPolygonlocationThenLoader[Q orm.Loadable]() fieldseekerPolygonlocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerPolygonlocationThenLoader[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 fieldseekerPolygonlocation's Organization into the .R struct +func (o *FieldseekerPolygonlocation) 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.Polygonlocations = FieldseekerPolygonlocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerPolygonlocation's Organization into the .R struct +func (os FieldseekerPolygonlocationSlice) 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.Polygonlocations = append(rel.R.Polygonlocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerPolygonlocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerPolygonlocationJoins[Q]) aliasedAs(alias string) fieldseekerPolygonlocationJoins[Q] { + return buildFieldseekerPolygonlocationJoins[Q](buildFieldseekerPolygonlocationColumns(alias), j.typ) +} + +func buildFieldseekerPolygonlocationJoins[Q dialect.Joinable](cols fieldseekerPolygonlocationColumns, typ string) fieldseekerPolygonlocationJoins[Q] { + return fieldseekerPolygonlocationJoins[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/db/models/fieldseeker.pool.bob.go b/db/models/fieldseeker.pool.bob.go index 70b95958..62bfe1c6 100644 --- a/db/models/fieldseeker.pool.bob.go +++ b/db/models/fieldseeker.pool.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,53 +21,75 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerPool is an object representing the database table. type FieldseekerPool struct { Objectid int64 `db:"objectid,pk" ` - // Trap Data ID + // Original attribute from ArcGIS API is TRAPDATA_ID TrapdataID null.Val[uuid.UUID] `db:"trapdata_id" ` - // Date Sent + // Original attribute from ArcGIS API is DATESENT Datesent null.Val[time.Time] `db:"datesent" ` - // Survey Tech + // Original attribute from ArcGIS API is SURVTECH Survtech null.Val[string] `db:"survtech" ` - // Date Tested + // Original attribute from ArcGIS API is DATETESTED Datetested null.Val[time.Time] `db:"datetested" ` - // Test Tech + // Original attribute from ArcGIS API is TESTTECH Testtech null.Val[string] `db:"testtech" ` - // Comments + // Original attribute from ArcGIS API is COMMENTS Comments null.Val[string] `db:"comments" ` - // Sample ID + // Original attribute from ArcGIS API is SAMPLEID Sampleid null.Val[string] `db:"sampleid" ` - // Processed - Processed null.Val[enums.FieldseekerPoolNotinuitFEnum] `db:"processed" ` - LabID null.Val[uuid.UUID] `db:"lab_id" ` - // Test Methods - Testmethod null.Val[enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum] `db:"testmethod" ` - // Diseases Tested - Diseasetested null.Val[enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum] `db:"diseasetested" ` - // Diseases Positive - Diseasepos null.Val[enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum] `db:"diseasepos" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - Lab null.Val[enums.FieldseekerPoolMosquitolabnameEnum] `db:"lab" ` - // Pool Year + // Original attribute from ArcGIS API is PROCESSED + Processed null.Val[int16] `db:"processed" ` + // Original attribute from ArcGIS API is LAB_ID + LabID null.Val[uuid.UUID] `db:"lab_id" ` + // Original attribute from ArcGIS API is TESTMETHOD + Testmethod null.Val[string] `db:"testmethod" ` + // Original attribute from ArcGIS API is DISEASETESTED + Diseasetested null.Val[string] `db:"diseasetested" ` + // Original attribute from ArcGIS API is DISEASEPOS + Diseasepos null.Val[string] `db:"diseasepos" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date + LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` + // Original attribute from ArcGIS API is LAB + Lab null.Val[string] `db:"lab" ` + // Original attribute from ArcGIS API is POOLYEAR Poolyear null.Val[int16] `db:"poolyear" ` - // Gateway Sync - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Vectorsurvcollectionid null.Val[string] `db:"vectorsurvcollectionid" ` - Vectorsurvpoolid null.Val[string] `db:"vectorsurvpoolid" ` - Vectorsurvtrapdataid null.Val[string] `db:"vectorsurvtrapdataid" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is GATEWAYSYNC + Gatewaysync null.Val[int16] `db:"gatewaysync" ` + // Original attribute from ArcGIS API is VECTORSURVCOLLECTIONID + Vectorsurvcollectionid null.Val[string] `db:"vectorsurvcollectionid" ` + // Original attribute from ArcGIS API is VECTORSURVPOOLID + Vectorsurvpoolid null.Val[string] `db:"vectorsurvpoolid" ` + // Original attribute from ArcGIS API is VECTORSURVTRAPDATAID + Vectorsurvtrapdataid null.Val[string] `db:"vectorsurvtrapdataid" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerPoolR `db:"-" ` } // FieldseekerPoolSlice is an alias for a slice of pointers to FieldseekerPool. @@ -79,10 +102,15 @@ var FieldseekerPools = psql.NewTablex[*FieldseekerPool, FieldseekerPoolSlice, *F // FieldseekerPoolsQuery is a query on the pool table type FieldseekerPoolsQuery = *psql.ViewQuery[*FieldseekerPool, FieldseekerPoolSlice] +// fieldseekerPoolR is where relationships are stored. +type fieldseekerPoolR struct { + Organization *Organization // fieldseeker.pool.pool_organization_id_fkey +} + func buildFieldseekerPoolColumns(alias string) fieldseekerPoolColumns { return fieldseekerPoolColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "trapdata_id", "datesent", "survtech", "datetested", "testtech", "comments", "sampleid", "processed", "lab_id", "testmethod", "diseasetested", "diseasepos", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "lab", "poolyear", "gatewaysync", "vectorsurvcollectionid", "vectorsurvpoolid", "vectorsurvtrapdataid", "creationdate", "creator", "editdate", "editor", "version", + "objectid", "trapdata_id", "datesent", "survtech", "datetested", "testtech", "comments", "sampleid", "processed", "lab_id", "testmethod", "diseasetested", "diseasepos", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "lab", "poolyear", "gatewaysync", "vectorsurvcollectionid", "vectorsurvpoolid", "vectorsurvtrapdataid", "creationdate", "creator", "editdate", "editor", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.pool"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -113,7 +141,10 @@ func buildFieldseekerPoolColumns(alias string) fieldseekerPoolColumns { Creator: psql.Quote(alias, "creator"), Editdate: psql.Quote(alias, "editdate"), Editor: psql.Quote(alias, "editor"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -148,7 +179,10 @@ type fieldseekerPoolColumns struct { Creator psql.Expression Editdate psql.Expression Editor psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerPoolColumns) Alias() string { @@ -163,39 +197,42 @@ func (fieldseekerPoolColumns) AliasedAs(alias string) fieldseekerPoolColumns { // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerPoolSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - TrapdataID omitnull.Val[uuid.UUID] `db:"trapdata_id" ` - Datesent omitnull.Val[time.Time] `db:"datesent" ` - Survtech omitnull.Val[string] `db:"survtech" ` - Datetested omitnull.Val[time.Time] `db:"datetested" ` - Testtech omitnull.Val[string] `db:"testtech" ` - Comments omitnull.Val[string] `db:"comments" ` - Sampleid omitnull.Val[string] `db:"sampleid" ` - Processed omitnull.Val[enums.FieldseekerPoolNotinuitFEnum] `db:"processed" ` - LabID omitnull.Val[uuid.UUID] `db:"lab_id" ` - Testmethod omitnull.Val[enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum] `db:"testmethod" ` - Diseasetested omitnull.Val[enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum] `db:"diseasetested" ` - Diseasepos omitnull.Val[enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum] `db:"diseasepos" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Lab omitnull.Val[enums.FieldseekerPoolMosquitolabnameEnum] `db:"lab" ` - Poolyear omitnull.Val[int16] `db:"poolyear" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Vectorsurvcollectionid omitnull.Val[string] `db:"vectorsurvcollectionid" ` - Vectorsurvpoolid omitnull.Val[string] `db:"vectorsurvpoolid" ` - Vectorsurvtrapdataid omitnull.Val[string] `db:"vectorsurvtrapdataid" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + TrapdataID omitnull.Val[uuid.UUID] `db:"trapdata_id" ` + Datesent omitnull.Val[time.Time] `db:"datesent" ` + Survtech omitnull.Val[string] `db:"survtech" ` + Datetested omitnull.Val[time.Time] `db:"datetested" ` + Testtech omitnull.Val[string] `db:"testtech" ` + Comments omitnull.Val[string] `db:"comments" ` + Sampleid omitnull.Val[string] `db:"sampleid" ` + Processed omitnull.Val[int16] `db:"processed" ` + LabID omitnull.Val[uuid.UUID] `db:"lab_id" ` + Testmethod omitnull.Val[string] `db:"testmethod" ` + Diseasetested omitnull.Val[string] `db:"diseasetested" ` + Diseasepos omitnull.Val[string] `db:"diseasepos" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Lab omitnull.Val[string] `db:"lab" ` + Poolyear omitnull.Val[int16] `db:"poolyear" ` + Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` + Vectorsurvcollectionid omitnull.Val[string] `db:"vectorsurvcollectionid" ` + Vectorsurvpoolid omitnull.Val[string] `db:"vectorsurvpoolid" ` + Vectorsurvtrapdataid omitnull.Val[string] `db:"vectorsurvtrapdataid" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerPoolSetter) SetColumns() []string { - vals := make([]string, 0, 29) + vals := make([]string, 0, 32) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -280,9 +317,18 @@ func (s FieldseekerPoolSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -371,9 +417,18 @@ func (s FieldseekerPoolSetter) Overwrite(t *FieldseekerPool) { if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerPoolSetter) Apply(q *dialect.InsertQuery) { @@ -382,7 +437,7 @@ func (s *FieldseekerPoolSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 29) + vals := make([]bob.Expression, 32) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -551,12 +606,30 @@ func (s *FieldseekerPoolSetter) Apply(q *dialect.InsertQuery) { vals[27] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[28] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[28] = psql.Arg(s.Geometry.MustGet()) } else { vals[28] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[29] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[30] = psql.Arg(s.Version.MustGet()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[31] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -566,7 +639,7 @@ func (s FieldseekerPoolSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s FieldseekerPoolSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 29) + exprs := make([]bob.Expression, 0, 32) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -764,6 +837,20 @@ func (s FieldseekerPoolSetter) Expressions(prefix ...string) []bob.Expression { }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -771,6 +858,13 @@ func (s FieldseekerPoolSetter) Expressions(prefix ...string) []bob.Expression { }}) } + 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 } @@ -838,6 +932,7 @@ func (o *FieldseekerPool) Update(ctx context.Context, exec bob.Executor, s *Fiel return err } + o.R = v.R *o = *v return nil @@ -858,7 +953,7 @@ func (o *FieldseekerPool) Reload(ctx context.Context, exec bob.Executor) error { if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -908,7 +1003,7 @@ func (o FieldseekerPoolSlice) copyMatchingRows(from ...*FieldseekerPool) { if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -1006,6 +1101,78 @@ func (o FieldseekerPoolSlice) ReloadAll(ctx context.Context, exec bob.Executor) return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerPool) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerPoolSlice) 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 attachFieldseekerPoolOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerPool0 *FieldseekerPool, organization1 *Organization) (*FieldseekerPool, error) { + setter := &FieldseekerPoolSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerPool0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerPoolOrganization0: %w", err) + } + + return fieldseekerPool0, nil +} + +func (fieldseekerPool0 *FieldseekerPool) 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 = attachFieldseekerPoolOrganization0(ctx, exec, 1, fieldseekerPool0, organization1) + if err != nil { + return err + } + + fieldseekerPool0.R.Organization = organization1 + + organization1.R.Pools = append(organization1.R.Pools, fieldseekerPool0) + + return nil +} + +func (fieldseekerPool0 *FieldseekerPool) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerPoolOrganization0(ctx, exec, 1, fieldseekerPool0, organization1) + if err != nil { + return err + } + + fieldseekerPool0.R.Organization = organization1 + + organization1.R.Pools = append(organization1.R.Pools, fieldseekerPool0) + + return nil +} + type fieldseekerPoolWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] TrapdataID psql.WhereNullMod[Q, uuid.UUID] @@ -1015,17 +1182,17 @@ type fieldseekerPoolWhere[Q psql.Filterable] struct { Testtech psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] Sampleid psql.WhereNullMod[Q, string] - Processed psql.WhereNullMod[Q, enums.FieldseekerPoolNotinuitFEnum] + Processed psql.WhereNullMod[Q, int16] LabID psql.WhereNullMod[Q, uuid.UUID] - Testmethod psql.WhereNullMod[Q, enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum] - Diseasetested psql.WhereNullMod[Q, enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum] - Diseasepos psql.WhereNullMod[Q, enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum] + Testmethod psql.WhereNullMod[Q, string] + Diseasetested psql.WhereNullMod[Q, string] + Diseasepos psql.WhereNullMod[Q, string] Globalid psql.WhereNullMod[Q, uuid.UUID] CreatedUser psql.WhereNullMod[Q, string] CreatedDate psql.WhereNullMod[Q, time.Time] LastEditedUser psql.WhereNullMod[Q, string] LastEditedDate psql.WhereNullMod[Q, time.Time] - Lab psql.WhereNullMod[Q, enums.FieldseekerPoolMosquitolabnameEnum] + Lab psql.WhereNullMod[Q, string] Poolyear psql.WhereNullMod[Q, int16] Gatewaysync psql.WhereNullMod[Q, int16] Vectorsurvcollectionid psql.WhereNullMod[Q, string] @@ -1035,7 +1202,10 @@ type fieldseekerPoolWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerPoolWhere[Q]) AliasedAs(alias string) fieldseekerPoolWhere[Q] { @@ -1052,17 +1222,17 @@ func buildFieldseekerPoolWhere[Q psql.Filterable](cols fieldseekerPoolColumns) f Testtech: psql.WhereNull[Q, string](cols.Testtech), Comments: psql.WhereNull[Q, string](cols.Comments), Sampleid: psql.WhereNull[Q, string](cols.Sampleid), - Processed: psql.WhereNull[Q, enums.FieldseekerPoolNotinuitFEnum](cols.Processed), + Processed: psql.WhereNull[Q, int16](cols.Processed), LabID: psql.WhereNull[Q, uuid.UUID](cols.LabID), - Testmethod: psql.WhereNull[Q, enums.FieldseekerPoolPoolTestmethod670efbfba86d41ba8e2d3cab5d749e7fEnum](cols.Testmethod), - Diseasetested: psql.WhereNull[Q, enums.FieldseekerPoolPoolDiseasetested0f02232949c04c7e8de820b9b515ed97Enum](cols.Diseasetested), - Diseasepos: psql.WhereNull[Q, enums.FieldseekerPoolPoolDiseasepos6889f8dd00074874aa726907e78497faEnum](cols.Diseasepos), + Testmethod: psql.WhereNull[Q, string](cols.Testmethod), + Diseasetested: psql.WhereNull[Q, string](cols.Diseasetested), + Diseasepos: psql.WhereNull[Q, string](cols.Diseasepos), Globalid: psql.WhereNull[Q, uuid.UUID](cols.Globalid), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), CreatedDate: psql.WhereNull[Q, time.Time](cols.CreatedDate), LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), LastEditedDate: psql.WhereNull[Q, time.Time](cols.LastEditedDate), - Lab: psql.WhereNull[Q, enums.FieldseekerPoolMosquitolabnameEnum](cols.Lab), + Lab: psql.WhereNull[Q, string](cols.Lab), Poolyear: psql.WhereNull[Q, int16](cols.Poolyear), Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), Vectorsurvcollectionid: psql.WhereNull[Q, string](cols.Vectorsurvcollectionid), @@ -1072,6 +1242,154 @@ func buildFieldseekerPoolWhere[Q psql.Filterable](cols fieldseekerPoolColumns) f Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerPool) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerPool cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Pools = FieldseekerPoolSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerPool has no relationship %q", name) + } +} + +type fieldseekerPoolPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerPoolPreloader() fieldseekerPoolPreloader { + return fieldseekerPoolPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerPools, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerPoolThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerPoolThenLoader[Q orm.Loadable]() fieldseekerPoolThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerPoolThenLoader[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 fieldseekerPool's Organization into the .R struct +func (o *FieldseekerPool) 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.Pools = FieldseekerPoolSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerPool's Organization into the .R struct +func (os FieldseekerPoolSlice) 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.Pools = append(rel.R.Pools, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerPoolJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerPoolJoins[Q]) aliasedAs(alias string) fieldseekerPoolJoins[Q] { + return buildFieldseekerPoolJoins[Q](buildFieldseekerPoolColumns(alias), j.typ) +} + +func buildFieldseekerPoolJoins[Q dialect.Joinable](cols fieldseekerPoolColumns, typ string) fieldseekerPoolJoins[Q] { + return fieldseekerPoolJoins[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/db/models/fieldseeker.pooldetail.bob.go b/db/models/fieldseeker.pooldetail.bob.go index 7b33fdaa..40d1f496 100644 --- a/db/models/fieldseeker.pooldetail.bob.go +++ b/db/models/fieldseeker.pooldetail.bob.go @@ -1,17 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -19,30 +21,47 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerPooldetail is an object representing the database table. type FieldseekerPooldetail struct { Objectid int64 `db:"objectid,pk" ` - // Trap Data ID + // Original attribute from ArcGIS API is TRAPDATA_ID TrapdataID null.Val[uuid.UUID] `db:"trapdata_id" ` - // Pool ID + // Original attribute from ArcGIS API is POOL_ID PoolID null.Val[uuid.UUID] `db:"pool_id" ` - // Species + // Original attribute from ArcGIS API is SPECIES Species null.Val[string] `db:"species" ` - // Females - Females null.Val[int16] `db:"females" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is FEMALES + Females null.Val[int16] `db:"females" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerPooldetailR `db:"-" ` } // FieldseekerPooldetailSlice is an alias for a slice of pointers to FieldseekerPooldetail. @@ -55,10 +74,15 @@ var FieldseekerPooldetails = psql.NewTablex[*FieldseekerPooldetail, FieldseekerP // FieldseekerPooldetailsQuery is a query on the pooldetail table type FieldseekerPooldetailsQuery = *psql.ViewQuery[*FieldseekerPooldetail, FieldseekerPooldetailSlice] +// fieldseekerPooldetailR is where relationships are stored. +type fieldseekerPooldetailR struct { + Organization *Organization // fieldseeker.pooldetail.pooldetail_organization_id_fkey +} + func buildFieldseekerPooldetailColumns(alias string) fieldseekerPooldetailColumns { return fieldseekerPooldetailColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "trapdata_id", "pool_id", "species", "females", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "creationdate", "creator", "editdate", "editor", "version", + "objectid", "trapdata_id", "pool_id", "species", "females", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "creationdate", "creator", "editdate", "editor", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.pooldetail"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -75,7 +99,10 @@ func buildFieldseekerPooldetailColumns(alias string) fieldseekerPooldetailColumn Creator: psql.Quote(alias, "creator"), Editdate: psql.Quote(alias, "editdate"), Editor: psql.Quote(alias, "editor"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -96,7 +123,10 @@ type fieldseekerPooldetailColumns struct { Creator psql.Expression Editdate psql.Expression Editor psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerPooldetailColumns) Alias() string { @@ -111,25 +141,28 @@ func (fieldseekerPooldetailColumns) AliasedAs(alias string) fieldseekerPooldetai // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerPooldetailSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - TrapdataID omitnull.Val[uuid.UUID] `db:"trapdata_id" ` - PoolID omitnull.Val[uuid.UUID] `db:"pool_id" ` - Species omitnull.Val[string] `db:"species" ` - Females omitnull.Val[int16] `db:"females" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + TrapdataID omitnull.Val[uuid.UUID] `db:"trapdata_id" ` + PoolID omitnull.Val[uuid.UUID] `db:"pool_id" ` + Species omitnull.Val[string] `db:"species" ` + Females omitnull.Val[int16] `db:"females" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerPooldetailSetter) SetColumns() []string { - vals := make([]string, 0, 15) + vals := make([]string, 0, 18) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -172,9 +205,18 @@ func (s FieldseekerPooldetailSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -221,9 +263,18 @@ func (s FieldseekerPooldetailSetter) Overwrite(t *FieldseekerPooldetail) { if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerPooldetailSetter) Apply(q *dialect.InsertQuery) { @@ -232,7 +283,7 @@ func (s *FieldseekerPooldetailSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 15) + vals := make([]bob.Expression, 18) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -317,12 +368,30 @@ func (s *FieldseekerPooldetailSetter) Apply(q *dialect.InsertQuery) { vals[13] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[14] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[14] = psql.Arg(s.Geometry.MustGet()) } else { vals[14] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[15] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[16] = psql.Arg(s.Version.MustGet()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[17] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -332,7 +401,7 @@ func (s FieldseekerPooldetailSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s FieldseekerPooldetailSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 15) + exprs := make([]bob.Expression, 0, 18) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -432,6 +501,20 @@ func (s FieldseekerPooldetailSetter) Expressions(prefix ...string) []bob.Express }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -439,6 +522,13 @@ func (s FieldseekerPooldetailSetter) Expressions(prefix ...string) []bob.Express }}) } + 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 } @@ -506,6 +596,7 @@ func (o *FieldseekerPooldetail) Update(ctx context.Context, exec bob.Executor, s return err } + o.R = v.R *o = *v return nil @@ -526,7 +617,7 @@ func (o *FieldseekerPooldetail) Reload(ctx context.Context, exec bob.Executor) e if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -576,7 +667,7 @@ func (o FieldseekerPooldetailSlice) copyMatchingRows(from ...*FieldseekerPooldet if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -674,6 +765,78 @@ func (o FieldseekerPooldetailSlice) ReloadAll(ctx context.Context, exec bob.Exec return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerPooldetail) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerPooldetailSlice) 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 attachFieldseekerPooldetailOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerPooldetail0 *FieldseekerPooldetail, organization1 *Organization) (*FieldseekerPooldetail, error) { + setter := &FieldseekerPooldetailSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerPooldetail0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerPooldetailOrganization0: %w", err) + } + + return fieldseekerPooldetail0, nil +} + +func (fieldseekerPooldetail0 *FieldseekerPooldetail) 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 = attachFieldseekerPooldetailOrganization0(ctx, exec, 1, fieldseekerPooldetail0, organization1) + if err != nil { + return err + } + + fieldseekerPooldetail0.R.Organization = organization1 + + organization1.R.Pooldetails = append(organization1.R.Pooldetails, fieldseekerPooldetail0) + + return nil +} + +func (fieldseekerPooldetail0 *FieldseekerPooldetail) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerPooldetailOrganization0(ctx, exec, 1, fieldseekerPooldetail0, organization1) + if err != nil { + return err + } + + fieldseekerPooldetail0.R.Organization = organization1 + + organization1.R.Pooldetails = append(organization1.R.Pooldetails, fieldseekerPooldetail0) + + return nil +} + type fieldseekerPooldetailWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] TrapdataID psql.WhereNullMod[Q, uuid.UUID] @@ -689,7 +852,10 @@ type fieldseekerPooldetailWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerPooldetailWhere[Q]) AliasedAs(alias string) fieldseekerPooldetailWhere[Q] { @@ -712,6 +878,154 @@ func buildFieldseekerPooldetailWhere[Q psql.Filterable](cols fieldseekerPooldeta Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerPooldetail) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerPooldetail cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Pooldetails = FieldseekerPooldetailSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerPooldetail has no relationship %q", name) + } +} + +type fieldseekerPooldetailPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerPooldetailPreloader() fieldseekerPooldetailPreloader { + return fieldseekerPooldetailPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerPooldetails, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerPooldetailThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerPooldetailThenLoader[Q orm.Loadable]() fieldseekerPooldetailThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerPooldetailThenLoader[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 fieldseekerPooldetail's Organization into the .R struct +func (o *FieldseekerPooldetail) 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.Pooldetails = FieldseekerPooldetailSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerPooldetail's Organization into the .R struct +func (os FieldseekerPooldetailSlice) 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.Pooldetails = append(rel.R.Pooldetails, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerPooldetailJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerPooldetailJoins[Q]) aliasedAs(alias string) fieldseekerPooldetailJoins[Q] { + return buildFieldseekerPooldetailJoins[Q](buildFieldseekerPooldetailColumns(alias), j.typ) +} + +func buildFieldseekerPooldetailJoins[Q dialect.Joinable](cols fieldseekerPooldetailColumns, typ string) fieldseekerPooldetailJoins[Q] { + return fieldseekerPooldetailJoins[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/db/models/fieldseeker.proposedtreatmentarea.bob.go b/db/models/fieldseeker.proposedtreatmentarea.bob.go index 14eca843..68b4e1ef 100644 --- a/db/models/fieldseeker.proposedtreatmentarea.bob.go +++ b/db/models/fieldseeker.proposedtreatmentarea.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,69 +21,85 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerProposedtreatmentarea is an object representing the database table. type FieldseekerProposedtreatmentarea struct { Objectid int64 `db:"objectid,pk" ` - // Method - Method null.Val[enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum] `db:"method" ` - // Comments + // Original attribute from ArcGIS API is METHOD + Method null.Val[string] `db:"method" ` + // Original attribute from ArcGIS API is COMMENTS Comments null.Val[string] `db:"comments" ` - // Zone + // Original attribute from ArcGIS API is ZONE Zone null.Val[string] `db:"zone" ` - // Reviewed - Reviewed null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] `db:"reviewed" ` - // Reviewed By + // Original attribute from ArcGIS API is REVIEWED + Reviewed null.Val[int16] `db:"reviewed" ` + // Original attribute from ArcGIS API is REVIEWEDBY Reviewedby null.Val[string] `db:"reviewedby" ` - // Reviewed Date + // Original attribute from ArcGIS API is REVIEWEDDATE Revieweddate null.Val[time.Time] `db:"revieweddate" ` - // Zone2 + // Original attribute from ArcGIS API is ZONE2 Zone2 null.Val[string] `db:"zone2" ` - // Completed Date + // Original attribute from ArcGIS API is COMPLETEDDATE Completeddate null.Val[time.Time] `db:"completeddate" ` - // Completed By + // Original attribute from ArcGIS API is COMPLETEDBY Completedby null.Val[string] `db:"completedby" ` - // Completed - Completed null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] `db:"completed" ` - // Is Spray Route - Issprayroute null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] `db:"issprayroute" ` - // Name + // Original attribute from ArcGIS API is COMPLETED + Completed null.Val[int16] `db:"completed" ` + // Original attribute from ArcGIS API is ISSPRAYROUTE + Issprayroute null.Val[int16] `db:"issprayroute" ` + // Original attribute from ArcGIS API is NAME Name null.Val[string] `db:"name" ` - // Acres - Acres null.Val[float64] `db:"acres" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - Exported null.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] `db:"exported" ` - // Target Product + // Original attribute from ArcGIS API is ACRES + Acres null.Val[float64] `db:"acres" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is EXPORTED + Exported null.Val[int16] `db:"exported" ` + // Original attribute from ArcGIS API is TARGETPRODUCT Targetproduct null.Val[string] `db:"targetproduct" ` - // Target App Rate + // Original attribute from ArcGIS API is TARGETAPPRATE Targetapprate null.Val[float64] `db:"targetapprate" ` - // Hectares + // Original attribute from ArcGIS API is HECTARES Hectares null.Val[float64] `db:"hectares" ` - // Last Treatment Activity + // Original attribute from ArcGIS API is LASTTREATACTIVITY Lasttreatactivity null.Val[string] `db:"lasttreatactivity" ` - // Last Treatment Date + // Original attribute from ArcGIS API is LASTTREATDATE Lasttreatdate null.Val[time.Time] `db:"lasttreatdate" ` - // Last Treatment Product + // Original attribute from ArcGIS API is LASTTREATPRODUCT Lasttreatproduct null.Val[string] `db:"lasttreatproduct" ` - // Last Treatment Quantity + // Original attribute from ArcGIS API is LASTTREATQTY Lasttreatqty null.Val[float64] `db:"lasttreatqty" ` - // Last Treatment Quantity Unit + // Original attribute from ArcGIS API is LASTTREATQTYUNIT Lasttreatqtyunit null.Val[string] `db:"lasttreatqtyunit" ` - // Priority - Priority null.Val[enums.FieldseekerProposedtreatmentareaLocationpriorityEnum] `db:"priority" ` - // Due Date - Duedate null.Val[time.Time] `db:"duedate" ` + // Original attribute from ArcGIS API is PRIORITY + Priority null.Val[string] `db:"priority" ` + // Original attribute from ArcGIS API is DUEDATE + Duedate null.Val[time.Time] `db:"duedate" ` + // Original attribute from ArcGIS API is CreationDate Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Target Species - Targetspecies null.Val[string] `db:"targetspecies" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is TARGETSPECIES + Targetspecies null.Val[string] `db:"targetspecies" ` + // Original attribute from ArcGIS API is Shape__Area + ShapeArea null.Val[float64] `db:"shape__area" ` + // Original attribute from ArcGIS API is Shape__Length + ShapeLength null.Val[float64] `db:"shape__length" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerProposedtreatmentareaR `db:"-" ` } // FieldseekerProposedtreatmentareaSlice is an alias for a slice of pointers to FieldseekerProposedtreatmentarea. @@ -95,10 +112,15 @@ var FieldseekerProposedtreatmentareas = psql.NewTablex[*FieldseekerProposedtreat // FieldseekerProposedtreatmentareasQuery is a query on the proposedtreatmentarea table type FieldseekerProposedtreatmentareasQuery = *psql.ViewQuery[*FieldseekerProposedtreatmentarea, FieldseekerProposedtreatmentareaSlice] +// fieldseekerProposedtreatmentareaR is where relationships are stored. +type fieldseekerProposedtreatmentareaR struct { + Organization *Organization // fieldseeker.proposedtreatmentarea.proposedtreatmentarea_organization_id_fkey +} + func buildFieldseekerProposedtreatmentareaColumns(alias string) fieldseekerProposedtreatmentareaColumns { return fieldseekerProposedtreatmentareaColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "method", "comments", "zone", "reviewed", "reviewedby", "revieweddate", "zone2", "completeddate", "completedby", "completed", "issprayroute", "name", "acres", "globalid", "exported", "targetproduct", "targetapprate", "hectares", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "priority", "duedate", "creationdate", "creator", "editdate", "editor", "targetspecies", "shape__area", "shape__length", "version", + "objectid", "method", "comments", "zone", "reviewed", "reviewedby", "revieweddate", "zone2", "completeddate", "completedby", "completed", "issprayroute", "name", "acres", "globalid", "exported", "targetproduct", "targetapprate", "hectares", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "priority", "duedate", "creationdate", "creator", "editdate", "editor", "targetspecies", "shape__area", "shape__length", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.proposedtreatmentarea"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -134,7 +156,10 @@ func buildFieldseekerProposedtreatmentareaColumns(alias string) fieldseekerPropo Targetspecies: psql.Quote(alias, "targetspecies"), ShapeArea: psql.Quote(alias, "shape__area"), ShapeLength: psql.Quote(alias, "shape__length"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -174,7 +199,10 @@ type fieldseekerProposedtreatmentareaColumns struct { Targetspecies psql.Expression ShapeArea psql.Expression ShapeLength psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerProposedtreatmentareaColumns) Alias() string { @@ -189,44 +217,47 @@ func (fieldseekerProposedtreatmentareaColumns) AliasedAs(alias string) fieldseek // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerProposedtreatmentareaSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Method omitnull.Val[enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum] `db:"method" ` - Comments omitnull.Val[string] `db:"comments" ` - Zone omitnull.Val[string] `db:"zone" ` - Reviewed omitnull.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[time.Time] `db:"revieweddate" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Completeddate omitnull.Val[time.Time] `db:"completeddate" ` - Completedby omitnull.Val[string] `db:"completedby" ` - Completed omitnull.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] `db:"completed" ` - Issprayroute omitnull.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] `db:"issprayroute" ` - Name omitnull.Val[string] `db:"name" ` - Acres omitnull.Val[float64] `db:"acres" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - Exported omitnull.Val[enums.FieldseekerProposedtreatmentareaNotinuitFEnum] `db:"exported" ` - Targetproduct omitnull.Val[string] `db:"targetproduct" ` - Targetapprate omitnull.Val[float64] `db:"targetapprate" ` - Hectares omitnull.Val[float64] `db:"hectares" ` - Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate omitnull.Val[time.Time] `db:"lasttreatdate" ` - Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` - Priority omitnull.Val[enums.FieldseekerProposedtreatmentareaLocationpriorityEnum] `db:"priority" ` - Duedate omitnull.Val[time.Time] `db:"duedate" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Targetspecies omitnull.Val[string] `db:"targetspecies" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Method omitnull.Val[string] `db:"method" ` + Comments omitnull.Val[string] `db:"comments" ` + Zone omitnull.Val[string] `db:"zone" ` + Reviewed omitnull.Val[int16] `db:"reviewed" ` + Reviewedby omitnull.Val[string] `db:"reviewedby" ` + Revieweddate omitnull.Val[time.Time] `db:"revieweddate" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Completeddate omitnull.Val[time.Time] `db:"completeddate" ` + Completedby omitnull.Val[string] `db:"completedby" ` + Completed omitnull.Val[int16] `db:"completed" ` + Issprayroute omitnull.Val[int16] `db:"issprayroute" ` + Name omitnull.Val[string] `db:"name" ` + Acres omitnull.Val[float64] `db:"acres" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + Exported omitnull.Val[int16] `db:"exported" ` + Targetproduct omitnull.Val[string] `db:"targetproduct" ` + Targetapprate omitnull.Val[float64] `db:"targetapprate" ` + Hectares omitnull.Val[float64] `db:"hectares" ` + Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` + Lasttreatdate omitnull.Val[time.Time] `db:"lasttreatdate" ` + Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` + Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` + Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` + Priority omitnull.Val[string] `db:"priority" ` + Duedate omitnull.Val[time.Time] `db:"duedate" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Targetspecies omitnull.Val[string] `db:"targetspecies" ` + ShapeArea omitnull.Val[float64] `db:"shape__area" ` + ShapeLength omitnull.Val[float64] `db:"shape__length" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerProposedtreatmentareaSetter) SetColumns() []string { - vals := make([]string, 0, 34) + vals := make([]string, 0, 37) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -326,9 +357,18 @@ func (s FieldseekerProposedtreatmentareaSetter) SetColumns() []string { if !s.ShapeLength.IsUnset() { vals = append(vals, "shape__length") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -432,9 +472,18 @@ func (s FieldseekerProposedtreatmentareaSetter) Overwrite(t *FieldseekerProposed if !s.ShapeLength.IsUnset() { t.ShapeLength = s.ShapeLength.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerProposedtreatmentareaSetter) Apply(q *dialect.InsertQuery) { @@ -443,7 +492,7 @@ func (s *FieldseekerProposedtreatmentareaSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 34) + vals := make([]bob.Expression, 37) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -642,12 +691,30 @@ func (s *FieldseekerProposedtreatmentareaSetter) Apply(q *dialect.InsertQuery) { vals[32] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[33] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[33] = psql.Arg(s.Geometry.MustGet()) } else { vals[33] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[34] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[34] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[35] = psql.Arg(s.Version.MustGet()) + } else { + vals[35] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[36] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[36] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -657,7 +724,7 @@ func (s FieldseekerProposedtreatmentareaSetter) UpdateMod() bob.Mod[*dialect.Upd } func (s FieldseekerProposedtreatmentareaSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 34) + exprs := make([]bob.Expression, 0, 37) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -890,6 +957,20 @@ func (s FieldseekerProposedtreatmentareaSetter) Expressions(prefix ...string) [] }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -897,6 +978,13 @@ func (s FieldseekerProposedtreatmentareaSetter) Expressions(prefix ...string) [] }}) } + 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 } @@ -964,6 +1052,7 @@ func (o *FieldseekerProposedtreatmentarea) Update(ctx context.Context, exec bob. return err } + o.R = v.R *o = *v return nil @@ -984,7 +1073,7 @@ func (o *FieldseekerProposedtreatmentarea) Reload(ctx context.Context, exec bob. if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -1034,7 +1123,7 @@ func (o FieldseekerProposedtreatmentareaSlice) copyMatchingRows(from ...*Fieldse if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -1132,23 +1221,95 @@ func (o FieldseekerProposedtreatmentareaSlice) ReloadAll(ctx context.Context, ex return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerProposedtreatmentarea) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerProposedtreatmentareaSlice) 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 attachFieldseekerProposedtreatmentareaOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerProposedtreatmentarea0 *FieldseekerProposedtreatmentarea, organization1 *Organization) (*FieldseekerProposedtreatmentarea, error) { + setter := &FieldseekerProposedtreatmentareaSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerProposedtreatmentarea0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerProposedtreatmentareaOrganization0: %w", err) + } + + return fieldseekerProposedtreatmentarea0, nil +} + +func (fieldseekerProposedtreatmentarea0 *FieldseekerProposedtreatmentarea) 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 = attachFieldseekerProposedtreatmentareaOrganization0(ctx, exec, 1, fieldseekerProposedtreatmentarea0, organization1) + if err != nil { + return err + } + + fieldseekerProposedtreatmentarea0.R.Organization = organization1 + + organization1.R.Proposedtreatmentareas = append(organization1.R.Proposedtreatmentareas, fieldseekerProposedtreatmentarea0) + + return nil +} + +func (fieldseekerProposedtreatmentarea0 *FieldseekerProposedtreatmentarea) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerProposedtreatmentareaOrganization0(ctx, exec, 1, fieldseekerProposedtreatmentarea0, organization1) + if err != nil { + return err + } + + fieldseekerProposedtreatmentarea0.R.Organization = organization1 + + organization1.R.Proposedtreatmentareas = append(organization1.R.Proposedtreatmentareas, fieldseekerProposedtreatmentarea0) + + return nil +} + type fieldseekerProposedtreatmentareaWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] - Method psql.WhereNullMod[Q, enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum] + Method psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] - Reviewed psql.WhereNullMod[Q, enums.FieldseekerProposedtreatmentareaNotinuitFEnum] + Reviewed psql.WhereNullMod[Q, int16] Reviewedby psql.WhereNullMod[Q, string] Revieweddate psql.WhereNullMod[Q, time.Time] Zone2 psql.WhereNullMod[Q, string] Completeddate psql.WhereNullMod[Q, time.Time] Completedby psql.WhereNullMod[Q, string] - Completed psql.WhereNullMod[Q, enums.FieldseekerProposedtreatmentareaNotinuitFEnum] - Issprayroute psql.WhereNullMod[Q, enums.FieldseekerProposedtreatmentareaNotinuitFEnum] + Completed psql.WhereNullMod[Q, int16] + Issprayroute psql.WhereNullMod[Q, int16] Name psql.WhereNullMod[Q, string] Acres psql.WhereNullMod[Q, float64] Globalid psql.WhereNullMod[Q, uuid.UUID] - Exported psql.WhereNullMod[Q, enums.FieldseekerProposedtreatmentareaNotinuitFEnum] + Exported psql.WhereNullMod[Q, int16] Targetproduct psql.WhereNullMod[Q, string] Targetapprate psql.WhereNullMod[Q, float64] Hectares psql.WhereNullMod[Q, float64] @@ -1157,7 +1318,7 @@ type fieldseekerProposedtreatmentareaWhere[Q psql.Filterable] struct { Lasttreatproduct psql.WhereNullMod[Q, string] Lasttreatqty psql.WhereNullMod[Q, float64] Lasttreatqtyunit psql.WhereNullMod[Q, string] - Priority psql.WhereNullMod[Q, enums.FieldseekerProposedtreatmentareaLocationpriorityEnum] + Priority psql.WhereNullMod[Q, string] Duedate psql.WhereNullMod[Q, time.Time] Creationdate psql.WhereNullMod[Q, time.Time] Creator psql.WhereNullMod[Q, string] @@ -1166,7 +1327,10 @@ type fieldseekerProposedtreatmentareaWhere[Q psql.Filterable] struct { Targetspecies psql.WhereNullMod[Q, string] ShapeArea psql.WhereNullMod[Q, float64] ShapeLength psql.WhereNullMod[Q, float64] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerProposedtreatmentareaWhere[Q]) AliasedAs(alias string) fieldseekerProposedtreatmentareaWhere[Q] { @@ -1176,21 +1340,21 @@ func (fieldseekerProposedtreatmentareaWhere[Q]) AliasedAs(alias string) fieldsee func buildFieldseekerProposedtreatmentareaWhere[Q psql.Filterable](cols fieldseekerProposedtreatmentareaColumns) fieldseekerProposedtreatmentareaWhere[Q] { return fieldseekerProposedtreatmentareaWhere[Q]{ Objectid: psql.Where[Q, int64](cols.Objectid), - Method: psql.WhereNull[Q, enums.FieldseekerProposedtreatmentareaMosquitotreatmentmethodEnum](cols.Method), + Method: psql.WhereNull[Q, string](cols.Method), Comments: psql.WhereNull[Q, string](cols.Comments), Zone: psql.WhereNull[Q, string](cols.Zone), - Reviewed: psql.WhereNull[Q, enums.FieldseekerProposedtreatmentareaNotinuitFEnum](cols.Reviewed), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), Revieweddate: psql.WhereNull[Q, time.Time](cols.Revieweddate), Zone2: psql.WhereNull[Q, string](cols.Zone2), Completeddate: psql.WhereNull[Q, time.Time](cols.Completeddate), Completedby: psql.WhereNull[Q, string](cols.Completedby), - Completed: psql.WhereNull[Q, enums.FieldseekerProposedtreatmentareaNotinuitFEnum](cols.Completed), - Issprayroute: psql.WhereNull[Q, enums.FieldseekerProposedtreatmentareaNotinuitFEnum](cols.Issprayroute), + Completed: psql.WhereNull[Q, int16](cols.Completed), + Issprayroute: psql.WhereNull[Q, int16](cols.Issprayroute), Name: psql.WhereNull[Q, string](cols.Name), Acres: psql.WhereNull[Q, float64](cols.Acres), Globalid: psql.WhereNull[Q, uuid.UUID](cols.Globalid), - Exported: psql.WhereNull[Q, enums.FieldseekerProposedtreatmentareaNotinuitFEnum](cols.Exported), + Exported: psql.WhereNull[Q, int16](cols.Exported), Targetproduct: psql.WhereNull[Q, string](cols.Targetproduct), Targetapprate: psql.WhereNull[Q, float64](cols.Targetapprate), Hectares: psql.WhereNull[Q, float64](cols.Hectares), @@ -1199,7 +1363,7 @@ func buildFieldseekerProposedtreatmentareaWhere[Q psql.Filterable](cols fieldsee Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), - Priority: psql.WhereNull[Q, enums.FieldseekerProposedtreatmentareaLocationpriorityEnum](cols.Priority), + Priority: psql.WhereNull[Q, string](cols.Priority), Duedate: psql.WhereNull[Q, time.Time](cols.Duedate), Creationdate: psql.WhereNull[Q, time.Time](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), @@ -1208,6 +1372,154 @@ func buildFieldseekerProposedtreatmentareaWhere[Q psql.Filterable](cols fieldsee Targetspecies: psql.WhereNull[Q, string](cols.Targetspecies), ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerProposedtreatmentarea) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerProposedtreatmentarea cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Proposedtreatmentareas = FieldseekerProposedtreatmentareaSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerProposedtreatmentarea has no relationship %q", name) + } +} + +type fieldseekerProposedtreatmentareaPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerProposedtreatmentareaPreloader() fieldseekerProposedtreatmentareaPreloader { + return fieldseekerProposedtreatmentareaPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerProposedtreatmentareas, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerProposedtreatmentareaThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerProposedtreatmentareaThenLoader[Q orm.Loadable]() fieldseekerProposedtreatmentareaThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerProposedtreatmentareaThenLoader[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 fieldseekerProposedtreatmentarea's Organization into the .R struct +func (o *FieldseekerProposedtreatmentarea) 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.Proposedtreatmentareas = FieldseekerProposedtreatmentareaSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerProposedtreatmentarea's Organization into the .R struct +func (os FieldseekerProposedtreatmentareaSlice) 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.Proposedtreatmentareas = append(rel.R.Proposedtreatmentareas, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerProposedtreatmentareaJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerProposedtreatmentareaJoins[Q]) aliasedAs(alias string) fieldseekerProposedtreatmentareaJoins[Q] { + return buildFieldseekerProposedtreatmentareaJoins[Q](buildFieldseekerProposedtreatmentareaColumns(alias), j.typ) +} + +func buildFieldseekerProposedtreatmentareaJoins[Q dialect.Joinable](cols fieldseekerProposedtreatmentareaColumns, typ string) fieldseekerProposedtreatmentareaJoins[Q] { + return fieldseekerProposedtreatmentareaJoins[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/db/models/fieldseeker.qamosquitoinspection.bob.go b/db/models/fieldseeker.qamosquitoinspection.bob.go index 7d135f65..1473b03e 100644 --- a/db/models/fieldseeker.qamosquitoinspection.bob.go +++ b/db/models/fieldseeker.qamosquitoinspection.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,116 +21,143 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerQamosquitoinspection is an object representing the database table. type FieldseekerQamosquitoinspection struct { Objectid int64 `db:"objectid,pk" ` - // Positive Dips + // Original attribute from ArcGIS API is POSDIPS Posdips null.Val[int16] `db:"posdips" ` - // Action - Actiontaken null.Val[enums.FieldseekerQamosquitoinspectionMosquitoactionEnum] `db:"actiontaken" ` - // Comments + // Original attribute from ArcGIS API is ACTIONTAKEN + Actiontaken null.Val[string] `db:"actiontaken" ` + // Original attribute from ArcGIS API is COMMENTS Comments null.Val[string] `db:"comments" ` - // Average Temperature + // Original attribute from ArcGIS API is AVETEMP Avetemp null.Val[float64] `db:"avetemp" ` - // Wind Speed + // Original attribute from ArcGIS API is WINDSPEED Windspeed null.Val[float64] `db:"windspeed" ` - // Rain Gauge - Raingauge null.Val[float64] `db:"raingauge" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - // Start + // Original attribute from ArcGIS API is RAINGAUGE + Raingauge null.Val[float64] `db:"raingauge" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is STARTDATETIME Startdatetime null.Val[time.Time] `db:"startdatetime" ` - // Finish + // Original attribute from ArcGIS API is ENDDATETIME Enddatetime null.Val[time.Time] `db:"enddatetime" ` - // Wind Direction - Winddir null.Val[string] `db:"winddir" ` - Reviewed null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[time.Time] `db:"revieweddate" ` - Locationname null.Val[string] `db:"locationname" ` - Zone null.Val[string] `db:"zone" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Zone2 null.Val[string] `db:"zone2" ` - // Landing Rate + // Original attribute from ArcGIS API is WINDDIR + Winddir null.Val[string] `db:"winddir" ` + // Original attribute from ArcGIS API is REVIEWED + Reviewed null.Val[int16] `db:"reviewed" ` + // Original attribute from ArcGIS API is REVIEWEDBY + Reviewedby null.Val[string] `db:"reviewedby" ` + // Original attribute from ArcGIS API is REVIEWEDDATE + Revieweddate null.Val[time.Time] `db:"revieweddate" ` + // Original attribute from ArcGIS API is LOCATIONNAME + Locationname null.Val[string] `db:"locationname" ` + // Original attribute from ArcGIS API is ZONE + Zone null.Val[string] `db:"zone" ` + // Original attribute from ArcGIS API is RECORDSTATUS + Recordstatus null.Val[int16] `db:"recordstatus" ` + // Original attribute from ArcGIS API is ZONE2 + Zone2 null.Val[string] `db:"zone2" ` + // Original attribute from ArcGIS API is LR LR null.Val[int16] `db:"lr" ` - // Negative Dips + // Original attribute from ArcGIS API is NEGDIPS Negdips null.Val[int16] `db:"negdips" ` - // Total Acres + // Original attribute from ArcGIS API is TOTALACRES Totalacres null.Val[float64] `db:"totalacres" ` - // Acres Breeding + // Original attribute from ArcGIS API is ACRESBREEDING Acresbreeding null.Val[float64] `db:"acresbreeding" ` - // Fish Present? - Fish null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"fish" ` - // Site Type - Sitetype null.Val[enums.FieldseekerQamosquitoinspectionQasitetypeEnum] `db:"sitetype" ` - // Breeding Potential - Breedingpotential null.Val[enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum] `db:"breedingpotential" ` - // Moving Water - Movingwater null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"movingwater" ` - // No Evidence of Water Ever - Nowaterever null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"nowaterever" ` - // Mosquito Habitat Indicators - Mosquitohabitat null.Val[enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum] `db:"mosquitohabitat" ` - // Habitat Value + // Original attribute from ArcGIS API is FISH + Fish null.Val[int16] `db:"fish" ` + // Original attribute from ArcGIS API is SITETYPE + Sitetype null.Val[string] `db:"sitetype" ` + // Original attribute from ArcGIS API is BREEDINGPOTENTIAL + Breedingpotential null.Val[string] `db:"breedingpotential" ` + // Original attribute from ArcGIS API is MOVINGWATER + Movingwater null.Val[int16] `db:"movingwater" ` + // Original attribute from ArcGIS API is NOWATEREVER + Nowaterever null.Val[int16] `db:"nowaterever" ` + // Original attribute from ArcGIS API is MOSQUITOHABITAT + Mosquitohabitat null.Val[string] `db:"mosquitohabitat" ` + // Original attribute from ArcGIS API is HABVALUE1 Habvalue1 null.Val[int16] `db:"habvalue1" ` - // % + // Original attribute from ArcGIS API is HABVALUE1PERCENT Habvalue1percent null.Val[int16] `db:"habvalue1percent" ` - // Habitat Value + // Original attribute from ArcGIS API is HABVALUE2 Habvalue2 null.Val[int16] `db:"habvalue2" ` - // % + // Original attribute from ArcGIS API is HABVALUE2PERCENT Habvalue2percent null.Val[int16] `db:"habvalue2percent" ` - // Potential + // Original attribute from ArcGIS API is POTENTIAL Potential null.Val[int16] `db:"potential" ` - // Larvae Present - Larvaepresent null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"larvaepresent" ` - // Larvae Inside Treated Area? - Larvaeinsidetreatedarea null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"larvaeinsidetreatedarea" ` - // Larvae Outside Treated Area? - Larvaeoutsidetreatedarea null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"larvaeoutsidetreatedarea" ` - // Reason Larvae Present - Larvaereason null.Val[enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum] `db:"larvaereason" ` - // Aquatic Organisms - Aquaticorganisms null.Val[enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum] `db:"aquaticorganisms" ` - // Vegetation - Vegetation null.Val[enums.FieldseekerQamosquitoinspectionQavegetationEnum] `db:"vegetation" ` - // Source Reduction - Sourcereduction null.Val[enums.FieldseekerQamosquitoinspectionQasourcereductionEnum] `db:"sourcereduction" ` - // Water Present? - Waterpresent null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"waterpresent" ` - // Water Movement - Watermovement1 null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] `db:"watermovement1" ` - // % + // Original attribute from ArcGIS API is LARVAEPRESENT + Larvaepresent null.Val[int16] `db:"larvaepresent" ` + // Original attribute from ArcGIS API is LARVAEINSIDETREATEDAREA + Larvaeinsidetreatedarea null.Val[int16] `db:"larvaeinsidetreatedarea" ` + // Original attribute from ArcGIS API is LARVAEOUTSIDETREATEDAREA + Larvaeoutsidetreatedarea null.Val[int16] `db:"larvaeoutsidetreatedarea" ` + // Original attribute from ArcGIS API is LARVAEREASON + Larvaereason null.Val[string] `db:"larvaereason" ` + // Original attribute from ArcGIS API is AQUATICORGANISMS + Aquaticorganisms null.Val[string] `db:"aquaticorganisms" ` + // Original attribute from ArcGIS API is VEGETATION + Vegetation null.Val[string] `db:"vegetation" ` + // Original attribute from ArcGIS API is SOURCEREDUCTION + Sourcereduction null.Val[string] `db:"sourcereduction" ` + // Original attribute from ArcGIS API is WATERPRESENT + Waterpresent null.Val[int16] `db:"waterpresent" ` + // Original attribute from ArcGIS API is WATERMOVEMENT1 + Watermovement1 null.Val[string] `db:"watermovement1" ` + // Original attribute from ArcGIS API is WATERMOVEMENT1PERCENT Watermovement1percent null.Val[int16] `db:"watermovement1percent" ` - // Water Movement - Watermovement2 null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] `db:"watermovement2" ` - // % + // Original attribute from ArcGIS API is WATERMOVEMENT2 + Watermovement2 null.Val[string] `db:"watermovement2" ` + // Original attribute from ArcGIS API is WATERMOVEMENT2PERCENT Watermovement2percent null.Val[int16] `db:"watermovement2percent" ` - // Soil Conditions - Soilconditions null.Val[enums.FieldseekerQamosquitoinspectionQasoilconditionEnum] `db:"soilconditions" ` - // How Long Water Present? - Waterduration null.Val[enums.FieldseekerQamosquitoinspectionQawaterdurationEnum] `db:"waterduration" ` - // Water Source - Watersource null.Val[enums.FieldseekerQamosquitoinspectionQawatersourceEnum] `db:"watersource" ` - // Water Conditions - Waterconditions null.Val[enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum] `db:"waterconditions" ` - // Adult Activity - Adultactivity null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"adultactivity" ` - Linelocid null.Val[uuid.UUID] `db:"linelocid" ` - Pointlocid null.Val[uuid.UUID] `db:"pointlocid" ` - Polygonlocid null.Val[uuid.UUID] `db:"polygonlocid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - // Field Tech - Fieldtech null.Val[string] `db:"fieldtech" ` + // Original attribute from ArcGIS API is SOILCONDITIONS + Soilconditions null.Val[string] `db:"soilconditions" ` + // Original attribute from ArcGIS API is WATERDURATION + Waterduration null.Val[string] `db:"waterduration" ` + // Original attribute from ArcGIS API is WATERSOURCE + Watersource null.Val[string] `db:"watersource" ` + // Original attribute from ArcGIS API is WATERCONDITIONS + Waterconditions null.Val[string] `db:"waterconditions" ` + // Original attribute from ArcGIS API is ADULTACTIVITY + Adultactivity null.Val[int16] `db:"adultactivity" ` + // Original attribute from ArcGIS API is LINELOCID + Linelocid null.Val[uuid.UUID] `db:"linelocid" ` + // Original attribute from ArcGIS API is POINTLOCID + Pointlocid null.Val[uuid.UUID] `db:"pointlocid" ` + // Original attribute from ArcGIS API is POLYGONLOCID + Polygonlocid null.Val[uuid.UUID] `db:"polygonlocid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date + LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` + // Original attribute from ArcGIS API is FIELDTECH + Fieldtech null.Val[string] `db:"fieldtech" ` + // Original attribute from ArcGIS API is CreationDate Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerQamosquitoinspectionR `db:"-" ` } // FieldseekerQamosquitoinspectionSlice is an alias for a slice of pointers to FieldseekerQamosquitoinspection. @@ -142,10 +170,15 @@ var FieldseekerQamosquitoinspections = psql.NewTablex[*FieldseekerQamosquitoinsp // FieldseekerQamosquitoinspectionsQuery is a query on the qamosquitoinspection table type FieldseekerQamosquitoinspectionsQuery = *psql.ViewQuery[*FieldseekerQamosquitoinspection, FieldseekerQamosquitoinspectionSlice] +// fieldseekerQamosquitoinspectionR is where relationships are stored. +type fieldseekerQamosquitoinspectionR struct { + Organization *Organization // fieldseeker.qamosquitoinspection.qamosquitoinspection_organization_id_fkey +} + func buildFieldseekerQamosquitoinspectionColumns(alias string) fieldseekerQamosquitoinspectionColumns { return fieldseekerQamosquitoinspectionColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "posdips", "actiontaken", "comments", "avetemp", "windspeed", "raingauge", "globalid", "startdatetime", "enddatetime", "winddir", "reviewed", "reviewedby", "revieweddate", "locationname", "zone", "recordstatus", "zone2", "lr", "negdips", "totalacres", "acresbreeding", "fish", "sitetype", "breedingpotential", "movingwater", "nowaterever", "mosquitohabitat", "habvalue1", "habvalue1percent", "habvalue2", "habvalue2percent", "potential", "larvaepresent", "larvaeinsidetreatedarea", "larvaeoutsidetreatedarea", "larvaereason", "aquaticorganisms", "vegetation", "sourcereduction", "waterpresent", "watermovement1", "watermovement1percent", "watermovement2", "watermovement2percent", "soilconditions", "waterduration", "watersource", "waterconditions", "adultactivity", "linelocid", "pointlocid", "polygonlocid", "created_user", "created_date", "last_edited_user", "last_edited_date", "fieldtech", "creationdate", "creator", "editdate", "editor", "version", + "objectid", "posdips", "actiontaken", "comments", "avetemp", "windspeed", "raingauge", "globalid", "startdatetime", "enddatetime", "winddir", "reviewed", "reviewedby", "revieweddate", "locationname", "zone", "recordstatus", "zone2", "lr", "negdips", "totalacres", "acresbreeding", "fish", "sitetype", "breedingpotential", "movingwater", "nowaterever", "mosquitohabitat", "habvalue1", "habvalue1percent", "habvalue2", "habvalue2percent", "potential", "larvaepresent", "larvaeinsidetreatedarea", "larvaeoutsidetreatedarea", "larvaereason", "aquaticorganisms", "vegetation", "sourcereduction", "waterpresent", "watermovement1", "watermovement1percent", "watermovement2", "watermovement2percent", "soilconditions", "waterduration", "watersource", "waterconditions", "adultactivity", "linelocid", "pointlocid", "polygonlocid", "created_user", "created_date", "last_edited_user", "last_edited_date", "fieldtech", "creationdate", "creator", "editdate", "editor", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.qamosquitoinspection"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -210,7 +243,10 @@ func buildFieldseekerQamosquitoinspectionColumns(alias string) fieldseekerQamosq Creator: psql.Quote(alias, "creator"), Editdate: psql.Quote(alias, "editdate"), Editor: psql.Quote(alias, "editor"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -279,7 +315,10 @@ type fieldseekerQamosquitoinspectionColumns struct { Creator psql.Expression Editdate psql.Expression Editor psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerQamosquitoinspectionColumns) Alias() string { @@ -294,73 +333,76 @@ func (fieldseekerQamosquitoinspectionColumns) AliasedAs(alias string) fieldseeke // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerQamosquitoinspectionSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Posdips omitnull.Val[int16] `db:"posdips" ` - Actiontaken omitnull.Val[enums.FieldseekerQamosquitoinspectionMosquitoactionEnum] `db:"actiontaken" ` - Comments omitnull.Val[string] `db:"comments" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - Startdatetime omitnull.Val[time.Time] `db:"startdatetime" ` - Enddatetime omitnull.Val[time.Time] `db:"enddatetime" ` - Winddir omitnull.Val[string] `db:"winddir" ` - Reviewed omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[time.Time] `db:"revieweddate" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Zone omitnull.Val[string] `db:"zone" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - LR omitnull.Val[int16] `db:"lr" ` - Negdips omitnull.Val[int16] `db:"negdips" ` - Totalacres omitnull.Val[float64] `db:"totalacres" ` - Acresbreeding omitnull.Val[float64] `db:"acresbreeding" ` - Fish omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"fish" ` - Sitetype omitnull.Val[enums.FieldseekerQamosquitoinspectionQasitetypeEnum] `db:"sitetype" ` - Breedingpotential omitnull.Val[enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum] `db:"breedingpotential" ` - Movingwater omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"movingwater" ` - Nowaterever omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"nowaterever" ` - Mosquitohabitat omitnull.Val[enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum] `db:"mosquitohabitat" ` - Habvalue1 omitnull.Val[int16] `db:"habvalue1" ` - Habvalue1percent omitnull.Val[int16] `db:"habvalue1percent" ` - Habvalue2 omitnull.Val[int16] `db:"habvalue2" ` - Habvalue2percent omitnull.Val[int16] `db:"habvalue2percent" ` - Potential omitnull.Val[int16] `db:"potential" ` - Larvaepresent omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"larvaepresent" ` - Larvaeinsidetreatedarea omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"larvaeinsidetreatedarea" ` - Larvaeoutsidetreatedarea omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"larvaeoutsidetreatedarea" ` - Larvaereason omitnull.Val[enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum] `db:"larvaereason" ` - Aquaticorganisms omitnull.Val[enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum] `db:"aquaticorganisms" ` - Vegetation omitnull.Val[enums.FieldseekerQamosquitoinspectionQavegetationEnum] `db:"vegetation" ` - Sourcereduction omitnull.Val[enums.FieldseekerQamosquitoinspectionQasourcereductionEnum] `db:"sourcereduction" ` - Waterpresent omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"waterpresent" ` - Watermovement1 omitnull.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] `db:"watermovement1" ` - Watermovement1percent omitnull.Val[int16] `db:"watermovement1percent" ` - Watermovement2 omitnull.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] `db:"watermovement2" ` - Watermovement2percent omitnull.Val[int16] `db:"watermovement2percent" ` - Soilconditions omitnull.Val[enums.FieldseekerQamosquitoinspectionQasoilconditionEnum] `db:"soilconditions" ` - Waterduration omitnull.Val[enums.FieldseekerQamosquitoinspectionQawaterdurationEnum] `db:"waterduration" ` - Watersource omitnull.Val[enums.FieldseekerQamosquitoinspectionQawatersourceEnum] `db:"watersource" ` - Waterconditions omitnull.Val[enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum] `db:"waterconditions" ` - Adultactivity omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"adultactivity" ` - Linelocid omitnull.Val[uuid.UUID] `db:"linelocid" ` - Pointlocid omitnull.Val[uuid.UUID] `db:"pointlocid" ` - Polygonlocid omitnull.Val[uuid.UUID] `db:"polygonlocid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Posdips omitnull.Val[int16] `db:"posdips" ` + Actiontaken omitnull.Val[string] `db:"actiontaken" ` + Comments omitnull.Val[string] `db:"comments" ` + Avetemp omitnull.Val[float64] `db:"avetemp" ` + Windspeed omitnull.Val[float64] `db:"windspeed" ` + Raingauge omitnull.Val[float64] `db:"raingauge" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + Startdatetime omitnull.Val[time.Time] `db:"startdatetime" ` + Enddatetime omitnull.Val[time.Time] `db:"enddatetime" ` + Winddir omitnull.Val[string] `db:"winddir" ` + Reviewed omitnull.Val[int16] `db:"reviewed" ` + Reviewedby omitnull.Val[string] `db:"reviewedby" ` + Revieweddate omitnull.Val[time.Time] `db:"revieweddate" ` + Locationname omitnull.Val[string] `db:"locationname" ` + Zone omitnull.Val[string] `db:"zone" ` + Recordstatus omitnull.Val[int16] `db:"recordstatus" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + LR omitnull.Val[int16] `db:"lr" ` + Negdips omitnull.Val[int16] `db:"negdips" ` + Totalacres omitnull.Val[float64] `db:"totalacres" ` + Acresbreeding omitnull.Val[float64] `db:"acresbreeding" ` + Fish omitnull.Val[int16] `db:"fish" ` + Sitetype omitnull.Val[string] `db:"sitetype" ` + Breedingpotential omitnull.Val[string] `db:"breedingpotential" ` + Movingwater omitnull.Val[int16] `db:"movingwater" ` + Nowaterever omitnull.Val[int16] `db:"nowaterever" ` + Mosquitohabitat omitnull.Val[string] `db:"mosquitohabitat" ` + Habvalue1 omitnull.Val[int16] `db:"habvalue1" ` + Habvalue1percent omitnull.Val[int16] `db:"habvalue1percent" ` + Habvalue2 omitnull.Val[int16] `db:"habvalue2" ` + Habvalue2percent omitnull.Val[int16] `db:"habvalue2percent" ` + Potential omitnull.Val[int16] `db:"potential" ` + Larvaepresent omitnull.Val[int16] `db:"larvaepresent" ` + Larvaeinsidetreatedarea omitnull.Val[int16] `db:"larvaeinsidetreatedarea" ` + Larvaeoutsidetreatedarea omitnull.Val[int16] `db:"larvaeoutsidetreatedarea" ` + Larvaereason omitnull.Val[string] `db:"larvaereason" ` + Aquaticorganisms omitnull.Val[string] `db:"aquaticorganisms" ` + Vegetation omitnull.Val[string] `db:"vegetation" ` + Sourcereduction omitnull.Val[string] `db:"sourcereduction" ` + Waterpresent omitnull.Val[int16] `db:"waterpresent" ` + Watermovement1 omitnull.Val[string] `db:"watermovement1" ` + Watermovement1percent omitnull.Val[int16] `db:"watermovement1percent" ` + Watermovement2 omitnull.Val[string] `db:"watermovement2" ` + Watermovement2percent omitnull.Val[int16] `db:"watermovement2percent" ` + Soilconditions omitnull.Val[string] `db:"soilconditions" ` + Waterduration omitnull.Val[string] `db:"waterduration" ` + Watersource omitnull.Val[string] `db:"watersource" ` + Waterconditions omitnull.Val[string] `db:"waterconditions" ` + Adultactivity omitnull.Val[int16] `db:"adultactivity" ` + Linelocid omitnull.Val[uuid.UUID] `db:"linelocid" ` + Pointlocid omitnull.Val[uuid.UUID] `db:"pointlocid" ` + Polygonlocid omitnull.Val[uuid.UUID] `db:"polygonlocid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Fieldtech omitnull.Val[string] `db:"fieldtech" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerQamosquitoinspectionSetter) SetColumns() []string { - vals := make([]string, 0, 63) + vals := make([]string, 0, 66) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -547,9 +589,18 @@ func (s FieldseekerQamosquitoinspectionSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -740,9 +791,18 @@ func (s FieldseekerQamosquitoinspectionSetter) Overwrite(t *FieldseekerQamosquit if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { @@ -751,7 +811,7 @@ func (s *FieldseekerQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 63) + vals := make([]bob.Expression, 66) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -1124,12 +1184,30 @@ func (s *FieldseekerQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { vals[61] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[62] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[62] = psql.Arg(s.Geometry.MustGet()) } else { vals[62] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[63] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[63] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[64] = psql.Arg(s.Version.MustGet()) + } else { + vals[64] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[65] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[65] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -1139,7 +1217,7 @@ func (s FieldseekerQamosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.Upda } func (s FieldseekerQamosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 63) + exprs := make([]bob.Expression, 0, 66) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -1575,6 +1653,20 @@ func (s FieldseekerQamosquitoinspectionSetter) Expressions(prefix ...string) []b }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -1582,6 +1674,13 @@ func (s FieldseekerQamosquitoinspectionSetter) Expressions(prefix ...string) []b }}) } + 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 } @@ -1649,6 +1748,7 @@ func (o *FieldseekerQamosquitoinspection) Update(ctx context.Context, exec bob.E return err } + o.R = v.R *o = *v return nil @@ -1669,7 +1769,7 @@ func (o *FieldseekerQamosquitoinspection) Reload(ctx context.Context, exec bob.E if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -1719,7 +1819,7 @@ func (o FieldseekerQamosquitoinspectionSlice) copyMatchingRows(from ...*Fieldsee if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -1817,10 +1917,82 @@ func (o FieldseekerQamosquitoinspectionSlice) ReloadAll(ctx context.Context, exe return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerQamosquitoinspection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerQamosquitoinspectionSlice) 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 attachFieldseekerQamosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerQamosquitoinspection0 *FieldseekerQamosquitoinspection, organization1 *Organization) (*FieldseekerQamosquitoinspection, error) { + setter := &FieldseekerQamosquitoinspectionSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerQamosquitoinspection0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerQamosquitoinspectionOrganization0: %w", err) + } + + return fieldseekerQamosquitoinspection0, nil +} + +func (fieldseekerQamosquitoinspection0 *FieldseekerQamosquitoinspection) 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 = attachFieldseekerQamosquitoinspectionOrganization0(ctx, exec, 1, fieldseekerQamosquitoinspection0, organization1) + if err != nil { + return err + } + + fieldseekerQamosquitoinspection0.R.Organization = organization1 + + organization1.R.Qamosquitoinspections = append(organization1.R.Qamosquitoinspections, fieldseekerQamosquitoinspection0) + + return nil +} + +func (fieldseekerQamosquitoinspection0 *FieldseekerQamosquitoinspection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerQamosquitoinspectionOrganization0(ctx, exec, 1, fieldseekerQamosquitoinspection0, organization1) + if err != nil { + return err + } + + fieldseekerQamosquitoinspection0.R.Organization = organization1 + + organization1.R.Qamosquitoinspections = append(organization1.R.Qamosquitoinspections, fieldseekerQamosquitoinspection0) + + return nil +} + type fieldseekerQamosquitoinspectionWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] Posdips psql.WhereNullMod[Q, int16] - Actiontaken psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionMosquitoactionEnum] + Actiontaken psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] Avetemp psql.WhereNullMod[Q, float64] Windspeed psql.WhereNullMod[Q, float64] @@ -1829,7 +2001,7 @@ type fieldseekerQamosquitoinspectionWhere[Q psql.Filterable] struct { Startdatetime psql.WhereNullMod[Q, time.Time] Enddatetime psql.WhereNullMod[Q, time.Time] Winddir psql.WhereNullMod[Q, string] - Reviewed psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum] + Reviewed psql.WhereNullMod[Q, int16] Reviewedby psql.WhereNullMod[Q, string] Revieweddate psql.WhereNullMod[Q, time.Time] Locationname psql.WhereNullMod[Q, string] @@ -1840,34 +2012,34 @@ type fieldseekerQamosquitoinspectionWhere[Q psql.Filterable] struct { Negdips psql.WhereNullMod[Q, int16] Totalacres psql.WhereNullMod[Q, float64] Acresbreeding psql.WhereNullMod[Q, float64] - Fish psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum] - Sitetype psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQasitetypeEnum] - Breedingpotential psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum] - Movingwater psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum] - Nowaterever psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum] - Mosquitohabitat psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum] + Fish psql.WhereNullMod[Q, int16] + Sitetype psql.WhereNullMod[Q, string] + Breedingpotential psql.WhereNullMod[Q, string] + Movingwater psql.WhereNullMod[Q, int16] + Nowaterever psql.WhereNullMod[Q, int16] + Mosquitohabitat psql.WhereNullMod[Q, string] Habvalue1 psql.WhereNullMod[Q, int16] Habvalue1percent psql.WhereNullMod[Q, int16] Habvalue2 psql.WhereNullMod[Q, int16] Habvalue2percent psql.WhereNullMod[Q, int16] Potential psql.WhereNullMod[Q, int16] - Larvaepresent psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum] - Larvaeinsidetreatedarea psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum] - Larvaeoutsidetreatedarea psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum] - Larvaereason psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum] - Aquaticorganisms psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum] - Vegetation psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQavegetationEnum] - Sourcereduction psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQasourcereductionEnum] - Waterpresent psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum] - Watermovement1 psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQawatermovementEnum] + Larvaepresent psql.WhereNullMod[Q, int16] + Larvaeinsidetreatedarea psql.WhereNullMod[Q, int16] + Larvaeoutsidetreatedarea psql.WhereNullMod[Q, int16] + Larvaereason psql.WhereNullMod[Q, string] + Aquaticorganisms psql.WhereNullMod[Q, string] + Vegetation psql.WhereNullMod[Q, string] + Sourcereduction psql.WhereNullMod[Q, string] + Waterpresent psql.WhereNullMod[Q, int16] + Watermovement1 psql.WhereNullMod[Q, string] Watermovement1percent psql.WhereNullMod[Q, int16] - Watermovement2 psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQawatermovementEnum] + Watermovement2 psql.WhereNullMod[Q, string] Watermovement2percent psql.WhereNullMod[Q, int16] - Soilconditions psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQasoilconditionEnum] - Waterduration psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQawaterdurationEnum] - Watersource psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQawatersourceEnum] - Waterconditions psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum] - Adultactivity psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum] + Soilconditions psql.WhereNullMod[Q, string] + Waterduration psql.WhereNullMod[Q, string] + Watersource psql.WhereNullMod[Q, string] + Waterconditions psql.WhereNullMod[Q, string] + Adultactivity psql.WhereNullMod[Q, int16] Linelocid psql.WhereNullMod[Q, uuid.UUID] Pointlocid psql.WhereNullMod[Q, uuid.UUID] Polygonlocid psql.WhereNullMod[Q, uuid.UUID] @@ -1880,7 +2052,10 @@ type fieldseekerQamosquitoinspectionWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerQamosquitoinspectionWhere[Q]) AliasedAs(alias string) fieldseekerQamosquitoinspectionWhere[Q] { @@ -1891,7 +2066,7 @@ func buildFieldseekerQamosquitoinspectionWhere[Q psql.Filterable](cols fieldseek return fieldseekerQamosquitoinspectionWhere[Q]{ Objectid: psql.Where[Q, int64](cols.Objectid), Posdips: psql.WhereNull[Q, int16](cols.Posdips), - Actiontaken: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionMosquitoactionEnum](cols.Actiontaken), + Actiontaken: psql.WhereNull[Q, string](cols.Actiontaken), Comments: psql.WhereNull[Q, string](cols.Comments), Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), @@ -1900,7 +2075,7 @@ func buildFieldseekerQamosquitoinspectionWhere[Q psql.Filterable](cols fieldseek Startdatetime: psql.WhereNull[Q, time.Time](cols.Startdatetime), Enddatetime: psql.WhereNull[Q, time.Time](cols.Enddatetime), Winddir: psql.WhereNull[Q, string](cols.Winddir), - Reviewed: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Reviewed), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), Revieweddate: psql.WhereNull[Q, time.Time](cols.Revieweddate), Locationname: psql.WhereNull[Q, string](cols.Locationname), @@ -1911,34 +2086,34 @@ func buildFieldseekerQamosquitoinspectionWhere[Q psql.Filterable](cols fieldseek Negdips: psql.WhereNull[Q, int16](cols.Negdips), Totalacres: psql.WhereNull[Q, float64](cols.Totalacres), Acresbreeding: psql.WhereNull[Q, float64](cols.Acresbreeding), - Fish: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Fish), - Sitetype: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQasitetypeEnum](cols.Sitetype), - Breedingpotential: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum](cols.Breedingpotential), - Movingwater: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Movingwater), - Nowaterever: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Nowaterever), - Mosquitohabitat: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum](cols.Mosquitohabitat), + Fish: psql.WhereNull[Q, int16](cols.Fish), + Sitetype: psql.WhereNull[Q, string](cols.Sitetype), + Breedingpotential: psql.WhereNull[Q, string](cols.Breedingpotential), + Movingwater: psql.WhereNull[Q, int16](cols.Movingwater), + Nowaterever: psql.WhereNull[Q, int16](cols.Nowaterever), + Mosquitohabitat: psql.WhereNull[Q, string](cols.Mosquitohabitat), Habvalue1: psql.WhereNull[Q, int16](cols.Habvalue1), Habvalue1percent: psql.WhereNull[Q, int16](cols.Habvalue1percent), Habvalue2: psql.WhereNull[Q, int16](cols.Habvalue2), Habvalue2percent: psql.WhereNull[Q, int16](cols.Habvalue2percent), Potential: psql.WhereNull[Q, int16](cols.Potential), - Larvaepresent: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Larvaepresent), - Larvaeinsidetreatedarea: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Larvaeinsidetreatedarea), - Larvaeoutsidetreatedarea: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Larvaeoutsidetreatedarea), - Larvaereason: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum](cols.Larvaereason), - Aquaticorganisms: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum](cols.Aquaticorganisms), - Vegetation: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQavegetationEnum](cols.Vegetation), - Sourcereduction: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQasourcereductionEnum](cols.Sourcereduction), - Waterpresent: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Waterpresent), - Watermovement1: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQawatermovementEnum](cols.Watermovement1), + Larvaepresent: psql.WhereNull[Q, int16](cols.Larvaepresent), + Larvaeinsidetreatedarea: psql.WhereNull[Q, int16](cols.Larvaeinsidetreatedarea), + Larvaeoutsidetreatedarea: psql.WhereNull[Q, int16](cols.Larvaeoutsidetreatedarea), + Larvaereason: psql.WhereNull[Q, string](cols.Larvaereason), + Aquaticorganisms: psql.WhereNull[Q, string](cols.Aquaticorganisms), + Vegetation: psql.WhereNull[Q, string](cols.Vegetation), + Sourcereduction: psql.WhereNull[Q, string](cols.Sourcereduction), + Waterpresent: psql.WhereNull[Q, int16](cols.Waterpresent), + Watermovement1: psql.WhereNull[Q, string](cols.Watermovement1), Watermovement1percent: psql.WhereNull[Q, int16](cols.Watermovement1percent), - Watermovement2: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQawatermovementEnum](cols.Watermovement2), + Watermovement2: psql.WhereNull[Q, string](cols.Watermovement2), Watermovement2percent: psql.WhereNull[Q, int16](cols.Watermovement2percent), - Soilconditions: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQasoilconditionEnum](cols.Soilconditions), - Waterduration: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQawaterdurationEnum](cols.Waterduration), - Watersource: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQawatersourceEnum](cols.Watersource), - Waterconditions: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum](cols.Waterconditions), - Adultactivity: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Adultactivity), + Soilconditions: psql.WhereNull[Q, string](cols.Soilconditions), + Waterduration: psql.WhereNull[Q, string](cols.Waterduration), + Watersource: psql.WhereNull[Q, string](cols.Watersource), + Waterconditions: psql.WhereNull[Q, string](cols.Waterconditions), + Adultactivity: psql.WhereNull[Q, int16](cols.Adultactivity), Linelocid: psql.WhereNull[Q, uuid.UUID](cols.Linelocid), Pointlocid: psql.WhereNull[Q, uuid.UUID](cols.Pointlocid), Polygonlocid: psql.WhereNull[Q, uuid.UUID](cols.Polygonlocid), @@ -1951,6 +2126,154 @@ func buildFieldseekerQamosquitoinspectionWhere[Q psql.Filterable](cols fieldseek Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerQamosquitoinspection) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerQamosquitoinspection cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Qamosquitoinspections = FieldseekerQamosquitoinspectionSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerQamosquitoinspection has no relationship %q", name) + } +} + +type fieldseekerQamosquitoinspectionPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerQamosquitoinspectionPreloader() fieldseekerQamosquitoinspectionPreloader { + return fieldseekerQamosquitoinspectionPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerQamosquitoinspections, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerQamosquitoinspectionThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerQamosquitoinspectionThenLoader[Q orm.Loadable]() fieldseekerQamosquitoinspectionThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerQamosquitoinspectionThenLoader[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 fieldseekerQamosquitoinspection's Organization into the .R struct +func (o *FieldseekerQamosquitoinspection) 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.Qamosquitoinspections = FieldseekerQamosquitoinspectionSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerQamosquitoinspection's Organization into the .R struct +func (os FieldseekerQamosquitoinspectionSlice) 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.Qamosquitoinspections = append(rel.R.Qamosquitoinspections, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerQamosquitoinspectionJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerQamosquitoinspectionJoins[Q]) aliasedAs(alias string) fieldseekerQamosquitoinspectionJoins[Q] { + return buildFieldseekerQamosquitoinspectionJoins[Q](buildFieldseekerQamosquitoinspectionColumns(alias), j.typ) +} + +func buildFieldseekerQamosquitoinspectionJoins[Q dialect.Joinable](cols fieldseekerQamosquitoinspectionColumns, typ string) fieldseekerQamosquitoinspectionJoins[Q] { + return fieldseekerQamosquitoinspectionJoins[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/db/models/fieldseeker.rodentlocation.bob.go b/db/models/fieldseeker.rodentlocation.bob.go index ed156217..913e45d7 100644 --- a/db/models/fieldseeker.rodentlocation.bob.go +++ b/db/models/fieldseeker.rodentlocation.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,50 +21,79 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerRodentlocation is an object representing the database table. type FieldseekerRodentlocation struct { Objectid int64 `db:"objectid,pk" ` - // Location Name - Locationname null.Val[string] `db:"locationname" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - Habitat null.Val[enums.FieldseekerRodentlocationRodentlocationhabitatEnum] `db:"habitat" ` - Priority null.Val[enums.FieldseekerRodentlocationLocationpriority1Enum] `db:"priority" ` - Usetype null.Val[enums.FieldseekerRodentlocationLocationusetype1Enum] `db:"usetype" ` - Active null.Val[enums.FieldseekerRodentlocationNotinuitF1Enum] `db:"active" ` - Description null.Val[string] `db:"description" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Comments null.Val[string] `db:"comments" ` - Symbology null.Val[enums.FieldseekerRodentlocationRodentlocationSymbologyEnum] `db:"symbology" ` - // External ID - Externalid null.Val[string] `db:"externalid" ` + // Original attribute from ArcGIS API is LOCATIONNAME + Locationname null.Val[string] `db:"locationname" ` + // Original attribute from ArcGIS API is ZONE + Zone null.Val[string] `db:"zone" ` + // Original attribute from ArcGIS API is ZONE2 + Zone2 null.Val[string] `db:"zone2" ` + // Original attribute from ArcGIS API is HABITAT + Habitat null.Val[string] `db:"habitat" ` + // Original attribute from ArcGIS API is PRIORITY + Priority null.Val[string] `db:"priority" ` + // Original attribute from ArcGIS API is USETYPE + Usetype null.Val[string] `db:"usetype" ` + // Original attribute from ArcGIS API is ACTIVE + Active null.Val[int16] `db:"active" ` + // Original attribute from ArcGIS API is DESCRIPTION + Description null.Val[string] `db:"description" ` + // Original attribute from ArcGIS API is ACCESSDESC + Accessdesc null.Val[string] `db:"accessdesc" ` + // Original attribute from ArcGIS API is COMMENTS + Comments null.Val[string] `db:"comments" ` + // Original attribute from ArcGIS API is SYMBOLOGY + Symbology null.Val[string] `db:"symbology" ` + // Original attribute from ArcGIS API is EXTERNALID + Externalid null.Val[string] `db:"externalid" ` + // Original attribute from ArcGIS API is NEXTACTIONDATESCHEDULED Nextactiondatescheduled null.Val[time.Time] `db:"nextactiondatescheduled" ` - Locationnumber null.Val[int32] `db:"locationnumber" ` - // Last Inspection Date + // Original attribute from ArcGIS API is LOCATIONNUMBER + Locationnumber null.Val[int32] `db:"locationnumber" ` + // Original attribute from ArcGIS API is LASTINSPECTDATE Lastinspectdate null.Val[time.Time] `db:"lastinspectdate" ` - // Last Inspection Species + // Original attribute from ArcGIS API is LASTINSPECTSPECIES Lastinspectspecies null.Val[string] `db:"lastinspectspecies" ` - // Last Inspection Action + // Original attribute from ArcGIS API is LASTINSPECTACTION Lastinspectaction null.Val[string] `db:"lastinspectaction" ` - // Last Inspection Conditions + // Original attribute from ArcGIS API is LASTINSPECTCONDITIONS Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` - // Last Inspection Rodent Evidence - Lastinspectrodentevidence null.Val[string] `db:"lastinspectrodentevidence" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Jurisdiction - Jurisdiction null.Val[string] `db:"jurisdiction" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is LASTINSPECTRODENTEVIDENCE + Lastinspectrodentevidence null.Val[string] `db:"lastinspectrodentevidence" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date + LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is JURISDICTION + Jurisdiction null.Val[string] `db:"jurisdiction" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerRodentlocationR `db:"-" ` } // FieldseekerRodentlocationSlice is an alias for a slice of pointers to FieldseekerRodentlocation. @@ -76,10 +106,15 @@ var FieldseekerRodentlocations = psql.NewTablex[*FieldseekerRodentlocation, Fiel // FieldseekerRodentlocationsQuery is a query on the rodentlocation table type FieldseekerRodentlocationsQuery = *psql.ViewQuery[*FieldseekerRodentlocation, FieldseekerRodentlocationSlice] +// fieldseekerRodentlocationR is where relationships are stored. +type fieldseekerRodentlocationR struct { + Organization *Organization // fieldseeker.rodentlocation.rodentlocation_organization_id_fkey +} + func buildFieldseekerRodentlocationColumns(alias string) fieldseekerRodentlocationColumns { return fieldseekerRodentlocationColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "locationname", "zone", "zone2", "habitat", "priority", "usetype", "active", "description", "accessdesc", "comments", "symbology", "externalid", "nextactiondatescheduled", "locationnumber", "lastinspectdate", "lastinspectspecies", "lastinspectaction", "lastinspectconditions", "lastinspectrodentevidence", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "creationdate", "creator", "editdate", "editor", "jurisdiction", "version", + "objectid", "locationname", "zone", "zone2", "habitat", "priority", "usetype", "active", "description", "accessdesc", "comments", "symbology", "externalid", "nextactiondatescheduled", "locationnumber", "lastinspectdate", "lastinspectspecies", "lastinspectaction", "lastinspectconditions", "lastinspectrodentevidence", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "creationdate", "creator", "editdate", "editor", "jurisdiction", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.rodentlocation"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -112,7 +147,10 @@ func buildFieldseekerRodentlocationColumns(alias string) fieldseekerRodentlocati Editdate: psql.Quote(alias, "editdate"), Editor: psql.Quote(alias, "editor"), Jurisdiction: psql.Quote(alias, "jurisdiction"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -149,7 +187,10 @@ type fieldseekerRodentlocationColumns struct { Editdate psql.Expression Editor psql.Expression Jurisdiction psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerRodentlocationColumns) Alias() string { @@ -164,41 +205,44 @@ func (fieldseekerRodentlocationColumns) AliasedAs(alias string) fieldseekerRoden // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerRodentlocationSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Habitat omitnull.Val[enums.FieldseekerRodentlocationRodentlocationhabitatEnum] `db:"habitat" ` - Priority omitnull.Val[enums.FieldseekerRodentlocationLocationpriority1Enum] `db:"priority" ` - Usetype omitnull.Val[enums.FieldseekerRodentlocationLocationusetype1Enum] `db:"usetype" ` - Active omitnull.Val[enums.FieldseekerRodentlocationNotinuitF1Enum] `db:"active" ` - Description omitnull.Val[string] `db:"description" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Comments omitnull.Val[string] `db:"comments" ` - Symbology omitnull.Val[enums.FieldseekerRodentlocationRodentlocationSymbologyEnum] `db:"symbology" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Nextactiondatescheduled omitnull.Val[time.Time] `db:"nextactiondatescheduled" ` - Locationnumber omitnull.Val[int32] `db:"locationnumber" ` - Lastinspectdate omitnull.Val[time.Time] `db:"lastinspectdate" ` - Lastinspectspecies omitnull.Val[string] `db:"lastinspectspecies" ` - Lastinspectaction omitnull.Val[string] `db:"lastinspectaction" ` - Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` - Lastinspectrodentevidence omitnull.Val[string] `db:"lastinspectrodentevidence" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Locationname omitnull.Val[string] `db:"locationname" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Habitat omitnull.Val[string] `db:"habitat" ` + Priority omitnull.Val[string] `db:"priority" ` + Usetype omitnull.Val[string] `db:"usetype" ` + Active omitnull.Val[int16] `db:"active" ` + Description omitnull.Val[string] `db:"description" ` + Accessdesc omitnull.Val[string] `db:"accessdesc" ` + Comments omitnull.Val[string] `db:"comments" ` + Symbology omitnull.Val[string] `db:"symbology" ` + Externalid omitnull.Val[string] `db:"externalid" ` + Nextactiondatescheduled omitnull.Val[time.Time] `db:"nextactiondatescheduled" ` + Locationnumber omitnull.Val[int32] `db:"locationnumber" ` + Lastinspectdate omitnull.Val[time.Time] `db:"lastinspectdate" ` + Lastinspectspecies omitnull.Val[string] `db:"lastinspectspecies" ` + Lastinspectaction omitnull.Val[string] `db:"lastinspectaction" ` + Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` + Lastinspectrodentevidence omitnull.Val[string] `db:"lastinspectrodentevidence" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerRodentlocationSetter) SetColumns() []string { - vals := make([]string, 0, 31) + vals := make([]string, 0, 34) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -289,9 +333,18 @@ func (s FieldseekerRodentlocationSetter) SetColumns() []string { if !s.Jurisdiction.IsUnset() { vals = append(vals, "jurisdiction") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -386,9 +439,18 @@ func (s FieldseekerRodentlocationSetter) Overwrite(t *FieldseekerRodentlocation) if !s.Jurisdiction.IsUnset() { t.Jurisdiction = s.Jurisdiction.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerRodentlocationSetter) Apply(q *dialect.InsertQuery) { @@ -397,7 +459,7 @@ func (s *FieldseekerRodentlocationSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 31) + vals := make([]bob.Expression, 34) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -578,12 +640,30 @@ func (s *FieldseekerRodentlocationSetter) Apply(q *dialect.InsertQuery) { vals[29] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[30] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[30] = psql.Arg(s.Geometry.MustGet()) } else { vals[30] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[31] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[32] = psql.Arg(s.Version.MustGet()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[33] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -593,7 +673,7 @@ func (s FieldseekerRodentlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuer } func (s FieldseekerRodentlocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 31) + exprs := make([]bob.Expression, 0, 34) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -805,6 +885,20 @@ func (s FieldseekerRodentlocationSetter) Expressions(prefix ...string) []bob.Exp }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -812,6 +906,13 @@ func (s FieldseekerRodentlocationSetter) Expressions(prefix ...string) []bob.Exp }}) } + 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 } @@ -879,6 +980,7 @@ func (o *FieldseekerRodentlocation) Update(ctx context.Context, exec bob.Executo return err } + o.R = v.R *o = *v return nil @@ -899,7 +1001,7 @@ func (o *FieldseekerRodentlocation) Reload(ctx context.Context, exec bob.Executo if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -949,7 +1051,7 @@ func (o FieldseekerRodentlocationSlice) copyMatchingRows(from ...*FieldseekerRod if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -1047,19 +1149,91 @@ func (o FieldseekerRodentlocationSlice) ReloadAll(ctx context.Context, exec bob. return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerRodentlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerRodentlocationSlice) 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 attachFieldseekerRodentlocationOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerRodentlocation0 *FieldseekerRodentlocation, organization1 *Organization) (*FieldseekerRodentlocation, error) { + setter := &FieldseekerRodentlocationSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerRodentlocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerRodentlocationOrganization0: %w", err) + } + + return fieldseekerRodentlocation0, nil +} + +func (fieldseekerRodentlocation0 *FieldseekerRodentlocation) 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 = attachFieldseekerRodentlocationOrganization0(ctx, exec, 1, fieldseekerRodentlocation0, organization1) + if err != nil { + return err + } + + fieldseekerRodentlocation0.R.Organization = organization1 + + organization1.R.Rodentlocations = append(organization1.R.Rodentlocations, fieldseekerRodentlocation0) + + return nil +} + +func (fieldseekerRodentlocation0 *FieldseekerRodentlocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerRodentlocationOrganization0(ctx, exec, 1, fieldseekerRodentlocation0, organization1) + if err != nil { + return err + } + + fieldseekerRodentlocation0.R.Organization = organization1 + + organization1.R.Rodentlocations = append(organization1.R.Rodentlocations, fieldseekerRodentlocation0) + + return nil +} + type fieldseekerRodentlocationWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] Locationname psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] - Habitat psql.WhereNullMod[Q, enums.FieldseekerRodentlocationRodentlocationhabitatEnum] - Priority psql.WhereNullMod[Q, enums.FieldseekerRodentlocationLocationpriority1Enum] - Usetype psql.WhereNullMod[Q, enums.FieldseekerRodentlocationLocationusetype1Enum] - Active psql.WhereNullMod[Q, enums.FieldseekerRodentlocationNotinuitF1Enum] + Habitat psql.WhereNullMod[Q, string] + Priority psql.WhereNullMod[Q, string] + Usetype psql.WhereNullMod[Q, string] + Active psql.WhereNullMod[Q, int16] Description psql.WhereNullMod[Q, string] Accessdesc psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] - Symbology psql.WhereNullMod[Q, enums.FieldseekerRodentlocationRodentlocationSymbologyEnum] + Symbology psql.WhereNullMod[Q, string] Externalid psql.WhereNullMod[Q, string] Nextactiondatescheduled psql.WhereNullMod[Q, time.Time] Locationnumber psql.WhereNullMod[Q, int32] @@ -1078,7 +1252,10 @@ type fieldseekerRodentlocationWhere[Q psql.Filterable] struct { Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] Jurisdiction psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerRodentlocationWhere[Q]) AliasedAs(alias string) fieldseekerRodentlocationWhere[Q] { @@ -1091,14 +1268,14 @@ func buildFieldseekerRodentlocationWhere[Q psql.Filterable](cols fieldseekerRode Locationname: psql.WhereNull[Q, string](cols.Locationname), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), - Habitat: psql.WhereNull[Q, enums.FieldseekerRodentlocationRodentlocationhabitatEnum](cols.Habitat), - Priority: psql.WhereNull[Q, enums.FieldseekerRodentlocationLocationpriority1Enum](cols.Priority), - Usetype: psql.WhereNull[Q, enums.FieldseekerRodentlocationLocationusetype1Enum](cols.Usetype), - Active: psql.WhereNull[Q, enums.FieldseekerRodentlocationNotinuitF1Enum](cols.Active), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Priority: psql.WhereNull[Q, string](cols.Priority), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Active: psql.WhereNull[Q, int16](cols.Active), Description: psql.WhereNull[Q, string](cols.Description), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Comments: psql.WhereNull[Q, string](cols.Comments), - Symbology: psql.WhereNull[Q, enums.FieldseekerRodentlocationRodentlocationSymbologyEnum](cols.Symbology), + Symbology: psql.WhereNull[Q, string](cols.Symbology), Externalid: psql.WhereNull[Q, string](cols.Externalid), Nextactiondatescheduled: psql.WhereNull[Q, time.Time](cols.Nextactiondatescheduled), Locationnumber: psql.WhereNull[Q, int32](cols.Locationnumber), @@ -1117,6 +1294,154 @@ func buildFieldseekerRodentlocationWhere[Q psql.Filterable](cols fieldseekerRode Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerRodentlocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerRodentlocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Rodentlocations = FieldseekerRodentlocationSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerRodentlocation has no relationship %q", name) + } +} + +type fieldseekerRodentlocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerRodentlocationPreloader() fieldseekerRodentlocationPreloader { + return fieldseekerRodentlocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerRodentlocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerRodentlocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerRodentlocationThenLoader[Q orm.Loadable]() fieldseekerRodentlocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerRodentlocationThenLoader[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 fieldseekerRodentlocation's Organization into the .R struct +func (o *FieldseekerRodentlocation) 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.Rodentlocations = FieldseekerRodentlocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerRodentlocation's Organization into the .R struct +func (os FieldseekerRodentlocationSlice) 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.Rodentlocations = append(rel.R.Rodentlocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerRodentlocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerRodentlocationJoins[Q]) aliasedAs(alias string) fieldseekerRodentlocationJoins[Q] { + return buildFieldseekerRodentlocationJoins[Q](buildFieldseekerRodentlocationColumns(alias), j.typ) +} + +func buildFieldseekerRodentlocationJoins[Q dialect.Joinable](cols fieldseekerRodentlocationColumns, typ string) fieldseekerRodentlocationJoins[Q] { + return fieldseekerRodentlocationJoins[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/db/models/fieldseeker.samplecollection.bob.go b/db/models/fieldseeker.samplecollection.bob.go index 878c496d..2ee1a92f 100644 --- a/db/models/fieldseeker.samplecollection.bob.go +++ b/db/models/fieldseeker.samplecollection.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,92 +21,111 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerSamplecollection is an object representing the database table. type FieldseekerSamplecollection struct { - Objectid int64 `db:"objectid,pk" ` - LocID null.Val[uuid.UUID] `db:"loc_id" ` - // Start + Objectid int64 `db:"objectid,pk" ` + // Original attribute from ArcGIS API is LOC_ID + LocID null.Val[uuid.UUID] `db:"loc_id" ` + // Original attribute from ArcGIS API is STARTDATETIME Startdatetime null.Val[time.Time] `db:"startdatetime" ` - // Finish + // Original attribute from ArcGIS API is ENDDATETIME Enddatetime null.Val[time.Time] `db:"enddatetime" ` - // Conditions - Sitecond null.Val[enums.FieldseekerSamplecollectionMosquitositeconditionEnum] `db:"sitecond" ` - // Sample ID + // Original attribute from ArcGIS API is SITECOND + Sitecond null.Val[string] `db:"sitecond" ` + // Original attribute from ArcGIS API is SAMPLEID Sampleid null.Val[string] `db:"sampleid" ` - // Surveillance Technician + // Original attribute from ArcGIS API is SURVTECH Survtech null.Val[string] `db:"survtech" ` - // Sent + // Original attribute from ArcGIS API is DATESENT Datesent null.Val[time.Time] `db:"datesent" ` - // Tested + // Original attribute from ArcGIS API is DATETESTED Datetested null.Val[time.Time] `db:"datetested" ` - // Test Technician + // Original attribute from ArcGIS API is TESTTECH Testtech null.Val[string] `db:"testtech" ` - // Comments + // Original attribute from ArcGIS API is COMMENTS Comments null.Val[string] `db:"comments" ` - // Processed - Processed null.Val[enums.FieldseekerSamplecollectionNotinuitFEnum] `db:"processed" ` - // Sample Type - Sampletype null.Val[enums.FieldseekerSamplecollectionMosquitosampletypeEnum] `db:"sampletype" ` - // Sample Condition - Samplecond null.Val[enums.FieldseekerSamplecollectionMosquitosampleconditionEnum] `db:"samplecond" ` - // Species - Species null.Val[enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum] `db:"species" ` - // Sex - Sex null.Val[enums.FieldseekerSamplecollectionNotinuisexEnum] `db:"sex" ` - // Average Temperature + // Original attribute from ArcGIS API is PROCESSED + Processed null.Val[int16] `db:"processed" ` + // Original attribute from ArcGIS API is SAMPLETYPE + Sampletype null.Val[string] `db:"sampletype" ` + // Original attribute from ArcGIS API is SAMPLECOND + Samplecond null.Val[string] `db:"samplecond" ` + // Original attribute from ArcGIS API is SPECIES + Species null.Val[string] `db:"species" ` + // Original attribute from ArcGIS API is SEX + Sex null.Val[string] `db:"sex" ` + // Original attribute from ArcGIS API is AVETEMP Avetemp null.Val[float64] `db:"avetemp" ` - // Wind Speed + // Original attribute from ArcGIS API is WINDSPEED Windspeed null.Val[float64] `db:"windspeed" ` - // Wind Direction - Winddir null.Val[enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum] `db:"winddir" ` - // Rain Gauge + // Original attribute from ArcGIS API is WINDDIR + Winddir null.Val[string] `db:"winddir" ` + // Original attribute from ArcGIS API is RAINGAUGE Raingauge null.Val[float64] `db:"raingauge" ` - // Activity - Activity null.Val[enums.FieldseekerSamplecollectionMosquitoactivityEnum] `db:"activity" ` - // Test Method - Testmethod null.Val[enums.FieldseekerSamplecollectionMosquitotestmethodEnum] `db:"testmethod" ` - // Disease Tested - Diseasetested null.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum] `db:"diseasetested" ` - // Disease Positive - Diseasepos null.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum] `db:"diseasepos" ` - // Reviewed - Reviewed null.Val[enums.FieldseekerSamplecollectionNotinuitFEnum] `db:"reviewed" ` - // Reviewed By + // Original attribute from ArcGIS API is ACTIVITY + Activity null.Val[string] `db:"activity" ` + // Original attribute from ArcGIS API is TESTMETHOD + Testmethod null.Val[string] `db:"testmethod" ` + // Original attribute from ArcGIS API is DISEASETESTED + Diseasetested null.Val[string] `db:"diseasetested" ` + // Original attribute from ArcGIS API is DISEASEPOS + Diseasepos null.Val[string] `db:"diseasepos" ` + // Original attribute from ArcGIS API is REVIEWED + Reviewed null.Val[int16] `db:"reviewed" ` + // Original attribute from ArcGIS API is REVIEWEDBY Reviewedby null.Val[string] `db:"reviewedby" ` - // Reviewed Date + // Original attribute from ArcGIS API is REVIEWEDDATE Revieweddate null.Val[time.Time] `db:"revieweddate" ` - // Location Name + // Original attribute from ArcGIS API is LOCATIONNAME Locationname null.Val[string] `db:"locationname" ` - // Zone + // Original attribute from ArcGIS API is ZONE Zone null.Val[string] `db:"zone" ` - // RecordStatus + // Original attribute from ArcGIS API is RECORDSTATUS Recordstatus null.Val[int16] `db:"recordstatus" ` - // Zone2 - Zone2 null.Val[string] `db:"zone2" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is ZONE2 + Zone2 null.Val[string] `db:"zone2" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - // Lab - Lab null.Val[enums.FieldseekerSamplecollectionMosquitolabnameEnum] `db:"lab" ` - // Field Tech - Fieldtech null.Val[string] `db:"fieldtech" ` - Flockid null.Val[uuid.UUID] `db:"flockid" ` - // Sample Count + // Original attribute from ArcGIS API is LAB + Lab null.Val[string] `db:"lab" ` + // Original attribute from ArcGIS API is FIELDTECH + Fieldtech null.Val[string] `db:"fieldtech" ` + // Original attribute from ArcGIS API is FLOCKID + Flockid null.Val[uuid.UUID] `db:"flockid" ` + // Original attribute from ArcGIS API is SAMPLECOUNT Samplecount null.Val[int16] `db:"samplecount" ` - // ChickenID + // Original attribute from ArcGIS API is CHICKENID Chickenid null.Val[uuid.UUID] `db:"chickenid" ` - // Gateway Sync - Gatewaysync null.Val[int16] `db:"gatewaysync" ` + // Original attribute from ArcGIS API is GATEWAYSYNC + Gatewaysync null.Val[int16] `db:"gatewaysync" ` + // Original attribute from ArcGIS API is CreationDate Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerSamplecollectionR `db:"-" ` } // FieldseekerSamplecollectionSlice is an alias for a slice of pointers to FieldseekerSamplecollection. @@ -118,10 +138,15 @@ var FieldseekerSamplecollections = psql.NewTablex[*FieldseekerSamplecollection, // FieldseekerSamplecollectionsQuery is a query on the samplecollection table type FieldseekerSamplecollectionsQuery = *psql.ViewQuery[*FieldseekerSamplecollection, FieldseekerSamplecollectionSlice] +// fieldseekerSamplecollectionR is where relationships are stored. +type fieldseekerSamplecollectionR struct { + Organization *Organization // fieldseeker.samplecollection.samplecollection_organization_id_fkey +} + func buildFieldseekerSamplecollectionColumns(alias string) fieldseekerSamplecollectionColumns { return fieldseekerSamplecollectionColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "loc_id", "startdatetime", "enddatetime", "sitecond", "sampleid", "survtech", "datesent", "datetested", "testtech", "comments", "processed", "sampletype", "samplecond", "species", "sex", "avetemp", "windspeed", "winddir", "raingauge", "activity", "testmethod", "diseasetested", "diseasepos", "reviewed", "reviewedby", "revieweddate", "locationname", "zone", "recordstatus", "zone2", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "lab", "fieldtech", "flockid", "samplecount", "chickenid", "gatewaysync", "creationdate", "creator", "editdate", "editor", "version", + "objectid", "loc_id", "startdatetime", "enddatetime", "sitecond", "sampleid", "survtech", "datesent", "datetested", "testtech", "comments", "processed", "sampletype", "samplecond", "species", "sex", "avetemp", "windspeed", "winddir", "raingauge", "activity", "testmethod", "diseasetested", "diseasepos", "reviewed", "reviewedby", "revieweddate", "locationname", "zone", "recordstatus", "zone2", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "lab", "fieldtech", "flockid", "samplecount", "chickenid", "gatewaysync", "creationdate", "creator", "editdate", "editor", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.samplecollection"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -170,7 +195,10 @@ func buildFieldseekerSamplecollectionColumns(alias string) fieldseekerSamplecoll Creator: psql.Quote(alias, "creator"), Editdate: psql.Quote(alias, "editdate"), Editor: psql.Quote(alias, "editor"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -223,7 +251,10 @@ type fieldseekerSamplecollectionColumns struct { Creator psql.Expression Editdate psql.Expression Editor psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerSamplecollectionColumns) Alias() string { @@ -238,57 +269,60 @@ func (fieldseekerSamplecollectionColumns) AliasedAs(alias string) fieldseekerSam // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerSamplecollectionSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - LocID omitnull.Val[uuid.UUID] `db:"loc_id" ` - Startdatetime omitnull.Val[time.Time] `db:"startdatetime" ` - Enddatetime omitnull.Val[time.Time] `db:"enddatetime" ` - Sitecond omitnull.Val[enums.FieldseekerSamplecollectionMosquitositeconditionEnum] `db:"sitecond" ` - Sampleid omitnull.Val[string] `db:"sampleid" ` - Survtech omitnull.Val[string] `db:"survtech" ` - Datesent omitnull.Val[time.Time] `db:"datesent" ` - Datetested omitnull.Val[time.Time] `db:"datetested" ` - Testtech omitnull.Val[string] `db:"testtech" ` - Comments omitnull.Val[string] `db:"comments" ` - Processed omitnull.Val[enums.FieldseekerSamplecollectionNotinuitFEnum] `db:"processed" ` - Sampletype omitnull.Val[enums.FieldseekerSamplecollectionMosquitosampletypeEnum] `db:"sampletype" ` - Samplecond omitnull.Val[enums.FieldseekerSamplecollectionMosquitosampleconditionEnum] `db:"samplecond" ` - Species omitnull.Val[enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum] `db:"species" ` - Sex omitnull.Val[enums.FieldseekerSamplecollectionNotinuisexEnum] `db:"sex" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - Winddir omitnull.Val[enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum] `db:"winddir" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Activity omitnull.Val[enums.FieldseekerSamplecollectionMosquitoactivityEnum] `db:"activity" ` - Testmethod omitnull.Val[enums.FieldseekerSamplecollectionMosquitotestmethodEnum] `db:"testmethod" ` - Diseasetested omitnull.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum] `db:"diseasetested" ` - Diseasepos omitnull.Val[enums.FieldseekerSamplecollectionMosquitodiseaseEnum] `db:"diseasepos" ` - Reviewed omitnull.Val[enums.FieldseekerSamplecollectionNotinuitFEnum] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[time.Time] `db:"revieweddate" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Zone omitnull.Val[string] `db:"zone" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Lab omitnull.Val[enums.FieldseekerSamplecollectionMosquitolabnameEnum] `db:"lab" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Flockid omitnull.Val[uuid.UUID] `db:"flockid" ` - Samplecount omitnull.Val[int16] `db:"samplecount" ` - Chickenid omitnull.Val[uuid.UUID] `db:"chickenid" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + LocID omitnull.Val[uuid.UUID] `db:"loc_id" ` + Startdatetime omitnull.Val[time.Time] `db:"startdatetime" ` + Enddatetime omitnull.Val[time.Time] `db:"enddatetime" ` + Sitecond omitnull.Val[string] `db:"sitecond" ` + Sampleid omitnull.Val[string] `db:"sampleid" ` + Survtech omitnull.Val[string] `db:"survtech" ` + Datesent omitnull.Val[time.Time] `db:"datesent" ` + Datetested omitnull.Val[time.Time] `db:"datetested" ` + Testtech omitnull.Val[string] `db:"testtech" ` + Comments omitnull.Val[string] `db:"comments" ` + Processed omitnull.Val[int16] `db:"processed" ` + Sampletype omitnull.Val[string] `db:"sampletype" ` + Samplecond omitnull.Val[string] `db:"samplecond" ` + Species omitnull.Val[string] `db:"species" ` + Sex omitnull.Val[string] `db:"sex" ` + Avetemp omitnull.Val[float64] `db:"avetemp" ` + Windspeed omitnull.Val[float64] `db:"windspeed" ` + Winddir omitnull.Val[string] `db:"winddir" ` + Raingauge omitnull.Val[float64] `db:"raingauge" ` + Activity omitnull.Val[string] `db:"activity" ` + Testmethod omitnull.Val[string] `db:"testmethod" ` + Diseasetested omitnull.Val[string] `db:"diseasetested" ` + Diseasepos omitnull.Val[string] `db:"diseasepos" ` + Reviewed omitnull.Val[int16] `db:"reviewed" ` + Reviewedby omitnull.Val[string] `db:"reviewedby" ` + Revieweddate omitnull.Val[time.Time] `db:"revieweddate" ` + Locationname omitnull.Val[string] `db:"locationname" ` + Zone omitnull.Val[string] `db:"zone" ` + Recordstatus omitnull.Val[int16] `db:"recordstatus" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Lab omitnull.Val[string] `db:"lab" ` + Fieldtech omitnull.Val[string] `db:"fieldtech" ` + Flockid omitnull.Val[uuid.UUID] `db:"flockid" ` + Samplecount omitnull.Val[int16] `db:"samplecount" ` + Chickenid omitnull.Val[uuid.UUID] `db:"chickenid" ` + Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerSamplecollectionSetter) SetColumns() []string { - vals := make([]string, 0, 47) + vals := make([]string, 0, 50) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -427,9 +461,18 @@ func (s FieldseekerSamplecollectionSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -572,9 +615,18 @@ func (s FieldseekerSamplecollectionSetter) Overwrite(t *FieldseekerSamplecollect if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerSamplecollectionSetter) Apply(q *dialect.InsertQuery) { @@ -583,7 +635,7 @@ func (s *FieldseekerSamplecollectionSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 47) + vals := make([]bob.Expression, 50) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -860,12 +912,30 @@ func (s *FieldseekerSamplecollectionSetter) Apply(q *dialect.InsertQuery) { vals[45] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[46] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[46] = psql.Arg(s.Geometry.MustGet()) } else { vals[46] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[47] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[47] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[48] = psql.Arg(s.Version.MustGet()) + } else { + vals[48] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[49] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[49] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -875,7 +945,7 @@ func (s FieldseekerSamplecollectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQu } func (s FieldseekerSamplecollectionSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 47) + exprs := make([]bob.Expression, 0, 50) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -1199,6 +1269,20 @@ func (s FieldseekerSamplecollectionSetter) Expressions(prefix ...string) []bob.E }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -1206,6 +1290,13 @@ func (s FieldseekerSamplecollectionSetter) Expressions(prefix ...string) []bob.E }}) } + 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 } @@ -1273,6 +1364,7 @@ func (o *FieldseekerSamplecollection) Update(ctx context.Context, exec bob.Execu return err } + o.R = v.R *o = *v return nil @@ -1293,7 +1385,7 @@ func (o *FieldseekerSamplecollection) Reload(ctx context.Context, exec bob.Execu if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -1343,7 +1435,7 @@ func (o FieldseekerSamplecollectionSlice) copyMatchingRows(from ...*FieldseekerS if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -1441,32 +1533,104 @@ func (o FieldseekerSamplecollectionSlice) ReloadAll(ctx context.Context, exec bo return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerSamplecollection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerSamplecollectionSlice) 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 attachFieldseekerSamplecollectionOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerSamplecollection0 *FieldseekerSamplecollection, organization1 *Organization) (*FieldseekerSamplecollection, error) { + setter := &FieldseekerSamplecollectionSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerSamplecollection0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerSamplecollectionOrganization0: %w", err) + } + + return fieldseekerSamplecollection0, nil +} + +func (fieldseekerSamplecollection0 *FieldseekerSamplecollection) 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 = attachFieldseekerSamplecollectionOrganization0(ctx, exec, 1, fieldseekerSamplecollection0, organization1) + if err != nil { + return err + } + + fieldseekerSamplecollection0.R.Organization = organization1 + + organization1.R.Samplecollections = append(organization1.R.Samplecollections, fieldseekerSamplecollection0) + + return nil +} + +func (fieldseekerSamplecollection0 *FieldseekerSamplecollection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerSamplecollectionOrganization0(ctx, exec, 1, fieldseekerSamplecollection0, organization1) + if err != nil { + return err + } + + fieldseekerSamplecollection0.R.Organization = organization1 + + organization1.R.Samplecollections = append(organization1.R.Samplecollections, fieldseekerSamplecollection0) + + return nil +} + type fieldseekerSamplecollectionWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] LocID psql.WhereNullMod[Q, uuid.UUID] Startdatetime psql.WhereNullMod[Q, time.Time] Enddatetime psql.WhereNullMod[Q, time.Time] - Sitecond psql.WhereNullMod[Q, enums.FieldseekerSamplecollectionMosquitositeconditionEnum] + Sitecond psql.WhereNullMod[Q, string] Sampleid psql.WhereNullMod[Q, string] Survtech psql.WhereNullMod[Q, string] Datesent psql.WhereNullMod[Q, time.Time] Datetested psql.WhereNullMod[Q, time.Time] Testtech psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] - Processed psql.WhereNullMod[Q, enums.FieldseekerSamplecollectionNotinuitFEnum] - Sampletype psql.WhereNullMod[Q, enums.FieldseekerSamplecollectionMosquitosampletypeEnum] - Samplecond psql.WhereNullMod[Q, enums.FieldseekerSamplecollectionMosquitosampleconditionEnum] - Species psql.WhereNullMod[Q, enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum] - Sex psql.WhereNullMod[Q, enums.FieldseekerSamplecollectionNotinuisexEnum] + Processed psql.WhereNullMod[Q, int16] + Sampletype psql.WhereNullMod[Q, string] + Samplecond psql.WhereNullMod[Q, string] + Species psql.WhereNullMod[Q, string] + Sex psql.WhereNullMod[Q, string] Avetemp psql.WhereNullMod[Q, float64] Windspeed psql.WhereNullMod[Q, float64] - Winddir psql.WhereNullMod[Q, enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum] + Winddir psql.WhereNullMod[Q, string] Raingauge psql.WhereNullMod[Q, float64] - Activity psql.WhereNullMod[Q, enums.FieldseekerSamplecollectionMosquitoactivityEnum] - Testmethod psql.WhereNullMod[Q, enums.FieldseekerSamplecollectionMosquitotestmethodEnum] - Diseasetested psql.WhereNullMod[Q, enums.FieldseekerSamplecollectionMosquitodiseaseEnum] - Diseasepos psql.WhereNullMod[Q, enums.FieldseekerSamplecollectionMosquitodiseaseEnum] - Reviewed psql.WhereNullMod[Q, enums.FieldseekerSamplecollectionNotinuitFEnum] + Activity psql.WhereNullMod[Q, string] + Testmethod psql.WhereNullMod[Q, string] + Diseasetested psql.WhereNullMod[Q, string] + Diseasepos psql.WhereNullMod[Q, string] + Reviewed psql.WhereNullMod[Q, int16] Reviewedby psql.WhereNullMod[Q, string] Revieweddate psql.WhereNullMod[Q, time.Time] Locationname psql.WhereNullMod[Q, string] @@ -1478,7 +1642,7 @@ type fieldseekerSamplecollectionWhere[Q psql.Filterable] struct { CreatedDate psql.WhereNullMod[Q, time.Time] LastEditedUser psql.WhereNullMod[Q, string] LastEditedDate psql.WhereNullMod[Q, time.Time] - Lab psql.WhereNullMod[Q, enums.FieldseekerSamplecollectionMosquitolabnameEnum] + Lab psql.WhereNullMod[Q, string] Fieldtech psql.WhereNullMod[Q, string] Flockid psql.WhereNullMod[Q, uuid.UUID] Samplecount psql.WhereNullMod[Q, int16] @@ -1488,7 +1652,10 @@ type fieldseekerSamplecollectionWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerSamplecollectionWhere[Q]) AliasedAs(alias string) fieldseekerSamplecollectionWhere[Q] { @@ -1501,27 +1668,27 @@ func buildFieldseekerSamplecollectionWhere[Q psql.Filterable](cols fieldseekerSa LocID: psql.WhereNull[Q, uuid.UUID](cols.LocID), Startdatetime: psql.WhereNull[Q, time.Time](cols.Startdatetime), Enddatetime: psql.WhereNull[Q, time.Time](cols.Enddatetime), - Sitecond: psql.WhereNull[Q, enums.FieldseekerSamplecollectionMosquitositeconditionEnum](cols.Sitecond), + Sitecond: psql.WhereNull[Q, string](cols.Sitecond), Sampleid: psql.WhereNull[Q, string](cols.Sampleid), Survtech: psql.WhereNull[Q, string](cols.Survtech), Datesent: psql.WhereNull[Q, time.Time](cols.Datesent), Datetested: psql.WhereNull[Q, time.Time](cols.Datetested), Testtech: psql.WhereNull[Q, string](cols.Testtech), Comments: psql.WhereNull[Q, string](cols.Comments), - Processed: psql.WhereNull[Q, enums.FieldseekerSamplecollectionNotinuitFEnum](cols.Processed), - Sampletype: psql.WhereNull[Q, enums.FieldseekerSamplecollectionMosquitosampletypeEnum](cols.Sampletype), - Samplecond: psql.WhereNull[Q, enums.FieldseekerSamplecollectionMosquitosampleconditionEnum](cols.Samplecond), - Species: psql.WhereNull[Q, enums.FieldseekerSamplecollectionMosquitosamplespeciesEnum](cols.Species), - Sex: psql.WhereNull[Q, enums.FieldseekerSamplecollectionNotinuisexEnum](cols.Sex), + Processed: psql.WhereNull[Q, int16](cols.Processed), + Sampletype: psql.WhereNull[Q, string](cols.Sampletype), + Samplecond: psql.WhereNull[Q, string](cols.Samplecond), + Species: psql.WhereNull[Q, string](cols.Species), + Sex: psql.WhereNull[Q, string](cols.Sex), Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), - Winddir: psql.WhereNull[Q, enums.FieldseekerSamplecollectionNotinuiwinddirectionEnum](cols.Winddir), + Winddir: psql.WhereNull[Q, string](cols.Winddir), Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), - Activity: psql.WhereNull[Q, enums.FieldseekerSamplecollectionMosquitoactivityEnum](cols.Activity), - Testmethod: psql.WhereNull[Q, enums.FieldseekerSamplecollectionMosquitotestmethodEnum](cols.Testmethod), - Diseasetested: psql.WhereNull[Q, enums.FieldseekerSamplecollectionMosquitodiseaseEnum](cols.Diseasetested), - Diseasepos: psql.WhereNull[Q, enums.FieldseekerSamplecollectionMosquitodiseaseEnum](cols.Diseasepos), - Reviewed: psql.WhereNull[Q, enums.FieldseekerSamplecollectionNotinuitFEnum](cols.Reviewed), + Activity: psql.WhereNull[Q, string](cols.Activity), + Testmethod: psql.WhereNull[Q, string](cols.Testmethod), + Diseasetested: psql.WhereNull[Q, string](cols.Diseasetested), + Diseasepos: psql.WhereNull[Q, string](cols.Diseasepos), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), Revieweddate: psql.WhereNull[Q, time.Time](cols.Revieweddate), Locationname: psql.WhereNull[Q, string](cols.Locationname), @@ -1533,7 +1700,7 @@ func buildFieldseekerSamplecollectionWhere[Q psql.Filterable](cols fieldseekerSa CreatedDate: psql.WhereNull[Q, time.Time](cols.CreatedDate), LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), LastEditedDate: psql.WhereNull[Q, time.Time](cols.LastEditedDate), - Lab: psql.WhereNull[Q, enums.FieldseekerSamplecollectionMosquitolabnameEnum](cols.Lab), + Lab: psql.WhereNull[Q, string](cols.Lab), Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), Flockid: psql.WhereNull[Q, uuid.UUID](cols.Flockid), Samplecount: psql.WhereNull[Q, int16](cols.Samplecount), @@ -1543,6 +1710,154 @@ func buildFieldseekerSamplecollectionWhere[Q psql.Filterable](cols fieldseekerSa Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerSamplecollection) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerSamplecollection cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Samplecollections = FieldseekerSamplecollectionSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerSamplecollection has no relationship %q", name) + } +} + +type fieldseekerSamplecollectionPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerSamplecollectionPreloader() fieldseekerSamplecollectionPreloader { + return fieldseekerSamplecollectionPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerSamplecollections, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerSamplecollectionThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerSamplecollectionThenLoader[Q orm.Loadable]() fieldseekerSamplecollectionThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerSamplecollectionThenLoader[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 fieldseekerSamplecollection's Organization into the .R struct +func (o *FieldseekerSamplecollection) 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.Samplecollections = FieldseekerSamplecollectionSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerSamplecollection's Organization into the .R struct +func (os FieldseekerSamplecollectionSlice) 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.Samplecollections = append(rel.R.Samplecollections, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerSamplecollectionJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerSamplecollectionJoins[Q]) aliasedAs(alias string) fieldseekerSamplecollectionJoins[Q] { + return buildFieldseekerSamplecollectionJoins[Q](buildFieldseekerSamplecollectionColumns(alias), j.typ) +} + +func buildFieldseekerSamplecollectionJoins[Q dialect.Joinable](cols fieldseekerSamplecollectionColumns, typ string) fieldseekerSamplecollectionJoins[Q] { + return fieldseekerSamplecollectionJoins[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/db/models/fieldseeker.samplelocation.bob.go b/db/models/fieldseeker.samplelocation.bob.go index 951093a9..b9cef04e 100644 --- a/db/models/fieldseeker.samplelocation.bob.go +++ b/db/models/fieldseeker.samplelocation.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,49 +21,67 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerSamplelocation is an object representing the database table. type FieldseekerSamplelocation struct { Objectid int64 `db:"objectid,pk" ` - // Name + // Original attribute from ArcGIS API is NAME Name null.Val[string] `db:"name" ` - // Zone + // Original attribute from ArcGIS API is ZONE Zone null.Val[string] `db:"zone" ` - // Habitat - Habitat null.Val[enums.FieldseekerSamplelocationLocationhabitattypeEnum] `db:"habitat" ` - // Priority - Priority null.Val[enums.FieldseekerSamplelocationLocationpriorityEnum] `db:"priority" ` - // Use Type - Usetype null.Val[enums.FieldseekerSamplelocationSamplelocationusetypeEnum] `db:"usetype" ` - // Active - Active null.Val[enums.FieldseekerSamplelocationNotinuitFEnum] `db:"active" ` - // Description + // Original attribute from ArcGIS API is HABITAT + Habitat null.Val[string] `db:"habitat" ` + // Original attribute from ArcGIS API is PRIORITY + Priority null.Val[string] `db:"priority" ` + // Original attribute from ArcGIS API is USETYPE + Usetype null.Val[string] `db:"usetype" ` + // Original attribute from ArcGIS API is ACTIVE + Active null.Val[int16] `db:"active" ` + // Original attribute from ArcGIS API is DESCRIPTION Description null.Val[string] `db:"description" ` - // Access Description + // Original attribute from ArcGIS API is ACCESSDESC Accessdesc null.Val[string] `db:"accessdesc" ` - // Comments + // Original attribute from ArcGIS API is COMMENTS Comments null.Val[string] `db:"comments" ` - // External ID + // Original attribute from ArcGIS API is EXTERNALID Externalid null.Val[string] `db:"externalid" ` - // Next Scheduled Action + // Original attribute from ArcGIS API is NEXTACTIONDATESCHEDULED Nextactiondatescheduled null.Val[time.Time] `db:"nextactiondatescheduled" ` - // Zone2 - Zone2 null.Val[string] `db:"zone2" ` - Locationnumber null.Val[int32] `db:"locationnumber" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is ZONE2 + Zone2 null.Val[string] `db:"zone2" ` + // Original attribute from ArcGIS API is LOCATIONNUMBER + Locationnumber null.Val[int32] `db:"locationnumber" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - // Gateway Sync - Gatewaysync null.Val[int16] `db:"gatewaysync" ` + // Original attribute from ArcGIS API is GATEWAYSYNC + Gatewaysync null.Val[int16] `db:"gatewaysync" ` + // Original attribute from ArcGIS API is CreationDate Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerSamplelocationR `db:"-" ` } // FieldseekerSamplelocationSlice is an alias for a slice of pointers to FieldseekerSamplelocation. @@ -75,10 +94,15 @@ var FieldseekerSamplelocations = psql.NewTablex[*FieldseekerSamplelocation, Fiel // FieldseekerSamplelocationsQuery is a query on the samplelocation table type FieldseekerSamplelocationsQuery = *psql.ViewQuery[*FieldseekerSamplelocation, FieldseekerSamplelocationSlice] +// fieldseekerSamplelocationR is where relationships are stored. +type fieldseekerSamplelocationR struct { + Organization *Organization // fieldseeker.samplelocation.samplelocation_organization_id_fkey +} + func buildFieldseekerSamplelocationColumns(alias string) fieldseekerSamplelocationColumns { return fieldseekerSamplelocationColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "name", "zone", "habitat", "priority", "usetype", "active", "description", "accessdesc", "comments", "externalid", "nextactiondatescheduled", "zone2", "locationnumber", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "gatewaysync", "creationdate", "creator", "editdate", "editor", "version", + "objectid", "name", "zone", "habitat", "priority", "usetype", "active", "description", "accessdesc", "comments", "externalid", "nextactiondatescheduled", "zone2", "locationnumber", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "gatewaysync", "creationdate", "creator", "editdate", "editor", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.samplelocation"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -105,7 +129,10 @@ func buildFieldseekerSamplelocationColumns(alias string) fieldseekerSamplelocati Creator: psql.Quote(alias, "creator"), Editdate: psql.Quote(alias, "editdate"), Editor: psql.Quote(alias, "editor"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -136,7 +163,10 @@ type fieldseekerSamplelocationColumns struct { Creator psql.Expression Editdate psql.Expression Editor psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerSamplelocationColumns) Alias() string { @@ -151,35 +181,38 @@ func (fieldseekerSamplelocationColumns) AliasedAs(alias string) fieldseekerSampl // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerSamplelocationSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Name omitnull.Val[string] `db:"name" ` - Zone omitnull.Val[string] `db:"zone" ` - Habitat omitnull.Val[enums.FieldseekerSamplelocationLocationhabitattypeEnum] `db:"habitat" ` - Priority omitnull.Val[enums.FieldseekerSamplelocationLocationpriorityEnum] `db:"priority" ` - Usetype omitnull.Val[enums.FieldseekerSamplelocationSamplelocationusetypeEnum] `db:"usetype" ` - Active omitnull.Val[enums.FieldseekerSamplelocationNotinuitFEnum] `db:"active" ` - Description omitnull.Val[string] `db:"description" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Comments omitnull.Val[string] `db:"comments" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Nextactiondatescheduled omitnull.Val[time.Time] `db:"nextactiondatescheduled" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Locationnumber omitnull.Val[int32] `db:"locationnumber" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Name omitnull.Val[string] `db:"name" ` + Zone omitnull.Val[string] `db:"zone" ` + Habitat omitnull.Val[string] `db:"habitat" ` + Priority omitnull.Val[string] `db:"priority" ` + Usetype omitnull.Val[string] `db:"usetype" ` + Active omitnull.Val[int16] `db:"active" ` + Description omitnull.Val[string] `db:"description" ` + Accessdesc omitnull.Val[string] `db:"accessdesc" ` + Comments omitnull.Val[string] `db:"comments" ` + Externalid omitnull.Val[string] `db:"externalid" ` + Nextactiondatescheduled omitnull.Val[time.Time] `db:"nextactiondatescheduled" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Locationnumber omitnull.Val[int32] `db:"locationnumber" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerSamplelocationSetter) SetColumns() []string { - vals := make([]string, 0, 25) + vals := make([]string, 0, 28) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -252,9 +285,18 @@ func (s FieldseekerSamplelocationSetter) SetColumns() []string { if !s.Editor.IsUnset() { vals = append(vals, "editor") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -331,9 +373,18 @@ func (s FieldseekerSamplelocationSetter) Overwrite(t *FieldseekerSamplelocation) if !s.Editor.IsUnset() { t.Editor = s.Editor.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerSamplelocationSetter) Apply(q *dialect.InsertQuery) { @@ -342,7 +393,7 @@ func (s *FieldseekerSamplelocationSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 25) + vals := make([]bob.Expression, 28) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -487,12 +538,30 @@ func (s *FieldseekerSamplelocationSetter) Apply(q *dialect.InsertQuery) { vals[23] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[24] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[24] = psql.Arg(s.Geometry.MustGet()) } else { vals[24] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[25] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[25] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[26] = psql.Arg(s.Version.MustGet()) + } else { + vals[26] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[27] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[27] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -502,7 +571,7 @@ func (s FieldseekerSamplelocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuer } func (s FieldseekerSamplelocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 25) + exprs := make([]bob.Expression, 0, 28) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -672,6 +741,20 @@ func (s FieldseekerSamplelocationSetter) Expressions(prefix ...string) []bob.Exp }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -679,6 +762,13 @@ func (s FieldseekerSamplelocationSetter) Expressions(prefix ...string) []bob.Exp }}) } + 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 } @@ -746,6 +836,7 @@ func (o *FieldseekerSamplelocation) Update(ctx context.Context, exec bob.Executo return err } + o.R = v.R *o = *v return nil @@ -766,7 +857,7 @@ func (o *FieldseekerSamplelocation) Reload(ctx context.Context, exec bob.Executo if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -816,7 +907,7 @@ func (o FieldseekerSamplelocationSlice) copyMatchingRows(from ...*FieldseekerSam if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -914,14 +1005,86 @@ func (o FieldseekerSamplelocationSlice) ReloadAll(ctx context.Context, exec bob. return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerSamplelocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerSamplelocationSlice) 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 attachFieldseekerSamplelocationOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerSamplelocation0 *FieldseekerSamplelocation, organization1 *Organization) (*FieldseekerSamplelocation, error) { + setter := &FieldseekerSamplelocationSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerSamplelocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerSamplelocationOrganization0: %w", err) + } + + return fieldseekerSamplelocation0, nil +} + +func (fieldseekerSamplelocation0 *FieldseekerSamplelocation) 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 = attachFieldseekerSamplelocationOrganization0(ctx, exec, 1, fieldseekerSamplelocation0, organization1) + if err != nil { + return err + } + + fieldseekerSamplelocation0.R.Organization = organization1 + + organization1.R.Samplelocations = append(organization1.R.Samplelocations, fieldseekerSamplelocation0) + + return nil +} + +func (fieldseekerSamplelocation0 *FieldseekerSamplelocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerSamplelocationOrganization0(ctx, exec, 1, fieldseekerSamplelocation0, organization1) + if err != nil { + return err + } + + fieldseekerSamplelocation0.R.Organization = organization1 + + organization1.R.Samplelocations = append(organization1.R.Samplelocations, fieldseekerSamplelocation0) + + return nil +} + type fieldseekerSamplelocationWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] Name psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] - Habitat psql.WhereNullMod[Q, enums.FieldseekerSamplelocationLocationhabitattypeEnum] - Priority psql.WhereNullMod[Q, enums.FieldseekerSamplelocationLocationpriorityEnum] - Usetype psql.WhereNullMod[Q, enums.FieldseekerSamplelocationSamplelocationusetypeEnum] - Active psql.WhereNullMod[Q, enums.FieldseekerSamplelocationNotinuitFEnum] + Habitat psql.WhereNullMod[Q, string] + Priority psql.WhereNullMod[Q, string] + Usetype psql.WhereNullMod[Q, string] + Active psql.WhereNullMod[Q, int16] Description psql.WhereNullMod[Q, string] Accessdesc psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] @@ -939,7 +1102,10 @@ type fieldseekerSamplelocationWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerSamplelocationWhere[Q]) AliasedAs(alias string) fieldseekerSamplelocationWhere[Q] { @@ -951,10 +1117,10 @@ func buildFieldseekerSamplelocationWhere[Q psql.Filterable](cols fieldseekerSamp Objectid: psql.Where[Q, int64](cols.Objectid), Name: psql.WhereNull[Q, string](cols.Name), Zone: psql.WhereNull[Q, string](cols.Zone), - Habitat: psql.WhereNull[Q, enums.FieldseekerSamplelocationLocationhabitattypeEnum](cols.Habitat), - Priority: psql.WhereNull[Q, enums.FieldseekerSamplelocationLocationpriorityEnum](cols.Priority), - Usetype: psql.WhereNull[Q, enums.FieldseekerSamplelocationSamplelocationusetypeEnum](cols.Usetype), - Active: psql.WhereNull[Q, enums.FieldseekerSamplelocationNotinuitFEnum](cols.Active), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Priority: psql.WhereNull[Q, string](cols.Priority), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Active: psql.WhereNull[Q, int16](cols.Active), Description: psql.WhereNull[Q, string](cols.Description), Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Comments: psql.WhereNull[Q, string](cols.Comments), @@ -972,6 +1138,154 @@ func buildFieldseekerSamplelocationWhere[Q psql.Filterable](cols fieldseekerSamp Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerSamplelocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerSamplelocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Samplelocations = FieldseekerSamplelocationSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerSamplelocation has no relationship %q", name) + } +} + +type fieldseekerSamplelocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerSamplelocationPreloader() fieldseekerSamplelocationPreloader { + return fieldseekerSamplelocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerSamplelocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerSamplelocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerSamplelocationThenLoader[Q orm.Loadable]() fieldseekerSamplelocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerSamplelocationThenLoader[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 fieldseekerSamplelocation's Organization into the .R struct +func (o *FieldseekerSamplelocation) 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.Samplelocations = FieldseekerSamplelocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerSamplelocation's Organization into the .R struct +func (os FieldseekerSamplelocationSlice) 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.Samplelocations = append(rel.R.Samplelocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerSamplelocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerSamplelocationJoins[Q]) aliasedAs(alias string) fieldseekerSamplelocationJoins[Q] { + return buildFieldseekerSamplelocationJoins[Q](buildFieldseekerSamplelocationColumns(alias), j.typ) +} + +func buildFieldseekerSamplelocationJoins[Q dialect.Joinable](cols fieldseekerSamplelocationColumns, typ string) fieldseekerSamplelocationJoins[Q] { + return fieldseekerSamplelocationJoins[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/db/models/fieldseeker.servicerequest.bob.go b/db/models/fieldseeker.servicerequest.bob.go index 36121c91..c3c94fae 100644 --- a/db/models/fieldseeker.servicerequest.bob.go +++ b/db/models/fieldseeker.servicerequest.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,173 +21,191 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerServicerequest is an object representing the database table. type FieldseekerServicerequest struct { Objectid int64 `db:"objectid,pk" ` - // Received + // Original attribute from ArcGIS API is RECDATETIME Recdatetime null.Val[time.Time] `db:"recdatetime" ` - // Source - Source null.Val[enums.FieldseekerServicerequestServicerequestsourceEnum] `db:"source" ` - // Entered By + // Original attribute from ArcGIS API is SOURCE + Source null.Val[string] `db:"source" ` + // Original attribute from ArcGIS API is ENTRYTECH Entrytech null.Val[string] `db:"entrytech" ` - // Priority - Priority null.Val[enums.FieldseekerServicerequestServicerequestpriorityEnum] `db:"priority" ` - // Supervisor - Supervisor null.Val[enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808] `db:"supervisor" ` - // Assigned To - Assignedtech null.Val[enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8] `db:"assignedtech" ` - // Status - Status null.Val[enums.FieldseekerServicerequestServicerequeststatusEnum] `db:"status" ` - // Anonymous Caller - Clranon null.Val[enums.FieldseekerServicerequestNotinuitFEnum] `db:"clranon" ` - // Caller Name + // Original attribute from ArcGIS API is PRIORITY + Priority null.Val[string] `db:"priority" ` + // Original attribute from ArcGIS API is SUPERVISOR + Supervisor null.Val[string] `db:"supervisor" ` + // Original attribute from ArcGIS API is ASSIGNEDTECH + Assignedtech null.Val[string] `db:"assignedtech" ` + // Original attribute from ArcGIS API is STATUS + Status null.Val[string] `db:"status" ` + // Original attribute from ArcGIS API is CLRANON + Clranon null.Val[int16] `db:"clranon" ` + // Original attribute from ArcGIS API is CLRFNAME Clrfname null.Val[string] `db:"clrfname" ` - // Caller Phone + // Original attribute from ArcGIS API is CLRPHONE1 Clrphone1 null.Val[string] `db:"clrphone1" ` - // Caller Alternate Phone + // Original attribute from ArcGIS API is CLRPHONE2 Clrphone2 null.Val[string] `db:"clrphone2" ` - // Caller Email + // Original attribute from ArcGIS API is CLREMAIL Clremail null.Val[string] `db:"clremail" ` - // Caller Company + // Original attribute from ArcGIS API is CLRCOMPANY Clrcompany null.Val[string] `db:"clrcompany" ` - // Caller Address + // Original attribute from ArcGIS API is CLRADDR1 Clraddr1 null.Val[string] `db:"clraddr1" ` - // Caller Address 2 + // Original attribute from ArcGIS API is CLRADDR2 Clraddr2 null.Val[string] `db:"clraddr2" ` - // Caller City + // Original attribute from ArcGIS API is CLRCITY Clrcity null.Val[string] `db:"clrcity" ` - // Caller State - Clrstate null.Val[enums.FieldseekerServicerequestServicerequestregionEnum] `db:"clrstate" ` - // Caller ZIP + // Original attribute from ArcGIS API is CLRSTATE + Clrstate null.Val[string] `db:"clrstate" ` + // Original attribute from ArcGIS API is CLRZIP Clrzip null.Val[string] `db:"clrzip" ` - // Caller Other + // Original attribute from ArcGIS API is CLROTHER Clrother null.Val[string] `db:"clrother" ` - // Caller Contact Preference - Clrcontpref null.Val[enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum] `db:"clrcontpref" ` - // Request Company + // Original attribute from ArcGIS API is CLRCONTPREF + Clrcontpref null.Val[string] `db:"clrcontpref" ` + // Original attribute from ArcGIS API is REQCOMPANY Reqcompany null.Val[string] `db:"reqcompany" ` - // Request Address + // Original attribute from ArcGIS API is REQADDR1 Reqaddr1 null.Val[string] `db:"reqaddr1" ` - // Request Address 2 + // Original attribute from ArcGIS API is REQADDR2 Reqaddr2 null.Val[string] `db:"reqaddr2" ` - // Request City + // Original attribute from ArcGIS API is REQCITY Reqcity null.Val[string] `db:"reqcity" ` - // Request State - Reqstate null.Val[enums.FieldseekerServicerequestServicerequestregionEnum] `db:"reqstate" ` - // Request ZIP + // Original attribute from ArcGIS API is REQSTATE + Reqstate null.Val[string] `db:"reqstate" ` + // Original attribute from ArcGIS API is REQZIP Reqzip null.Val[string] `db:"reqzip" ` - // Request Cross Street + // Original attribute from ArcGIS API is REQCROSSST Reqcrossst null.Val[string] `db:"reqcrossst" ` - // Request Subdivision + // Original attribute from ArcGIS API is REQSUBDIV Reqsubdiv null.Val[string] `db:"reqsubdiv" ` - // Request Map Grid + // Original attribute from ArcGIS API is REQMAPGRID Reqmapgrid null.Val[string] `db:"reqmapgrid" ` - // Permission to Enter - Reqpermission null.Val[enums.FieldseekerServicerequestNotinuitFEnum] `db:"reqpermission" ` - // Request Target - Reqtarget null.Val[enums.FieldseekerServicerequestServicerequesttargetEnum] `db:"reqtarget" ` - // Request Description + // Original attribute from ArcGIS API is REQPERMISSION + Reqpermission null.Val[int16] `db:"reqpermission" ` + // Original attribute from ArcGIS API is REQTARGET + Reqtarget null.Val[string] `db:"reqtarget" ` + // Original attribute from ArcGIS API is REQDESCR Reqdescr null.Val[string] `db:"reqdescr" ` - // Notes for Field Technician + // Original attribute from ArcGIS API is REQNOTESFORTECH Reqnotesfortech null.Val[string] `db:"reqnotesfortech" ` - // Notes for Customer + // Original attribute from ArcGIS API is REQNOTESFORCUST Reqnotesforcust null.Val[string] `db:"reqnotesforcust" ` - // Request Field Notes + // Original attribute from ArcGIS API is REQFLDNOTES Reqfldnotes null.Val[string] `db:"reqfldnotes" ` - // Request Program Actions + // Original attribute from ArcGIS API is REQPROGRAMACTIONS Reqprogramactions null.Val[string] `db:"reqprogramactions" ` - // Closed + // Original attribute from ArcGIS API is DATETIMECLOSED Datetimeclosed null.Val[time.Time] `db:"datetimeclosed" ` - // Closed By + // Original attribute from ArcGIS API is TECHCLOSED Techclosed null.Val[string] `db:"techclosed" ` - // SR# + // Original attribute from ArcGIS API is SR_NUMBER SRNumber null.Val[int32] `db:"sr_number" ` - // Reviewed - Reviewed null.Val[enums.FieldseekerServicerequestNotinuitFEnum] `db:"reviewed" ` - // Reviewed By + // Original attribute from ArcGIS API is REVIEWED + Reviewed null.Val[int16] `db:"reviewed" ` + // Original attribute from ArcGIS API is REVIEWEDBY Reviewedby null.Val[string] `db:"reviewedby" ` - // Reviewed Date + // Original attribute from ArcGIS API is REVIEWEDDATE Revieweddate null.Val[time.Time] `db:"revieweddate" ` - // Accepted - Accepted null.Val[enums.FieldseekerServicerequestNotinuitFEnum] `db:"accepted" ` - // Accepted Date + // Original attribute from ArcGIS API is ACCEPTED + Accepted null.Val[int16] `db:"accepted" ` + // Original attribute from ArcGIS API is ACCEPTEDDATE Accepteddate null.Val[time.Time] `db:"accepteddate" ` - // Rejected By + // Original attribute from ArcGIS API is REJECTEDBY Rejectedby null.Val[string] `db:"rejectedby" ` - // Rejected Date + // Original attribute from ArcGIS API is REJECTEDDATE Rejecteddate null.Val[time.Time] `db:"rejecteddate" ` - // Rejected Reason - Rejectedreason null.Val[enums.FieldseekerServicerequestServicerequestrejectedreasonEnum] `db:"rejectedreason" ` - // Due Date + // Original attribute from ArcGIS API is REJECTEDREASON + Rejectedreason null.Val[string] `db:"rejectedreason" ` + // Original attribute from ArcGIS API is DUEDATE Duedate null.Val[time.Time] `db:"duedate" ` - // Accepted By + // Original attribute from ArcGIS API is ACCEPTEDBY Acceptedby null.Val[string] `db:"acceptedby" ` - // Comments + // Original attribute from ArcGIS API is COMMENTS Comments null.Val[string] `db:"comments" ` - // Estimated Completion Date + // Original attribute from ArcGIS API is ESTCOMPLETEDATE Estcompletedate null.Val[time.Time] `db:"estcompletedate" ` - // Next Action - Nextaction null.Val[enums.FieldseekerServicerequestServicerequestnextactionEnum] `db:"nextaction" ` - // Record Status - Recordstatus null.Val[int16] `db:"recordstatus" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is NEXTACTION + Nextaction null.Val[string] `db:"nextaction" ` + // Original attribute from ArcGIS API is RECORDSTATUS + Recordstatus null.Val[int16] `db:"recordstatus" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - // First Response Date + // Original attribute from ArcGIS API is FIRSTRESPONSEDATE Firstresponsedate null.Val[time.Time] `db:"firstresponsedate" ` - // Response Day Count + // Original attribute from ArcGIS API is RESPONSEDAYCOUNT Responsedaycount null.Val[int16] `db:"responsedaycount" ` - // Verify Correct Location + // Original attribute from ArcGIS API is ALLOWED Allowed null.Val[string] `db:"allowed" ` - // Xvalue + // Original attribute from ArcGIS API is XVALUE Xvalue null.Val[string] `db:"xvalue" ` - // Yvalue + // Original attribute from ArcGIS API is YVALUE Yvalue null.Val[string] `db:"yvalue" ` - // ValidX + // Original attribute from ArcGIS API is VALIDX Validx null.Val[string] `db:"validx" ` - // ValidY + // Original attribute from ArcGIS API is VALIDY Validy null.Val[string] `db:"validy" ` - // External ID + // Original attribute from ArcGIS API is EXTERNALID Externalid null.Val[string] `db:"externalid" ` - // External Error - Externalerror null.Val[string] `db:"externalerror" ` - Pointlocid null.Val[uuid.UUID] `db:"pointlocid" ` - // Notified + // Original attribute from ArcGIS API is EXTERNALERROR + Externalerror null.Val[string] `db:"externalerror" ` + // Original attribute from ArcGIS API is POINTLOCID + Pointlocid null.Val[uuid.UUID] `db:"pointlocid" ` + // Original attribute from ArcGIS API is NOTIFIED Notified null.Val[int16] `db:"notified" ` - // Notified Date + // Original attribute from ArcGIS API is NOTIFIEDDATE Notifieddate null.Val[time.Time] `db:"notifieddate" ` - // Scheduled + // Original attribute from ArcGIS API is SCHEDULED Scheduled null.Val[int16] `db:"scheduled" ` - // Scheduled Date + // Original attribute from ArcGIS API is SCHEDULEDDATE Scheduleddate null.Val[time.Time] `db:"scheduleddate" ` - // Dog - Dog null.Val[enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31] `db:"dog" ` - // Schedule Period - SchedulePeriod null.Val[enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab] `db:"schedule_period" ` - // Schedule Notes + // Original attribute from ArcGIS API is DOG + Dog null.Val[int32] `db:"dog" ` + // Original attribute from ArcGIS API is schedule_period + SchedulePeriod null.Val[string] `db:"schedule_period" ` + // Original attribute from ArcGIS API is schedule_notes ScheduleNotes null.Val[string] `db:"schedule_notes" ` - // Prefer speaking Spanish - Spanish null.Val[enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC] `db:"spanish" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Issues Reported - Issuesreported null.Val[enums.FieldseekerServicerequestServicerequestissuesEnum] `db:"issuesreported" ` - // Jurisdiction + // Original attribute from ArcGIS API is Spanish + Spanish null.Val[int32] `db:"spanish" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is ISSUESREPORTED + Issuesreported null.Val[string] `db:"issuesreported" ` + // Original attribute from ArcGIS API is JURISDICTION Jurisdiction null.Val[string] `db:"jurisdiction" ` - // Notification Timestamp + // Original attribute from ArcGIS API is NOTIFICATIONTIMESTAMP Notificationtimestamp null.Val[string] `db:"notificationtimestamp" ` - // Zone + // Original attribute from ArcGIS API is ZONE Zone null.Val[string] `db:"zone" ` - // Zone2 - Zone2 null.Val[string] `db:"zone2" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is ZONE2 + Zone2 null.Val[string] `db:"zone2" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerServicerequestR `db:"-" ` } // FieldseekerServicerequestSlice is an alias for a slice of pointers to FieldseekerServicerequest. @@ -199,10 +218,15 @@ var FieldseekerServicerequests = psql.NewTablex[*FieldseekerServicerequest, Fiel // FieldseekerServicerequestsQuery is a query on the servicerequest table type FieldseekerServicerequestsQuery = *psql.ViewQuery[*FieldseekerServicerequest, FieldseekerServicerequestSlice] +// fieldseekerServicerequestR is where relationships are stored. +type fieldseekerServicerequestR struct { + Organization *Organization // fieldseeker.servicerequest.servicerequest_organization_id_fkey +} + func buildFieldseekerServicerequestColumns(alias string) fieldseekerServicerequestColumns { return fieldseekerServicerequestColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "recdatetime", "source", "entrytech", "priority", "supervisor", "assignedtech", "status", "clranon", "clrfname", "clrphone1", "clrphone2", "clremail", "clrcompany", "clraddr1", "clraddr2", "clrcity", "clrstate", "clrzip", "clrother", "clrcontpref", "reqcompany", "reqaddr1", "reqaddr2", "reqcity", "reqstate", "reqzip", "reqcrossst", "reqsubdiv", "reqmapgrid", "reqpermission", "reqtarget", "reqdescr", "reqnotesfortech", "reqnotesforcust", "reqfldnotes", "reqprogramactions", "datetimeclosed", "techclosed", "sr_number", "reviewed", "reviewedby", "revieweddate", "accepted", "accepteddate", "rejectedby", "rejecteddate", "rejectedreason", "duedate", "acceptedby", "comments", "estcompletedate", "nextaction", "recordstatus", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "firstresponsedate", "responsedaycount", "allowed", "xvalue", "yvalue", "validx", "validy", "externalid", "externalerror", "pointlocid", "notified", "notifieddate", "scheduled", "scheduleddate", "dog", "schedule_period", "schedule_notes", "spanish", "creationdate", "creator", "editdate", "editor", "issuesreported", "jurisdiction", "notificationtimestamp", "zone", "zone2", "version", + "objectid", "recdatetime", "source", "entrytech", "priority", "supervisor", "assignedtech", "status", "clranon", "clrfname", "clrphone1", "clrphone2", "clremail", "clrcompany", "clraddr1", "clraddr2", "clrcity", "clrstate", "clrzip", "clrother", "clrcontpref", "reqcompany", "reqaddr1", "reqaddr2", "reqcity", "reqstate", "reqzip", "reqcrossst", "reqsubdiv", "reqmapgrid", "reqpermission", "reqtarget", "reqdescr", "reqnotesfortech", "reqnotesforcust", "reqfldnotes", "reqprogramactions", "datetimeclosed", "techclosed", "sr_number", "reviewed", "reviewedby", "revieweddate", "accepted", "accepteddate", "rejectedby", "rejecteddate", "rejectedreason", "duedate", "acceptedby", "comments", "estcompletedate", "nextaction", "recordstatus", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "firstresponsedate", "responsedaycount", "allowed", "xvalue", "yvalue", "validx", "validy", "externalid", "externalerror", "pointlocid", "notified", "notifieddate", "scheduled", "scheduleddate", "dog", "schedule_period", "schedule_notes", "spanish", "creationdate", "creator", "editdate", "editor", "issuesreported", "jurisdiction", "notificationtimestamp", "zone", "zone2", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.servicerequest"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -291,7 +315,10 @@ func buildFieldseekerServicerequestColumns(alias string) fieldseekerServicereque Notificationtimestamp: psql.Quote(alias, "notificationtimestamp"), Zone: psql.Quote(alias, "zone"), Zone2: psql.Quote(alias, "zone2"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -384,7 +411,10 @@ type fieldseekerServicerequestColumns struct { Notificationtimestamp psql.Expression Zone psql.Expression Zone2 psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerServicerequestColumns) Alias() string { @@ -399,97 +429,100 @@ func (fieldseekerServicerequestColumns) AliasedAs(alias string) fieldseekerServi // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerServicerequestSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Recdatetime omitnull.Val[time.Time] `db:"recdatetime" ` - Source omitnull.Val[enums.FieldseekerServicerequestServicerequestsourceEnum] `db:"source" ` - Entrytech omitnull.Val[string] `db:"entrytech" ` - Priority omitnull.Val[enums.FieldseekerServicerequestServicerequestpriorityEnum] `db:"priority" ` - Supervisor omitnull.Val[enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808] `db:"supervisor" ` - Assignedtech omitnull.Val[enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8] `db:"assignedtech" ` - Status omitnull.Val[enums.FieldseekerServicerequestServicerequeststatusEnum] `db:"status" ` - Clranon omitnull.Val[enums.FieldseekerServicerequestNotinuitFEnum] `db:"clranon" ` - Clrfname omitnull.Val[string] `db:"clrfname" ` - Clrphone1 omitnull.Val[string] `db:"clrphone1" ` - Clrphone2 omitnull.Val[string] `db:"clrphone2" ` - Clremail omitnull.Val[string] `db:"clremail" ` - Clrcompany omitnull.Val[string] `db:"clrcompany" ` - Clraddr1 omitnull.Val[string] `db:"clraddr1" ` - Clraddr2 omitnull.Val[string] `db:"clraddr2" ` - Clrcity omitnull.Val[string] `db:"clrcity" ` - Clrstate omitnull.Val[enums.FieldseekerServicerequestServicerequestregionEnum] `db:"clrstate" ` - Clrzip omitnull.Val[string] `db:"clrzip" ` - Clrother omitnull.Val[string] `db:"clrother" ` - Clrcontpref omitnull.Val[enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum] `db:"clrcontpref" ` - Reqcompany omitnull.Val[string] `db:"reqcompany" ` - Reqaddr1 omitnull.Val[string] `db:"reqaddr1" ` - Reqaddr2 omitnull.Val[string] `db:"reqaddr2" ` - Reqcity omitnull.Val[string] `db:"reqcity" ` - Reqstate omitnull.Val[enums.FieldseekerServicerequestServicerequestregionEnum] `db:"reqstate" ` - Reqzip omitnull.Val[string] `db:"reqzip" ` - Reqcrossst omitnull.Val[string] `db:"reqcrossst" ` - Reqsubdiv omitnull.Val[string] `db:"reqsubdiv" ` - Reqmapgrid omitnull.Val[string] `db:"reqmapgrid" ` - Reqpermission omitnull.Val[enums.FieldseekerServicerequestNotinuitFEnum] `db:"reqpermission" ` - Reqtarget omitnull.Val[enums.FieldseekerServicerequestServicerequesttargetEnum] `db:"reqtarget" ` - Reqdescr omitnull.Val[string] `db:"reqdescr" ` - Reqnotesfortech omitnull.Val[string] `db:"reqnotesfortech" ` - Reqnotesforcust omitnull.Val[string] `db:"reqnotesforcust" ` - Reqfldnotes omitnull.Val[string] `db:"reqfldnotes" ` - Reqprogramactions omitnull.Val[string] `db:"reqprogramactions" ` - Datetimeclosed omitnull.Val[time.Time] `db:"datetimeclosed" ` - Techclosed omitnull.Val[string] `db:"techclosed" ` - SRNumber omitnull.Val[int32] `db:"sr_number" ` - Reviewed omitnull.Val[enums.FieldseekerServicerequestNotinuitFEnum] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[time.Time] `db:"revieweddate" ` - Accepted omitnull.Val[enums.FieldseekerServicerequestNotinuitFEnum] `db:"accepted" ` - Accepteddate omitnull.Val[time.Time] `db:"accepteddate" ` - Rejectedby omitnull.Val[string] `db:"rejectedby" ` - Rejecteddate omitnull.Val[time.Time] `db:"rejecteddate" ` - Rejectedreason omitnull.Val[enums.FieldseekerServicerequestServicerequestrejectedreasonEnum] `db:"rejectedreason" ` - Duedate omitnull.Val[time.Time] `db:"duedate" ` - Acceptedby omitnull.Val[string] `db:"acceptedby" ` - Comments omitnull.Val[string] `db:"comments" ` - Estcompletedate omitnull.Val[time.Time] `db:"estcompletedate" ` - Nextaction omitnull.Val[enums.FieldseekerServicerequestServicerequestnextactionEnum] `db:"nextaction" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Firstresponsedate omitnull.Val[time.Time] `db:"firstresponsedate" ` - Responsedaycount omitnull.Val[int16] `db:"responsedaycount" ` - Allowed omitnull.Val[string] `db:"allowed" ` - Xvalue omitnull.Val[string] `db:"xvalue" ` - Yvalue omitnull.Val[string] `db:"yvalue" ` - Validx omitnull.Val[string] `db:"validx" ` - Validy omitnull.Val[string] `db:"validy" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Externalerror omitnull.Val[string] `db:"externalerror" ` - Pointlocid omitnull.Val[uuid.UUID] `db:"pointlocid" ` - Notified omitnull.Val[int16] `db:"notified" ` - Notifieddate omitnull.Val[time.Time] `db:"notifieddate" ` - Scheduled omitnull.Val[int16] `db:"scheduled" ` - Scheduleddate omitnull.Val[time.Time] `db:"scheduleddate" ` - Dog omitnull.Val[enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31] `db:"dog" ` - SchedulePeriod omitnull.Val[enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab] `db:"schedule_period" ` - ScheduleNotes omitnull.Val[string] `db:"schedule_notes" ` - Spanish omitnull.Val[enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC] `db:"spanish" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Issuesreported omitnull.Val[enums.FieldseekerServicerequestServicerequestissuesEnum] `db:"issuesreported" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Notificationtimestamp omitnull.Val[string] `db:"notificationtimestamp" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Recdatetime omitnull.Val[time.Time] `db:"recdatetime" ` + Source omitnull.Val[string] `db:"source" ` + Entrytech omitnull.Val[string] `db:"entrytech" ` + Priority omitnull.Val[string] `db:"priority" ` + Supervisor omitnull.Val[string] `db:"supervisor" ` + Assignedtech omitnull.Val[string] `db:"assignedtech" ` + Status omitnull.Val[string] `db:"status" ` + Clranon omitnull.Val[int16] `db:"clranon" ` + Clrfname omitnull.Val[string] `db:"clrfname" ` + Clrphone1 omitnull.Val[string] `db:"clrphone1" ` + Clrphone2 omitnull.Val[string] `db:"clrphone2" ` + Clremail omitnull.Val[string] `db:"clremail" ` + Clrcompany omitnull.Val[string] `db:"clrcompany" ` + Clraddr1 omitnull.Val[string] `db:"clraddr1" ` + Clraddr2 omitnull.Val[string] `db:"clraddr2" ` + Clrcity omitnull.Val[string] `db:"clrcity" ` + Clrstate omitnull.Val[string] `db:"clrstate" ` + Clrzip omitnull.Val[string] `db:"clrzip" ` + Clrother omitnull.Val[string] `db:"clrother" ` + Clrcontpref omitnull.Val[string] `db:"clrcontpref" ` + Reqcompany omitnull.Val[string] `db:"reqcompany" ` + Reqaddr1 omitnull.Val[string] `db:"reqaddr1" ` + Reqaddr2 omitnull.Val[string] `db:"reqaddr2" ` + Reqcity omitnull.Val[string] `db:"reqcity" ` + Reqstate omitnull.Val[string] `db:"reqstate" ` + Reqzip omitnull.Val[string] `db:"reqzip" ` + Reqcrossst omitnull.Val[string] `db:"reqcrossst" ` + Reqsubdiv omitnull.Val[string] `db:"reqsubdiv" ` + Reqmapgrid omitnull.Val[string] `db:"reqmapgrid" ` + Reqpermission omitnull.Val[int16] `db:"reqpermission" ` + Reqtarget omitnull.Val[string] `db:"reqtarget" ` + Reqdescr omitnull.Val[string] `db:"reqdescr" ` + Reqnotesfortech omitnull.Val[string] `db:"reqnotesfortech" ` + Reqnotesforcust omitnull.Val[string] `db:"reqnotesforcust" ` + Reqfldnotes omitnull.Val[string] `db:"reqfldnotes" ` + Reqprogramactions omitnull.Val[string] `db:"reqprogramactions" ` + Datetimeclosed omitnull.Val[time.Time] `db:"datetimeclosed" ` + Techclosed omitnull.Val[string] `db:"techclosed" ` + SRNumber omitnull.Val[int32] `db:"sr_number" ` + Reviewed omitnull.Val[int16] `db:"reviewed" ` + Reviewedby omitnull.Val[string] `db:"reviewedby" ` + Revieweddate omitnull.Val[time.Time] `db:"revieweddate" ` + Accepted omitnull.Val[int16] `db:"accepted" ` + Accepteddate omitnull.Val[time.Time] `db:"accepteddate" ` + Rejectedby omitnull.Val[string] `db:"rejectedby" ` + Rejecteddate omitnull.Val[time.Time] `db:"rejecteddate" ` + Rejectedreason omitnull.Val[string] `db:"rejectedreason" ` + Duedate omitnull.Val[time.Time] `db:"duedate" ` + Acceptedby omitnull.Val[string] `db:"acceptedby" ` + Comments omitnull.Val[string] `db:"comments" ` + Estcompletedate omitnull.Val[time.Time] `db:"estcompletedate" ` + Nextaction omitnull.Val[string] `db:"nextaction" ` + Recordstatus omitnull.Val[int16] `db:"recordstatus" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Firstresponsedate omitnull.Val[time.Time] `db:"firstresponsedate" ` + Responsedaycount omitnull.Val[int16] `db:"responsedaycount" ` + Allowed omitnull.Val[string] `db:"allowed" ` + Xvalue omitnull.Val[string] `db:"xvalue" ` + Yvalue omitnull.Val[string] `db:"yvalue" ` + Validx omitnull.Val[string] `db:"validx" ` + Validy omitnull.Val[string] `db:"validy" ` + Externalid omitnull.Val[string] `db:"externalid" ` + Externalerror omitnull.Val[string] `db:"externalerror" ` + Pointlocid omitnull.Val[uuid.UUID] `db:"pointlocid" ` + Notified omitnull.Val[int16] `db:"notified" ` + Notifieddate omitnull.Val[time.Time] `db:"notifieddate" ` + Scheduled omitnull.Val[int16] `db:"scheduled" ` + Scheduleddate omitnull.Val[time.Time] `db:"scheduleddate" ` + Dog omitnull.Val[int32] `db:"dog" ` + SchedulePeriod omitnull.Val[string] `db:"schedule_period" ` + ScheduleNotes omitnull.Val[string] `db:"schedule_notes" ` + Spanish omitnull.Val[int32] `db:"spanish" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Issuesreported omitnull.Val[string] `db:"issuesreported" ` + Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` + Notificationtimestamp omitnull.Val[string] `db:"notificationtimestamp" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerServicerequestSetter) SetColumns() []string { - vals := make([]string, 0, 87) + vals := make([]string, 0, 90) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -748,9 +781,18 @@ func (s FieldseekerServicerequestSetter) SetColumns() []string { if !s.Zone2.IsUnset() { vals = append(vals, "zone2") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -1013,9 +1055,18 @@ func (s FieldseekerServicerequestSetter) Overwrite(t *FieldseekerServicerequest) if !s.Zone2.IsUnset() { t.Zone2 = s.Zone2.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerServicerequestSetter) Apply(q *dialect.InsertQuery) { @@ -1024,7 +1075,7 @@ func (s *FieldseekerServicerequestSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 87) + vals := make([]bob.Expression, 90) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -1541,12 +1592,30 @@ func (s *FieldseekerServicerequestSetter) Apply(q *dialect.InsertQuery) { vals[85] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[86] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[86] = psql.Arg(s.Geometry.MustGet()) } else { vals[86] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[87] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[87] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[88] = psql.Arg(s.Version.MustGet()) + } else { + vals[88] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[89] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[89] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -1556,7 +1625,7 @@ func (s FieldseekerServicerequestSetter) UpdateMod() bob.Mod[*dialect.UpdateQuer } func (s FieldseekerServicerequestSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 87) + exprs := make([]bob.Expression, 0, 90) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -2160,6 +2229,20 @@ func (s FieldseekerServicerequestSetter) Expressions(prefix ...string) []bob.Exp }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -2167,6 +2250,13 @@ func (s FieldseekerServicerequestSetter) Expressions(prefix ...string) []bob.Exp }}) } + 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 } @@ -2234,6 +2324,7 @@ func (o *FieldseekerServicerequest) Update(ctx context.Context, exec bob.Executo return err } + o.R = v.R *o = *v return nil @@ -2254,7 +2345,7 @@ func (o *FieldseekerServicerequest) Reload(ctx context.Context, exec bob.Executo if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -2304,7 +2395,7 @@ func (o FieldseekerServicerequestSlice) copyMatchingRows(from ...*FieldseekerSer if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -2402,16 +2493,88 @@ func (o FieldseekerServicerequestSlice) ReloadAll(ctx context.Context, exec bob. return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerServicerequest) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerServicerequestSlice) 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 attachFieldseekerServicerequestOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerServicerequest0 *FieldseekerServicerequest, organization1 *Organization) (*FieldseekerServicerequest, error) { + setter := &FieldseekerServicerequestSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerServicerequest0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerServicerequestOrganization0: %w", err) + } + + return fieldseekerServicerequest0, nil +} + +func (fieldseekerServicerequest0 *FieldseekerServicerequest) 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 = attachFieldseekerServicerequestOrganization0(ctx, exec, 1, fieldseekerServicerequest0, organization1) + if err != nil { + return err + } + + fieldseekerServicerequest0.R.Organization = organization1 + + organization1.R.Servicerequests = append(organization1.R.Servicerequests, fieldseekerServicerequest0) + + return nil +} + +func (fieldseekerServicerequest0 *FieldseekerServicerequest) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerServicerequestOrganization0(ctx, exec, 1, fieldseekerServicerequest0, organization1) + if err != nil { + return err + } + + fieldseekerServicerequest0.R.Organization = organization1 + + organization1.R.Servicerequests = append(organization1.R.Servicerequests, fieldseekerServicerequest0) + + return nil +} + type fieldseekerServicerequestWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] Recdatetime psql.WhereNullMod[Q, time.Time] - Source psql.WhereNullMod[Q, enums.FieldseekerServicerequestServicerequestsourceEnum] + Source psql.WhereNullMod[Q, string] Entrytech psql.WhereNullMod[Q, string] - Priority psql.WhereNullMod[Q, enums.FieldseekerServicerequestServicerequestpriorityEnum] - Supervisor psql.WhereNullMod[Q, enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808] - Assignedtech psql.WhereNullMod[Q, enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8] - Status psql.WhereNullMod[Q, enums.FieldseekerServicerequestServicerequeststatusEnum] - Clranon psql.WhereNullMod[Q, enums.FieldseekerServicerequestNotinuitFEnum] + Priority psql.WhereNullMod[Q, string] + Supervisor psql.WhereNullMod[Q, string] + Assignedtech psql.WhereNullMod[Q, string] + Status psql.WhereNullMod[Q, string] + Clranon psql.WhereNullMod[Q, int16] Clrfname psql.WhereNullMod[Q, string] Clrphone1 psql.WhereNullMod[Q, string] Clrphone2 psql.WhereNullMod[Q, string] @@ -2420,21 +2583,21 @@ type fieldseekerServicerequestWhere[Q psql.Filterable] struct { Clraddr1 psql.WhereNullMod[Q, string] Clraddr2 psql.WhereNullMod[Q, string] Clrcity psql.WhereNullMod[Q, string] - Clrstate psql.WhereNullMod[Q, enums.FieldseekerServicerequestServicerequestregionEnum] + Clrstate psql.WhereNullMod[Q, string] Clrzip psql.WhereNullMod[Q, string] Clrother psql.WhereNullMod[Q, string] - Clrcontpref psql.WhereNullMod[Q, enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum] + Clrcontpref psql.WhereNullMod[Q, string] Reqcompany psql.WhereNullMod[Q, string] Reqaddr1 psql.WhereNullMod[Q, string] Reqaddr2 psql.WhereNullMod[Q, string] Reqcity psql.WhereNullMod[Q, string] - Reqstate psql.WhereNullMod[Q, enums.FieldseekerServicerequestServicerequestregionEnum] + Reqstate psql.WhereNullMod[Q, string] Reqzip psql.WhereNullMod[Q, string] Reqcrossst psql.WhereNullMod[Q, string] Reqsubdiv psql.WhereNullMod[Q, string] Reqmapgrid psql.WhereNullMod[Q, string] - Reqpermission psql.WhereNullMod[Q, enums.FieldseekerServicerequestNotinuitFEnum] - Reqtarget psql.WhereNullMod[Q, enums.FieldseekerServicerequestServicerequesttargetEnum] + Reqpermission psql.WhereNullMod[Q, int16] + Reqtarget psql.WhereNullMod[Q, string] Reqdescr psql.WhereNullMod[Q, string] Reqnotesfortech psql.WhereNullMod[Q, string] Reqnotesforcust psql.WhereNullMod[Q, string] @@ -2443,19 +2606,19 @@ type fieldseekerServicerequestWhere[Q psql.Filterable] struct { Datetimeclosed psql.WhereNullMod[Q, time.Time] Techclosed psql.WhereNullMod[Q, string] SRNumber psql.WhereNullMod[Q, int32] - Reviewed psql.WhereNullMod[Q, enums.FieldseekerServicerequestNotinuitFEnum] + Reviewed psql.WhereNullMod[Q, int16] Reviewedby psql.WhereNullMod[Q, string] Revieweddate psql.WhereNullMod[Q, time.Time] - Accepted psql.WhereNullMod[Q, enums.FieldseekerServicerequestNotinuitFEnum] + Accepted psql.WhereNullMod[Q, int16] Accepteddate psql.WhereNullMod[Q, time.Time] Rejectedby psql.WhereNullMod[Q, string] Rejecteddate psql.WhereNullMod[Q, time.Time] - Rejectedreason psql.WhereNullMod[Q, enums.FieldseekerServicerequestServicerequestrejectedreasonEnum] + Rejectedreason psql.WhereNullMod[Q, string] Duedate psql.WhereNullMod[Q, time.Time] Acceptedby psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] Estcompletedate psql.WhereNullMod[Q, time.Time] - Nextaction psql.WhereNullMod[Q, enums.FieldseekerServicerequestServicerequestnextactionEnum] + Nextaction psql.WhereNullMod[Q, string] Recordstatus psql.WhereNullMod[Q, int16] Globalid psql.WhereNullMod[Q, uuid.UUID] CreatedUser psql.WhereNullMod[Q, string] @@ -2476,20 +2639,23 @@ type fieldseekerServicerequestWhere[Q psql.Filterable] struct { Notifieddate psql.WhereNullMod[Q, time.Time] Scheduled psql.WhereNullMod[Q, int16] Scheduleddate psql.WhereNullMod[Q, time.Time] - Dog psql.WhereNullMod[Q, enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31] - SchedulePeriod psql.WhereNullMod[Q, enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab] + Dog psql.WhereNullMod[Q, int32] + SchedulePeriod psql.WhereNullMod[Q, string] ScheduleNotes psql.WhereNullMod[Q, string] - Spanish psql.WhereNullMod[Q, enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC] + Spanish psql.WhereNullMod[Q, int32] Creationdate psql.WhereNullMod[Q, time.Time] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] - Issuesreported psql.WhereNullMod[Q, enums.FieldseekerServicerequestServicerequestissuesEnum] + Issuesreported psql.WhereNullMod[Q, string] Jurisdiction psql.WhereNullMod[Q, string] Notificationtimestamp psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerServicerequestWhere[Q]) AliasedAs(alias string) fieldseekerServicerequestWhere[Q] { @@ -2500,13 +2666,13 @@ func buildFieldseekerServicerequestWhere[Q psql.Filterable](cols fieldseekerServ return fieldseekerServicerequestWhere[Q]{ Objectid: psql.Where[Q, int64](cols.Objectid), Recdatetime: psql.WhereNull[Q, time.Time](cols.Recdatetime), - Source: psql.WhereNull[Q, enums.FieldseekerServicerequestServicerequestsourceEnum](cols.Source), + Source: psql.WhereNull[Q, string](cols.Source), Entrytech: psql.WhereNull[Q, string](cols.Entrytech), - Priority: psql.WhereNull[Q, enums.FieldseekerServicerequestServicerequestpriorityEnum](cols.Priority), - Supervisor: psql.WhereNull[Q, enums.FieldseekerServicerequestServicerequestSupervisorEba07b90C8854fe6808](cols.Supervisor), - Assignedtech: psql.WhereNull[Q, enums.FieldseekerServicerequestServicerequestAssignedtech71D0D685868F4b7a8](cols.Assignedtech), - Status: psql.WhereNull[Q, enums.FieldseekerServicerequestServicerequeststatusEnum](cols.Status), - Clranon: psql.WhereNull[Q, enums.FieldseekerServicerequestNotinuitFEnum](cols.Clranon), + Priority: psql.WhereNull[Q, string](cols.Priority), + Supervisor: psql.WhereNull[Q, string](cols.Supervisor), + Assignedtech: psql.WhereNull[Q, string](cols.Assignedtech), + Status: psql.WhereNull[Q, string](cols.Status), + Clranon: psql.WhereNull[Q, int16](cols.Clranon), Clrfname: psql.WhereNull[Q, string](cols.Clrfname), Clrphone1: psql.WhereNull[Q, string](cols.Clrphone1), Clrphone2: psql.WhereNull[Q, string](cols.Clrphone2), @@ -2515,21 +2681,21 @@ func buildFieldseekerServicerequestWhere[Q psql.Filterable](cols fieldseekerServ Clraddr1: psql.WhereNull[Q, string](cols.Clraddr1), Clraddr2: psql.WhereNull[Q, string](cols.Clraddr2), Clrcity: psql.WhereNull[Q, string](cols.Clrcity), - Clrstate: psql.WhereNull[Q, enums.FieldseekerServicerequestServicerequestregionEnum](cols.Clrstate), + Clrstate: psql.WhereNull[Q, string](cols.Clrstate), Clrzip: psql.WhereNull[Q, string](cols.Clrzip), Clrother: psql.WhereNull[Q, string](cols.Clrother), - Clrcontpref: psql.WhereNull[Q, enums.FieldseekerServicerequestServicerequestcontactpreferencesEnum](cols.Clrcontpref), + Clrcontpref: psql.WhereNull[Q, string](cols.Clrcontpref), Reqcompany: psql.WhereNull[Q, string](cols.Reqcompany), Reqaddr1: psql.WhereNull[Q, string](cols.Reqaddr1), Reqaddr2: psql.WhereNull[Q, string](cols.Reqaddr2), Reqcity: psql.WhereNull[Q, string](cols.Reqcity), - Reqstate: psql.WhereNull[Q, enums.FieldseekerServicerequestServicerequestregionEnum](cols.Reqstate), + Reqstate: psql.WhereNull[Q, string](cols.Reqstate), Reqzip: psql.WhereNull[Q, string](cols.Reqzip), Reqcrossst: psql.WhereNull[Q, string](cols.Reqcrossst), Reqsubdiv: psql.WhereNull[Q, string](cols.Reqsubdiv), Reqmapgrid: psql.WhereNull[Q, string](cols.Reqmapgrid), - Reqpermission: psql.WhereNull[Q, enums.FieldseekerServicerequestNotinuitFEnum](cols.Reqpermission), - Reqtarget: psql.WhereNull[Q, enums.FieldseekerServicerequestServicerequesttargetEnum](cols.Reqtarget), + Reqpermission: psql.WhereNull[Q, int16](cols.Reqpermission), + Reqtarget: psql.WhereNull[Q, string](cols.Reqtarget), Reqdescr: psql.WhereNull[Q, string](cols.Reqdescr), Reqnotesfortech: psql.WhereNull[Q, string](cols.Reqnotesfortech), Reqnotesforcust: psql.WhereNull[Q, string](cols.Reqnotesforcust), @@ -2538,19 +2704,19 @@ func buildFieldseekerServicerequestWhere[Q psql.Filterable](cols fieldseekerServ Datetimeclosed: psql.WhereNull[Q, time.Time](cols.Datetimeclosed), Techclosed: psql.WhereNull[Q, string](cols.Techclosed), SRNumber: psql.WhereNull[Q, int32](cols.SRNumber), - Reviewed: psql.WhereNull[Q, enums.FieldseekerServicerequestNotinuitFEnum](cols.Reviewed), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), Revieweddate: psql.WhereNull[Q, time.Time](cols.Revieweddate), - Accepted: psql.WhereNull[Q, enums.FieldseekerServicerequestNotinuitFEnum](cols.Accepted), + Accepted: psql.WhereNull[Q, int16](cols.Accepted), Accepteddate: psql.WhereNull[Q, time.Time](cols.Accepteddate), Rejectedby: psql.WhereNull[Q, string](cols.Rejectedby), Rejecteddate: psql.WhereNull[Q, time.Time](cols.Rejecteddate), - Rejectedreason: psql.WhereNull[Q, enums.FieldseekerServicerequestServicerequestrejectedreasonEnum](cols.Rejectedreason), + Rejectedreason: psql.WhereNull[Q, string](cols.Rejectedreason), Duedate: psql.WhereNull[Q, time.Time](cols.Duedate), Acceptedby: psql.WhereNull[Q, string](cols.Acceptedby), Comments: psql.WhereNull[Q, string](cols.Comments), Estcompletedate: psql.WhereNull[Q, time.Time](cols.Estcompletedate), - Nextaction: psql.WhereNull[Q, enums.FieldseekerServicerequestServicerequestnextactionEnum](cols.Nextaction), + Nextaction: psql.WhereNull[Q, string](cols.Nextaction), Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), Globalid: psql.WhereNull[Q, uuid.UUID](cols.Globalid), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), @@ -2571,19 +2737,167 @@ func buildFieldseekerServicerequestWhere[Q psql.Filterable](cols fieldseekerServ Notifieddate: psql.WhereNull[Q, time.Time](cols.Notifieddate), Scheduled: psql.WhereNull[Q, int16](cols.Scheduled), Scheduleddate: psql.WhereNull[Q, time.Time](cols.Scheduleddate), - Dog: psql.WhereNull[Q, enums.FieldseekerServicerequestServicerequestDog2b95ec9712864FCD88F4F0e31](cols.Dog), - SchedulePeriod: psql.WhereNull[Q, enums.FieldseekerServicerequestServicerequestSchedulePeriod3F40C046Afd14ab](cols.SchedulePeriod), + Dog: psql.WhereNull[Q, int32](cols.Dog), + SchedulePeriod: psql.WhereNull[Q, string](cols.SchedulePeriod), ScheduleNotes: psql.WhereNull[Q, string](cols.ScheduleNotes), - Spanish: psql.WhereNull[Q, enums.FieldseekerServicerequestServicerequestSpanishAaa3dc669f9a45278ecdC](cols.Spanish), + Spanish: psql.WhereNull[Q, int32](cols.Spanish), Creationdate: psql.WhereNull[Q, time.Time](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), - Issuesreported: psql.WhereNull[Q, enums.FieldseekerServicerequestServicerequestissuesEnum](cols.Issuesreported), + Issuesreported: psql.WhereNull[Q, string](cols.Issuesreported), Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), Notificationtimestamp: psql.WhereNull[Q, string](cols.Notificationtimestamp), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerServicerequest) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerServicerequest cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Servicerequests = FieldseekerServicerequestSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerServicerequest has no relationship %q", name) + } +} + +type fieldseekerServicerequestPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerServicerequestPreloader() fieldseekerServicerequestPreloader { + return fieldseekerServicerequestPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerServicerequests, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerServicerequestThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerServicerequestThenLoader[Q orm.Loadable]() fieldseekerServicerequestThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerServicerequestThenLoader[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 fieldseekerServicerequest's Organization into the .R struct +func (o *FieldseekerServicerequest) 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.Servicerequests = FieldseekerServicerequestSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerServicerequest's Organization into the .R struct +func (os FieldseekerServicerequestSlice) 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.Servicerequests = append(rel.R.Servicerequests, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerServicerequestJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerServicerequestJoins[Q]) aliasedAs(alias string) fieldseekerServicerequestJoins[Q] { + return buildFieldseekerServicerequestJoins[Q](buildFieldseekerServicerequestColumns(alias), j.typ) +} + +func buildFieldseekerServicerequestJoins[Q dialect.Joinable](cols fieldseekerServicerequestColumns, typ string) fieldseekerServicerequestJoins[Q] { + return fieldseekerServicerequestJoins[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/db/models/fieldseeker.speciesabundance.bob.go b/db/models/fieldseeker.speciesabundance.bob.go index 9b661af1..2147f025 100644 --- a/db/models/fieldseeker.speciesabundance.bob.go +++ b/db/models/fieldseeker.speciesabundance.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,54 +21,77 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerSpeciesabundance is an object representing the database table. type FieldseekerSpeciesabundance struct { Objectid int64 `db:"objectid,pk" ` - // Trap Data ID + // Original attribute from ArcGIS API is TRAPDATA_ID TrapdataID null.Val[uuid.UUID] `db:"trapdata_id" ` - // Species + // Original attribute from ArcGIS API is SPECIES Species null.Val[string] `db:"species" ` - // Males + // Original attribute from ArcGIS API is MALES Males null.Val[int16] `db:"males" ` - // Unknown + // Original attribute from ArcGIS API is UNKNOWN Unknown null.Val[int16] `db:"unknown" ` - // Blooded Females + // Original attribute from ArcGIS API is BLOODEDFEM Bloodedfem null.Val[int16] `db:"bloodedfem" ` - // Gravid Females + // Original attribute from ArcGIS API is GRAVIDFEM Gravidfem null.Val[int16] `db:"gravidfem" ` - // Larvae + // Original attribute from ArcGIS API is LARVAE Larvae null.Val[int16] `db:"larvae" ` - // Pools to Generate + // Original attribute from ArcGIS API is POOLSTOGEN Poolstogen null.Val[int16] `db:"poolstogen" ` - // Processed - Processed null.Val[enums.FieldseekerSpeciesabundanceNotinuitFEnum] `db:"processed" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - // Pupae + // Original attribute from ArcGIS API is PROCESSED + Processed null.Val[int16] `db:"processed" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date + LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` + // Original attribute from ArcGIS API is PUPAE Pupae null.Val[int16] `db:"pupae" ` - // Eggs + // Original attribute from ArcGIS API is EGGS Eggs null.Val[int16] `db:"eggs" ` - // Females + // Original attribute from ArcGIS API is FEMALES Females null.Val[int32] `db:"females" ` - // Total Adults - Total null.Val[int32] `db:"total" ` + // Original attribute from ArcGIS API is TOTAL + Total null.Val[int32] `db:"total" ` + // Original attribute from ArcGIS API is CreationDate Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Yearweek null.Val[int32] `db:"yearweek" ` - Globalzscore null.Val[float64] `db:"globalzscore" ` - R7score null.Val[float64] `db:"r7score" ` - R8score null.Val[float64] `db:"r8score" ` - H3R7 null.Val[string] `db:"h3r7" ` - H3R8 null.Val[string] `db:"h3r8" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is yearWeek + Yearweek null.Val[int32] `db:"yearweek" ` + // Original attribute from ArcGIS API is globalZScore + Globalzscore null.Val[float64] `db:"globalzscore" ` + // Original attribute from ArcGIS API is r7Score + R7score null.Val[float64] `db:"r7score" ` + // Original attribute from ArcGIS API is r8Score + R8score null.Val[float64] `db:"r8score" ` + // Original attribute from ArcGIS API is h3r7 + H3R7 null.Val[string] `db:"h3r7" ` + // Original attribute from ArcGIS API is h3r8 + H3R8 null.Val[string] `db:"h3r8" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerSpeciesabundanceR `db:"-" ` } // FieldseekerSpeciesabundanceSlice is an alias for a slice of pointers to FieldseekerSpeciesabundance. @@ -80,10 +104,15 @@ var FieldseekerSpeciesabundances = psql.NewTablex[*FieldseekerSpeciesabundance, // FieldseekerSpeciesabundancesQuery is a query on the speciesabundance table type FieldseekerSpeciesabundancesQuery = *psql.ViewQuery[*FieldseekerSpeciesabundance, FieldseekerSpeciesabundanceSlice] +// fieldseekerSpeciesabundanceR is where relationships are stored. +type fieldseekerSpeciesabundanceR struct { + Organization *Organization // fieldseeker.speciesabundance.speciesabundance_organization_id_fkey +} + func buildFieldseekerSpeciesabundanceColumns(alias string) fieldseekerSpeciesabundanceColumns { return fieldseekerSpeciesabundanceColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "trapdata_id", "species", "males", "unknown", "bloodedfem", "gravidfem", "larvae", "poolstogen", "processed", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "pupae", "eggs", "females", "total", "creationdate", "creator", "editdate", "editor", "yearweek", "globalzscore", "r7score", "r8score", "h3r7", "h3r8", "version", + "objectid", "trapdata_id", "species", "males", "unknown", "bloodedfem", "gravidfem", "larvae", "poolstogen", "processed", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "pupae", "eggs", "females", "total", "creationdate", "creator", "editdate", "editor", "yearweek", "globalzscore", "r7score", "r8score", "h3r7", "h3r8", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.speciesabundance"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -115,7 +144,10 @@ func buildFieldseekerSpeciesabundanceColumns(alias string) fieldseekerSpeciesabu R8score: psql.Quote(alias, "r8score"), H3R7: psql.Quote(alias, "h3r7"), H3R8: psql.Quote(alias, "h3r8"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -151,7 +183,10 @@ type fieldseekerSpeciesabundanceColumns struct { R8score psql.Expression H3R7 psql.Expression H3R8 psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerSpeciesabundanceColumns) Alias() string { @@ -166,40 +201,43 @@ func (fieldseekerSpeciesabundanceColumns) AliasedAs(alias string) fieldseekerSpe // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerSpeciesabundanceSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - TrapdataID omitnull.Val[uuid.UUID] `db:"trapdata_id" ` - Species omitnull.Val[string] `db:"species" ` - Males omitnull.Val[int16] `db:"males" ` - Unknown omitnull.Val[int16] `db:"unknown" ` - Bloodedfem omitnull.Val[int16] `db:"bloodedfem" ` - Gravidfem omitnull.Val[int16] `db:"gravidfem" ` - Larvae omitnull.Val[int16] `db:"larvae" ` - Poolstogen omitnull.Val[int16] `db:"poolstogen" ` - Processed omitnull.Val[enums.FieldseekerSpeciesabundanceNotinuitFEnum] `db:"processed" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Pupae omitnull.Val[int16] `db:"pupae" ` - Eggs omitnull.Val[int16] `db:"eggs" ` - Females omitnull.Val[int32] `db:"females" ` - Total omitnull.Val[int32] `db:"total" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Yearweek omitnull.Val[int32] `db:"yearweek" ` - Globalzscore omitnull.Val[float64] `db:"globalzscore" ` - R7score omitnull.Val[float64] `db:"r7score" ` - R8score omitnull.Val[float64] `db:"r8score" ` - H3R7 omitnull.Val[string] `db:"h3r7" ` - H3R8 omitnull.Val[string] `db:"h3r8" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + TrapdataID omitnull.Val[uuid.UUID] `db:"trapdata_id" ` + Species omitnull.Val[string] `db:"species" ` + Males omitnull.Val[int16] `db:"males" ` + Unknown omitnull.Val[int16] `db:"unknown" ` + Bloodedfem omitnull.Val[int16] `db:"bloodedfem" ` + Gravidfem omitnull.Val[int16] `db:"gravidfem" ` + Larvae omitnull.Val[int16] `db:"larvae" ` + Poolstogen omitnull.Val[int16] `db:"poolstogen" ` + Processed omitnull.Val[int16] `db:"processed" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Pupae omitnull.Val[int16] `db:"pupae" ` + Eggs omitnull.Val[int16] `db:"eggs" ` + Females omitnull.Val[int32] `db:"females" ` + Total omitnull.Val[int32] `db:"total" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Yearweek omitnull.Val[int32] `db:"yearweek" ` + Globalzscore omitnull.Val[float64] `db:"globalzscore" ` + R7score omitnull.Val[float64] `db:"r7score" ` + R8score omitnull.Val[float64] `db:"r8score" ` + H3R7 omitnull.Val[string] `db:"h3r7" ` + H3R8 omitnull.Val[string] `db:"h3r8" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerSpeciesabundanceSetter) SetColumns() []string { - vals := make([]string, 0, 30) + vals := make([]string, 0, 33) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -287,9 +325,18 @@ func (s FieldseekerSpeciesabundanceSetter) SetColumns() []string { if !s.H3R8.IsUnset() { vals = append(vals, "h3r8") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -381,9 +428,18 @@ func (s FieldseekerSpeciesabundanceSetter) Overwrite(t *FieldseekerSpeciesabunda if !s.H3R8.IsUnset() { t.H3R8 = s.H3R8.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerSpeciesabundanceSetter) Apply(q *dialect.InsertQuery) { @@ -392,7 +448,7 @@ func (s *FieldseekerSpeciesabundanceSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 30) + vals := make([]bob.Expression, 33) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -567,12 +623,30 @@ func (s *FieldseekerSpeciesabundanceSetter) Apply(q *dialect.InsertQuery) { vals[28] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[29] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[29] = psql.Arg(s.Geometry.MustGet()) } else { vals[29] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[30] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[31] = psql.Arg(s.Version.MustGet()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[32] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -582,7 +656,7 @@ func (s FieldseekerSpeciesabundanceSetter) UpdateMod() bob.Mod[*dialect.UpdateQu } func (s FieldseekerSpeciesabundanceSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 30) + exprs := make([]bob.Expression, 0, 33) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -787,6 +861,20 @@ func (s FieldseekerSpeciesabundanceSetter) Expressions(prefix ...string) []bob.E }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -794,6 +882,13 @@ func (s FieldseekerSpeciesabundanceSetter) Expressions(prefix ...string) []bob.E }}) } + 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 } @@ -861,6 +956,7 @@ func (o *FieldseekerSpeciesabundance) Update(ctx context.Context, exec bob.Execu return err } + o.R = v.R *o = *v return nil @@ -881,7 +977,7 @@ func (o *FieldseekerSpeciesabundance) Reload(ctx context.Context, exec bob.Execu if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -931,7 +1027,7 @@ func (o FieldseekerSpeciesabundanceSlice) copyMatchingRows(from ...*FieldseekerS if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -1029,6 +1125,78 @@ func (o FieldseekerSpeciesabundanceSlice) ReloadAll(ctx context.Context, exec bo return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerSpeciesabundance) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerSpeciesabundanceSlice) 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 attachFieldseekerSpeciesabundanceOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerSpeciesabundance0 *FieldseekerSpeciesabundance, organization1 *Organization) (*FieldseekerSpeciesabundance, error) { + setter := &FieldseekerSpeciesabundanceSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerSpeciesabundance0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerSpeciesabundanceOrganization0: %w", err) + } + + return fieldseekerSpeciesabundance0, nil +} + +func (fieldseekerSpeciesabundance0 *FieldseekerSpeciesabundance) 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 = attachFieldseekerSpeciesabundanceOrganization0(ctx, exec, 1, fieldseekerSpeciesabundance0, organization1) + if err != nil { + return err + } + + fieldseekerSpeciesabundance0.R.Organization = organization1 + + organization1.R.Speciesabundances = append(organization1.R.Speciesabundances, fieldseekerSpeciesabundance0) + + return nil +} + +func (fieldseekerSpeciesabundance0 *FieldseekerSpeciesabundance) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerSpeciesabundanceOrganization0(ctx, exec, 1, fieldseekerSpeciesabundance0, organization1) + if err != nil { + return err + } + + fieldseekerSpeciesabundance0.R.Organization = organization1 + + organization1.R.Speciesabundances = append(organization1.R.Speciesabundances, fieldseekerSpeciesabundance0) + + return nil +} + type fieldseekerSpeciesabundanceWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] TrapdataID psql.WhereNullMod[Q, uuid.UUID] @@ -1039,7 +1207,7 @@ type fieldseekerSpeciesabundanceWhere[Q psql.Filterable] struct { Gravidfem psql.WhereNullMod[Q, int16] Larvae psql.WhereNullMod[Q, int16] Poolstogen psql.WhereNullMod[Q, int16] - Processed psql.WhereNullMod[Q, enums.FieldseekerSpeciesabundanceNotinuitFEnum] + Processed psql.WhereNullMod[Q, int16] Globalid psql.WhereNullMod[Q, uuid.UUID] CreatedUser psql.WhereNullMod[Q, string] CreatedDate psql.WhereNullMod[Q, time.Time] @@ -1059,7 +1227,10 @@ type fieldseekerSpeciesabundanceWhere[Q psql.Filterable] struct { R8score psql.WhereNullMod[Q, float64] H3R7 psql.WhereNullMod[Q, string] H3R8 psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerSpeciesabundanceWhere[Q]) AliasedAs(alias string) fieldseekerSpeciesabundanceWhere[Q] { @@ -1077,7 +1248,7 @@ func buildFieldseekerSpeciesabundanceWhere[Q psql.Filterable](cols fieldseekerSp Gravidfem: psql.WhereNull[Q, int16](cols.Gravidfem), Larvae: psql.WhereNull[Q, int16](cols.Larvae), Poolstogen: psql.WhereNull[Q, int16](cols.Poolstogen), - Processed: psql.WhereNull[Q, enums.FieldseekerSpeciesabundanceNotinuitFEnum](cols.Processed), + Processed: psql.WhereNull[Q, int16](cols.Processed), Globalid: psql.WhereNull[Q, uuid.UUID](cols.Globalid), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), CreatedDate: psql.WhereNull[Q, time.Time](cols.CreatedDate), @@ -1097,6 +1268,154 @@ func buildFieldseekerSpeciesabundanceWhere[Q psql.Filterable](cols fieldseekerSp R8score: psql.WhereNull[Q, float64](cols.R8score), H3R7: psql.WhereNull[Q, string](cols.H3R7), H3R8: psql.WhereNull[Q, string](cols.H3R8), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerSpeciesabundance) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerSpeciesabundance cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Speciesabundances = FieldseekerSpeciesabundanceSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerSpeciesabundance has no relationship %q", name) + } +} + +type fieldseekerSpeciesabundancePreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerSpeciesabundancePreloader() fieldseekerSpeciesabundancePreloader { + return fieldseekerSpeciesabundancePreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerSpeciesabundances, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerSpeciesabundanceThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerSpeciesabundanceThenLoader[Q orm.Loadable]() fieldseekerSpeciesabundanceThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerSpeciesabundanceThenLoader[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 fieldseekerSpeciesabundance's Organization into the .R struct +func (o *FieldseekerSpeciesabundance) 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.Speciesabundances = FieldseekerSpeciesabundanceSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerSpeciesabundance's Organization into the .R struct +func (os FieldseekerSpeciesabundanceSlice) 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.Speciesabundances = append(rel.R.Speciesabundances, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerSpeciesabundanceJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerSpeciesabundanceJoins[Q]) aliasedAs(alias string) fieldseekerSpeciesabundanceJoins[Q] { + return buildFieldseekerSpeciesabundanceJoins[Q](buildFieldseekerSpeciesabundanceColumns(alias), j.typ) +} + +func buildFieldseekerSpeciesabundanceJoins[Q dialect.Joinable](cols fieldseekerSpeciesabundanceColumns, typ string) fieldseekerSpeciesabundanceJoins[Q] { + return fieldseekerSpeciesabundanceJoins[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/db/models/fieldseeker.stormdrain.bob.go b/db/models/fieldseeker.stormdrain.bob.go index c99f8b5b..5f916b08 100644 --- a/db/models/fieldseeker.stormdrain.bob.go +++ b/db/models/fieldseeker.stormdrain.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,35 +21,57 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerStormdrain is an object representing the database table. type FieldseekerStormdrain struct { - Objectid int64 `db:"objectid,pk" ` - Nexttreatmentdate null.Val[time.Time] `db:"nexttreatmentdate" ` - Lasttreatdate null.Val[time.Time] `db:"lasttreatdate" ` - Lastaction null.Val[string] `db:"lastaction" ` - Symbology null.Val[enums.FieldseekerStormdrainStormdrainsymbologyEnum] `db:"symbology" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` - LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - Laststatus null.Val[string] `db:"laststatus" ` - // Zone + Objectid int64 `db:"objectid,pk" ` + // Original attribute from ArcGIS API is NextTreatmentDate + Nexttreatmentdate null.Val[time.Time] `db:"nexttreatmentdate" ` + // Original attribute from ArcGIS API is LastTreatDate + Lasttreatdate null.Val[time.Time] `db:"lasttreatdate" ` + // Original attribute from ArcGIS API is LastAction + Lastaction null.Val[string] `db:"lastaction" ` + // Original attribute from ArcGIS API is Symbology + Symbology null.Val[string] `db:"symbology" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date + LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` + // Original attribute from ArcGIS API is LastStatus + Laststatus null.Val[string] `db:"laststatus" ` + // Original attribute from ArcGIS API is ZONE Zone null.Val[string] `db:"zone" ` - // Zone2 - Zone2 null.Val[string] `db:"zone2" ` + // Original attribute from ArcGIS API is ZONE2 + Zone2 null.Val[string] `db:"zone2" ` + // Original attribute from ArcGIS API is CreationDate Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Type + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is TYPE Type null.Val[string] `db:"type" ` - // Jurisdiction - Jurisdiction null.Val[string] `db:"jurisdiction" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is JURISDICTION + Jurisdiction null.Val[string] `db:"jurisdiction" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerStormdrainR `db:"-" ` } // FieldseekerStormdrainSlice is an alias for a slice of pointers to FieldseekerStormdrain. @@ -61,10 +84,15 @@ var FieldseekerStormdrains = psql.NewTablex[*FieldseekerStormdrain, FieldseekerS // FieldseekerStormdrainsQuery is a query on the stormdrain table type FieldseekerStormdrainsQuery = *psql.ViewQuery[*FieldseekerStormdrain, FieldseekerStormdrainSlice] +// fieldseekerStormdrainR is where relationships are stored. +type fieldseekerStormdrainR struct { + Organization *Organization // fieldseeker.stormdrain.stormdrain_organization_id_fkey +} + func buildFieldseekerStormdrainColumns(alias string) fieldseekerStormdrainColumns { return fieldseekerStormdrainColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "nexttreatmentdate", "lasttreatdate", "lastaction", "symbology", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "laststatus", "zone", "zone2", "creationdate", "creator", "editdate", "editor", "type", "jurisdiction", "version", + "objectid", "nexttreatmentdate", "lasttreatdate", "lastaction", "symbology", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "laststatus", "zone", "zone2", "creationdate", "creator", "editdate", "editor", "type", "jurisdiction", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.stormdrain"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -86,7 +114,10 @@ func buildFieldseekerStormdrainColumns(alias string) fieldseekerStormdrainColumn Editor: psql.Quote(alias, "editor"), Type: psql.Quote(alias, "type"), Jurisdiction: psql.Quote(alias, "jurisdiction"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -112,7 +143,10 @@ type fieldseekerStormdrainColumns struct { Editor psql.Expression Type psql.Expression Jurisdiction psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerStormdrainColumns) Alias() string { @@ -127,30 +161,33 @@ func (fieldseekerStormdrainColumns) AliasedAs(alias string) fieldseekerStormdrai // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerStormdrainSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Nexttreatmentdate omitnull.Val[time.Time] `db:"nexttreatmentdate" ` - Lasttreatdate omitnull.Val[time.Time] `db:"lasttreatdate" ` - Lastaction omitnull.Val[string] `db:"lastaction" ` - Symbology omitnull.Val[enums.FieldseekerStormdrainStormdrainsymbologyEnum] `db:"symbology" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Laststatus omitnull.Val[string] `db:"laststatus" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Type omitnull.Val[string] `db:"type" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Nexttreatmentdate omitnull.Val[time.Time] `db:"nexttreatmentdate" ` + Lasttreatdate omitnull.Val[time.Time] `db:"lasttreatdate" ` + Lastaction omitnull.Val[string] `db:"lastaction" ` + Symbology omitnull.Val[string] `db:"symbology" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Laststatus omitnull.Val[string] `db:"laststatus" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Type omitnull.Val[string] `db:"type" ` + Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerStormdrainSetter) SetColumns() []string { - vals := make([]string, 0, 20) + vals := make([]string, 0, 23) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -208,9 +245,18 @@ func (s FieldseekerStormdrainSetter) SetColumns() []string { if !s.Jurisdiction.IsUnset() { vals = append(vals, "jurisdiction") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -272,9 +318,18 @@ func (s FieldseekerStormdrainSetter) Overwrite(t *FieldseekerStormdrain) { if !s.Jurisdiction.IsUnset() { t.Jurisdiction = s.Jurisdiction.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerStormdrainSetter) Apply(q *dialect.InsertQuery) { @@ -283,7 +338,7 @@ func (s *FieldseekerStormdrainSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 20) + vals := make([]bob.Expression, 23) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -398,12 +453,30 @@ func (s *FieldseekerStormdrainSetter) Apply(q *dialect.InsertQuery) { vals[18] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[19] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[19] = psql.Arg(s.Geometry.MustGet()) } else { vals[19] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[20] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[21] = psql.Arg(s.Version.MustGet()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[22] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[22] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -413,7 +486,7 @@ func (s FieldseekerStormdrainSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s FieldseekerStormdrainSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 20) + exprs := make([]bob.Expression, 0, 23) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -548,6 +621,20 @@ func (s FieldseekerStormdrainSetter) Expressions(prefix ...string) []bob.Express }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -555,6 +642,13 @@ func (s FieldseekerStormdrainSetter) Expressions(prefix ...string) []bob.Express }}) } + 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 } @@ -622,6 +716,7 @@ func (o *FieldseekerStormdrain) Update(ctx context.Context, exec bob.Executor, s return err } + o.R = v.R *o = *v return nil @@ -642,7 +737,7 @@ func (o *FieldseekerStormdrain) Reload(ctx context.Context, exec bob.Executor) e if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -692,7 +787,7 @@ func (o FieldseekerStormdrainSlice) copyMatchingRows(from ...*FieldseekerStormdr if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -790,12 +885,84 @@ func (o FieldseekerStormdrainSlice) ReloadAll(ctx context.Context, exec bob.Exec return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerStormdrain) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerStormdrainSlice) 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 attachFieldseekerStormdrainOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerStormdrain0 *FieldseekerStormdrain, organization1 *Organization) (*FieldseekerStormdrain, error) { + setter := &FieldseekerStormdrainSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerStormdrain0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerStormdrainOrganization0: %w", err) + } + + return fieldseekerStormdrain0, nil +} + +func (fieldseekerStormdrain0 *FieldseekerStormdrain) 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 = attachFieldseekerStormdrainOrganization0(ctx, exec, 1, fieldseekerStormdrain0, organization1) + if err != nil { + return err + } + + fieldseekerStormdrain0.R.Organization = organization1 + + organization1.R.Stormdrains = append(organization1.R.Stormdrains, fieldseekerStormdrain0) + + return nil +} + +func (fieldseekerStormdrain0 *FieldseekerStormdrain) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerStormdrainOrganization0(ctx, exec, 1, fieldseekerStormdrain0, organization1) + if err != nil { + return err + } + + fieldseekerStormdrain0.R.Organization = organization1 + + organization1.R.Stormdrains = append(organization1.R.Stormdrains, fieldseekerStormdrain0) + + return nil +} + type fieldseekerStormdrainWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] Nexttreatmentdate psql.WhereNullMod[Q, time.Time] Lasttreatdate psql.WhereNullMod[Q, time.Time] Lastaction psql.WhereNullMod[Q, string] - Symbology psql.WhereNullMod[Q, enums.FieldseekerStormdrainStormdrainsymbologyEnum] + Symbology psql.WhereNullMod[Q, string] Globalid psql.WhereNullMod[Q, uuid.UUID] CreatedUser psql.WhereNullMod[Q, string] CreatedDate psql.WhereNullMod[Q, time.Time] @@ -810,7 +977,10 @@ type fieldseekerStormdrainWhere[Q psql.Filterable] struct { Editor psql.WhereNullMod[Q, string] Type psql.WhereNullMod[Q, string] Jurisdiction psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerStormdrainWhere[Q]) AliasedAs(alias string) fieldseekerStormdrainWhere[Q] { @@ -823,7 +993,7 @@ func buildFieldseekerStormdrainWhere[Q psql.Filterable](cols fieldseekerStormdra Nexttreatmentdate: psql.WhereNull[Q, time.Time](cols.Nexttreatmentdate), Lasttreatdate: psql.WhereNull[Q, time.Time](cols.Lasttreatdate), Lastaction: psql.WhereNull[Q, string](cols.Lastaction), - Symbology: psql.WhereNull[Q, enums.FieldseekerStormdrainStormdrainsymbologyEnum](cols.Symbology), + Symbology: psql.WhereNull[Q, string](cols.Symbology), Globalid: psql.WhereNull[Q, uuid.UUID](cols.Globalid), CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), CreatedDate: psql.WhereNull[Q, time.Time](cols.CreatedDate), @@ -838,6 +1008,154 @@ func buildFieldseekerStormdrainWhere[Q psql.Filterable](cols fieldseekerStormdra Editor: psql.WhereNull[Q, string](cols.Editor), Type: psql.WhereNull[Q, string](cols.Type), Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerStormdrain) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerStormdrain cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Stormdrains = FieldseekerStormdrainSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerStormdrain has no relationship %q", name) + } +} + +type fieldseekerStormdrainPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerStormdrainPreloader() fieldseekerStormdrainPreloader { + return fieldseekerStormdrainPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerStormdrains, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerStormdrainThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerStormdrainThenLoader[Q orm.Loadable]() fieldseekerStormdrainThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerStormdrainThenLoader[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 fieldseekerStormdrain's Organization into the .R struct +func (o *FieldseekerStormdrain) 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.Stormdrains = FieldseekerStormdrainSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerStormdrain's Organization into the .R struct +func (os FieldseekerStormdrainSlice) 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.Stormdrains = append(rel.R.Stormdrains, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerStormdrainJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerStormdrainJoins[Q]) aliasedAs(alias string) fieldseekerStormdrainJoins[Q] { + return buildFieldseekerStormdrainJoins[Q](buildFieldseekerStormdrainColumns(alias), j.typ) +} + +func buildFieldseekerStormdrainJoins[Q dialect.Joinable](cols fieldseekerStormdrainColumns, typ string) fieldseekerStormdrainJoins[Q] { + return fieldseekerStormdrainJoins[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/db/models/fieldseeker.timecard.bob.go b/db/models/fieldseeker.timecard.bob.go index d05ca8e0..6bb2ca91 100644 --- a/db/models/fieldseeker.timecard.bob.go +++ b/db/models/fieldseeker.timecard.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,49 +21,75 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerTimecard is an object representing the database table. type FieldseekerTimecard struct { Objectid int64 `db:"objectid,pk" ` - // Activity - Activity null.Val[enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu] `db:"activity" ` - // Start + // Original attribute from ArcGIS API is ACTIVITY + Activity null.Val[string] `db:"activity" ` + // Original attribute from ArcGIS API is STARTDATETIME Startdatetime null.Val[time.Time] `db:"startdatetime" ` - // Finish + // Original attribute from ArcGIS API is ENDDATETIME Enddatetime null.Val[time.Time] `db:"enddatetime" ` - // Comments - Comments null.Val[string] `db:"comments" ` + // Original attribute from ArcGIS API is COMMENTS + Comments null.Val[string] `db:"comments" ` + // Original attribute from ArcGIS API is EXTERNALID Externalid null.Val[string] `db:"externalid" ` - // Equipment Type - Equiptype null.Val[enums.FieldseekerTimecardTimecardequipmenttypeEnum] `db:"equiptype" ` - // Location Name + // Original attribute from ArcGIS API is EQUIPTYPE + Equiptype null.Val[string] `db:"equiptype" ` + // Original attribute from ArcGIS API is LOCATIONNAME Locationname null.Val[string] `db:"locationname" ` - // Zone + // Original attribute from ArcGIS API is ZONE Zone null.Val[string] `db:"zone" ` - // Zone2 - Zone2 null.Val[string] `db:"zone2" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is ZONE2 + Zone2 null.Val[string] `db:"zone2" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - Linelocid null.Val[uuid.UUID] `db:"linelocid" ` - Pointlocid null.Val[uuid.UUID] `db:"pointlocid" ` - Polygonlocid null.Val[uuid.UUID] `db:"polygonlocid" ` - Lclocid null.Val[uuid.UUID] `db:"lclocid" ` - Samplelocid null.Val[uuid.UUID] `db:"samplelocid" ` - Srid null.Val[uuid.UUID] `db:"srid" ` - Traplocid null.Val[uuid.UUID] `db:"traplocid" ` - // Field Tech - Fieldtech null.Val[string] `db:"fieldtech" ` + // Original attribute from ArcGIS API is LINELOCID + Linelocid null.Val[uuid.UUID] `db:"linelocid" ` + // Original attribute from ArcGIS API is POINTLOCID + Pointlocid null.Val[uuid.UUID] `db:"pointlocid" ` + // Original attribute from ArcGIS API is POLYGONLOCID + Polygonlocid null.Val[uuid.UUID] `db:"polygonlocid" ` + // Original attribute from ArcGIS API is LCLOCID + Lclocid null.Val[uuid.UUID] `db:"lclocid" ` + // Original attribute from ArcGIS API is SAMPLELOCID + Samplelocid null.Val[uuid.UUID] `db:"samplelocid" ` + // Original attribute from ArcGIS API is SRID + Srid null.Val[uuid.UUID] `db:"srid" ` + // Original attribute from ArcGIS API is TRAPLOCID + Traplocid null.Val[uuid.UUID] `db:"traplocid" ` + // Original attribute from ArcGIS API is FIELDTECH + Fieldtech null.Val[string] `db:"fieldtech" ` + // Original attribute from ArcGIS API is CreationDate Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Rodentlocid null.Val[uuid.UUID] `db:"rodentlocid" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is RODENTLOCID + Rodentlocid null.Val[uuid.UUID] `db:"rodentlocid" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerTimecardR `db:"-" ` } // FieldseekerTimecardSlice is an alias for a slice of pointers to FieldseekerTimecard. @@ -75,10 +102,15 @@ var FieldseekerTimecards = psql.NewTablex[*FieldseekerTimecard, FieldseekerTimec // FieldseekerTimecardsQuery is a query on the timecard table type FieldseekerTimecardsQuery = *psql.ViewQuery[*FieldseekerTimecard, FieldseekerTimecardSlice] +// fieldseekerTimecardR is where relationships are stored. +type fieldseekerTimecardR struct { + Organization *Organization // fieldseeker.timecard.timecard_organization_id_fkey +} + func buildFieldseekerTimecardColumns(alias string) fieldseekerTimecardColumns { return fieldseekerTimecardColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "activity", "startdatetime", "enddatetime", "comments", "externalid", "equiptype", "locationname", "zone", "zone2", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "linelocid", "pointlocid", "polygonlocid", "lclocid", "samplelocid", "srid", "traplocid", "fieldtech", "creationdate", "creator", "editdate", "editor", "rodentlocid", "version", + "objectid", "activity", "startdatetime", "enddatetime", "comments", "externalid", "equiptype", "locationname", "zone", "zone2", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "linelocid", "pointlocid", "polygonlocid", "lclocid", "samplelocid", "srid", "traplocid", "fieldtech", "creationdate", "creator", "editdate", "editor", "rodentlocid", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.timecard"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -109,7 +141,10 @@ func buildFieldseekerTimecardColumns(alias string) fieldseekerTimecardColumns { Editdate: psql.Quote(alias, "editdate"), Editor: psql.Quote(alias, "editor"), Rodentlocid: psql.Quote(alias, "rodentlocid"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -144,7 +179,10 @@ type fieldseekerTimecardColumns struct { Editdate psql.Expression Editor psql.Expression Rodentlocid psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerTimecardColumns) Alias() string { @@ -159,39 +197,42 @@ func (fieldseekerTimecardColumns) AliasedAs(alias string) fieldseekerTimecardCol // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerTimecardSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Activity omitnull.Val[enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu] `db:"activity" ` - Startdatetime omitnull.Val[time.Time] `db:"startdatetime" ` - Enddatetime omitnull.Val[time.Time] `db:"enddatetime" ` - Comments omitnull.Val[string] `db:"comments" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Equiptype omitnull.Val[enums.FieldseekerTimecardTimecardequipmenttypeEnum] `db:"equiptype" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Linelocid omitnull.Val[uuid.UUID] `db:"linelocid" ` - Pointlocid omitnull.Val[uuid.UUID] `db:"pointlocid" ` - Polygonlocid omitnull.Val[uuid.UUID] `db:"polygonlocid" ` - Lclocid omitnull.Val[uuid.UUID] `db:"lclocid" ` - Samplelocid omitnull.Val[uuid.UUID] `db:"samplelocid" ` - Srid omitnull.Val[uuid.UUID] `db:"srid" ` - Traplocid omitnull.Val[uuid.UUID] `db:"traplocid" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Rodentlocid omitnull.Val[uuid.UUID] `db:"rodentlocid" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Activity omitnull.Val[string] `db:"activity" ` + Startdatetime omitnull.Val[time.Time] `db:"startdatetime" ` + Enddatetime omitnull.Val[time.Time] `db:"enddatetime" ` + Comments omitnull.Val[string] `db:"comments" ` + Externalid omitnull.Val[string] `db:"externalid" ` + Equiptype omitnull.Val[string] `db:"equiptype" ` + Locationname omitnull.Val[string] `db:"locationname" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Linelocid omitnull.Val[uuid.UUID] `db:"linelocid" ` + Pointlocid omitnull.Val[uuid.UUID] `db:"pointlocid" ` + Polygonlocid omitnull.Val[uuid.UUID] `db:"polygonlocid" ` + Lclocid omitnull.Val[uuid.UUID] `db:"lclocid" ` + Samplelocid omitnull.Val[uuid.UUID] `db:"samplelocid" ` + Srid omitnull.Val[uuid.UUID] `db:"srid" ` + Traplocid omitnull.Val[uuid.UUID] `db:"traplocid" ` + Fieldtech omitnull.Val[string] `db:"fieldtech" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Rodentlocid omitnull.Val[uuid.UUID] `db:"rodentlocid" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerTimecardSetter) SetColumns() []string { - vals := make([]string, 0, 29) + vals := make([]string, 0, 32) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -276,9 +317,18 @@ func (s FieldseekerTimecardSetter) SetColumns() []string { if !s.Rodentlocid.IsUnset() { vals = append(vals, "rodentlocid") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -367,9 +417,18 @@ func (s FieldseekerTimecardSetter) Overwrite(t *FieldseekerTimecard) { if !s.Rodentlocid.IsUnset() { t.Rodentlocid = s.Rodentlocid.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerTimecardSetter) Apply(q *dialect.InsertQuery) { @@ -378,7 +437,7 @@ func (s *FieldseekerTimecardSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 29) + vals := make([]bob.Expression, 32) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -547,12 +606,30 @@ func (s *FieldseekerTimecardSetter) Apply(q *dialect.InsertQuery) { vals[27] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[28] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[28] = psql.Arg(s.Geometry.MustGet()) } else { vals[28] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[29] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[29] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[30] = psql.Arg(s.Version.MustGet()) + } else { + vals[30] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[31] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -562,7 +639,7 @@ func (s FieldseekerTimecardSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s FieldseekerTimecardSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 29) + exprs := make([]bob.Expression, 0, 32) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -760,6 +837,20 @@ func (s FieldseekerTimecardSetter) Expressions(prefix ...string) []bob.Expressio }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -767,6 +858,13 @@ func (s FieldseekerTimecardSetter) Expressions(prefix ...string) []bob.Expressio }}) } + 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 } @@ -834,6 +932,7 @@ func (o *FieldseekerTimecard) Update(ctx context.Context, exec bob.Executor, s * return err } + o.R = v.R *o = *v return nil @@ -854,7 +953,7 @@ func (o *FieldseekerTimecard) Reload(ctx context.Context, exec bob.Executor) err if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -904,7 +1003,7 @@ func (o FieldseekerTimecardSlice) copyMatchingRows(from ...*FieldseekerTimecard) if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -1002,14 +1101,86 @@ func (o FieldseekerTimecardSlice) ReloadAll(ctx context.Context, exec bob.Execut return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerTimecard) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerTimecardSlice) 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 attachFieldseekerTimecardOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerTimecard0 *FieldseekerTimecard, organization1 *Organization) (*FieldseekerTimecard, error) { + setter := &FieldseekerTimecardSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerTimecard0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerTimecardOrganization0: %w", err) + } + + return fieldseekerTimecard0, nil +} + +func (fieldseekerTimecard0 *FieldseekerTimecard) 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 = attachFieldseekerTimecardOrganization0(ctx, exec, 1, fieldseekerTimecard0, organization1) + if err != nil { + return err + } + + fieldseekerTimecard0.R.Organization = organization1 + + organization1.R.Timecards = append(organization1.R.Timecards, fieldseekerTimecard0) + + return nil +} + +func (fieldseekerTimecard0 *FieldseekerTimecard) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerTimecardOrganization0(ctx, exec, 1, fieldseekerTimecard0, organization1) + if err != nil { + return err + } + + fieldseekerTimecard0.R.Organization = organization1 + + organization1.R.Timecards = append(organization1.R.Timecards, fieldseekerTimecard0) + + return nil +} + type fieldseekerTimecardWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] - Activity psql.WhereNullMod[Q, enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu] + Activity psql.WhereNullMod[Q, string] Startdatetime psql.WhereNullMod[Q, time.Time] Enddatetime psql.WhereNullMod[Q, time.Time] Comments psql.WhereNullMod[Q, string] Externalid psql.WhereNullMod[Q, string] - Equiptype psql.WhereNullMod[Q, enums.FieldseekerTimecardTimecardequipmenttypeEnum] + Equiptype psql.WhereNullMod[Q, string] Locationname psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] @@ -1031,7 +1202,10 @@ type fieldseekerTimecardWhere[Q psql.Filterable] struct { Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] Rodentlocid psql.WhereNullMod[Q, uuid.UUID] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerTimecardWhere[Q]) AliasedAs(alias string) fieldseekerTimecardWhere[Q] { @@ -1041,12 +1215,12 @@ func (fieldseekerTimecardWhere[Q]) AliasedAs(alias string) fieldseekerTimecardWh func buildFieldseekerTimecardWhere[Q psql.Filterable](cols fieldseekerTimecardColumns) fieldseekerTimecardWhere[Q] { return fieldseekerTimecardWhere[Q]{ Objectid: psql.Where[Q, int64](cols.Objectid), - Activity: psql.WhereNull[Q, enums.FieldseekerTimecardTimecardActivity451e67260c084304a35457170dc13366Enu](cols.Activity), + Activity: psql.WhereNull[Q, string](cols.Activity), Startdatetime: psql.WhereNull[Q, time.Time](cols.Startdatetime), Enddatetime: psql.WhereNull[Q, time.Time](cols.Enddatetime), Comments: psql.WhereNull[Q, string](cols.Comments), Externalid: psql.WhereNull[Q, string](cols.Externalid), - Equiptype: psql.WhereNull[Q, enums.FieldseekerTimecardTimecardequipmenttypeEnum](cols.Equiptype), + Equiptype: psql.WhereNull[Q, string](cols.Equiptype), Locationname: psql.WhereNull[Q, string](cols.Locationname), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), @@ -1068,6 +1242,154 @@ func buildFieldseekerTimecardWhere[Q psql.Filterable](cols fieldseekerTimecardCo Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), Rodentlocid: psql.WhereNull[Q, uuid.UUID](cols.Rodentlocid), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerTimecard) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerTimecard cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Timecards = FieldseekerTimecardSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerTimecard has no relationship %q", name) + } +} + +type fieldseekerTimecardPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerTimecardPreloader() fieldseekerTimecardPreloader { + return fieldseekerTimecardPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerTimecards, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerTimecardThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerTimecardThenLoader[Q orm.Loadable]() fieldseekerTimecardThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerTimecardThenLoader[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 fieldseekerTimecard's Organization into the .R struct +func (o *FieldseekerTimecard) 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.Timecards = FieldseekerTimecardSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerTimecard's Organization into the .R struct +func (os FieldseekerTimecardSlice) 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.Timecards = append(rel.R.Timecards, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerTimecardJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerTimecardJoins[Q]) aliasedAs(alias string) fieldseekerTimecardJoins[Q] { + return buildFieldseekerTimecardJoins[Q](buildFieldseekerTimecardColumns(alias), j.typ) +} + +func buildFieldseekerTimecardJoins[Q dialect.Joinable](cols fieldseekerTimecardColumns, typ string) fieldseekerTimecardJoins[Q] { + return fieldseekerTimecardJoins[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/db/models/fieldseeker.trapdata.bob.go b/db/models/fieldseeker.trapdata.bob.go index 7c36a2f7..542730e7 100644 --- a/db/models/fieldseeker.trapdata.bob.go +++ b/db/models/fieldseeker.trapdata.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,76 +21,103 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerTrapdatum is an object representing the database table. type FieldseekerTrapdatum struct { Objectid int64 `db:"objectid,pk" ` - // Trap Type - Traptype null.Val[enums.FieldseekerTrapdataMosquitotraptypeEnum] `db:"traptype" ` - // Trap Activity Type - Trapactivitytype null.Val[enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum] `db:"trapactivitytype" ` - // Start + // Original attribute from ArcGIS API is TRAPTYPE + Traptype null.Val[string] `db:"traptype" ` + // Original attribute from ArcGIS API is TRAPACTIVITYTYPE + Trapactivitytype null.Val[string] `db:"trapactivitytype" ` + // Original attribute from ArcGIS API is STARTDATETIME Startdatetime null.Val[time.Time] `db:"startdatetime" ` - // Finish + // Original attribute from ArcGIS API is ENDDATETIME Enddatetime null.Val[time.Time] `db:"enddatetime" ` - // Comments + // Original attribute from ArcGIS API is COMMENTS Comments null.Val[string] `db:"comments" ` - // Tech Identifying Species in Lab + // Original attribute from ArcGIS API is IDBYTECH Idbytech null.Val[string] `db:"idbytech" ` - // Tech Sorting Trap Results in Lab + // Original attribute from ArcGIS API is SORTBYTECH Sortbytech null.Val[string] `db:"sortbytech" ` - // Processed - Processed null.Val[enums.FieldseekerTrapdataNotinuitFEnum] `db:"processed" ` - // Site Conditions - Sitecond null.Val[enums.FieldseekerTrapdataMosquitositeconditionEnum] `db:"sitecond" ` - // Location Name + // Original attribute from ArcGIS API is PROCESSED + Processed null.Val[int16] `db:"processed" ` + // Original attribute from ArcGIS API is SITECOND + Sitecond null.Val[string] `db:"sitecond" ` + // Original attribute from ArcGIS API is LOCATIONNAME Locationname null.Val[string] `db:"locationname" ` - // RecordStatus + // Original attribute from ArcGIS API is RECORDSTATUS Recordstatus null.Val[int16] `db:"recordstatus" ` - // Reviewed - Reviewed null.Val[enums.FieldseekerTrapdataNotinuitFEnum] `db:"reviewed" ` - // Reviewed By + // Original attribute from ArcGIS API is REVIEWED + Reviewed null.Val[int16] `db:"reviewed" ` + // Original attribute from ArcGIS API is REVIEWEDBY Reviewedby null.Val[string] `db:"reviewedby" ` - // Reviewed Date + // Original attribute from ArcGIS API is REVIEWEDDATE Revieweddate null.Val[time.Time] `db:"revieweddate" ` - // Trap Condition - Trapcondition null.Val[enums.FieldseekerTrapdataMosquitotrapconditionEnum] `db:"trapcondition" ` - // Trap Nights + // Original attribute from ArcGIS API is TRAPCONDITION + Trapcondition null.Val[string] `db:"trapcondition" ` + // Original attribute from ArcGIS API is TRAPNIGHTS Trapnights null.Val[int16] `db:"trapnights" ` - // Zone + // Original attribute from ArcGIS API is ZONE Zone null.Val[string] `db:"zone" ` - // Zone2 - Zone2 null.Val[string] `db:"zone2" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is ZONE2 + Zone2 null.Val[string] `db:"zone2" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - Srid null.Val[uuid.UUID] `db:"srid" ` - // Field Tech + // Original attribute from ArcGIS API is SRID + Srid null.Val[uuid.UUID] `db:"srid" ` + // Original attribute from ArcGIS API is FIELDTECH Fieldtech null.Val[string] `db:"fieldtech" ` - // Gateway Sync - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - LocID null.Val[uuid.UUID] `db:"loc_id" ` - // Voltage - Voltage null.Val[float64] `db:"voltage" ` - Winddir null.Val[enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166] `db:"winddir" ` - Windspeed null.Val[float64] `db:"windspeed" ` - Avetemp null.Val[float64] `db:"avetemp" ` - Raingauge null.Val[float64] `db:"raingauge" ` - // Landing Rate - LR null.Val[int16] `db:"lr" ` - Field null.Val[int32] `db:"field" ` - Vectorsurvtrapdataid null.Val[string] `db:"vectorsurvtrapdataid" ` - Vectorsurvtraplocationid null.Val[string] `db:"vectorsurvtraplocationid" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Lure null.Val[enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu] `db:"lure" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is GATEWAYSYNC + Gatewaysync null.Val[int16] `db:"gatewaysync" ` + // Original attribute from ArcGIS API is LOC_ID + LocID null.Val[uuid.UUID] `db:"loc_id" ` + // Original attribute from ArcGIS API is VOLTAGE + Voltage null.Val[float64] `db:"voltage" ` + // Original attribute from ArcGIS API is WINDDIR + Winddir null.Val[string] `db:"winddir" ` + // Original attribute from ArcGIS API is WINDSPEED + Windspeed null.Val[float64] `db:"windspeed" ` + // Original attribute from ArcGIS API is AVETEMP + Avetemp null.Val[float64] `db:"avetemp" ` + // Original attribute from ArcGIS API is RAINGAUGE + Raingauge null.Val[float64] `db:"raingauge" ` + // Original attribute from ArcGIS API is LR + LR null.Val[int16] `db:"lr" ` + // Original attribute from ArcGIS API is Field + Field null.Val[int32] `db:"field" ` + // Original attribute from ArcGIS API is VECTORSURVTRAPDATAID + Vectorsurvtrapdataid null.Val[string] `db:"vectorsurvtrapdataid" ` + // Original attribute from ArcGIS API is VECTORSURVTRAPLOCATIONID + Vectorsurvtraplocationid null.Val[string] `db:"vectorsurvtraplocationid" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is Lure + Lure null.Val[string] `db:"lure" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerTrapdatumR `db:"-" ` } // FieldseekerTrapdatumSlice is an alias for a slice of pointers to FieldseekerTrapdatum. @@ -102,10 +130,15 @@ var FieldseekerTrapdata = psql.NewTablex[*FieldseekerTrapdatum, FieldseekerTrapd // FieldseekerTrapdataQuery is a query on the trapdata table type FieldseekerTrapdataQuery = *psql.ViewQuery[*FieldseekerTrapdatum, FieldseekerTrapdatumSlice] +// fieldseekerTrapdatumR is where relationships are stored. +type fieldseekerTrapdatumR struct { + Organization *Organization // fieldseeker.trapdata.trapdata_organization_id_fkey +} + func buildFieldseekerTrapdatumColumns(alias string) fieldseekerTrapdatumColumns { return fieldseekerTrapdatumColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "traptype", "trapactivitytype", "startdatetime", "enddatetime", "comments", "idbytech", "sortbytech", "processed", "sitecond", "locationname", "recordstatus", "reviewed", "reviewedby", "revieweddate", "trapcondition", "trapnights", "zone", "zone2", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "srid", "fieldtech", "gatewaysync", "loc_id", "voltage", "winddir", "windspeed", "avetemp", "raingauge", "lr", "field", "vectorsurvtrapdataid", "vectorsurvtraplocationid", "creationdate", "creator", "editdate", "editor", "lure", "version", + "objectid", "traptype", "trapactivitytype", "startdatetime", "enddatetime", "comments", "idbytech", "sortbytech", "processed", "sitecond", "locationname", "recordstatus", "reviewed", "reviewedby", "revieweddate", "trapcondition", "trapnights", "zone", "zone2", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "srid", "fieldtech", "gatewaysync", "loc_id", "voltage", "winddir", "windspeed", "avetemp", "raingauge", "lr", "field", "vectorsurvtrapdataid", "vectorsurvtraplocationid", "creationdate", "creator", "editdate", "editor", "lure", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.trapdata"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -150,7 +183,10 @@ func buildFieldseekerTrapdatumColumns(alias string) fieldseekerTrapdatumColumns Editdate: psql.Quote(alias, "editdate"), Editor: psql.Quote(alias, "editor"), Lure: psql.Quote(alias, "lure"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -199,7 +235,10 @@ type fieldseekerTrapdatumColumns struct { Editdate psql.Expression Editor psql.Expression Lure psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerTrapdatumColumns) Alias() string { @@ -214,53 +253,56 @@ func (fieldseekerTrapdatumColumns) AliasedAs(alias string) fieldseekerTrapdatumC // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerTrapdatumSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Traptype omitnull.Val[enums.FieldseekerTrapdataMosquitotraptypeEnum] `db:"traptype" ` - Trapactivitytype omitnull.Val[enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum] `db:"trapactivitytype" ` - Startdatetime omitnull.Val[time.Time] `db:"startdatetime" ` - Enddatetime omitnull.Val[time.Time] `db:"enddatetime" ` - Comments omitnull.Val[string] `db:"comments" ` - Idbytech omitnull.Val[string] `db:"idbytech" ` - Sortbytech omitnull.Val[string] `db:"sortbytech" ` - Processed omitnull.Val[enums.FieldseekerTrapdataNotinuitFEnum] `db:"processed" ` - Sitecond omitnull.Val[enums.FieldseekerTrapdataMosquitositeconditionEnum] `db:"sitecond" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Reviewed omitnull.Val[enums.FieldseekerTrapdataNotinuitFEnum] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[time.Time] `db:"revieweddate" ` - Trapcondition omitnull.Val[enums.FieldseekerTrapdataMosquitotrapconditionEnum] `db:"trapcondition" ` - Trapnights omitnull.Val[int16] `db:"trapnights" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Srid omitnull.Val[uuid.UUID] `db:"srid" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - LocID omitnull.Val[uuid.UUID] `db:"loc_id" ` - Voltage omitnull.Val[float64] `db:"voltage" ` - Winddir omitnull.Val[enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166] `db:"winddir" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - LR omitnull.Val[int16] `db:"lr" ` - Field omitnull.Val[int32] `db:"field" ` - Vectorsurvtrapdataid omitnull.Val[string] `db:"vectorsurvtrapdataid" ` - Vectorsurvtraplocationid omitnull.Val[string] `db:"vectorsurvtraplocationid" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Lure omitnull.Val[enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu] `db:"lure" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Traptype omitnull.Val[string] `db:"traptype" ` + Trapactivitytype omitnull.Val[string] `db:"trapactivitytype" ` + Startdatetime omitnull.Val[time.Time] `db:"startdatetime" ` + Enddatetime omitnull.Val[time.Time] `db:"enddatetime" ` + Comments omitnull.Val[string] `db:"comments" ` + Idbytech omitnull.Val[string] `db:"idbytech" ` + Sortbytech omitnull.Val[string] `db:"sortbytech" ` + Processed omitnull.Val[int16] `db:"processed" ` + Sitecond omitnull.Val[string] `db:"sitecond" ` + Locationname omitnull.Val[string] `db:"locationname" ` + Recordstatus omitnull.Val[int16] `db:"recordstatus" ` + Reviewed omitnull.Val[int16] `db:"reviewed" ` + Reviewedby omitnull.Val[string] `db:"reviewedby" ` + Revieweddate omitnull.Val[time.Time] `db:"revieweddate" ` + Trapcondition omitnull.Val[string] `db:"trapcondition" ` + Trapnights omitnull.Val[int16] `db:"trapnights" ` + Zone omitnull.Val[string] `db:"zone" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Srid omitnull.Val[uuid.UUID] `db:"srid" ` + Fieldtech omitnull.Val[string] `db:"fieldtech" ` + Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` + LocID omitnull.Val[uuid.UUID] `db:"loc_id" ` + Voltage omitnull.Val[float64] `db:"voltage" ` + Winddir omitnull.Val[string] `db:"winddir" ` + Windspeed omitnull.Val[float64] `db:"windspeed" ` + Avetemp omitnull.Val[float64] `db:"avetemp" ` + Raingauge omitnull.Val[float64] `db:"raingauge" ` + LR omitnull.Val[int16] `db:"lr" ` + Field omitnull.Val[int32] `db:"field" ` + Vectorsurvtrapdataid omitnull.Val[string] `db:"vectorsurvtrapdataid" ` + Vectorsurvtraplocationid omitnull.Val[string] `db:"vectorsurvtraplocationid" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Lure omitnull.Val[string] `db:"lure" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerTrapdatumSetter) SetColumns() []string { - vals := make([]string, 0, 43) + vals := make([]string, 0, 46) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -387,9 +429,18 @@ func (s FieldseekerTrapdatumSetter) SetColumns() []string { if !s.Lure.IsUnset() { vals = append(vals, "lure") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -520,9 +571,18 @@ func (s FieldseekerTrapdatumSetter) Overwrite(t *FieldseekerTrapdatum) { if !s.Lure.IsUnset() { t.Lure = s.Lure.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerTrapdatumSetter) Apply(q *dialect.InsertQuery) { @@ -531,7 +591,7 @@ func (s *FieldseekerTrapdatumSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 43) + vals := make([]bob.Expression, 46) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -784,12 +844,30 @@ func (s *FieldseekerTrapdatumSetter) Apply(q *dialect.InsertQuery) { vals[41] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[42] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[42] = psql.Arg(s.Geometry.MustGet()) } else { vals[42] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[43] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[43] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[44] = psql.Arg(s.Version.MustGet()) + } else { + vals[44] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[45] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[45] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -799,7 +877,7 @@ func (s FieldseekerTrapdatumSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s FieldseekerTrapdatumSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 43) + exprs := make([]bob.Expression, 0, 46) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -1095,6 +1173,20 @@ func (s FieldseekerTrapdatumSetter) Expressions(prefix ...string) []bob.Expressi }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -1102,6 +1194,13 @@ func (s FieldseekerTrapdatumSetter) Expressions(prefix ...string) []bob.Expressi }}) } + 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 } @@ -1169,6 +1268,7 @@ func (o *FieldseekerTrapdatum) Update(ctx context.Context, exec bob.Executor, s return err } + o.R = v.R *o = *v return nil @@ -1189,7 +1289,7 @@ func (o *FieldseekerTrapdatum) Reload(ctx context.Context, exec bob.Executor) er if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -1239,7 +1339,7 @@ func (o FieldseekerTrapdatumSlice) copyMatchingRows(from ...*FieldseekerTrapdatu if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -1337,23 +1437,95 @@ func (o FieldseekerTrapdatumSlice) ReloadAll(ctx context.Context, exec bob.Execu return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerTrapdatum) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerTrapdatumSlice) 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 attachFieldseekerTrapdatumOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerTrapdatum0 *FieldseekerTrapdatum, organization1 *Organization) (*FieldseekerTrapdatum, error) { + setter := &FieldseekerTrapdatumSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerTrapdatum0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerTrapdatumOrganization0: %w", err) + } + + return fieldseekerTrapdatum0, nil +} + +func (fieldseekerTrapdatum0 *FieldseekerTrapdatum) 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 = attachFieldseekerTrapdatumOrganization0(ctx, exec, 1, fieldseekerTrapdatum0, organization1) + if err != nil { + return err + } + + fieldseekerTrapdatum0.R.Organization = organization1 + + organization1.R.Trapdata = append(organization1.R.Trapdata, fieldseekerTrapdatum0) + + return nil +} + +func (fieldseekerTrapdatum0 *FieldseekerTrapdatum) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerTrapdatumOrganization0(ctx, exec, 1, fieldseekerTrapdatum0, organization1) + if err != nil { + return err + } + + fieldseekerTrapdatum0.R.Organization = organization1 + + organization1.R.Trapdata = append(organization1.R.Trapdata, fieldseekerTrapdatum0) + + return nil +} + type fieldseekerTrapdatumWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] - Traptype psql.WhereNullMod[Q, enums.FieldseekerTrapdataMosquitotraptypeEnum] - Trapactivitytype psql.WhereNullMod[Q, enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum] + Traptype psql.WhereNullMod[Q, string] + Trapactivitytype psql.WhereNullMod[Q, string] Startdatetime psql.WhereNullMod[Q, time.Time] Enddatetime psql.WhereNullMod[Q, time.Time] Comments psql.WhereNullMod[Q, string] Idbytech psql.WhereNullMod[Q, string] Sortbytech psql.WhereNullMod[Q, string] - Processed psql.WhereNullMod[Q, enums.FieldseekerTrapdataNotinuitFEnum] - Sitecond psql.WhereNullMod[Q, enums.FieldseekerTrapdataMosquitositeconditionEnum] + Processed psql.WhereNullMod[Q, int16] + Sitecond psql.WhereNullMod[Q, string] Locationname psql.WhereNullMod[Q, string] Recordstatus psql.WhereNullMod[Q, int16] - Reviewed psql.WhereNullMod[Q, enums.FieldseekerTrapdataNotinuitFEnum] + Reviewed psql.WhereNullMod[Q, int16] Reviewedby psql.WhereNullMod[Q, string] Revieweddate psql.WhereNullMod[Q, time.Time] - Trapcondition psql.WhereNullMod[Q, enums.FieldseekerTrapdataMosquitotrapconditionEnum] + Trapcondition psql.WhereNullMod[Q, string] Trapnights psql.WhereNullMod[Q, int16] Zone psql.WhereNullMod[Q, string] Zone2 psql.WhereNullMod[Q, string] @@ -1367,7 +1539,7 @@ type fieldseekerTrapdatumWhere[Q psql.Filterable] struct { Gatewaysync psql.WhereNullMod[Q, int16] LocID psql.WhereNullMod[Q, uuid.UUID] Voltage psql.WhereNullMod[Q, float64] - Winddir psql.WhereNullMod[Q, enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166] + Winddir psql.WhereNullMod[Q, string] Windspeed psql.WhereNullMod[Q, float64] Avetemp psql.WhereNullMod[Q, float64] Raingauge psql.WhereNullMod[Q, float64] @@ -1379,8 +1551,11 @@ type fieldseekerTrapdatumWhere[Q psql.Filterable] struct { Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] - Lure psql.WhereNullMod[Q, enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu] + Lure psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerTrapdatumWhere[Q]) AliasedAs(alias string) fieldseekerTrapdatumWhere[Q] { @@ -1390,21 +1565,21 @@ func (fieldseekerTrapdatumWhere[Q]) AliasedAs(alias string) fieldseekerTrapdatum func buildFieldseekerTrapdatumWhere[Q psql.Filterable](cols fieldseekerTrapdatumColumns) fieldseekerTrapdatumWhere[Q] { return fieldseekerTrapdatumWhere[Q]{ Objectid: psql.Where[Q, int64](cols.Objectid), - Traptype: psql.WhereNull[Q, enums.FieldseekerTrapdataMosquitotraptypeEnum](cols.Traptype), - Trapactivitytype: psql.WhereNull[Q, enums.FieldseekerTrapdataNotinuitrapactivitytypeEnum](cols.Trapactivitytype), + Traptype: psql.WhereNull[Q, string](cols.Traptype), + Trapactivitytype: psql.WhereNull[Q, string](cols.Trapactivitytype), Startdatetime: psql.WhereNull[Q, time.Time](cols.Startdatetime), Enddatetime: psql.WhereNull[Q, time.Time](cols.Enddatetime), Comments: psql.WhereNull[Q, string](cols.Comments), Idbytech: psql.WhereNull[Q, string](cols.Idbytech), Sortbytech: psql.WhereNull[Q, string](cols.Sortbytech), - Processed: psql.WhereNull[Q, enums.FieldseekerTrapdataNotinuitFEnum](cols.Processed), - Sitecond: psql.WhereNull[Q, enums.FieldseekerTrapdataMosquitositeconditionEnum](cols.Sitecond), + Processed: psql.WhereNull[Q, int16](cols.Processed), + Sitecond: psql.WhereNull[Q, string](cols.Sitecond), Locationname: psql.WhereNull[Q, string](cols.Locationname), Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), - Reviewed: psql.WhereNull[Q, enums.FieldseekerTrapdataNotinuitFEnum](cols.Reviewed), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), Revieweddate: psql.WhereNull[Q, time.Time](cols.Revieweddate), - Trapcondition: psql.WhereNull[Q, enums.FieldseekerTrapdataMosquitotrapconditionEnum](cols.Trapcondition), + Trapcondition: psql.WhereNull[Q, string](cols.Trapcondition), Trapnights: psql.WhereNull[Q, int16](cols.Trapnights), Zone: psql.WhereNull[Q, string](cols.Zone), Zone2: psql.WhereNull[Q, string](cols.Zone2), @@ -1418,7 +1593,7 @@ func buildFieldseekerTrapdatumWhere[Q psql.Filterable](cols fieldseekerTrapdatum Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), LocID: psql.WhereNull[Q, uuid.UUID](cols.LocID), Voltage: psql.WhereNull[Q, float64](cols.Voltage), - Winddir: psql.WhereNull[Q, enums.FieldseekerTrapdataTrapdataWinddirC1a31e05D0B94B228800Be127bb3f166](cols.Winddir), + Winddir: psql.WhereNull[Q, string](cols.Winddir), Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), @@ -1430,7 +1605,155 @@ func buildFieldseekerTrapdatumWhere[Q psql.Filterable](cols fieldseekerTrapdatum Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), - Lure: psql.WhereNull[Q, enums.FieldseekerTrapdataTrapdataLure25fe542f077F4254868176e8f436354bEnu](cols.Lure), + Lure: psql.WhereNull[Q, string](cols.Lure), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerTrapdatum) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerTrapdatum cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Trapdata = FieldseekerTrapdatumSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerTrapdatum has no relationship %q", name) + } +} + +type fieldseekerTrapdatumPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerTrapdatumPreloader() fieldseekerTrapdatumPreloader { + return fieldseekerTrapdatumPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerTrapdata, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerTrapdatumThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerTrapdatumThenLoader[Q orm.Loadable]() fieldseekerTrapdatumThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerTrapdatumThenLoader[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 fieldseekerTrapdatum's Organization into the .R struct +func (o *FieldseekerTrapdatum) 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.Trapdata = FieldseekerTrapdatumSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerTrapdatum's Organization into the .R struct +func (os FieldseekerTrapdatumSlice) 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.Trapdata = append(rel.R.Trapdata, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerTrapdatumJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerTrapdatumJoins[Q]) aliasedAs(alias string) fieldseekerTrapdatumJoins[Q] { + return buildFieldseekerTrapdatumJoins[Q](buildFieldseekerTrapdatumColumns(alias), j.typ) +} + +func buildFieldseekerTrapdatumJoins[Q dialect.Joinable](cols fieldseekerTrapdatumColumns, typ string) fieldseekerTrapdatumJoins[Q] { + return fieldseekerTrapdatumJoins[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/db/models/fieldseeker.traplocation.bob.go b/db/models/fieldseeker.traplocation.bob.go index ff5a3198..8d8d653e 100644 --- a/db/models/fieldseeker.traplocation.bob.go +++ b/db/models/fieldseeker.traplocation.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,58 +21,79 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerTraplocation is an object representing the database table. type FieldseekerTraplocation struct { Objectid int64 `db:"objectid,pk" ` - // Name + // Original attribute from ArcGIS API is NAME Name null.Val[string] `db:"name" ` - // Zone + // Original attribute from ArcGIS API is ZONE Zone null.Val[string] `db:"zone" ` - // Habitat - Habitat null.Val[enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e] `db:"habitat" ` - // Priority - Priority null.Val[enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B] `db:"priority" ` - // Use Type - Usetype null.Val[enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2] `db:"usetype" ` - // Active - Active null.Val[enums.FieldseekerTraplocationNotinuitFEnum] `db:"active" ` - // Description + // Original attribute from ArcGIS API is HABITAT + Habitat null.Val[string] `db:"habitat" ` + // Original attribute from ArcGIS API is PRIORITY + Priority null.Val[string] `db:"priority" ` + // Original attribute from ArcGIS API is USETYPE + Usetype null.Val[string] `db:"usetype" ` + // Original attribute from ArcGIS API is ACTIVE + Active null.Val[int16] `db:"active" ` + // Original attribute from ArcGIS API is DESCRIPTION Description null.Val[string] `db:"description" ` - // Access Description - Accessdesc null.Val[enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0] `db:"accessdesc" ` - // Comments + // Original attribute from ArcGIS API is ACCESSDESC + Accessdesc null.Val[string] `db:"accessdesc" ` + // Original attribute from ArcGIS API is COMMENTS Comments null.Val[string] `db:"comments" ` - // External ID + // Original attribute from ArcGIS API is EXTERNALID Externalid null.Val[string] `db:"externalid" ` - // Next Scheduled Action + // Original attribute from ArcGIS API is NEXTACTIONDATESCHEDULED Nextactiondatescheduled null.Val[time.Time] `db:"nextactiondatescheduled" ` - // Zone2 - Zone2 null.Val[string] `db:"zone2" ` - Locationnumber null.Val[int32] `db:"locationnumber" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is ZONE2 + Zone2 null.Val[string] `db:"zone2" ` + // Original attribute from ArcGIS API is LOCATIONNUMBER + Locationnumber null.Val[int32] `db:"locationnumber" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - // Gateway Sync + // Original attribute from ArcGIS API is GATEWAYSYNC Gatewaysync null.Val[int16] `db:"gatewaysync" ` - // Route + // Original attribute from ArcGIS API is route Route null.Val[int32] `db:"route" ` - // Set Day of Week + // Original attribute from ArcGIS API is set_dow SetDow null.Val[int32] `db:"set_dow" ` - // Route order - RouteOrder null.Val[int32] `db:"route_order" ` - Vectorsurvsiteid null.Val[string] `db:"vectorsurvsiteid" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - H3R7 null.Val[string] `db:"h3r7" ` - H3R8 null.Val[string] `db:"h3r8" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is route_order + RouteOrder null.Val[int32] `db:"route_order" ` + // Original attribute from ArcGIS API is VECTORSURVSITEID + Vectorsurvsiteid null.Val[string] `db:"vectorsurvsiteid" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is h3r7 + H3R7 null.Val[string] `db:"h3r7" ` + // Original attribute from ArcGIS API is h3r8 + H3R8 null.Val[string] `db:"h3r8" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerTraplocationR `db:"-" ` } // FieldseekerTraplocationSlice is an alias for a slice of pointers to FieldseekerTraplocation. @@ -84,10 +106,15 @@ var FieldseekerTraplocations = psql.NewTablex[*FieldseekerTraplocation, Fieldsee // FieldseekerTraplocationsQuery is a query on the traplocation table type FieldseekerTraplocationsQuery = *psql.ViewQuery[*FieldseekerTraplocation, FieldseekerTraplocationSlice] +// fieldseekerTraplocationR is where relationships are stored. +type fieldseekerTraplocationR struct { + Organization *Organization // fieldseeker.traplocation.traplocation_organization_id_fkey +} + func buildFieldseekerTraplocationColumns(alias string) fieldseekerTraplocationColumns { return fieldseekerTraplocationColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "name", "zone", "habitat", "priority", "usetype", "active", "description", "accessdesc", "comments", "externalid", "nextactiondatescheduled", "zone2", "locationnumber", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "gatewaysync", "route", "set_dow", "route_order", "vectorsurvsiteid", "creationdate", "creator", "editdate", "editor", "h3r7", "h3r8", "version", + "objectid", "name", "zone", "habitat", "priority", "usetype", "active", "description", "accessdesc", "comments", "externalid", "nextactiondatescheduled", "zone2", "locationnumber", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "gatewaysync", "route", "set_dow", "route_order", "vectorsurvsiteid", "creationdate", "creator", "editdate", "editor", "h3r7", "h3r8", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.traplocation"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -120,7 +147,10 @@ func buildFieldseekerTraplocationColumns(alias string) fieldseekerTraplocationCo Editor: psql.Quote(alias, "editor"), H3R7: psql.Quote(alias, "h3r7"), H3R8: psql.Quote(alias, "h3r8"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -157,7 +187,10 @@ type fieldseekerTraplocationColumns struct { Editor psql.Expression H3R7 psql.Expression H3R8 psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerTraplocationColumns) Alias() string { @@ -172,41 +205,44 @@ func (fieldseekerTraplocationColumns) AliasedAs(alias string) fieldseekerTraploc // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerTraplocationSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Name omitnull.Val[string] `db:"name" ` - Zone omitnull.Val[string] `db:"zone" ` - Habitat omitnull.Val[enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e] `db:"habitat" ` - Priority omitnull.Val[enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B] `db:"priority" ` - Usetype omitnull.Val[enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2] `db:"usetype" ` - Active omitnull.Val[enums.FieldseekerTraplocationNotinuitFEnum] `db:"active" ` - Description omitnull.Val[string] `db:"description" ` - Accessdesc omitnull.Val[enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0] `db:"accessdesc" ` - Comments omitnull.Val[string] `db:"comments" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Nextactiondatescheduled omitnull.Val[time.Time] `db:"nextactiondatescheduled" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Locationnumber omitnull.Val[int32] `db:"locationnumber" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Route omitnull.Val[int32] `db:"route" ` - SetDow omitnull.Val[int32] `db:"set_dow" ` - RouteOrder omitnull.Val[int32] `db:"route_order" ` - Vectorsurvsiteid omitnull.Val[string] `db:"vectorsurvsiteid" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - H3R7 omitnull.Val[string] `db:"h3r7" ` - H3R8 omitnull.Val[string] `db:"h3r8" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Name omitnull.Val[string] `db:"name" ` + Zone omitnull.Val[string] `db:"zone" ` + Habitat omitnull.Val[string] `db:"habitat" ` + Priority omitnull.Val[string] `db:"priority" ` + Usetype omitnull.Val[string] `db:"usetype" ` + Active omitnull.Val[int16] `db:"active" ` + Description omitnull.Val[string] `db:"description" ` + Accessdesc omitnull.Val[string] `db:"accessdesc" ` + Comments omitnull.Val[string] `db:"comments" ` + Externalid omitnull.Val[string] `db:"externalid" ` + Nextactiondatescheduled omitnull.Val[time.Time] `db:"nextactiondatescheduled" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Locationnumber omitnull.Val[int32] `db:"locationnumber" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` + Route omitnull.Val[int32] `db:"route" ` + SetDow omitnull.Val[int32] `db:"set_dow" ` + RouteOrder omitnull.Val[int32] `db:"route_order" ` + Vectorsurvsiteid omitnull.Val[string] `db:"vectorsurvsiteid" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + H3R7 omitnull.Val[string] `db:"h3r7" ` + H3R8 omitnull.Val[string] `db:"h3r8" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerTraplocationSetter) SetColumns() []string { - vals := make([]string, 0, 31) + vals := make([]string, 0, 34) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -297,9 +333,18 @@ func (s FieldseekerTraplocationSetter) SetColumns() []string { if !s.H3R8.IsUnset() { vals = append(vals, "h3r8") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -394,9 +439,18 @@ func (s FieldseekerTraplocationSetter) Overwrite(t *FieldseekerTraplocation) { if !s.H3R8.IsUnset() { t.H3R8 = s.H3R8.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerTraplocationSetter) Apply(q *dialect.InsertQuery) { @@ -405,7 +459,7 @@ func (s *FieldseekerTraplocationSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 31) + vals := make([]bob.Expression, 34) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -586,12 +640,30 @@ func (s *FieldseekerTraplocationSetter) Apply(q *dialect.InsertQuery) { vals[29] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[30] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[30] = psql.Arg(s.Geometry.MustGet()) } else { vals[30] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[31] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[31] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[32] = psql.Arg(s.Version.MustGet()) + } else { + vals[32] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[33] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[33] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -601,7 +673,7 @@ func (s FieldseekerTraplocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] } func (s FieldseekerTraplocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 31) + exprs := make([]bob.Expression, 0, 34) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -813,6 +885,20 @@ func (s FieldseekerTraplocationSetter) Expressions(prefix ...string) []bob.Expre }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -820,6 +906,13 @@ func (s FieldseekerTraplocationSetter) Expressions(prefix ...string) []bob.Expre }}) } + 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 } @@ -887,6 +980,7 @@ func (o *FieldseekerTraplocation) Update(ctx context.Context, exec bob.Executor, return err } + o.R = v.R *o = *v return nil @@ -907,7 +1001,7 @@ func (o *FieldseekerTraplocation) Reload(ctx context.Context, exec bob.Executor) if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -957,7 +1051,7 @@ func (o FieldseekerTraplocationSlice) copyMatchingRows(from ...*FieldseekerTrapl if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -1055,16 +1149,88 @@ func (o FieldseekerTraplocationSlice) ReloadAll(ctx context.Context, exec bob.Ex return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerTraplocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerTraplocationSlice) 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 attachFieldseekerTraplocationOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerTraplocation0 *FieldseekerTraplocation, organization1 *Organization) (*FieldseekerTraplocation, error) { + setter := &FieldseekerTraplocationSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerTraplocation0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerTraplocationOrganization0: %w", err) + } + + return fieldseekerTraplocation0, nil +} + +func (fieldseekerTraplocation0 *FieldseekerTraplocation) 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 = attachFieldseekerTraplocationOrganization0(ctx, exec, 1, fieldseekerTraplocation0, organization1) + if err != nil { + return err + } + + fieldseekerTraplocation0.R.Organization = organization1 + + organization1.R.Traplocations = append(organization1.R.Traplocations, fieldseekerTraplocation0) + + return nil +} + +func (fieldseekerTraplocation0 *FieldseekerTraplocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerTraplocationOrganization0(ctx, exec, 1, fieldseekerTraplocation0, organization1) + if err != nil { + return err + } + + fieldseekerTraplocation0.R.Organization = organization1 + + organization1.R.Traplocations = append(organization1.R.Traplocations, fieldseekerTraplocation0) + + return nil +} + type fieldseekerTraplocationWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] Name psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] - Habitat psql.WhereNullMod[Q, enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e] - Priority psql.WhereNullMod[Q, enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B] - Usetype psql.WhereNullMod[Q, enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2] - Active psql.WhereNullMod[Q, enums.FieldseekerTraplocationNotinuitFEnum] + Habitat psql.WhereNullMod[Q, string] + Priority psql.WhereNullMod[Q, string] + Usetype psql.WhereNullMod[Q, string] + Active psql.WhereNullMod[Q, int16] Description psql.WhereNullMod[Q, string] - Accessdesc psql.WhereNullMod[Q, enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0] + Accessdesc psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] Externalid psql.WhereNullMod[Q, string] Nextactiondatescheduled psql.WhereNullMod[Q, time.Time] @@ -1086,7 +1252,10 @@ type fieldseekerTraplocationWhere[Q psql.Filterable] struct { Editor psql.WhereNullMod[Q, string] H3R7 psql.WhereNullMod[Q, string] H3R8 psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerTraplocationWhere[Q]) AliasedAs(alias string) fieldseekerTraplocationWhere[Q] { @@ -1098,12 +1267,12 @@ func buildFieldseekerTraplocationWhere[Q psql.Filterable](cols fieldseekerTraplo Objectid: psql.Where[Q, int64](cols.Objectid), Name: psql.WhereNull[Q, string](cols.Name), Zone: psql.WhereNull[Q, string](cols.Zone), - Habitat: psql.WhereNull[Q, enums.FieldseekerTraplocationTraplocationHabitat5c349680f5ff40b1aeca88c17993e](cols.Habitat), - Priority: psql.WhereNull[Q, enums.FieldseekerTraplocationTraplocationPriority680FB011063B41D59F39271C959B](cols.Priority), - Usetype: psql.WhereNull[Q, enums.FieldseekerTraplocationTraplocationUsetype5e0eff9231fb404c98cc53c1d49a2](cols.Usetype), - Active: psql.WhereNull[Q, enums.FieldseekerTraplocationNotinuitFEnum](cols.Active), + Habitat: psql.WhereNull[Q, string](cols.Habitat), + Priority: psql.WhereNull[Q, string](cols.Priority), + Usetype: psql.WhereNull[Q, string](cols.Usetype), + Active: psql.WhereNull[Q, int16](cols.Active), Description: psql.WhereNull[Q, string](cols.Description), - Accessdesc: psql.WhereNull[Q, enums.FieldseekerTraplocationTraplocationAccessdesc154CBD1045244e3a8ca0F0](cols.Accessdesc), + Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), Comments: psql.WhereNull[Q, string](cols.Comments), Externalid: psql.WhereNull[Q, string](cols.Externalid), Nextactiondatescheduled: psql.WhereNull[Q, time.Time](cols.Nextactiondatescheduled), @@ -1125,6 +1294,154 @@ func buildFieldseekerTraplocationWhere[Q psql.Filterable](cols fieldseekerTraplo Editor: psql.WhereNull[Q, string](cols.Editor), H3R7: psql.WhereNull[Q, string](cols.H3R7), H3R8: psql.WhereNull[Q, string](cols.H3R8), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerTraplocation) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerTraplocation cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Traplocations = FieldseekerTraplocationSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerTraplocation has no relationship %q", name) + } +} + +type fieldseekerTraplocationPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerTraplocationPreloader() fieldseekerTraplocationPreloader { + return fieldseekerTraplocationPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerTraplocations, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerTraplocationThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerTraplocationThenLoader[Q orm.Loadable]() fieldseekerTraplocationThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerTraplocationThenLoader[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 fieldseekerTraplocation's Organization into the .R struct +func (o *FieldseekerTraplocation) 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.Traplocations = FieldseekerTraplocationSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerTraplocation's Organization into the .R struct +func (os FieldseekerTraplocationSlice) 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.Traplocations = append(rel.R.Traplocations, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerTraplocationJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerTraplocationJoins[Q]) aliasedAs(alias string) fieldseekerTraplocationJoins[Q] { + return buildFieldseekerTraplocationJoins[Q](buildFieldseekerTraplocationColumns(alias), j.typ) +} + +func buildFieldseekerTraplocationJoins[Q dialect.Joinable](cols fieldseekerTraplocationColumns, typ string) fieldseekerTraplocationJoins[Q] { + return fieldseekerTraplocationJoins[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/db/models/fieldseeker.treatment.bob.go b/db/models/fieldseeker.treatment.bob.go index b4df3ba8..616aa74d 100644 --- a/db/models/fieldseeker.treatment.bob.go +++ b/db/models/fieldseeker.treatment.bob.go @@ -1,18 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,104 +21,127 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerTreatment is an object representing the database table. type FieldseekerTreatment struct { Objectid int64 `db:"objectid,pk" ` - // Activity - Activity null.Val[enums.FieldseekerTreatmentMosquitoactivityEnum] `db:"activity" ` - // Area Treated + // Original attribute from ArcGIS API is ACTIVITY + Activity null.Val[string] `db:"activity" ` + // Original attribute from ArcGIS API is TREATAREA Treatarea null.Val[float64] `db:"treatarea" ` - // Area Unit - Areaunit null.Val[enums.FieldseekerTreatmentMosquitoproductareaunitEnum] `db:"areaunit" ` - // Product + // Original attribute from ArcGIS API is AREAUNIT + Areaunit null.Val[string] `db:"areaunit" ` + // Original attribute from ArcGIS API is PRODUCT Product null.Val[string] `db:"product" ` - // Quantity + // Original attribute from ArcGIS API is QTY Qty null.Val[float64] `db:"qty" ` - // Quantity Unit - Qtyunit null.Val[enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum] `db:"qtyunit" ` - // Method - Method null.Val[enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu] `db:"method" ` - // Equipment Type - Equiptype null.Val[enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f] `db:"equiptype" ` - // Comments + // Original attribute from ArcGIS API is QTYUNIT + Qtyunit null.Val[string] `db:"qtyunit" ` + // Original attribute from ArcGIS API is METHOD + Method null.Val[string] `db:"method" ` + // Original attribute from ArcGIS API is EQUIPTYPE + Equiptype null.Val[string] `db:"equiptype" ` + // Original attribute from ArcGIS API is COMMENTS Comments null.Val[string] `db:"comments" ` - // Average Temperature + // Original attribute from ArcGIS API is AVETEMP Avetemp null.Val[float64] `db:"avetemp" ` - // Wind Speed + // Original attribute from ArcGIS API is WINDSPEED Windspeed null.Val[float64] `db:"windspeed" ` - // Wind Direction - Winddir null.Val[enums.FieldseekerTreatmentNotinuiwinddirectionEnum] `db:"winddir" ` - // Rain Gauge + // Original attribute from ArcGIS API is WINDDIR + Winddir null.Val[string] `db:"winddir" ` + // Original attribute from ArcGIS API is RAINGAUGE Raingauge null.Val[float64] `db:"raingauge" ` - // Start + // Original attribute from ArcGIS API is STARTDATETIME Startdatetime null.Val[time.Time] `db:"startdatetime" ` - // Finish + // Original attribute from ArcGIS API is ENDDATETIME Enddatetime null.Val[time.Time] `db:"enddatetime" ` - InspID null.Val[uuid.UUID] `db:"insp_id" ` - // Reviewed - Reviewed null.Val[enums.FieldseekerTreatmentNotinuitFEnum] `db:"reviewed" ` - // Reviewed By + // Original attribute from ArcGIS API is INSP_ID + InspID null.Val[uuid.UUID] `db:"insp_id" ` + // Original attribute from ArcGIS API is REVIEWED + Reviewed null.Val[int16] `db:"reviewed" ` + // Original attribute from ArcGIS API is REVIEWEDBY Reviewedby null.Val[string] `db:"reviewedby" ` - // Reviewed Date + // Original attribute from ArcGIS API is REVIEWEDDATE Revieweddate null.Val[time.Time] `db:"revieweddate" ` - // Location Name + // Original attribute from ArcGIS API is LOCATIONNAME Locationname null.Val[string] `db:"locationname" ` - // Zone + // Original attribute from ArcGIS API is ZONE Zone null.Val[string] `db:"zone" ` - // Warning Override - Warningoverride null.Val[enums.FieldseekerTreatmentNotinuitFEnum] `db:"warningoverride" ` - // RecordStatus + // Original attribute from ArcGIS API is WARNINGOVERRIDE + Warningoverride null.Val[int16] `db:"warningoverride" ` + // Original attribute from ArcGIS API is RECORDSTATUS Recordstatus null.Val[int16] `db:"recordstatus" ` - // Zone2 + // Original attribute from ArcGIS API is ZONE2 Zone2 null.Val[string] `db:"zone2" ` - // Treated Acres + // Original attribute from ArcGIS API is TREATACRES Treatacres null.Val[float64] `db:"treatacres" ` - // Tire Count + // Original attribute from ArcGIS API is TIRECOUNT Tirecount null.Val[int16] `db:"tirecount" ` - // Catch Basin Count + // Original attribute from ArcGIS API is CBCOUNT Cbcount null.Val[int16] `db:"cbcount" ` - // Container Count - Containercount null.Val[int16] `db:"containercount" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - // Treatment Length + // Original attribute from ArcGIS API is CONTAINERCOUNT + Containercount null.Val[int16] `db:"containercount" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is TREATMENTLENGTH Treatmentlength null.Val[float64] `db:"treatmentlength" ` - // Treatment Hours + // Original attribute from ArcGIS API is TREATMENTHOURS Treatmenthours null.Val[float64] `db:"treatmenthours" ` - // Treatment Length Units - Treatmentlengthunits null.Val[string] `db:"treatmentlengthunits" ` - Linelocid null.Val[uuid.UUID] `db:"linelocid" ` - Pointlocid null.Val[uuid.UUID] `db:"pointlocid" ` - Polygonlocid null.Val[uuid.UUID] `db:"polygonlocid" ` - Srid null.Val[uuid.UUID] `db:"srid" ` - Sdid null.Val[uuid.UUID] `db:"sdid" ` - Barrierrouteid null.Val[uuid.UUID] `db:"barrierrouteid" ` - Ulvrouteid null.Val[uuid.UUID] `db:"ulvrouteid" ` - // Field Tech - Fieldtech null.Val[string] `db:"fieldtech" ` - Ptaid null.Val[uuid.UUID] `db:"ptaid" ` - Flowrate null.Val[float64] `db:"flowrate" ` - // Habitat - Habitat null.Val[enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1] `db:"habitat" ` - // Treat Hectares + // Original attribute from ArcGIS API is TREATMENTLENGTHUNITS + Treatmentlengthunits null.Val[string] `db:"treatmentlengthunits" ` + // Original attribute from ArcGIS API is LINELOCID + Linelocid null.Val[uuid.UUID] `db:"linelocid" ` + // Original attribute from ArcGIS API is POINTLOCID + Pointlocid null.Val[uuid.UUID] `db:"pointlocid" ` + // Original attribute from ArcGIS API is POLYGONLOCID + Polygonlocid null.Val[uuid.UUID] `db:"polygonlocid" ` + // Original attribute from ArcGIS API is SRID + Srid null.Val[uuid.UUID] `db:"srid" ` + // Original attribute from ArcGIS API is SDID + Sdid null.Val[uuid.UUID] `db:"sdid" ` + // Original attribute from ArcGIS API is BARRIERROUTEID + Barrierrouteid null.Val[uuid.UUID] `db:"barrierrouteid" ` + // Original attribute from ArcGIS API is ULVROUTEID + Ulvrouteid null.Val[uuid.UUID] `db:"ulvrouteid" ` + // Original attribute from ArcGIS API is FIELDTECH + Fieldtech null.Val[string] `db:"fieldtech" ` + // Original attribute from ArcGIS API is PTAID + Ptaid null.Val[uuid.UUID] `db:"ptaid" ` + // Original attribute from ArcGIS API is FLOWRATE + Flowrate null.Val[float64] `db:"flowrate" ` + // Original attribute from ArcGIS API is HABITAT + Habitat null.Val[string] `db:"habitat" ` + // Original attribute from ArcGIS API is TREATHECTARES Treathectares null.Val[float64] `db:"treathectares" ` - // Inventory Location + // Original attribute from ArcGIS API is INVLOC Invloc null.Val[string] `db:"invloc" ` - // temp_Conditions - TempSitecond null.Val[enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E] `db:"temp_sitecond" ` - // Conditions - Sitecond null.Val[enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E] `db:"sitecond" ` - // TotalCostProduct - Totalcostprodcut null.Val[float64] `db:"totalcostprodcut" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - // Target Species - Targetspecies null.Val[string] `db:"targetspecies" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is temp_SITECOND + TempSitecond null.Val[string] `db:"temp_sitecond" ` + // Original attribute from ArcGIS API is SITECOND + Sitecond null.Val[string] `db:"sitecond" ` + // Original attribute from ArcGIS API is TotalCostProdcut + Totalcostprodcut null.Val[float64] `db:"totalcostprodcut" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is TARGETSPECIES + Targetspecies null.Val[string] `db:"targetspecies" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerTreatmentR `db:"-" ` } // FieldseekerTreatmentSlice is an alias for a slice of pointers to FieldseekerTreatment. @@ -130,10 +154,15 @@ var FieldseekerTreatments = psql.NewTablex[*FieldseekerTreatment, FieldseekerTre // FieldseekerTreatmentsQuery is a query on the treatment table type FieldseekerTreatmentsQuery = *psql.ViewQuery[*FieldseekerTreatment, FieldseekerTreatmentSlice] +// fieldseekerTreatmentR is where relationships are stored. +type fieldseekerTreatmentR struct { + Organization *Organization // fieldseeker.treatment.treatment_organization_id_fkey +} + func buildFieldseekerTreatmentColumns(alias string) fieldseekerTreatmentColumns { return fieldseekerTreatmentColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "activity", "treatarea", "areaunit", "product", "qty", "qtyunit", "method", "equiptype", "comments", "avetemp", "windspeed", "winddir", "raingauge", "startdatetime", "enddatetime", "insp_id", "reviewed", "reviewedby", "revieweddate", "locationname", "zone", "warningoverride", "recordstatus", "zone2", "treatacres", "tirecount", "cbcount", "containercount", "globalid", "treatmentlength", "treatmenthours", "treatmentlengthunits", "linelocid", "pointlocid", "polygonlocid", "srid", "sdid", "barrierrouteid", "ulvrouteid", "fieldtech", "ptaid", "flowrate", "habitat", "treathectares", "invloc", "temp_sitecond", "sitecond", "totalcostprodcut", "creationdate", "creator", "editdate", "editor", "targetspecies", "version", + "objectid", "activity", "treatarea", "areaunit", "product", "qty", "qtyunit", "method", "equiptype", "comments", "avetemp", "windspeed", "winddir", "raingauge", "startdatetime", "enddatetime", "insp_id", "reviewed", "reviewedby", "revieweddate", "locationname", "zone", "warningoverride", "recordstatus", "zone2", "treatacres", "tirecount", "cbcount", "containercount", "globalid", "treatmentlength", "treatmenthours", "treatmentlengthunits", "linelocid", "pointlocid", "polygonlocid", "srid", "sdid", "barrierrouteid", "ulvrouteid", "fieldtech", "ptaid", "flowrate", "habitat", "treathectares", "invloc", "temp_sitecond", "sitecond", "totalcostprodcut", "creationdate", "creator", "editdate", "editor", "targetspecies", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.treatment"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -190,7 +219,10 @@ func buildFieldseekerTreatmentColumns(alias string) fieldseekerTreatmentColumns Editdate: psql.Quote(alias, "editdate"), Editor: psql.Quote(alias, "editor"), Targetspecies: psql.Quote(alias, "targetspecies"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -251,7 +283,10 @@ type fieldseekerTreatmentColumns struct { Editdate psql.Expression Editor psql.Expression Targetspecies psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerTreatmentColumns) Alias() string { @@ -266,65 +301,68 @@ func (fieldseekerTreatmentColumns) AliasedAs(alias string) fieldseekerTreatmentC // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerTreatmentSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Activity omitnull.Val[enums.FieldseekerTreatmentMosquitoactivityEnum] `db:"activity" ` - Treatarea omitnull.Val[float64] `db:"treatarea" ` - Areaunit omitnull.Val[enums.FieldseekerTreatmentMosquitoproductareaunitEnum] `db:"areaunit" ` - Product omitnull.Val[string] `db:"product" ` - Qty omitnull.Val[float64] `db:"qty" ` - Qtyunit omitnull.Val[enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum] `db:"qtyunit" ` - Method omitnull.Val[enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu] `db:"method" ` - Equiptype omitnull.Val[enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f] `db:"equiptype" ` - Comments omitnull.Val[string] `db:"comments" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - Winddir omitnull.Val[enums.FieldseekerTreatmentNotinuiwinddirectionEnum] `db:"winddir" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Startdatetime omitnull.Val[time.Time] `db:"startdatetime" ` - Enddatetime omitnull.Val[time.Time] `db:"enddatetime" ` - InspID omitnull.Val[uuid.UUID] `db:"insp_id" ` - Reviewed omitnull.Val[enums.FieldseekerTreatmentNotinuitFEnum] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[time.Time] `db:"revieweddate" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Zone omitnull.Val[string] `db:"zone" ` - Warningoverride omitnull.Val[enums.FieldseekerTreatmentNotinuitFEnum] `db:"warningoverride" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Treatacres omitnull.Val[float64] `db:"treatacres" ` - Tirecount omitnull.Val[int16] `db:"tirecount" ` - Cbcount omitnull.Val[int16] `db:"cbcount" ` - Containercount omitnull.Val[int16] `db:"containercount" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - Treatmentlength omitnull.Val[float64] `db:"treatmentlength" ` - Treatmenthours omitnull.Val[float64] `db:"treatmenthours" ` - Treatmentlengthunits omitnull.Val[string] `db:"treatmentlengthunits" ` - Linelocid omitnull.Val[uuid.UUID] `db:"linelocid" ` - Pointlocid omitnull.Val[uuid.UUID] `db:"pointlocid" ` - Polygonlocid omitnull.Val[uuid.UUID] `db:"polygonlocid" ` - Srid omitnull.Val[uuid.UUID] `db:"srid" ` - Sdid omitnull.Val[uuid.UUID] `db:"sdid" ` - Barrierrouteid omitnull.Val[uuid.UUID] `db:"barrierrouteid" ` - Ulvrouteid omitnull.Val[uuid.UUID] `db:"ulvrouteid" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Ptaid omitnull.Val[uuid.UUID] `db:"ptaid" ` - Flowrate omitnull.Val[float64] `db:"flowrate" ` - Habitat omitnull.Val[enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1] `db:"habitat" ` - Treathectares omitnull.Val[float64] `db:"treathectares" ` - Invloc omitnull.Val[string] `db:"invloc" ` - TempSitecond omitnull.Val[enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E] `db:"temp_sitecond" ` - Sitecond omitnull.Val[enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E] `db:"sitecond" ` - Totalcostprodcut omitnull.Val[float64] `db:"totalcostprodcut" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Targetspecies omitnull.Val[string] `db:"targetspecies" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Activity omitnull.Val[string] `db:"activity" ` + Treatarea omitnull.Val[float64] `db:"treatarea" ` + Areaunit omitnull.Val[string] `db:"areaunit" ` + Product omitnull.Val[string] `db:"product" ` + Qty omitnull.Val[float64] `db:"qty" ` + Qtyunit omitnull.Val[string] `db:"qtyunit" ` + Method omitnull.Val[string] `db:"method" ` + Equiptype omitnull.Val[string] `db:"equiptype" ` + Comments omitnull.Val[string] `db:"comments" ` + Avetemp omitnull.Val[float64] `db:"avetemp" ` + Windspeed omitnull.Val[float64] `db:"windspeed" ` + Winddir omitnull.Val[string] `db:"winddir" ` + Raingauge omitnull.Val[float64] `db:"raingauge" ` + Startdatetime omitnull.Val[time.Time] `db:"startdatetime" ` + Enddatetime omitnull.Val[time.Time] `db:"enddatetime" ` + InspID omitnull.Val[uuid.UUID] `db:"insp_id" ` + Reviewed omitnull.Val[int16] `db:"reviewed" ` + Reviewedby omitnull.Val[string] `db:"reviewedby" ` + Revieweddate omitnull.Val[time.Time] `db:"revieweddate" ` + Locationname omitnull.Val[string] `db:"locationname" ` + Zone omitnull.Val[string] `db:"zone" ` + Warningoverride omitnull.Val[int16] `db:"warningoverride" ` + Recordstatus omitnull.Val[int16] `db:"recordstatus" ` + Zone2 omitnull.Val[string] `db:"zone2" ` + Treatacres omitnull.Val[float64] `db:"treatacres" ` + Tirecount omitnull.Val[int16] `db:"tirecount" ` + Cbcount omitnull.Val[int16] `db:"cbcount" ` + Containercount omitnull.Val[int16] `db:"containercount" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + Treatmentlength omitnull.Val[float64] `db:"treatmentlength" ` + Treatmenthours omitnull.Val[float64] `db:"treatmenthours" ` + Treatmentlengthunits omitnull.Val[string] `db:"treatmentlengthunits" ` + Linelocid omitnull.Val[uuid.UUID] `db:"linelocid" ` + Pointlocid omitnull.Val[uuid.UUID] `db:"pointlocid" ` + Polygonlocid omitnull.Val[uuid.UUID] `db:"polygonlocid" ` + Srid omitnull.Val[uuid.UUID] `db:"srid" ` + Sdid omitnull.Val[uuid.UUID] `db:"sdid" ` + Barrierrouteid omitnull.Val[uuid.UUID] `db:"barrierrouteid" ` + Ulvrouteid omitnull.Val[uuid.UUID] `db:"ulvrouteid" ` + Fieldtech omitnull.Val[string] `db:"fieldtech" ` + Ptaid omitnull.Val[uuid.UUID] `db:"ptaid" ` + Flowrate omitnull.Val[float64] `db:"flowrate" ` + Habitat omitnull.Val[string] `db:"habitat" ` + Treathectares omitnull.Val[float64] `db:"treathectares" ` + Invloc omitnull.Val[string] `db:"invloc" ` + TempSitecond omitnull.Val[string] `db:"temp_sitecond" ` + Sitecond omitnull.Val[string] `db:"sitecond" ` + Totalcostprodcut omitnull.Val[float64] `db:"totalcostprodcut" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + Targetspecies omitnull.Val[string] `db:"targetspecies" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerTreatmentSetter) SetColumns() []string { - vals := make([]string, 0, 55) + vals := make([]string, 0, 58) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -487,9 +525,18 @@ func (s FieldseekerTreatmentSetter) SetColumns() []string { if !s.Targetspecies.IsUnset() { vals = append(vals, "targetspecies") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -656,9 +703,18 @@ func (s FieldseekerTreatmentSetter) Overwrite(t *FieldseekerTreatment) { if !s.Targetspecies.IsUnset() { t.Targetspecies = s.Targetspecies.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerTreatmentSetter) Apply(q *dialect.InsertQuery) { @@ -667,7 +723,7 @@ func (s *FieldseekerTreatmentSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 55) + vals := make([]bob.Expression, 58) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -992,12 +1048,30 @@ func (s *FieldseekerTreatmentSetter) Apply(q *dialect.InsertQuery) { vals[53] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[54] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[54] = psql.Arg(s.Geometry.MustGet()) } else { vals[54] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[55] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[55] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[56] = psql.Arg(s.Version.MustGet()) + } else { + vals[56] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[57] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[57] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -1007,7 +1081,7 @@ func (s FieldseekerTreatmentSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s FieldseekerTreatmentSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 55) + exprs := make([]bob.Expression, 0, 58) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -1387,6 +1461,20 @@ func (s FieldseekerTreatmentSetter) Expressions(prefix ...string) []bob.Expressi }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -1394,6 +1482,13 @@ func (s FieldseekerTreatmentSetter) Expressions(prefix ...string) []bob.Expressi }}) } + 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 } @@ -1461,6 +1556,7 @@ func (o *FieldseekerTreatment) Update(ctx context.Context, exec bob.Executor, s return err } + o.R = v.R *o = *v return nil @@ -1481,7 +1577,7 @@ func (o *FieldseekerTreatment) Reload(ctx context.Context, exec bob.Executor) er if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -1531,7 +1627,7 @@ func (o FieldseekerTreatmentSlice) copyMatchingRows(from ...*FieldseekerTreatmen if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -1629,30 +1725,102 @@ func (o FieldseekerTreatmentSlice) ReloadAll(ctx context.Context, exec bob.Execu return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerTreatment) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerTreatmentSlice) 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 attachFieldseekerTreatmentOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerTreatment0 *FieldseekerTreatment, organization1 *Organization) (*FieldseekerTreatment, error) { + setter := &FieldseekerTreatmentSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerTreatment0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerTreatmentOrganization0: %w", err) + } + + return fieldseekerTreatment0, nil +} + +func (fieldseekerTreatment0 *FieldseekerTreatment) 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 = attachFieldseekerTreatmentOrganization0(ctx, exec, 1, fieldseekerTreatment0, organization1) + if err != nil { + return err + } + + fieldseekerTreatment0.R.Organization = organization1 + + organization1.R.Treatments = append(organization1.R.Treatments, fieldseekerTreatment0) + + return nil +} + +func (fieldseekerTreatment0 *FieldseekerTreatment) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerTreatmentOrganization0(ctx, exec, 1, fieldseekerTreatment0, organization1) + if err != nil { + return err + } + + fieldseekerTreatment0.R.Organization = organization1 + + organization1.R.Treatments = append(organization1.R.Treatments, fieldseekerTreatment0) + + return nil +} + type fieldseekerTreatmentWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] - Activity psql.WhereNullMod[Q, enums.FieldseekerTreatmentMosquitoactivityEnum] + Activity psql.WhereNullMod[Q, string] Treatarea psql.WhereNullMod[Q, float64] - Areaunit psql.WhereNullMod[Q, enums.FieldseekerTreatmentMosquitoproductareaunitEnum] + Areaunit psql.WhereNullMod[Q, string] Product psql.WhereNullMod[Q, string] Qty psql.WhereNullMod[Q, float64] - Qtyunit psql.WhereNullMod[Q, enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum] - Method psql.WhereNullMod[Q, enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu] - Equiptype psql.WhereNullMod[Q, enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f] + Qtyunit psql.WhereNullMod[Q, string] + Method psql.WhereNullMod[Q, string] + Equiptype psql.WhereNullMod[Q, string] Comments psql.WhereNullMod[Q, string] Avetemp psql.WhereNullMod[Q, float64] Windspeed psql.WhereNullMod[Q, float64] - Winddir psql.WhereNullMod[Q, enums.FieldseekerTreatmentNotinuiwinddirectionEnum] + Winddir psql.WhereNullMod[Q, string] Raingauge psql.WhereNullMod[Q, float64] Startdatetime psql.WhereNullMod[Q, time.Time] Enddatetime psql.WhereNullMod[Q, time.Time] InspID psql.WhereNullMod[Q, uuid.UUID] - Reviewed psql.WhereNullMod[Q, enums.FieldseekerTreatmentNotinuitFEnum] + Reviewed psql.WhereNullMod[Q, int16] Reviewedby psql.WhereNullMod[Q, string] Revieweddate psql.WhereNullMod[Q, time.Time] Locationname psql.WhereNullMod[Q, string] Zone psql.WhereNullMod[Q, string] - Warningoverride psql.WhereNullMod[Q, enums.FieldseekerTreatmentNotinuitFEnum] + Warningoverride psql.WhereNullMod[Q, int16] Recordstatus psql.WhereNullMod[Q, int16] Zone2 psql.WhereNullMod[Q, string] Treatacres psql.WhereNullMod[Q, float64] @@ -1673,18 +1841,21 @@ type fieldseekerTreatmentWhere[Q psql.Filterable] struct { Fieldtech psql.WhereNullMod[Q, string] Ptaid psql.WhereNullMod[Q, uuid.UUID] Flowrate psql.WhereNullMod[Q, float64] - Habitat psql.WhereNullMod[Q, enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1] + Habitat psql.WhereNullMod[Q, string] Treathectares psql.WhereNullMod[Q, float64] Invloc psql.WhereNullMod[Q, string] - TempSitecond psql.WhereNullMod[Q, enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E] - Sitecond psql.WhereNullMod[Q, enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E] + TempSitecond psql.WhereNullMod[Q, string] + Sitecond psql.WhereNullMod[Q, string] Totalcostprodcut psql.WhereNullMod[Q, float64] Creationdate psql.WhereNullMod[Q, time.Time] Creator psql.WhereNullMod[Q, string] Editdate psql.WhereNullMod[Q, time.Time] Editor psql.WhereNullMod[Q, string] Targetspecies psql.WhereNullMod[Q, string] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerTreatmentWhere[Q]) AliasedAs(alias string) fieldseekerTreatmentWhere[Q] { @@ -1694,28 +1865,28 @@ func (fieldseekerTreatmentWhere[Q]) AliasedAs(alias string) fieldseekerTreatment func buildFieldseekerTreatmentWhere[Q psql.Filterable](cols fieldseekerTreatmentColumns) fieldseekerTreatmentWhere[Q] { return fieldseekerTreatmentWhere[Q]{ Objectid: psql.Where[Q, int64](cols.Objectid), - Activity: psql.WhereNull[Q, enums.FieldseekerTreatmentMosquitoactivityEnum](cols.Activity), + Activity: psql.WhereNull[Q, string](cols.Activity), Treatarea: psql.WhereNull[Q, float64](cols.Treatarea), - Areaunit: psql.WhereNull[Q, enums.FieldseekerTreatmentMosquitoproductareaunitEnum](cols.Areaunit), + Areaunit: psql.WhereNull[Q, string](cols.Areaunit), Product: psql.WhereNull[Q, string](cols.Product), Qty: psql.WhereNull[Q, float64](cols.Qty), - Qtyunit: psql.WhereNull[Q, enums.FieldseekerTreatmentMosquitoproductmeasureunitEnum](cols.Qtyunit), - Method: psql.WhereNull[Q, enums.FieldseekerTreatmentTreatmentMethodD558ca3ccf43440c8160758253967621Enu](cols.Method), - Equiptype: psql.WhereNull[Q, enums.FieldseekerTreatmentTreatmentEquiptype45694D79FF2142CCBe4fA0d1def4f](cols.Equiptype), + Qtyunit: psql.WhereNull[Q, string](cols.Qtyunit), + Method: psql.WhereNull[Q, string](cols.Method), + Equiptype: psql.WhereNull[Q, string](cols.Equiptype), Comments: psql.WhereNull[Q, string](cols.Comments), Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), - Winddir: psql.WhereNull[Q, enums.FieldseekerTreatmentNotinuiwinddirectionEnum](cols.Winddir), + Winddir: psql.WhereNull[Q, string](cols.Winddir), Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), Startdatetime: psql.WhereNull[Q, time.Time](cols.Startdatetime), Enddatetime: psql.WhereNull[Q, time.Time](cols.Enddatetime), InspID: psql.WhereNull[Q, uuid.UUID](cols.InspID), - Reviewed: psql.WhereNull[Q, enums.FieldseekerTreatmentNotinuitFEnum](cols.Reviewed), + Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), Revieweddate: psql.WhereNull[Q, time.Time](cols.Revieweddate), Locationname: psql.WhereNull[Q, string](cols.Locationname), Zone: psql.WhereNull[Q, string](cols.Zone), - Warningoverride: psql.WhereNull[Q, enums.FieldseekerTreatmentNotinuitFEnum](cols.Warningoverride), + Warningoverride: psql.WhereNull[Q, int16](cols.Warningoverride), Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), Zone2: psql.WhereNull[Q, string](cols.Zone2), Treatacres: psql.WhereNull[Q, float64](cols.Treatacres), @@ -1736,17 +1907,165 @@ func buildFieldseekerTreatmentWhere[Q psql.Filterable](cols fieldseekerTreatment Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), Ptaid: psql.WhereNull[Q, uuid.UUID](cols.Ptaid), Flowrate: psql.WhereNull[Q, float64](cols.Flowrate), - Habitat: psql.WhereNull[Q, enums.FieldseekerTreatmentTreatmentHabitat0afee7ebF9ea47078483Cccfe60f0d1](cols.Habitat), + Habitat: psql.WhereNull[Q, string](cols.Habitat), Treathectares: psql.WhereNull[Q, float64](cols.Treathectares), Invloc: psql.WhereNull[Q, string](cols.Invloc), - TempSitecond: psql.WhereNull[Q, enums.FieldseekerTreatmentTreatmentSitecondF812e1f64dcb4dc9a75da9d00abe6169E](cols.TempSitecond), - Sitecond: psql.WhereNull[Q, enums.FieldseekerTreatmentTreatmentSitecond5a15bf36fa124280b961f31cd1a9b571E](cols.Sitecond), + TempSitecond: psql.WhereNull[Q, string](cols.TempSitecond), + Sitecond: psql.WhereNull[Q, string](cols.Sitecond), Totalcostprodcut: psql.WhereNull[Q, float64](cols.Totalcostprodcut), Creationdate: psql.WhereNull[Q, time.Time](cols.Creationdate), Creator: psql.WhereNull[Q, string](cols.Creator), Editdate: psql.WhereNull[Q, time.Time](cols.Editdate), Editor: psql.WhereNull[Q, string](cols.Editor), Targetspecies: psql.WhereNull[Q, string](cols.Targetspecies), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerTreatment) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerTreatment cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Treatments = FieldseekerTreatmentSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerTreatment has no relationship %q", name) + } +} + +type fieldseekerTreatmentPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerTreatmentPreloader() fieldseekerTreatmentPreloader { + return fieldseekerTreatmentPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerTreatments, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerTreatmentThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerTreatmentThenLoader[Q orm.Loadable]() fieldseekerTreatmentThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerTreatmentThenLoader[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 fieldseekerTreatment's Organization into the .R struct +func (o *FieldseekerTreatment) 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.Treatments = FieldseekerTreatmentSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerTreatment's Organization into the .R struct +func (os FieldseekerTreatmentSlice) 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.Treatments = append(rel.R.Treatments, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerTreatmentJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerTreatmentJoins[Q]) aliasedAs(alias string) fieldseekerTreatmentJoins[Q] { + return buildFieldseekerTreatmentJoins[Q](buildFieldseekerTreatmentColumns(alias), j.typ) +} + +func buildFieldseekerTreatmentJoins[Q dialect.Joinable](cols fieldseekerTreatmentColumns, typ string) fieldseekerTreatmentJoins[Q] { + return fieldseekerTreatmentJoins[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/db/models/fieldseeker.treatmentarea.bob.go b/db/models/fieldseeker.treatmentarea.bob.go index 23155680..2c2c14e2 100644 --- a/db/models/fieldseeker.treatmentarea.bob.go +++ b/db/models/fieldseeker.treatmentarea.bob.go @@ -1,17 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -19,31 +21,55 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerTreatmentarea is an object representing the database table. type FieldseekerTreatmentarea struct { - Objectid int64 `db:"objectid,pk" ` - TreatID null.Val[uuid.UUID] `db:"treat_id" ` + Objectid int64 `db:"objectid,pk" ` + // Original attribute from ArcGIS API is TREAT_ID + TreatID null.Val[uuid.UUID] `db:"treat_id" ` + // Original attribute from ArcGIS API is SESSION_ID SessionID null.Val[uuid.UUID] `db:"session_id" ` - // Treatment Date - Treatdate null.Val[time.Time] `db:"treatdate" ` - Comments null.Val[string] `db:"comments" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is TREATDATE + Treatdate null.Val[time.Time] `db:"treatdate" ` + // Original attribute from ArcGIS API is COMMENTS + Comments null.Val[string] `db:"comments" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - Notified null.Val[int16] `db:"notified" ` - Type null.Val[string] `db:"type" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is Notified + Notified null.Val[int16] `db:"notified" ` + // Original attribute from ArcGIS API is Type + Type null.Val[string] `db:"type" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is Shape__Area + ShapeArea null.Val[float64] `db:"shape__area" ` + // Original attribute from ArcGIS API is Shape__Length + ShapeLength null.Val[float64] `db:"shape__length" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerTreatmentareaR `db:"-" ` } // FieldseekerTreatmentareaSlice is an alias for a slice of pointers to FieldseekerTreatmentarea. @@ -56,10 +82,15 @@ var FieldseekerTreatmentareas = psql.NewTablex[*FieldseekerTreatmentarea, Fields // FieldseekerTreatmentareasQuery is a query on the treatmentarea table type FieldseekerTreatmentareasQuery = *psql.ViewQuery[*FieldseekerTreatmentarea, FieldseekerTreatmentareaSlice] +// fieldseekerTreatmentareaR is where relationships are stored. +type fieldseekerTreatmentareaR struct { + Organization *Organization // fieldseeker.treatmentarea.treatmentarea_organization_id_fkey +} + func buildFieldseekerTreatmentareaColumns(alias string) fieldseekerTreatmentareaColumns { return fieldseekerTreatmentareaColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "treat_id", "session_id", "treatdate", "comments", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "notified", "type", "creationdate", "creator", "editdate", "editor", "shape__area", "shape__length", "version", + "objectid", "treat_id", "session_id", "treatdate", "comments", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "notified", "type", "creationdate", "creator", "editdate", "editor", "shape__area", "shape__length", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.treatmentarea"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -80,7 +111,10 @@ func buildFieldseekerTreatmentareaColumns(alias string) fieldseekerTreatmentarea Editor: psql.Quote(alias, "editor"), ShapeArea: psql.Quote(alias, "shape__area"), ShapeLength: psql.Quote(alias, "shape__length"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -105,7 +139,10 @@ type fieldseekerTreatmentareaColumns struct { Editor psql.Expression ShapeArea psql.Expression ShapeLength psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerTreatmentareaColumns) Alias() string { @@ -120,29 +157,32 @@ func (fieldseekerTreatmentareaColumns) AliasedAs(alias string) fieldseekerTreatm // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerTreatmentareaSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - TreatID omitnull.Val[uuid.UUID] `db:"treat_id" ` - SessionID omitnull.Val[uuid.UUID] `db:"session_id" ` - Treatdate omitnull.Val[time.Time] `db:"treatdate" ` - Comments omitnull.Val[string] `db:"comments" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Notified omitnull.Val[int16] `db:"notified" ` - Type omitnull.Val[string] `db:"type" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + TreatID omitnull.Val[uuid.UUID] `db:"treat_id" ` + SessionID omitnull.Val[uuid.UUID] `db:"session_id" ` + Treatdate omitnull.Val[time.Time] `db:"treatdate" ` + Comments omitnull.Val[string] `db:"comments" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Notified omitnull.Val[int16] `db:"notified" ` + Type omitnull.Val[string] `db:"type" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + ShapeArea omitnull.Val[float64] `db:"shape__area" ` + ShapeLength omitnull.Val[float64] `db:"shape__length" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerTreatmentareaSetter) SetColumns() []string { - vals := make([]string, 0, 19) + vals := make([]string, 0, 22) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -197,9 +237,18 @@ func (s FieldseekerTreatmentareaSetter) SetColumns() []string { if !s.ShapeLength.IsUnset() { vals = append(vals, "shape__length") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -258,9 +307,18 @@ func (s FieldseekerTreatmentareaSetter) Overwrite(t *FieldseekerTreatmentarea) { if !s.ShapeLength.IsUnset() { t.ShapeLength = s.ShapeLength.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerTreatmentareaSetter) Apply(q *dialect.InsertQuery) { @@ -269,7 +327,7 @@ func (s *FieldseekerTreatmentareaSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 19) + vals := make([]bob.Expression, 22) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -378,12 +436,30 @@ func (s *FieldseekerTreatmentareaSetter) Apply(q *dialect.InsertQuery) { vals[17] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[18] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[18] = psql.Arg(s.Geometry.MustGet()) } else { vals[18] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[19] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[19] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[20] = psql.Arg(s.Version.MustGet()) + } else { + vals[20] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[21] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[21] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -393,7 +469,7 @@ func (s FieldseekerTreatmentareaSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery } func (s FieldseekerTreatmentareaSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 19) + exprs := make([]bob.Expression, 0, 22) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -521,6 +597,20 @@ func (s FieldseekerTreatmentareaSetter) Expressions(prefix ...string) []bob.Expr }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -528,6 +618,13 @@ func (s FieldseekerTreatmentareaSetter) Expressions(prefix ...string) []bob.Expr }}) } + 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 } @@ -595,6 +692,7 @@ func (o *FieldseekerTreatmentarea) Update(ctx context.Context, exec bob.Executor return err } + o.R = v.R *o = *v return nil @@ -615,7 +713,7 @@ func (o *FieldseekerTreatmentarea) Reload(ctx context.Context, exec bob.Executor if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -665,7 +763,7 @@ func (o FieldseekerTreatmentareaSlice) copyMatchingRows(from ...*FieldseekerTrea if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -763,6 +861,78 @@ func (o FieldseekerTreatmentareaSlice) ReloadAll(ctx context.Context, exec bob.E return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerTreatmentarea) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerTreatmentareaSlice) 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 attachFieldseekerTreatmentareaOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerTreatmentarea0 *FieldseekerTreatmentarea, organization1 *Organization) (*FieldseekerTreatmentarea, error) { + setter := &FieldseekerTreatmentareaSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerTreatmentarea0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerTreatmentareaOrganization0: %w", err) + } + + return fieldseekerTreatmentarea0, nil +} + +func (fieldseekerTreatmentarea0 *FieldseekerTreatmentarea) 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 = attachFieldseekerTreatmentareaOrganization0(ctx, exec, 1, fieldseekerTreatmentarea0, organization1) + if err != nil { + return err + } + + fieldseekerTreatmentarea0.R.Organization = organization1 + + organization1.R.Treatmentareas = append(organization1.R.Treatmentareas, fieldseekerTreatmentarea0) + + return nil +} + +func (fieldseekerTreatmentarea0 *FieldseekerTreatmentarea) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerTreatmentareaOrganization0(ctx, exec, 1, fieldseekerTreatmentarea0, organization1) + if err != nil { + return err + } + + fieldseekerTreatmentarea0.R.Organization = organization1 + + organization1.R.Treatmentareas = append(organization1.R.Treatmentareas, fieldseekerTreatmentarea0) + + return nil +} + type fieldseekerTreatmentareaWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] TreatID psql.WhereNullMod[Q, uuid.UUID] @@ -782,7 +952,10 @@ type fieldseekerTreatmentareaWhere[Q psql.Filterable] struct { Editor psql.WhereNullMod[Q, string] ShapeArea psql.WhereNullMod[Q, float64] ShapeLength psql.WhereNullMod[Q, float64] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerTreatmentareaWhere[Q]) AliasedAs(alias string) fieldseekerTreatmentareaWhere[Q] { @@ -809,6 +982,154 @@ func buildFieldseekerTreatmentareaWhere[Q psql.Filterable](cols fieldseekerTreat Editor: psql.WhereNull[Q, string](cols.Editor), ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerTreatmentarea) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerTreatmentarea cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Treatmentareas = FieldseekerTreatmentareaSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerTreatmentarea has no relationship %q", name) + } +} + +type fieldseekerTreatmentareaPreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerTreatmentareaPreloader() fieldseekerTreatmentareaPreloader { + return fieldseekerTreatmentareaPreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerTreatmentareas, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerTreatmentareaThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerTreatmentareaThenLoader[Q orm.Loadable]() fieldseekerTreatmentareaThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerTreatmentareaThenLoader[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 fieldseekerTreatmentarea's Organization into the .R struct +func (o *FieldseekerTreatmentarea) 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.Treatmentareas = FieldseekerTreatmentareaSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerTreatmentarea's Organization into the .R struct +func (os FieldseekerTreatmentareaSlice) 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.Treatmentareas = append(rel.R.Treatmentareas, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerTreatmentareaJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerTreatmentareaJoins[Q]) aliasedAs(alias string) fieldseekerTreatmentareaJoins[Q] { + return buildFieldseekerTreatmentareaJoins[Q](buildFieldseekerTreatmentareaColumns(alias), j.typ) +} + +func buildFieldseekerTreatmentareaJoins[Q dialect.Joinable](cols fieldseekerTreatmentareaColumns, typ string) fieldseekerTreatmentareaJoins[Q] { + return fieldseekerTreatmentareaJoins[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/db/models/fieldseeker.zones.bob.go b/db/models/fieldseeker.zones.bob.go index f586dee3..60d42338 100644 --- a/db/models/fieldseeker.zones.bob.go +++ b/db/models/fieldseeker.zones.bob.go @@ -1,17 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -19,27 +21,47 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerZone is an object representing the database table. type FieldseekerZone struct { Objectid int64 `db:"objectid,pk" ` - // Name - Name null.Val[string] `db:"name" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is NAME + Name null.Val[string] `db:"name" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - Active null.Val[int32] `db:"active" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is ACTIVE + Active null.Val[int32] `db:"active" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is Shape__Area + ShapeArea null.Val[float64] `db:"shape__area" ` + // Original attribute from ArcGIS API is Shape__Length + ShapeLength null.Val[float64] `db:"shape__length" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerZoneR `db:"-" ` } // FieldseekerZoneSlice is an alias for a slice of pointers to FieldseekerZone. @@ -52,10 +74,15 @@ var FieldseekerZones = psql.NewTablex[*FieldseekerZone, FieldseekerZoneSlice, *F // FieldseekerZonesQuery is a query on the zones table type FieldseekerZonesQuery = *psql.ViewQuery[*FieldseekerZone, FieldseekerZoneSlice] +// fieldseekerZoneR is where relationships are stored. +type fieldseekerZoneR struct { + Organization *Organization // fieldseeker.zones.zones_organization_id_fkey +} + func buildFieldseekerZoneColumns(alias string) fieldseekerZoneColumns { return fieldseekerZoneColumns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "name", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "active", "creationdate", "creator", "editdate", "editor", "shape__area", "shape__length", "version", + "objectid", "name", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "active", "creationdate", "creator", "editdate", "editor", "shape__area", "shape__length", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.zones"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -72,7 +99,10 @@ func buildFieldseekerZoneColumns(alias string) fieldseekerZoneColumns { Editor: psql.Quote(alias, "editor"), ShapeArea: psql.Quote(alias, "shape__area"), ShapeLength: psql.Quote(alias, "shape__length"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -93,7 +123,10 @@ type fieldseekerZoneColumns struct { Editor psql.Expression ShapeArea psql.Expression ShapeLength psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerZoneColumns) Alias() string { @@ -108,25 +141,28 @@ func (fieldseekerZoneColumns) AliasedAs(alias string) fieldseekerZoneColumns { // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerZoneSetter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Name omitnull.Val[string] `db:"name" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Active omitnull.Val[int32] `db:"active" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Name omitnull.Val[string] `db:"name" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Active omitnull.Val[int32] `db:"active" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + ShapeArea omitnull.Val[float64] `db:"shape__area" ` + ShapeLength omitnull.Val[float64] `db:"shape__length" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerZoneSetter) SetColumns() []string { - vals := make([]string, 0, 15) + vals := make([]string, 0, 18) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -169,9 +205,18 @@ func (s FieldseekerZoneSetter) SetColumns() []string { if !s.ShapeLength.IsUnset() { vals = append(vals, "shape__length") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -218,9 +263,18 @@ func (s FieldseekerZoneSetter) Overwrite(t *FieldseekerZone) { if !s.ShapeLength.IsUnset() { t.ShapeLength = s.ShapeLength.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerZoneSetter) Apply(q *dialect.InsertQuery) { @@ -229,7 +283,7 @@ func (s *FieldseekerZoneSetter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 15) + vals := make([]bob.Expression, 18) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -314,12 +368,30 @@ func (s *FieldseekerZoneSetter) Apply(q *dialect.InsertQuery) { vals[13] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[14] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[14] = psql.Arg(s.Geometry.MustGet()) } else { vals[14] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[15] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[16] = psql.Arg(s.Version.MustGet()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[17] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[17] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -329,7 +401,7 @@ func (s FieldseekerZoneSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s FieldseekerZoneSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 15) + exprs := make([]bob.Expression, 0, 18) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -429,6 +501,20 @@ func (s FieldseekerZoneSetter) Expressions(prefix ...string) []bob.Expression { }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -436,6 +522,13 @@ func (s FieldseekerZoneSetter) Expressions(prefix ...string) []bob.Expression { }}) } + 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 } @@ -503,6 +596,7 @@ func (o *FieldseekerZone) Update(ctx context.Context, exec bob.Executor, s *Fiel return err } + o.R = v.R *o = *v return nil @@ -523,7 +617,7 @@ func (o *FieldseekerZone) Reload(ctx context.Context, exec bob.Executor) error { if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -573,7 +667,7 @@ func (o FieldseekerZoneSlice) copyMatchingRows(from ...*FieldseekerZone) { if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -671,6 +765,78 @@ func (o FieldseekerZoneSlice) ReloadAll(ctx context.Context, exec bob.Executor) return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerZone) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerZoneSlice) 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 attachFieldseekerZoneOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerZone0 *FieldseekerZone, organization1 *Organization) (*FieldseekerZone, error) { + setter := &FieldseekerZoneSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerZone0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerZoneOrganization0: %w", err) + } + + return fieldseekerZone0, nil +} + +func (fieldseekerZone0 *FieldseekerZone) 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 = attachFieldseekerZoneOrganization0(ctx, exec, 1, fieldseekerZone0, organization1) + if err != nil { + return err + } + + fieldseekerZone0.R.Organization = organization1 + + organization1.R.Zones = append(organization1.R.Zones, fieldseekerZone0) + + return nil +} + +func (fieldseekerZone0 *FieldseekerZone) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerZoneOrganization0(ctx, exec, 1, fieldseekerZone0, organization1) + if err != nil { + return err + } + + fieldseekerZone0.R.Organization = organization1 + + organization1.R.Zones = append(organization1.R.Zones, fieldseekerZone0) + + return nil +} + type fieldseekerZoneWhere[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] Name psql.WhereNullMod[Q, string] @@ -686,7 +852,10 @@ type fieldseekerZoneWhere[Q psql.Filterable] struct { Editor psql.WhereNullMod[Q, string] ShapeArea psql.WhereNullMod[Q, float64] ShapeLength psql.WhereNullMod[Q, float64] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerZoneWhere[Q]) AliasedAs(alias string) fieldseekerZoneWhere[Q] { @@ -709,6 +878,154 @@ func buildFieldseekerZoneWhere[Q psql.Filterable](cols fieldseekerZoneColumns) f Editor: psql.WhereNull[Q, string](cols.Editor), ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerZone) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerZone cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Zones = FieldseekerZoneSlice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerZone has no relationship %q", name) + } +} + +type fieldseekerZonePreloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerZonePreloader() fieldseekerZonePreloader { + return fieldseekerZonePreloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerZones, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerZoneThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerZoneThenLoader[Q orm.Loadable]() fieldseekerZoneThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerZoneThenLoader[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 fieldseekerZone's Organization into the .R struct +func (o *FieldseekerZone) 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.Zones = FieldseekerZoneSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerZone's Organization into the .R struct +func (os FieldseekerZoneSlice) 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.Zones = append(rel.R.Zones, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerZoneJoins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerZoneJoins[Q]) aliasedAs(alias string) fieldseekerZoneJoins[Q] { + return buildFieldseekerZoneJoins[Q](buildFieldseekerZoneColumns(alias), j.typ) +} + +func buildFieldseekerZoneJoins[Q dialect.Joinable](cols fieldseekerZoneColumns, typ string) fieldseekerZoneJoins[Q] { + return fieldseekerZoneJoins[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/db/models/fieldseeker.zones2.bob.go b/db/models/fieldseeker.zones2.bob.go index a36ccb87..475e01d2 100644 --- a/db/models/fieldseeker.zones2.bob.go +++ b/db/models/fieldseeker.zones2.bob.go @@ -1,17 +1,19 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" + "encoding/json" + "fmt" "io" "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" - "github.com/gofrs/uuid/v5" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -19,26 +21,45 @@ import ( "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" + "github.com/stephenafamo/bob/types/pgtypes" ) // FieldseekerZones2 is an object representing the database table. type FieldseekerZones2 struct { Objectid int64 `db:"objectid,pk" ` - // Name - Name null.Val[string] `db:"name" ` - Globalid null.Val[uuid.UUID] `db:"globalid" ` - CreatedUser null.Val[string] `db:"created_user" ` - CreatedDate null.Val[time.Time] `db:"created_date" ` - LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is NAME + Name null.Val[string] `db:"name" ` + // Original attribute from ArcGIS API is GlobalID + Globalid null.Val[uuid.UUID] `db:"globalid" ` + // Original attribute from ArcGIS API is created_user + CreatedUser null.Val[string] `db:"created_user" ` + // Original attribute from ArcGIS API is created_date + CreatedDate null.Val[time.Time] `db:"created_date" ` + // Original attribute from ArcGIS API is last_edited_user + LastEditedUser null.Val[string] `db:"last_edited_user" ` + // Original attribute from ArcGIS API is last_edited_date LastEditedDate null.Val[time.Time] `db:"last_edited_date" ` - Creationdate null.Val[time.Time] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[time.Time] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - // Tracks version changes to the row. Increases when data is modified. - Version int32 `db:"version,pk" ` + // Original attribute from ArcGIS API is CreationDate + Creationdate null.Val[time.Time] `db:"creationdate" ` + // Original attribute from ArcGIS API is Creator + Creator null.Val[string] `db:"creator" ` + // Original attribute from ArcGIS API is EditDate + Editdate null.Val[time.Time] `db:"editdate" ` + // Original attribute from ArcGIS API is Editor + Editor null.Val[string] `db:"editor" ` + // Original attribute from ArcGIS API is Shape__Area + ShapeArea null.Val[float64] `db:"shape__area" ` + // Original attribute from ArcGIS API is Shape__Length + ShapeLength null.Val[float64] `db:"shape__length" ` + Geometry types.JSON[json.RawMessage] `db:"geometry" ` + Geospatial null.Val[string] `db:"geospatial" ` + Version int32 `db:"version,pk" ` + OrganizationID int32 `db:"organization_id" ` + + R fieldseekerZones2R `db:"-" ` } // FieldseekerZones2Slice is an alias for a slice of pointers to FieldseekerZones2. @@ -51,10 +72,15 @@ var FieldseekerZones2s = psql.NewTablex[*FieldseekerZones2, FieldseekerZones2Sli // FieldseekerZones2sQuery is a query on the zones2 table type FieldseekerZones2sQuery = *psql.ViewQuery[*FieldseekerZones2, FieldseekerZones2Slice] +// fieldseekerZones2R is where relationships are stored. +type fieldseekerZones2R struct { + Organization *Organization // fieldseeker.zones2.zones2_organization_id_fkey +} + func buildFieldseekerZones2Columns(alias string) fieldseekerZones2Columns { return fieldseekerZones2Columns{ ColumnsExpr: expr.NewColumnsExpr( - "objectid", "name", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "creationdate", "creator", "editdate", "editor", "shape__area", "shape__length", "version", + "objectid", "name", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "creationdate", "creator", "editdate", "editor", "shape__area", "shape__length", "geometry", "geospatial", "version", "organization_id", ).WithParent("fieldseeker.zones2"), tableAlias: alias, Objectid: psql.Quote(alias, "objectid"), @@ -70,7 +96,10 @@ func buildFieldseekerZones2Columns(alias string) fieldseekerZones2Columns { Editor: psql.Quote(alias, "editor"), ShapeArea: psql.Quote(alias, "shape__area"), ShapeLength: psql.Quote(alias, "shape__length"), + Geometry: psql.Quote(alias, "geometry"), + Geospatial: psql.Quote(alias, "geospatial"), Version: psql.Quote(alias, "version"), + OrganizationID: psql.Quote(alias, "organization_id"), } } @@ -90,7 +119,10 @@ type fieldseekerZones2Columns struct { Editor psql.Expression ShapeArea psql.Expression ShapeLength psql.Expression + Geometry psql.Expression + Geospatial psql.Expression Version psql.Expression + OrganizationID psql.Expression } func (c fieldseekerZones2Columns) Alias() string { @@ -105,24 +137,27 @@ func (fieldseekerZones2Columns) AliasedAs(alias string) fieldseekerZones2Columns // All values are optional, and do not have to be set // Generated columns are not included type FieldseekerZones2Setter struct { - Objectid omit.Val[int64] `db:"objectid,pk" ` - Name omitnull.Val[string] `db:"name" ` - Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` - CreatedUser omitnull.Val[string] `db:"created_user" ` - CreatedDate omitnull.Val[time.Time] `db:"created_date" ` - LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` - LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` - Creationdate omitnull.Val[time.Time] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[time.Time] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Version omit.Val[int32] `db:"version,pk" ` + Objectid omit.Val[int64] `db:"objectid,pk" ` + Name omitnull.Val[string] `db:"name" ` + Globalid omitnull.Val[uuid.UUID] `db:"globalid" ` + CreatedUser omitnull.Val[string] `db:"created_user" ` + CreatedDate omitnull.Val[time.Time] `db:"created_date" ` + LastEditedUser omitnull.Val[string] `db:"last_edited_user" ` + LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" ` + Creationdate omitnull.Val[time.Time] `db:"creationdate" ` + Creator omitnull.Val[string] `db:"creator" ` + Editdate omitnull.Val[time.Time] `db:"editdate" ` + Editor omitnull.Val[string] `db:"editor" ` + ShapeArea omitnull.Val[float64] `db:"shape__area" ` + ShapeLength omitnull.Val[float64] `db:"shape__length" ` + Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" ` + Geospatial omitnull.Val[string] `db:"geospatial" ` + Version omit.Val[int32] `db:"version,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` } func (s FieldseekerZones2Setter) SetColumns() []string { - vals := make([]string, 0, 14) + vals := make([]string, 0, 17) if s.Objectid.IsValue() { vals = append(vals, "objectid") } @@ -162,9 +197,18 @@ func (s FieldseekerZones2Setter) SetColumns() []string { if !s.ShapeLength.IsUnset() { vals = append(vals, "shape__length") } + if s.Geometry.IsValue() { + vals = append(vals, "geometry") + } + if !s.Geospatial.IsUnset() { + vals = append(vals, "geospatial") + } if s.Version.IsValue() { vals = append(vals, "version") } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } return vals } @@ -208,9 +252,18 @@ func (s FieldseekerZones2Setter) Overwrite(t *FieldseekerZones2) { if !s.ShapeLength.IsUnset() { t.ShapeLength = s.ShapeLength.MustGetNull() } + if s.Geometry.IsValue() { + t.Geometry = s.Geometry.MustGet() + } + if !s.Geospatial.IsUnset() { + t.Geospatial = s.Geospatial.MustGetNull() + } if s.Version.IsValue() { t.Version = s.Version.MustGet() } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } } func (s *FieldseekerZones2Setter) Apply(q *dialect.InsertQuery) { @@ -219,7 +272,7 @@ func (s *FieldseekerZones2Setter) Apply(q *dialect.InsertQuery) { }) q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 14) + vals := make([]bob.Expression, 17) if s.Objectid.IsValue() { vals[0] = psql.Arg(s.Objectid.MustGet()) } else { @@ -298,12 +351,30 @@ func (s *FieldseekerZones2Setter) Apply(q *dialect.InsertQuery) { vals[12] = psql.Raw("DEFAULT") } - if s.Version.IsValue() { - vals[13] = psql.Arg(s.Version.MustGet()) + if s.Geometry.IsValue() { + vals[13] = psql.Arg(s.Geometry.MustGet()) } else { vals[13] = psql.Raw("DEFAULT") } + if !s.Geospatial.IsUnset() { + vals[14] = psql.Arg(s.Geospatial.MustGetNull()) + } else { + vals[14] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[15] = psql.Arg(s.Version.MustGet()) + } else { + vals[15] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[16] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[16] = psql.Raw("DEFAULT") + } + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -313,7 +384,7 @@ func (s FieldseekerZones2Setter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s FieldseekerZones2Setter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 14) + exprs := make([]bob.Expression, 0, 17) if s.Objectid.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -406,6 +477,20 @@ func (s FieldseekerZones2Setter) Expressions(prefix ...string) []bob.Expression }}) } + if s.Geometry.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if !s.Geospatial.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geospatial")...), + psql.Arg(s.Geospatial), + }}) + } + if s.Version.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "version")...), @@ -413,6 +498,13 @@ func (s FieldseekerZones2Setter) Expressions(prefix ...string) []bob.Expression }}) } + 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 } @@ -480,6 +572,7 @@ func (o *FieldseekerZones2) Update(ctx context.Context, exec bob.Executor, s *Fi return err } + o.R = v.R *o = *v return nil @@ -500,7 +593,7 @@ func (o *FieldseekerZones2) Reload(ctx context.Context, exec bob.Executor) error if err != nil { return err } - + o2.R = o.R *o = *o2 return nil @@ -550,7 +643,7 @@ func (o FieldseekerZones2Slice) copyMatchingRows(from ...*FieldseekerZones2) { if new.Version != old.Version { continue } - + new.R = old.R o[i] = new break } @@ -648,6 +741,78 @@ func (o FieldseekerZones2Slice) ReloadAll(ctx context.Context, exec bob.Executor return nil } +// Organization starts a query for related objects on organization +func (o *FieldseekerZones2) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FieldseekerZones2Slice) 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 attachFieldseekerZones2Organization0(ctx context.Context, exec bob.Executor, count int, fieldseekerZones20 *FieldseekerZones2, organization1 *Organization) (*FieldseekerZones2, error) { + setter := &FieldseekerZones2Setter{ + OrganizationID: omit.From(organization1.ID), + } + + err := fieldseekerZones20.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFieldseekerZones2Organization0: %w", err) + } + + return fieldseekerZones20, nil +} + +func (fieldseekerZones20 *FieldseekerZones2) 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 = attachFieldseekerZones2Organization0(ctx, exec, 1, fieldseekerZones20, organization1) + if err != nil { + return err + } + + fieldseekerZones20.R.Organization = organization1 + + organization1.R.Zones2s = append(organization1.R.Zones2s, fieldseekerZones20) + + return nil +} + +func (fieldseekerZones20 *FieldseekerZones2) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFieldseekerZones2Organization0(ctx, exec, 1, fieldseekerZones20, organization1) + if err != nil { + return err + } + + fieldseekerZones20.R.Organization = organization1 + + organization1.R.Zones2s = append(organization1.R.Zones2s, fieldseekerZones20) + + return nil +} + type fieldseekerZones2Where[Q psql.Filterable] struct { Objectid psql.WhereMod[Q, int64] Name psql.WhereNullMod[Q, string] @@ -662,7 +827,10 @@ type fieldseekerZones2Where[Q psql.Filterable] struct { Editor psql.WhereNullMod[Q, string] ShapeArea psql.WhereNullMod[Q, float64] ShapeLength psql.WhereNullMod[Q, float64] + Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]] + Geospatial psql.WhereNullMod[Q, string] Version psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] } func (fieldseekerZones2Where[Q]) AliasedAs(alias string) fieldseekerZones2Where[Q] { @@ -684,6 +852,154 @@ func buildFieldseekerZones2Where[Q psql.Filterable](cols fieldseekerZones2Column Editor: psql.WhereNull[Q, string](cols.Editor), ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), + Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry), + Geospatial: psql.WhereNull[Q, string](cols.Geospatial), Version: psql.Where[Q, int32](cols.Version), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + } +} + +func (o *FieldseekerZones2) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("fieldseekerZones2 cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Zones2s = FieldseekerZones2Slice{o} + } + return nil + default: + return fmt.Errorf("fieldseekerZones2 has no relationship %q", name) + } +} + +type fieldseekerZones2Preloader struct { + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildFieldseekerZones2Preloader() fieldseekerZones2Preloader { + return fieldseekerZones2Preloader{ + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: FieldseekerZones2s, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type fieldseekerZones2ThenLoader[Q orm.Loadable] struct { + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFieldseekerZones2ThenLoader[Q orm.Loadable]() fieldseekerZones2ThenLoader[Q] { + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return fieldseekerZones2ThenLoader[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 fieldseekerZones2's Organization into the .R struct +func (o *FieldseekerZones2) 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.Zones2s = FieldseekerZones2Slice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the fieldseekerZones2's Organization into the .R struct +func (os FieldseekerZones2Slice) 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.Zones2s = append(rel.R.Zones2s, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +type fieldseekerZones2Joins[Q dialect.Joinable] struct { + typ string + Organization modAs[Q, organizationColumns] +} + +func (j fieldseekerZones2Joins[Q]) aliasedAs(alias string) fieldseekerZones2Joins[Q] { + return buildFieldseekerZones2Joins[Q](buildFieldseekerZones2Columns(alias), j.typ) +} + +func buildFieldseekerZones2Joins[Q dialect.Joinable](cols fieldseekerZones2Columns, typ string) fieldseekerZones2Joins[Q] { + return fieldseekerZones2Joins[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/db/models/fieldseeker_sync.bob.go b/db/models/fieldseeker_sync.bob.go index 2063ab7d..9c103541 100644 --- a/db/models/fieldseeker_sync.bob.go +++ b/db/models/fieldseeker_sync.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models diff --git a/db/models/fs_containerrelate.bob.go b/db/models/fs_containerrelate.bob.go deleted file mode 100644 index ab23d1a2..00000000 --- a/db/models/fs_containerrelate.bob.go +++ /dev/null @@ -1,1005 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSContainerrelate is an object representing the database table. -type FSContainerrelate struct { - OrganizationID int32 `db:"organization_id" ` - Containertype null.Val[string] `db:"containertype" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid string `db:"globalid" ` - Inspsampleid null.Val[string] `db:"inspsampleid" ` - Mosquitoinspid null.Val[string] `db:"mosquitoinspid" ` - Objectid int32 `db:"objectid,pk" ` - Treatmentid null.Val[string] `db:"treatmentid" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsContainerrelateR `db:"-" ` -} - -// FSContainerrelateSlice is an alias for a slice of pointers to FSContainerrelate. -// This should almost always be used instead of []*FSContainerrelate. -type FSContainerrelateSlice []*FSContainerrelate - -// FSContainerrelates contains methods to work with the fs_containerrelate table -var FSContainerrelates = psql.NewTablex[*FSContainerrelate, FSContainerrelateSlice, *FSContainerrelateSetter]("", "fs_containerrelate", buildFSContainerrelateColumns("fs_containerrelate")) - -// FSContainerrelatesQuery is a query on the fs_containerrelate table -type FSContainerrelatesQuery = *psql.ViewQuery[*FSContainerrelate, FSContainerrelateSlice] - -// fsContainerrelateR is where relationships are stored. -type fsContainerrelateR struct { - Organization *Organization // fs_containerrelate.fs_containerrelate_organization_id_fkey -} - -func buildFSContainerrelateColumns(alias string) fsContainerrelateColumns { - return fsContainerrelateColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "containertype", "creationdate", "creator", "editdate", "editor", "globalid", "inspsampleid", "mosquitoinspid", "objectid", "treatmentid", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "updated", - ).WithParent("fs_containerrelate"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Containertype: psql.Quote(alias, "containertype"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Inspsampleid: psql.Quote(alias, "inspsampleid"), - Mosquitoinspid: psql.Quote(alias, "mosquitoinspid"), - Objectid: psql.Quote(alias, "objectid"), - Treatmentid: psql.Quote(alias, "treatmentid"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsContainerrelateColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Containertype psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Inspsampleid psql.Expression - Mosquitoinspid psql.Expression - Objectid psql.Expression - Treatmentid psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Updated psql.Expression -} - -func (c fsContainerrelateColumns) Alias() string { - return c.tableAlias -} - -func (fsContainerrelateColumns) AliasedAs(alias string) fsContainerrelateColumns { - return buildFSContainerrelateColumns(alias) -} - -// FSContainerrelateSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSContainerrelateSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Containertype omitnull.Val[string] `db:"containertype" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - 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" ` - Treatmentid omitnull.Val[string] `db:"treatmentid" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSContainerrelateSetter) SetColumns() []string { - vals := make([]string, 0, 18) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Containertype.IsUnset() { - vals = append(vals, "containertype") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Inspsampleid.IsUnset() { - vals = append(vals, "inspsampleid") - } - if !s.Mosquitoinspid.IsUnset() { - vals = append(vals, "mosquitoinspid") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Treatmentid.IsUnset() { - vals = append(vals, "treatmentid") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSContainerrelateSetter) Overwrite(t *FSContainerrelate) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Containertype.IsUnset() { - t.Containertype = s.Containertype.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Inspsampleid.IsUnset() { - t.Inspsampleid = s.Inspsampleid.MustGetNull() - } - if !s.Mosquitoinspid.IsUnset() { - t.Mosquitoinspid = s.Mosquitoinspid.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Treatmentid.IsUnset() { - t.Treatmentid = s.Treatmentid.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSContainerrelateSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSContainerrelates.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 18) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Containertype.IsUnset() { - vals[1] = psql.Arg(s.Containertype.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[2] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[3] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[4] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[5] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[6] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Inspsampleid.IsUnset() { - vals[7] = psql.Arg(s.Inspsampleid.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Mosquitoinspid.IsUnset() { - vals[8] = psql.Arg(s.Mosquitoinspid.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[9] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Treatmentid.IsUnset() { - vals[10] = psql.Arg(s.Treatmentid.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[13] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[14] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[16] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[17] = psql.Arg(s.Updated.MustGet()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSContainerrelateSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSContainerrelateSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 18) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Containertype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "containertype")...), - psql.Arg(s.Containertype), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Inspsampleid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "inspsampleid")...), - psql.Arg(s.Inspsampleid), - }}) - } - - if !s.Mosquitoinspid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "mosquitoinspid")...), - psql.Arg(s.Mosquitoinspid), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Treatmentid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treatmentid")...), - psql.Arg(s.Treatmentid), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSContainerrelate retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSContainerrelate(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSContainerrelate, error) { - if len(cols) == 0 { - return FSContainerrelates.Query( - sm.Where(FSContainerrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSContainerrelates.Query( - sm.Where(FSContainerrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSContainerrelates.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSContainerrelateExists checks the presence of a single record by primary key -func FSContainerrelateExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSContainerrelates.Query( - sm.Where(FSContainerrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSContainerrelate is retrieved from the database -func (o *FSContainerrelate) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSContainerrelates.AfterSelectHooks.RunHooks(ctx, exec, FSContainerrelateSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSContainerrelates.AfterInsertHooks.RunHooks(ctx, exec, FSContainerrelateSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSContainerrelates.AfterUpdateHooks.RunHooks(ctx, exec, FSContainerrelateSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSContainerrelates.AfterDeleteHooks.RunHooks(ctx, exec, FSContainerrelateSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSContainerrelate -func (o *FSContainerrelate) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSContainerrelate) pkEQ() dialect.Expression { - return psql.Quote("fs_containerrelate", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSContainerrelate -func (o *FSContainerrelate) Update(ctx context.Context, exec bob.Executor, s *FSContainerrelateSetter) error { - v, err := FSContainerrelates.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 FSContainerrelate record with an executor -func (o *FSContainerrelate) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSContainerrelates.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSContainerrelate using the executor -func (o *FSContainerrelate) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSContainerrelates.Query( - sm.Where(FSContainerrelates.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSContainerrelateSlice is retrieved from the database -func (o FSContainerrelateSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSContainerrelates.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSContainerrelates.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSContainerrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSContainerrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSContainerrelateSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_containerrelate", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSContainerrelateSlice) copyMatchingRows(from ...*FSContainerrelate) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSContainerrelateSlice) 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 FSContainerrelates.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 *FSContainerrelate: - o.copyMatchingRows(retrieved) - case []*FSContainerrelate: - o.copyMatchingRows(retrieved...) - case FSContainerrelateSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSContainerrelate or a slice of FSContainerrelate - // then run the AfterUpdateHooks on the slice - _, err = FSContainerrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSContainerrelateSlice) 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 FSContainerrelates.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 *FSContainerrelate: - o.copyMatchingRows(retrieved) - case []*FSContainerrelate: - o.copyMatchingRows(retrieved...) - case FSContainerrelateSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSContainerrelate or a slice of FSContainerrelate - // then run the AfterDeleteHooks on the slice - _, err = FSContainerrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSContainerrelateSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSContainerrelateSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSContainerrelates.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSContainerrelateSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSContainerrelates.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSContainerrelateSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSContainerrelates.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 *FSContainerrelate) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSContainerrelateSlice) 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 attachFSContainerrelateOrganization0(ctx context.Context, exec bob.Executor, count int, fsContainerrelate0 *FSContainerrelate, organization1 *Organization) (*FSContainerrelate, error) { - setter := &FSContainerrelateSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsContainerrelate0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSContainerrelateOrganization0: %w", err) - } - - return fsContainerrelate0, nil -} - -func (fsContainerrelate0 *FSContainerrelate) 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 = attachFSContainerrelateOrganization0(ctx, exec, 1, fsContainerrelate0, organization1) - if err != nil { - return err - } - - fsContainerrelate0.R.Organization = organization1 - - organization1.R.FSContainerrelates = append(organization1.R.FSContainerrelates, fsContainerrelate0) - - return nil -} - -func (fsContainerrelate0 *FSContainerrelate) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSContainerrelateOrganization0(ctx, exec, 1, fsContainerrelate0, organization1) - if err != nil { - return err - } - - fsContainerrelate0.R.Organization = organization1 - - organization1.R.FSContainerrelates = append(organization1.R.FSContainerrelates, fsContainerrelate0) - - return nil -} - -type fsContainerrelateWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Containertype psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Inspsampleid psql.WhereNullMod[Q, string] - Mosquitoinspid psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Treatmentid psql.WhereNullMod[Q, string] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsContainerrelateWhere[Q]) AliasedAs(alias string) fsContainerrelateWhere[Q] { - return buildFSContainerrelateWhere[Q](buildFSContainerrelateColumns(alias)) -} - -func buildFSContainerrelateWhere[Q psql.Filterable](cols fsContainerrelateColumns) fsContainerrelateWhere[Q] { - return fsContainerrelateWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Containertype: psql.WhereNull[Q, string](cols.Containertype), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - 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), - Treatmentid: psql.WhereNull[Q, string](cols.Treatmentid), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSContainerrelate) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsContainerrelate cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSContainerrelates = FSContainerrelateSlice{o} - } - return nil - default: - return fmt.Errorf("fsContainerrelate has no relationship %q", name) - } -} - -type fsContainerrelatePreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSContainerrelatePreloader() fsContainerrelatePreloader { - return fsContainerrelatePreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSContainerrelates, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsContainerrelateThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSContainerrelateThenLoader[Q orm.Loadable]() fsContainerrelateThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsContainerrelateThenLoader[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 fsContainerrelate's Organization into the .R struct -func (o *FSContainerrelate) 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.FSContainerrelates = FSContainerrelateSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsContainerrelate's Organization into the .R struct -func (os FSContainerrelateSlice) 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.FSContainerrelates = append(rel.R.FSContainerrelates, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsContainerrelateJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsContainerrelateJoins[Q]) aliasedAs(alias string) fsContainerrelateJoins[Q] { - return buildFSContainerrelateJoins[Q](buildFSContainerrelateColumns(alias), j.typ) -} - -func buildFSContainerrelateJoins[Q dialect.Joinable](cols fsContainerrelateColumns, typ string) fsContainerrelateJoins[Q] { - return fsContainerrelateJoins[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/db/models/fs_fieldscoutinglog.bob.go b/db/models/fs_fieldscoutinglog.bob.go deleted file mode 100644 index 437d98ff..00000000 --- a/db/models/fs_fieldscoutinglog.bob.go +++ /dev/null @@ -1,930 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSFieldscoutinglog is an object representing the database table. -type FSFieldscoutinglog struct { - OrganizationID int32 `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid string `db:"globalid" ` - Objectid int32 `db:"objectid,pk" ` - Status null.Val[int16] `db:"status" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsFieldscoutinglogR `db:"-" ` -} - -// FSFieldscoutinglogSlice is an alias for a slice of pointers to FSFieldscoutinglog. -// This should almost always be used instead of []*FSFieldscoutinglog. -type FSFieldscoutinglogSlice []*FSFieldscoutinglog - -// FSFieldscoutinglogs contains methods to work with the fs_fieldscoutinglog table -var FSFieldscoutinglogs = psql.NewTablex[*FSFieldscoutinglog, FSFieldscoutinglogSlice, *FSFieldscoutinglogSetter]("", "fs_fieldscoutinglog", buildFSFieldscoutinglogColumns("fs_fieldscoutinglog")) - -// FSFieldscoutinglogsQuery is a query on the fs_fieldscoutinglog table -type FSFieldscoutinglogsQuery = *psql.ViewQuery[*FSFieldscoutinglog, FSFieldscoutinglogSlice] - -// fsFieldscoutinglogR is where relationships are stored. -type fsFieldscoutinglogR struct { - Organization *Organization // fs_fieldscoutinglog.fs_fieldscoutinglog_organization_id_fkey -} - -func buildFSFieldscoutinglogColumns(alias string) fsFieldscoutinglogColumns { - return fsFieldscoutinglogColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "objectid", "status", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "updated", - ).WithParent("fs_fieldscoutinglog"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Objectid: psql.Quote(alias, "objectid"), - Status: psql.Quote(alias, "status"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsFieldscoutinglogColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Objectid psql.Expression - Status psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Updated psql.Expression -} - -func (c fsFieldscoutinglogColumns) Alias() string { - return c.tableAlias -} - -func (fsFieldscoutinglogColumns) AliasedAs(alias string) fsFieldscoutinglogColumns { - return buildFSFieldscoutinglogColumns(alias) -} - -// FSFieldscoutinglogSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSFieldscoutinglogSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - 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" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSFieldscoutinglogSetter) SetColumns() []string { - vals := make([]string, 0, 15) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Status.IsUnset() { - vals = append(vals, "status") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSFieldscoutinglogSetter) Overwrite(t *FSFieldscoutinglog) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Status.IsUnset() { - t.Status = s.Status.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSFieldscoutinglogSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSFieldscoutinglogs.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 15) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[1] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[2] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[3] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[4] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[5] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[6] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Status.IsUnset() { - vals[7] = psql.Arg(s.Status.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[8] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[9] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[10] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[11] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[12] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[13] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[14] = psql.Arg(s.Updated.MustGet()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSFieldscoutinglogSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSFieldscoutinglogSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 15) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Status.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "status")...), - psql.Arg(s.Status), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSFieldscoutinglog retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSFieldscoutinglog(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSFieldscoutinglog, error) { - if len(cols) == 0 { - return FSFieldscoutinglogs.Query( - sm.Where(FSFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSFieldscoutinglogs.Query( - sm.Where(FSFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSFieldscoutinglogs.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSFieldscoutinglogExists checks the presence of a single record by primary key -func FSFieldscoutinglogExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSFieldscoutinglogs.Query( - sm.Where(FSFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSFieldscoutinglog is retrieved from the database -func (o *FSFieldscoutinglog) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSFieldscoutinglogs.AfterSelectHooks.RunHooks(ctx, exec, FSFieldscoutinglogSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSFieldscoutinglogs.AfterInsertHooks.RunHooks(ctx, exec, FSFieldscoutinglogSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSFieldscoutinglogs.AfterUpdateHooks.RunHooks(ctx, exec, FSFieldscoutinglogSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSFieldscoutinglogs.AfterDeleteHooks.RunHooks(ctx, exec, FSFieldscoutinglogSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSFieldscoutinglog -func (o *FSFieldscoutinglog) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSFieldscoutinglog) pkEQ() dialect.Expression { - return psql.Quote("fs_fieldscoutinglog", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSFieldscoutinglog -func (o *FSFieldscoutinglog) Update(ctx context.Context, exec bob.Executor, s *FSFieldscoutinglogSetter) error { - v, err := FSFieldscoutinglogs.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 FSFieldscoutinglog record with an executor -func (o *FSFieldscoutinglog) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSFieldscoutinglogs.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSFieldscoutinglog using the executor -func (o *FSFieldscoutinglog) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSFieldscoutinglogs.Query( - sm.Where(FSFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSFieldscoutinglogSlice is retrieved from the database -func (o FSFieldscoutinglogSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSFieldscoutinglogs.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSFieldscoutinglogs.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSFieldscoutinglogs.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSFieldscoutinglogs.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSFieldscoutinglogSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_fieldscoutinglog", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSFieldscoutinglogSlice) copyMatchingRows(from ...*FSFieldscoutinglog) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSFieldscoutinglogSlice) 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 FSFieldscoutinglogs.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 *FSFieldscoutinglog: - o.copyMatchingRows(retrieved) - case []*FSFieldscoutinglog: - o.copyMatchingRows(retrieved...) - case FSFieldscoutinglogSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSFieldscoutinglog or a slice of FSFieldscoutinglog - // then run the AfterUpdateHooks on the slice - _, err = FSFieldscoutinglogs.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSFieldscoutinglogSlice) 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 FSFieldscoutinglogs.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 *FSFieldscoutinglog: - o.copyMatchingRows(retrieved) - case []*FSFieldscoutinglog: - o.copyMatchingRows(retrieved...) - case FSFieldscoutinglogSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSFieldscoutinglog or a slice of FSFieldscoutinglog - // then run the AfterDeleteHooks on the slice - _, err = FSFieldscoutinglogs.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSFieldscoutinglogSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSFieldscoutinglogSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSFieldscoutinglogs.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSFieldscoutinglogSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSFieldscoutinglogs.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSFieldscoutinglogSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSFieldscoutinglogs.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 *FSFieldscoutinglog) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSFieldscoutinglogSlice) 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 attachFSFieldscoutinglogOrganization0(ctx context.Context, exec bob.Executor, count int, fsFieldscoutinglog0 *FSFieldscoutinglog, organization1 *Organization) (*FSFieldscoutinglog, error) { - setter := &FSFieldscoutinglogSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsFieldscoutinglog0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSFieldscoutinglogOrganization0: %w", err) - } - - return fsFieldscoutinglog0, nil -} - -func (fsFieldscoutinglog0 *FSFieldscoutinglog) 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 = attachFSFieldscoutinglogOrganization0(ctx, exec, 1, fsFieldscoutinglog0, organization1) - if err != nil { - return err - } - - fsFieldscoutinglog0.R.Organization = organization1 - - organization1.R.FSFieldscoutinglogs = append(organization1.R.FSFieldscoutinglogs, fsFieldscoutinglog0) - - return nil -} - -func (fsFieldscoutinglog0 *FSFieldscoutinglog) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSFieldscoutinglogOrganization0(ctx, exec, 1, fsFieldscoutinglog0, organization1) - if err != nil { - return err - } - - fsFieldscoutinglog0.R.Organization = organization1 - - organization1.R.FSFieldscoutinglogs = append(organization1.R.FSFieldscoutinglogs, fsFieldscoutinglog0) - - return nil -} - -type fsFieldscoutinglogWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Status psql.WhereNullMod[Q, int16] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsFieldscoutinglogWhere[Q]) AliasedAs(alias string) fsFieldscoutinglogWhere[Q] { - return buildFSFieldscoutinglogWhere[Q](buildFSFieldscoutinglogColumns(alias)) -} - -func buildFSFieldscoutinglogWhere[Q psql.Filterable](cols fsFieldscoutinglogColumns) fsFieldscoutinglogWhere[Q] { - return fsFieldscoutinglogWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - 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), - CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), - GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), - GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSFieldscoutinglog) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsFieldscoutinglog cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSFieldscoutinglogs = FSFieldscoutinglogSlice{o} - } - return nil - default: - return fmt.Errorf("fsFieldscoutinglog has no relationship %q", name) - } -} - -type fsFieldscoutinglogPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSFieldscoutinglogPreloader() fsFieldscoutinglogPreloader { - return fsFieldscoutinglogPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSFieldscoutinglogs, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsFieldscoutinglogThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSFieldscoutinglogThenLoader[Q orm.Loadable]() fsFieldscoutinglogThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsFieldscoutinglogThenLoader[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 fsFieldscoutinglog's Organization into the .R struct -func (o *FSFieldscoutinglog) 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.FSFieldscoutinglogs = FSFieldscoutinglogSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsFieldscoutinglog's Organization into the .R struct -func (os FSFieldscoutinglogSlice) 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.FSFieldscoutinglogs = append(rel.R.FSFieldscoutinglogs, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsFieldscoutinglogJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsFieldscoutinglogJoins[Q]) aliasedAs(alias string) fsFieldscoutinglogJoins[Q] { - return buildFSFieldscoutinglogJoins[Q](buildFSFieldscoutinglogColumns(alias), j.typ) -} - -func buildFSFieldscoutinglogJoins[Q dialect.Joinable](cols fsFieldscoutinglogColumns, typ string) fsFieldscoutinglogJoins[Q] { - return fsFieldscoutinglogJoins[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/db/models/fs_habitatrelate.bob.go b/db/models/fs_habitatrelate.bob.go deleted file mode 100644 index c123cf0b..00000000 --- a/db/models/fs_habitatrelate.bob.go +++ /dev/null @@ -1,955 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSHabitatrelate is an object representing the database table. -type FSHabitatrelate struct { - OrganizationID int32 `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - ForeignID null.Val[string] `db:"foreign_id" ` - Globalid string `db:"globalid" ` - Habitattype null.Val[string] `db:"habitattype" ` - Objectid int32 `db:"objectid,pk" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsHabitatrelateR `db:"-" ` -} - -// FSHabitatrelateSlice is an alias for a slice of pointers to FSHabitatrelate. -// This should almost always be used instead of []*FSHabitatrelate. -type FSHabitatrelateSlice []*FSHabitatrelate - -// FSHabitatrelates contains methods to work with the fs_habitatrelate table -var FSHabitatrelates = psql.NewTablex[*FSHabitatrelate, FSHabitatrelateSlice, *FSHabitatrelateSetter]("", "fs_habitatrelate", buildFSHabitatrelateColumns("fs_habitatrelate")) - -// FSHabitatrelatesQuery is a query on the fs_habitatrelate table -type FSHabitatrelatesQuery = *psql.ViewQuery[*FSHabitatrelate, FSHabitatrelateSlice] - -// fsHabitatrelateR is where relationships are stored. -type fsHabitatrelateR struct { - Organization *Organization // fs_habitatrelate.fs_habitatrelate_organization_id_fkey -} - -func buildFSHabitatrelateColumns(alias string) fsHabitatrelateColumns { - return fsHabitatrelateColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "foreign_id", "globalid", "habitattype", "objectid", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "updated", - ).WithParent("fs_habitatrelate"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - ForeignID: psql.Quote(alias, "foreign_id"), - Globalid: psql.Quote(alias, "globalid"), - Habitattype: psql.Quote(alias, "habitattype"), - Objectid: psql.Quote(alias, "objectid"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsHabitatrelateColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - ForeignID psql.Expression - Globalid psql.Expression - Habitattype psql.Expression - Objectid psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Updated psql.Expression -} - -func (c fsHabitatrelateColumns) Alias() string { - return c.tableAlias -} - -func (fsHabitatrelateColumns) AliasedAs(alias string) fsHabitatrelateColumns { - return buildFSHabitatrelateColumns(alias) -} - -// FSHabitatrelateSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSHabitatrelateSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - ForeignID omitnull.Val[string] `db:"foreign_id" ` - 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" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSHabitatrelateSetter) SetColumns() []string { - vals := make([]string, 0, 16) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.ForeignID.IsUnset() { - vals = append(vals, "foreign_id") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Habitattype.IsUnset() { - vals = append(vals, "habitattype") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSHabitatrelateSetter) Overwrite(t *FSHabitatrelate) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.ForeignID.IsUnset() { - t.ForeignID = s.ForeignID.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Habitattype.IsUnset() { - t.Habitattype = s.Habitattype.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSHabitatrelateSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSHabitatrelates.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 16) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[1] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[2] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[3] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[4] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.ForeignID.IsUnset() { - vals[5] = psql.Arg(s.ForeignID.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[6] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Habitattype.IsUnset() { - vals[7] = psql.Arg(s.Habitattype.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[8] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[9] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[10] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[11] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[12] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[13] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[14] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[15] = psql.Arg(s.Updated.MustGet()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSHabitatrelateSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSHabitatrelateSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 16) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.ForeignID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "foreign_id")...), - psql.Arg(s.ForeignID), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitattype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitattype")...), - psql.Arg(s.Habitattype), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSHabitatrelate retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSHabitatrelate(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSHabitatrelate, error) { - if len(cols) == 0 { - return FSHabitatrelates.Query( - sm.Where(FSHabitatrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSHabitatrelates.Query( - sm.Where(FSHabitatrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSHabitatrelates.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSHabitatrelateExists checks the presence of a single record by primary key -func FSHabitatrelateExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSHabitatrelates.Query( - sm.Where(FSHabitatrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSHabitatrelate is retrieved from the database -func (o *FSHabitatrelate) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSHabitatrelates.AfterSelectHooks.RunHooks(ctx, exec, FSHabitatrelateSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSHabitatrelates.AfterInsertHooks.RunHooks(ctx, exec, FSHabitatrelateSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSHabitatrelates.AfterUpdateHooks.RunHooks(ctx, exec, FSHabitatrelateSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSHabitatrelates.AfterDeleteHooks.RunHooks(ctx, exec, FSHabitatrelateSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSHabitatrelate -func (o *FSHabitatrelate) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSHabitatrelate) pkEQ() dialect.Expression { - return psql.Quote("fs_habitatrelate", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSHabitatrelate -func (o *FSHabitatrelate) Update(ctx context.Context, exec bob.Executor, s *FSHabitatrelateSetter) error { - v, err := FSHabitatrelates.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 FSHabitatrelate record with an executor -func (o *FSHabitatrelate) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSHabitatrelates.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSHabitatrelate using the executor -func (o *FSHabitatrelate) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSHabitatrelates.Query( - sm.Where(FSHabitatrelates.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSHabitatrelateSlice is retrieved from the database -func (o FSHabitatrelateSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSHabitatrelates.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSHabitatrelates.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSHabitatrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSHabitatrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSHabitatrelateSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_habitatrelate", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSHabitatrelateSlice) copyMatchingRows(from ...*FSHabitatrelate) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSHabitatrelateSlice) 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 FSHabitatrelates.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 *FSHabitatrelate: - o.copyMatchingRows(retrieved) - case []*FSHabitatrelate: - o.copyMatchingRows(retrieved...) - case FSHabitatrelateSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSHabitatrelate or a slice of FSHabitatrelate - // then run the AfterUpdateHooks on the slice - _, err = FSHabitatrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSHabitatrelateSlice) 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 FSHabitatrelates.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 *FSHabitatrelate: - o.copyMatchingRows(retrieved) - case []*FSHabitatrelate: - o.copyMatchingRows(retrieved...) - case FSHabitatrelateSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSHabitatrelate or a slice of FSHabitatrelate - // then run the AfterDeleteHooks on the slice - _, err = FSHabitatrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSHabitatrelateSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSHabitatrelateSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSHabitatrelates.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSHabitatrelateSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSHabitatrelates.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSHabitatrelateSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSHabitatrelates.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 *FSHabitatrelate) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSHabitatrelateSlice) 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 attachFSHabitatrelateOrganization0(ctx context.Context, exec bob.Executor, count int, fsHabitatrelate0 *FSHabitatrelate, organization1 *Organization) (*FSHabitatrelate, error) { - setter := &FSHabitatrelateSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsHabitatrelate0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSHabitatrelateOrganization0: %w", err) - } - - return fsHabitatrelate0, nil -} - -func (fsHabitatrelate0 *FSHabitatrelate) 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 = attachFSHabitatrelateOrganization0(ctx, exec, 1, fsHabitatrelate0, organization1) - if err != nil { - return err - } - - fsHabitatrelate0.R.Organization = organization1 - - organization1.R.FSHabitatrelates = append(organization1.R.FSHabitatrelates, fsHabitatrelate0) - - return nil -} - -func (fsHabitatrelate0 *FSHabitatrelate) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSHabitatrelateOrganization0(ctx, exec, 1, fsHabitatrelate0, organization1) - if err != nil { - return err - } - - fsHabitatrelate0.R.Organization = organization1 - - organization1.R.FSHabitatrelates = append(organization1.R.FSHabitatrelates, fsHabitatrelate0) - - return nil -} - -type fsHabitatrelateWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - ForeignID psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Habitattype psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsHabitatrelateWhere[Q]) AliasedAs(alias string) fsHabitatrelateWhere[Q] { - return buildFSHabitatrelateWhere[Q](buildFSHabitatrelateColumns(alias)) -} - -func buildFSHabitatrelateWhere[Q psql.Filterable](cols fsHabitatrelateColumns) fsHabitatrelateWhere[Q] { - return fsHabitatrelateWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - ForeignID: psql.WhereNull[Q, string](cols.ForeignID), - 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), - CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), - GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), - GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSHabitatrelate) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsHabitatrelate cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSHabitatrelates = FSHabitatrelateSlice{o} - } - return nil - default: - return fmt.Errorf("fsHabitatrelate has no relationship %q", name) - } -} - -type fsHabitatrelatePreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSHabitatrelatePreloader() fsHabitatrelatePreloader { - return fsHabitatrelatePreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSHabitatrelates, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsHabitatrelateThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSHabitatrelateThenLoader[Q orm.Loadable]() fsHabitatrelateThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsHabitatrelateThenLoader[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 fsHabitatrelate's Organization into the .R struct -func (o *FSHabitatrelate) 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.FSHabitatrelates = FSHabitatrelateSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsHabitatrelate's Organization into the .R struct -func (os FSHabitatrelateSlice) 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.FSHabitatrelates = append(rel.R.FSHabitatrelates, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsHabitatrelateJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsHabitatrelateJoins[Q]) aliasedAs(alias string) fsHabitatrelateJoins[Q] { - return buildFSHabitatrelateJoins[Q](buildFSHabitatrelateColumns(alias), j.typ) -} - -func buildFSHabitatrelateJoins[Q dialect.Joinable](cols fsHabitatrelateColumns, typ string) fsHabitatrelateJoins[Q] { - return fsHabitatrelateJoins[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/db/models/fs_inspectionsample.bob.go b/db/models/fs_inspectionsample.bob.go deleted file mode 100644 index 3fb5b008..00000000 --- a/db/models/fs_inspectionsample.bob.go +++ /dev/null @@ -1,1005 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSInspectionsample is an object representing the database table. -type FSInspectionsample struct { - OrganizationID int32 `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid string `db:"globalid" ` - Idbytech null.Val[string] `db:"idbytech" ` - InspID null.Val[string] `db:"insp_id" ` - Objectid int32 `db:"objectid,pk" ` - Processed null.Val[int16] `db:"processed" ` - Sampleid null.Val[string] `db:"sampleid" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsInspectionsampleR `db:"-" ` -} - -// FSInspectionsampleSlice is an alias for a slice of pointers to FSInspectionsample. -// This should almost always be used instead of []*FSInspectionsample. -type FSInspectionsampleSlice []*FSInspectionsample - -// FSInspectionsamples contains methods to work with the fs_inspectionsample table -var FSInspectionsamples = psql.NewTablex[*FSInspectionsample, FSInspectionsampleSlice, *FSInspectionsampleSetter]("", "fs_inspectionsample", buildFSInspectionsampleColumns("fs_inspectionsample")) - -// FSInspectionsamplesQuery is a query on the fs_inspectionsample table -type FSInspectionsamplesQuery = *psql.ViewQuery[*FSInspectionsample, FSInspectionsampleSlice] - -// fsInspectionsampleR is where relationships are stored. -type fsInspectionsampleR struct { - Organization *Organization // fs_inspectionsample.fs_inspectionsample_organization_id_fkey -} - -func buildFSInspectionsampleColumns(alias string) fsInspectionsampleColumns { - return fsInspectionsampleColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "idbytech", "insp_id", "objectid", "processed", "sampleid", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "updated", - ).WithParent("fs_inspectionsample"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Idbytech: psql.Quote(alias, "idbytech"), - InspID: psql.Quote(alias, "insp_id"), - Objectid: psql.Quote(alias, "objectid"), - Processed: psql.Quote(alias, "processed"), - Sampleid: psql.Quote(alias, "sampleid"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsInspectionsampleColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Idbytech psql.Expression - InspID psql.Expression - Objectid psql.Expression - Processed psql.Expression - Sampleid psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Updated psql.Expression -} - -func (c fsInspectionsampleColumns) Alias() string { - return c.tableAlias -} - -func (fsInspectionsampleColumns) AliasedAs(alias string) fsInspectionsampleColumns { - return buildFSInspectionsampleColumns(alias) -} - -// FSInspectionsampleSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSInspectionsampleSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - 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" ` - Processed omitnull.Val[int16] `db:"processed" ` - Sampleid omitnull.Val[string] `db:"sampleid" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSInspectionsampleSetter) SetColumns() []string { - vals := make([]string, 0, 18) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Idbytech.IsUnset() { - vals = append(vals, "idbytech") - } - if !s.InspID.IsUnset() { - vals = append(vals, "insp_id") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Processed.IsUnset() { - vals = append(vals, "processed") - } - if !s.Sampleid.IsUnset() { - vals = append(vals, "sampleid") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSInspectionsampleSetter) Overwrite(t *FSInspectionsample) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Idbytech.IsUnset() { - t.Idbytech = s.Idbytech.MustGetNull() - } - if !s.InspID.IsUnset() { - t.InspID = s.InspID.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Processed.IsUnset() { - t.Processed = s.Processed.MustGetNull() - } - if !s.Sampleid.IsUnset() { - t.Sampleid = s.Sampleid.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSInspectionsampleSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSInspectionsamples.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 18) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[1] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[2] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[3] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[4] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[5] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Idbytech.IsUnset() { - vals[6] = psql.Arg(s.Idbytech.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.InspID.IsUnset() { - vals[7] = psql.Arg(s.InspID.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[8] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Processed.IsUnset() { - vals[9] = psql.Arg(s.Processed.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Sampleid.IsUnset() { - vals[10] = psql.Arg(s.Sampleid.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[13] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[14] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[16] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[17] = psql.Arg(s.Updated.MustGet()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSInspectionsampleSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSInspectionsampleSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 18) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Idbytech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "idbytech")...), - psql.Arg(s.Idbytech), - }}) - } - - if !s.InspID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "insp_id")...), - psql.Arg(s.InspID), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Processed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "processed")...), - psql.Arg(s.Processed), - }}) - } - - if !s.Sampleid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sampleid")...), - psql.Arg(s.Sampleid), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSInspectionsample retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSInspectionsample(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSInspectionsample, error) { - if len(cols) == 0 { - return FSInspectionsamples.Query( - sm.Where(FSInspectionsamples.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSInspectionsamples.Query( - sm.Where(FSInspectionsamples.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSInspectionsamples.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSInspectionsampleExists checks the presence of a single record by primary key -func FSInspectionsampleExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSInspectionsamples.Query( - sm.Where(FSInspectionsamples.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSInspectionsample is retrieved from the database -func (o *FSInspectionsample) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSInspectionsamples.AfterSelectHooks.RunHooks(ctx, exec, FSInspectionsampleSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSInspectionsamples.AfterInsertHooks.RunHooks(ctx, exec, FSInspectionsampleSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSInspectionsamples.AfterUpdateHooks.RunHooks(ctx, exec, FSInspectionsampleSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSInspectionsamples.AfterDeleteHooks.RunHooks(ctx, exec, FSInspectionsampleSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSInspectionsample -func (o *FSInspectionsample) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSInspectionsample) pkEQ() dialect.Expression { - return psql.Quote("fs_inspectionsample", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSInspectionsample -func (o *FSInspectionsample) Update(ctx context.Context, exec bob.Executor, s *FSInspectionsampleSetter) error { - v, err := FSInspectionsamples.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 FSInspectionsample record with an executor -func (o *FSInspectionsample) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSInspectionsamples.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSInspectionsample using the executor -func (o *FSInspectionsample) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSInspectionsamples.Query( - sm.Where(FSInspectionsamples.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSInspectionsampleSlice is retrieved from the database -func (o FSInspectionsampleSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSInspectionsamples.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSInspectionsamples.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSInspectionsamples.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSInspectionsamples.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSInspectionsampleSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_inspectionsample", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSInspectionsampleSlice) copyMatchingRows(from ...*FSInspectionsample) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSInspectionsampleSlice) 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 FSInspectionsamples.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 *FSInspectionsample: - o.copyMatchingRows(retrieved) - case []*FSInspectionsample: - o.copyMatchingRows(retrieved...) - case FSInspectionsampleSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSInspectionsample or a slice of FSInspectionsample - // then run the AfterUpdateHooks on the slice - _, err = FSInspectionsamples.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSInspectionsampleSlice) 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 FSInspectionsamples.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 *FSInspectionsample: - o.copyMatchingRows(retrieved) - case []*FSInspectionsample: - o.copyMatchingRows(retrieved...) - case FSInspectionsampleSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSInspectionsample or a slice of FSInspectionsample - // then run the AfterDeleteHooks on the slice - _, err = FSInspectionsamples.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSInspectionsampleSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSInspectionsampleSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSInspectionsamples.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSInspectionsampleSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSInspectionsamples.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSInspectionsampleSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSInspectionsamples.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 *FSInspectionsample) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSInspectionsampleSlice) 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 attachFSInspectionsampleOrganization0(ctx context.Context, exec bob.Executor, count int, fsInspectionsample0 *FSInspectionsample, organization1 *Organization) (*FSInspectionsample, error) { - setter := &FSInspectionsampleSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsInspectionsample0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSInspectionsampleOrganization0: %w", err) - } - - return fsInspectionsample0, nil -} - -func (fsInspectionsample0 *FSInspectionsample) 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 = attachFSInspectionsampleOrganization0(ctx, exec, 1, fsInspectionsample0, organization1) - if err != nil { - return err - } - - fsInspectionsample0.R.Organization = organization1 - - organization1.R.FSInspectionsamples = append(organization1.R.FSInspectionsamples, fsInspectionsample0) - - return nil -} - -func (fsInspectionsample0 *FSInspectionsample) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSInspectionsampleOrganization0(ctx, exec, 1, fsInspectionsample0, organization1) - if err != nil { - return err - } - - fsInspectionsample0.R.Organization = organization1 - - organization1.R.FSInspectionsamples = append(organization1.R.FSInspectionsamples, fsInspectionsample0) - - return nil -} - -type fsInspectionsampleWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Idbytech psql.WhereNullMod[Q, string] - InspID psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Processed psql.WhereNullMod[Q, int16] - Sampleid psql.WhereNullMod[Q, string] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsInspectionsampleWhere[Q]) AliasedAs(alias string) fsInspectionsampleWhere[Q] { - return buildFSInspectionsampleWhere[Q](buildFSInspectionsampleColumns(alias)) -} - -func buildFSInspectionsampleWhere[Q psql.Filterable](cols fsInspectionsampleColumns) fsInspectionsampleWhere[Q] { - return fsInspectionsampleWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - 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), - Processed: psql.WhereNull[Q, int16](cols.Processed), - Sampleid: psql.WhereNull[Q, string](cols.Sampleid), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSInspectionsample) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsInspectionsample cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSInspectionsamples = FSInspectionsampleSlice{o} - } - return nil - default: - return fmt.Errorf("fsInspectionsample has no relationship %q", name) - } -} - -type fsInspectionsamplePreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSInspectionsamplePreloader() fsInspectionsamplePreloader { - return fsInspectionsamplePreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSInspectionsamples, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsInspectionsampleThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSInspectionsampleThenLoader[Q orm.Loadable]() fsInspectionsampleThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsInspectionsampleThenLoader[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 fsInspectionsample's Organization into the .R struct -func (o *FSInspectionsample) 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.FSInspectionsamples = FSInspectionsampleSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsInspectionsample's Organization into the .R struct -func (os FSInspectionsampleSlice) 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.FSInspectionsamples = append(rel.R.FSInspectionsamples, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsInspectionsampleJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsInspectionsampleJoins[Q]) aliasedAs(alias string) fsInspectionsampleJoins[Q] { - return buildFSInspectionsampleJoins[Q](buildFSInspectionsampleColumns(alias), j.typ) -} - -func buildFSInspectionsampleJoins[Q dialect.Joinable](cols fsInspectionsampleColumns, typ string) fsInspectionsampleJoins[Q] { - return fsInspectionsampleJoins[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/db/models/fs_inspectionsampledetail.bob.go b/db/models/fs_inspectionsampledetail.bob.go deleted file mode 100644 index fadd942d..00000000 --- a/db/models/fs_inspectionsampledetail.bob.go +++ /dev/null @@ -1,1280 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSInspectionsampledetail is an object representing the database table. -type FSInspectionsampledetail struct { - OrganizationID int32 `db:"organization_id" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fadultact null.Val[string] `db:"fadultact" ` - Fdomstage null.Val[string] `db:"fdomstage" ` - Feggcount null.Val[int16] `db:"feggcount" ` - Fieldspecies null.Val[string] `db:"fieldspecies" ` - Flarvcount null.Val[int16] `db:"flarvcount" ` - Flstages null.Val[string] `db:"flstages" ` - Fpupcount null.Val[int16] `db:"fpupcount" ` - Globalid string `db:"globalid" ` - InspsampleID null.Val[string] `db:"inspsample_id" ` - Labspecies null.Val[string] `db:"labspecies" ` - Ldomstage null.Val[string] `db:"ldomstage" ` - Leggcount null.Val[int16] `db:"leggcount" ` - Llarvcount null.Val[int16] `db:"llarvcount" ` - Lpupcount null.Val[int16] `db:"lpupcount" ` - Objectid int32 `db:"objectid,pk" ` - Processed null.Val[int16] `db:"processed" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsInspectionsampledetailR `db:"-" ` -} - -// FSInspectionsampledetailSlice is an alias for a slice of pointers to FSInspectionsampledetail. -// This should almost always be used instead of []*FSInspectionsampledetail. -type FSInspectionsampledetailSlice []*FSInspectionsampledetail - -// FSInspectionsampledetails contains methods to work with the fs_inspectionsampledetail table -var FSInspectionsampledetails = psql.NewTablex[*FSInspectionsampledetail, FSInspectionsampledetailSlice, *FSInspectionsampledetailSetter]("", "fs_inspectionsampledetail", buildFSInspectionsampledetailColumns("fs_inspectionsampledetail")) - -// FSInspectionsampledetailsQuery is a query on the fs_inspectionsampledetail table -type FSInspectionsampledetailsQuery = *psql.ViewQuery[*FSInspectionsampledetail, FSInspectionsampledetailSlice] - -// fsInspectionsampledetailR is where relationships are stored. -type fsInspectionsampledetailR struct { - Organization *Organization // fs_inspectionsampledetail.fs_inspectionsampledetail_organization_id_fkey -} - -func buildFSInspectionsampledetailColumns(alias string) fsInspectionsampledetailColumns { - return fsInspectionsampledetailColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "comments", "creationdate", "creator", "editdate", "editor", "fadultact", "fdomstage", "feggcount", "fieldspecies", "flarvcount", "flstages", "fpupcount", "globalid", "inspsample_id", "labspecies", "ldomstage", "leggcount", "llarvcount", "lpupcount", "objectid", "processed", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "updated", - ).WithParent("fs_inspectionsampledetail"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fadultact: psql.Quote(alias, "fadultact"), - Fdomstage: psql.Quote(alias, "fdomstage"), - Feggcount: psql.Quote(alias, "feggcount"), - Fieldspecies: psql.Quote(alias, "fieldspecies"), - Flarvcount: psql.Quote(alias, "flarvcount"), - Flstages: psql.Quote(alias, "flstages"), - Fpupcount: psql.Quote(alias, "fpupcount"), - Globalid: psql.Quote(alias, "globalid"), - InspsampleID: psql.Quote(alias, "inspsample_id"), - Labspecies: psql.Quote(alias, "labspecies"), - Ldomstage: psql.Quote(alias, "ldomstage"), - Leggcount: psql.Quote(alias, "leggcount"), - Llarvcount: psql.Quote(alias, "llarvcount"), - Lpupcount: psql.Quote(alias, "lpupcount"), - Objectid: psql.Quote(alias, "objectid"), - Processed: psql.Quote(alias, "processed"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsInspectionsampledetailColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fadultact psql.Expression - Fdomstage psql.Expression - Feggcount psql.Expression - Fieldspecies psql.Expression - Flarvcount psql.Expression - Flstages psql.Expression - Fpupcount psql.Expression - Globalid psql.Expression - InspsampleID psql.Expression - Labspecies psql.Expression - Ldomstage psql.Expression - Leggcount psql.Expression - Llarvcount psql.Expression - Lpupcount psql.Expression - Objectid psql.Expression - Processed psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Updated psql.Expression -} - -func (c fsInspectionsampledetailColumns) Alias() string { - return c.tableAlias -} - -func (fsInspectionsampledetailColumns) AliasedAs(alias string) fsInspectionsampledetailColumns { - return buildFSInspectionsampledetailColumns(alias) -} - -// FSInspectionsampledetailSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSInspectionsampledetailSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fadultact omitnull.Val[string] `db:"fadultact" ` - Fdomstage omitnull.Val[string] `db:"fdomstage" ` - Feggcount omitnull.Val[int16] `db:"feggcount" ` - Fieldspecies omitnull.Val[string] `db:"fieldspecies" ` - Flarvcount omitnull.Val[int16] `db:"flarvcount" ` - Flstages omitnull.Val[string] `db:"flstages" ` - Fpupcount omitnull.Val[int16] `db:"fpupcount" ` - 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" ` - Leggcount omitnull.Val[int16] `db:"leggcount" ` - Llarvcount omitnull.Val[int16] `db:"llarvcount" ` - Lpupcount omitnull.Val[int16] `db:"lpupcount" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Processed omitnull.Val[int16] `db:"processed" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSInspectionsampledetailSetter) SetColumns() []string { - vals := make([]string, 0, 29) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fadultact.IsUnset() { - vals = append(vals, "fadultact") - } - if !s.Fdomstage.IsUnset() { - vals = append(vals, "fdomstage") - } - if !s.Feggcount.IsUnset() { - vals = append(vals, "feggcount") - } - if !s.Fieldspecies.IsUnset() { - vals = append(vals, "fieldspecies") - } - if !s.Flarvcount.IsUnset() { - vals = append(vals, "flarvcount") - } - if !s.Flstages.IsUnset() { - vals = append(vals, "flstages") - } - if !s.Fpupcount.IsUnset() { - vals = append(vals, "fpupcount") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.InspsampleID.IsUnset() { - vals = append(vals, "inspsample_id") - } - if !s.Labspecies.IsUnset() { - vals = append(vals, "labspecies") - } - if !s.Ldomstage.IsUnset() { - vals = append(vals, "ldomstage") - } - if !s.Leggcount.IsUnset() { - vals = append(vals, "leggcount") - } - if !s.Llarvcount.IsUnset() { - vals = append(vals, "llarvcount") - } - if !s.Lpupcount.IsUnset() { - vals = append(vals, "lpupcount") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Processed.IsUnset() { - vals = append(vals, "processed") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSInspectionsampledetailSetter) Overwrite(t *FSInspectionsampledetail) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fadultact.IsUnset() { - t.Fadultact = s.Fadultact.MustGetNull() - } - if !s.Fdomstage.IsUnset() { - t.Fdomstage = s.Fdomstage.MustGetNull() - } - if !s.Feggcount.IsUnset() { - t.Feggcount = s.Feggcount.MustGetNull() - } - if !s.Fieldspecies.IsUnset() { - t.Fieldspecies = s.Fieldspecies.MustGetNull() - } - if !s.Flarvcount.IsUnset() { - t.Flarvcount = s.Flarvcount.MustGetNull() - } - if !s.Flstages.IsUnset() { - t.Flstages = s.Flstages.MustGetNull() - } - if !s.Fpupcount.IsUnset() { - t.Fpupcount = s.Fpupcount.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.InspsampleID.IsUnset() { - t.InspsampleID = s.InspsampleID.MustGetNull() - } - if !s.Labspecies.IsUnset() { - t.Labspecies = s.Labspecies.MustGetNull() - } - if !s.Ldomstage.IsUnset() { - t.Ldomstage = s.Ldomstage.MustGetNull() - } - if !s.Leggcount.IsUnset() { - t.Leggcount = s.Leggcount.MustGetNull() - } - if !s.Llarvcount.IsUnset() { - t.Llarvcount = s.Llarvcount.MustGetNull() - } - if !s.Lpupcount.IsUnset() { - t.Lpupcount = s.Lpupcount.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Processed.IsUnset() { - t.Processed = s.Processed.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSInspectionsampledetailSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSInspectionsampledetails.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 29) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[1] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[2] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[3] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[4] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[5] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Fadultact.IsUnset() { - vals[6] = psql.Arg(s.Fadultact.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Fdomstage.IsUnset() { - vals[7] = psql.Arg(s.Fdomstage.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Feggcount.IsUnset() { - vals[8] = psql.Arg(s.Feggcount.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Fieldspecies.IsUnset() { - vals[9] = psql.Arg(s.Fieldspecies.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Flarvcount.IsUnset() { - vals[10] = psql.Arg(s.Flarvcount.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Flstages.IsUnset() { - vals[11] = psql.Arg(s.Flstages.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Fpupcount.IsUnset() { - vals[12] = psql.Arg(s.Fpupcount.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[13] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.InspsampleID.IsUnset() { - vals[14] = psql.Arg(s.InspsampleID.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Labspecies.IsUnset() { - vals[15] = psql.Arg(s.Labspecies.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Ldomstage.IsUnset() { - vals[16] = psql.Arg(s.Ldomstage.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Leggcount.IsUnset() { - vals[17] = psql.Arg(s.Leggcount.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Llarvcount.IsUnset() { - vals[18] = psql.Arg(s.Llarvcount.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Lpupcount.IsUnset() { - vals[19] = psql.Arg(s.Lpupcount.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[20] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Processed.IsUnset() { - vals[21] = psql.Arg(s.Processed.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[22] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[23] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[24] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[25] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[26] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[27] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[28] = psql.Arg(s.Updated.MustGet()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSInspectionsampledetailSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSInspectionsampledetailSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 29) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fadultact.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fadultact")...), - psql.Arg(s.Fadultact), - }}) - } - - if !s.Fdomstage.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fdomstage")...), - psql.Arg(s.Fdomstage), - }}) - } - - if !s.Feggcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "feggcount")...), - psql.Arg(s.Feggcount), - }}) - } - - if !s.Fieldspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldspecies")...), - psql.Arg(s.Fieldspecies), - }}) - } - - if !s.Flarvcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "flarvcount")...), - psql.Arg(s.Flarvcount), - }}) - } - - if !s.Flstages.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "flstages")...), - psql.Arg(s.Flstages), - }}) - } - - if !s.Fpupcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fpupcount")...), - psql.Arg(s.Fpupcount), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.InspsampleID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "inspsample_id")...), - psql.Arg(s.InspsampleID), - }}) - } - - if !s.Labspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "labspecies")...), - psql.Arg(s.Labspecies), - }}) - } - - if !s.Ldomstage.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "ldomstage")...), - psql.Arg(s.Ldomstage), - }}) - } - - if !s.Leggcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "leggcount")...), - psql.Arg(s.Leggcount), - }}) - } - - if !s.Llarvcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "llarvcount")...), - psql.Arg(s.Llarvcount), - }}) - } - - if !s.Lpupcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lpupcount")...), - psql.Arg(s.Lpupcount), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Processed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "processed")...), - psql.Arg(s.Processed), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSInspectionsampledetail retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSInspectionsampledetail(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSInspectionsampledetail, error) { - if len(cols) == 0 { - return FSInspectionsampledetails.Query( - sm.Where(FSInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSInspectionsampledetails.Query( - sm.Where(FSInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSInspectionsampledetails.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSInspectionsampledetailExists checks the presence of a single record by primary key -func FSInspectionsampledetailExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSInspectionsampledetails.Query( - sm.Where(FSInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSInspectionsampledetail is retrieved from the database -func (o *FSInspectionsampledetail) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSInspectionsampledetails.AfterSelectHooks.RunHooks(ctx, exec, FSInspectionsampledetailSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSInspectionsampledetails.AfterInsertHooks.RunHooks(ctx, exec, FSInspectionsampledetailSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSInspectionsampledetails.AfterUpdateHooks.RunHooks(ctx, exec, FSInspectionsampledetailSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSInspectionsampledetails.AfterDeleteHooks.RunHooks(ctx, exec, FSInspectionsampledetailSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSInspectionsampledetail -func (o *FSInspectionsampledetail) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSInspectionsampledetail) pkEQ() dialect.Expression { - return psql.Quote("fs_inspectionsampledetail", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSInspectionsampledetail -func (o *FSInspectionsampledetail) Update(ctx context.Context, exec bob.Executor, s *FSInspectionsampledetailSetter) error { - v, err := FSInspectionsampledetails.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 FSInspectionsampledetail record with an executor -func (o *FSInspectionsampledetail) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSInspectionsampledetails.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSInspectionsampledetail using the executor -func (o *FSInspectionsampledetail) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSInspectionsampledetails.Query( - sm.Where(FSInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSInspectionsampledetailSlice is retrieved from the database -func (o FSInspectionsampledetailSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSInspectionsampledetails.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSInspectionsampledetails.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSInspectionsampledetails.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSInspectionsampledetails.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSInspectionsampledetailSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_inspectionsampledetail", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSInspectionsampledetailSlice) copyMatchingRows(from ...*FSInspectionsampledetail) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSInspectionsampledetailSlice) 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 FSInspectionsampledetails.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 *FSInspectionsampledetail: - o.copyMatchingRows(retrieved) - case []*FSInspectionsampledetail: - o.copyMatchingRows(retrieved...) - case FSInspectionsampledetailSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSInspectionsampledetail or a slice of FSInspectionsampledetail - // then run the AfterUpdateHooks on the slice - _, err = FSInspectionsampledetails.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSInspectionsampledetailSlice) 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 FSInspectionsampledetails.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 *FSInspectionsampledetail: - o.copyMatchingRows(retrieved) - case []*FSInspectionsampledetail: - o.copyMatchingRows(retrieved...) - case FSInspectionsampledetailSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSInspectionsampledetail or a slice of FSInspectionsampledetail - // then run the AfterDeleteHooks on the slice - _, err = FSInspectionsampledetails.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSInspectionsampledetailSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSInspectionsampledetailSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSInspectionsampledetails.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSInspectionsampledetailSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSInspectionsampledetails.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSInspectionsampledetailSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSInspectionsampledetails.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 *FSInspectionsampledetail) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSInspectionsampledetailSlice) 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 attachFSInspectionsampledetailOrganization0(ctx context.Context, exec bob.Executor, count int, fsInspectionsampledetail0 *FSInspectionsampledetail, organization1 *Organization) (*FSInspectionsampledetail, error) { - setter := &FSInspectionsampledetailSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsInspectionsampledetail0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSInspectionsampledetailOrganization0: %w", err) - } - - return fsInspectionsampledetail0, nil -} - -func (fsInspectionsampledetail0 *FSInspectionsampledetail) 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 = attachFSInspectionsampledetailOrganization0(ctx, exec, 1, fsInspectionsampledetail0, organization1) - if err != nil { - return err - } - - fsInspectionsampledetail0.R.Organization = organization1 - - organization1.R.FSInspectionsampledetails = append(organization1.R.FSInspectionsampledetails, fsInspectionsampledetail0) - - return nil -} - -func (fsInspectionsampledetail0 *FSInspectionsampledetail) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSInspectionsampledetailOrganization0(ctx, exec, 1, fsInspectionsampledetail0, organization1) - if err != nil { - return err - } - - fsInspectionsampledetail0.R.Organization = organization1 - - organization1.R.FSInspectionsampledetails = append(organization1.R.FSInspectionsampledetails, fsInspectionsampledetail0) - - return nil -} - -type fsInspectionsampledetailWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fadultact psql.WhereNullMod[Q, string] - Fdomstage psql.WhereNullMod[Q, string] - Feggcount psql.WhereNullMod[Q, int16] - Fieldspecies psql.WhereNullMod[Q, string] - Flarvcount psql.WhereNullMod[Q, int16] - Flstages psql.WhereNullMod[Q, string] - Fpupcount psql.WhereNullMod[Q, int16] - Globalid psql.WhereMod[Q, string] - InspsampleID psql.WhereNullMod[Q, string] - Labspecies psql.WhereNullMod[Q, string] - Ldomstage psql.WhereNullMod[Q, string] - Leggcount psql.WhereNullMod[Q, int16] - Llarvcount psql.WhereNullMod[Q, int16] - Lpupcount psql.WhereNullMod[Q, int16] - Objectid psql.WhereMod[Q, int32] - Processed psql.WhereNullMod[Q, int16] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsInspectionsampledetailWhere[Q]) AliasedAs(alias string) fsInspectionsampledetailWhere[Q] { - return buildFSInspectionsampledetailWhere[Q](buildFSInspectionsampledetailColumns(alias)) -} - -func buildFSInspectionsampledetailWhere[Q psql.Filterable](cols fsInspectionsampledetailColumns) fsInspectionsampledetailWhere[Q] { - return fsInspectionsampledetailWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Fadultact: psql.WhereNull[Q, string](cols.Fadultact), - Fdomstage: psql.WhereNull[Q, string](cols.Fdomstage), - Feggcount: psql.WhereNull[Q, int16](cols.Feggcount), - Fieldspecies: psql.WhereNull[Q, string](cols.Fieldspecies), - Flarvcount: psql.WhereNull[Q, int16](cols.Flarvcount), - Flstages: psql.WhereNull[Q, string](cols.Flstages), - Fpupcount: psql.WhereNull[Q, int16](cols.Fpupcount), - 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), - Leggcount: psql.WhereNull[Q, int16](cols.Leggcount), - Llarvcount: psql.WhereNull[Q, int16](cols.Llarvcount), - Lpupcount: psql.WhereNull[Q, int16](cols.Lpupcount), - Objectid: psql.Where[Q, int32](cols.Objectid), - Processed: psql.WhereNull[Q, int16](cols.Processed), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSInspectionsampledetail) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsInspectionsampledetail cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSInspectionsampledetails = FSInspectionsampledetailSlice{o} - } - return nil - default: - return fmt.Errorf("fsInspectionsampledetail has no relationship %q", name) - } -} - -type fsInspectionsampledetailPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSInspectionsampledetailPreloader() fsInspectionsampledetailPreloader { - return fsInspectionsampledetailPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSInspectionsampledetails, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsInspectionsampledetailThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSInspectionsampledetailThenLoader[Q orm.Loadable]() fsInspectionsampledetailThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsInspectionsampledetailThenLoader[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 fsInspectionsampledetail's Organization into the .R struct -func (o *FSInspectionsampledetail) 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.FSInspectionsampledetails = FSInspectionsampledetailSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsInspectionsampledetail's Organization into the .R struct -func (os FSInspectionsampledetailSlice) 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.FSInspectionsampledetails = append(rel.R.FSInspectionsampledetails, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsInspectionsampledetailJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsInspectionsampledetailJoins[Q]) aliasedAs(alias string) fsInspectionsampledetailJoins[Q] { - return buildFSInspectionsampledetailJoins[Q](buildFSInspectionsampledetailColumns(alias), j.typ) -} - -func buildFSInspectionsampledetailJoins[Q dialect.Joinable](cols fsInspectionsampledetailColumns, typ string) fsInspectionsampledetailJoins[Q] { - return fsInspectionsampledetailJoins[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/db/models/fs_linelocation.bob.go b/db/models/fs_linelocation.bob.go deleted file mode 100644 index c3dff36f..00000000 --- a/db/models/fs_linelocation.bob.go +++ /dev/null @@ -1,1855 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSLinelocation is an object representing the database table. -type FSLinelocation struct { - OrganizationID int32 `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Acres null.Val[float64] `db:"acres" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid string `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Hectares null.Val[float64] `db:"hectares" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Larvinspectinterval null.Val[int16] `db:"larvinspectinterval" ` - Lastinspectactiontaken null.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectactivity null.Val[string] `db:"lastinspectactivity" ` - Lastinspectavglarvae null.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae null.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectbreeding null.Val[string] `db:"lastinspectbreeding" ` - Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate null.Val[int64] `db:"lastinspectdate" ` - Lastinspectfieldspecies null.Val[string] `db:"lastinspectfieldspecies" ` - Lastinspectlstages null.Val[string] `db:"lastinspectlstages" ` - Lasttreatactivity null.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate null.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct null.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty null.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit null.Val[string] `db:"lasttreatqtyunit" ` - LengthFT null.Val[float64] `db:"length_ft" ` - LengthMeters null.Val[float64] `db:"length_meters" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Name null.Val[string] `db:"name" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Symbology null.Val[string] `db:"symbology" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - Usetype null.Val[string] `db:"usetype" ` - Waterorigin null.Val[string] `db:"waterorigin" ` - WidthFT null.Val[float64] `db:"width_ft" ` - WidthMeters null.Val[float64] `db:"width_meters" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsLinelocationR `db:"-" ` -} - -// FSLinelocationSlice is an alias for a slice of pointers to FSLinelocation. -// This should almost always be used instead of []*FSLinelocation. -type FSLinelocationSlice []*FSLinelocation - -// FSLinelocations contains methods to work with the fs_linelocation table -var FSLinelocations = psql.NewTablex[*FSLinelocation, FSLinelocationSlice, *FSLinelocationSetter]("", "fs_linelocation", buildFSLinelocationColumns("fs_linelocation")) - -// FSLinelocationsQuery is a query on the fs_linelocation table -type FSLinelocationsQuery = *psql.ViewQuery[*FSLinelocation, FSLinelocationSlice] - -// fsLinelocationR is where relationships are stored. -type fsLinelocationR struct { - Organization *Organization // fs_linelocation.fs_linelocation_organization_id_fkey -} - -func buildFSLinelocationColumns(alias string) fsLinelocationColumns { - return fsLinelocationColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "acres", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "globalid", "habitat", "hectares", "jurisdiction", "larvinspectinterval", "lastinspectactiontaken", "lastinspectactivity", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectbreeding", "lastinspectconditions", "lastinspectdate", "lastinspectfieldspecies", "lastinspectlstages", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "length_ft", "length_meters", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "symbology", "shape__length", "usetype", "waterorigin", "width_ft", "width_meters", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "updated", - ).WithParent("fs_linelocation"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accessdesc: psql.Quote(alias, "accessdesc"), - Acres: psql.Quote(alias, "acres"), - Active: psql.Quote(alias, "active"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Description: psql.Quote(alias, "description"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Habitat: psql.Quote(alias, "habitat"), - Hectares: psql.Quote(alias, "hectares"), - Jurisdiction: psql.Quote(alias, "jurisdiction"), - Larvinspectinterval: psql.Quote(alias, "larvinspectinterval"), - Lastinspectactiontaken: psql.Quote(alias, "lastinspectactiontaken"), - Lastinspectactivity: psql.Quote(alias, "lastinspectactivity"), - Lastinspectavglarvae: psql.Quote(alias, "lastinspectavglarvae"), - Lastinspectavgpupae: psql.Quote(alias, "lastinspectavgpupae"), - Lastinspectbreeding: psql.Quote(alias, "lastinspectbreeding"), - Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), - Lastinspectdate: psql.Quote(alias, "lastinspectdate"), - Lastinspectfieldspecies: psql.Quote(alias, "lastinspectfieldspecies"), - Lastinspectlstages: psql.Quote(alias, "lastinspectlstages"), - Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), - Lasttreatdate: psql.Quote(alias, "lasttreatdate"), - Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), - Lasttreatqty: psql.Quote(alias, "lasttreatqty"), - Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), - LengthFT: psql.Quote(alias, "length_ft"), - LengthMeters: psql.Quote(alias, "length_meters"), - Locationnumber: psql.Quote(alias, "locationnumber"), - Name: psql.Quote(alias, "name"), - Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), - Objectid: psql.Quote(alias, "objectid"), - Priority: psql.Quote(alias, "priority"), - Symbology: psql.Quote(alias, "symbology"), - ShapeLength: psql.Quote(alias, "shape__length"), - Usetype: psql.Quote(alias, "usetype"), - Waterorigin: psql.Quote(alias, "waterorigin"), - WidthFT: psql.Quote(alias, "width_ft"), - WidthMeters: psql.Quote(alias, "width_meters"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsLinelocationColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accessdesc psql.Expression - Acres psql.Expression - Active psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Description psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Habitat psql.Expression - Hectares psql.Expression - Jurisdiction psql.Expression - Larvinspectinterval psql.Expression - Lastinspectactiontaken psql.Expression - Lastinspectactivity psql.Expression - Lastinspectavglarvae psql.Expression - Lastinspectavgpupae psql.Expression - Lastinspectbreeding psql.Expression - Lastinspectconditions psql.Expression - Lastinspectdate psql.Expression - Lastinspectfieldspecies psql.Expression - Lastinspectlstages psql.Expression - Lasttreatactivity psql.Expression - Lasttreatdate psql.Expression - Lasttreatproduct psql.Expression - Lasttreatqty psql.Expression - Lasttreatqtyunit psql.Expression - LengthFT psql.Expression - LengthMeters psql.Expression - Locationnumber psql.Expression - Name psql.Expression - Nextactiondatescheduled psql.Expression - Objectid psql.Expression - Priority psql.Expression - Symbology psql.Expression - ShapeLength psql.Expression - Usetype psql.Expression - Waterorigin psql.Expression - WidthFT psql.Expression - WidthMeters psql.Expression - Zone psql.Expression - Zone2 psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Updated psql.Expression -} - -func (c fsLinelocationColumns) Alias() string { - return c.tableAlias -} - -func (fsLinelocationColumns) AliasedAs(alias string) fsLinelocationColumns { - return buildFSLinelocationColumns(alias) -} - -// FSLinelocationSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSLinelocationSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Acres omitnull.Val[float64] `db:"acres" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omit.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Hectares omitnull.Val[float64] `db:"hectares" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Larvinspectinterval omitnull.Val[int16] `db:"larvinspectinterval" ` - Lastinspectactiontaken omitnull.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectactivity omitnull.Val[string] `db:"lastinspectactivity" ` - Lastinspectavglarvae omitnull.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae omitnull.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectbreeding omitnull.Val[string] `db:"lastinspectbreeding" ` - Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate omitnull.Val[int64] `db:"lastinspectdate" ` - Lastinspectfieldspecies omitnull.Val[string] `db:"lastinspectfieldspecies" ` - Lastinspectlstages omitnull.Val[string] `db:"lastinspectlstages" ` - Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate omitnull.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` - LengthFT omitnull.Val[float64] `db:"length_ft" ` - LengthMeters omitnull.Val[float64] `db:"length_meters" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Name omitnull.Val[string] `db:"name" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Symbology omitnull.Val[string] `db:"symbology" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Usetype omitnull.Val[string] `db:"usetype" ` - Waterorigin omitnull.Val[string] `db:"waterorigin" ` - WidthFT omitnull.Val[float64] `db:"width_ft" ` - WidthMeters omitnull.Val[float64] `db:"width_meters" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSLinelocationSetter) SetColumns() []string { - vals := make([]string, 0, 52) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accessdesc.IsUnset() { - vals = append(vals, "accessdesc") - } - if !s.Acres.IsUnset() { - vals = append(vals, "acres") - } - if !s.Active.IsUnset() { - vals = append(vals, "active") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Description.IsUnset() { - vals = append(vals, "description") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Habitat.IsUnset() { - vals = append(vals, "habitat") - } - if !s.Hectares.IsUnset() { - vals = append(vals, "hectares") - } - if !s.Jurisdiction.IsUnset() { - vals = append(vals, "jurisdiction") - } - if !s.Larvinspectinterval.IsUnset() { - vals = append(vals, "larvinspectinterval") - } - if !s.Lastinspectactiontaken.IsUnset() { - vals = append(vals, "lastinspectactiontaken") - } - if !s.Lastinspectactivity.IsUnset() { - vals = append(vals, "lastinspectactivity") - } - if !s.Lastinspectavglarvae.IsUnset() { - vals = append(vals, "lastinspectavglarvae") - } - if !s.Lastinspectavgpupae.IsUnset() { - vals = append(vals, "lastinspectavgpupae") - } - if !s.Lastinspectbreeding.IsUnset() { - vals = append(vals, "lastinspectbreeding") - } - if !s.Lastinspectconditions.IsUnset() { - vals = append(vals, "lastinspectconditions") - } - if !s.Lastinspectdate.IsUnset() { - vals = append(vals, "lastinspectdate") - } - if !s.Lastinspectfieldspecies.IsUnset() { - vals = append(vals, "lastinspectfieldspecies") - } - if !s.Lastinspectlstages.IsUnset() { - vals = append(vals, "lastinspectlstages") - } - if !s.Lasttreatactivity.IsUnset() { - vals = append(vals, "lasttreatactivity") - } - if !s.Lasttreatdate.IsUnset() { - vals = append(vals, "lasttreatdate") - } - if !s.Lasttreatproduct.IsUnset() { - vals = append(vals, "lasttreatproduct") - } - if !s.Lasttreatqty.IsUnset() { - vals = append(vals, "lasttreatqty") - } - if !s.Lasttreatqtyunit.IsUnset() { - vals = append(vals, "lasttreatqtyunit") - } - if !s.LengthFT.IsUnset() { - vals = append(vals, "length_ft") - } - if !s.LengthMeters.IsUnset() { - vals = append(vals, "length_meters") - } - if !s.Locationnumber.IsUnset() { - vals = append(vals, "locationnumber") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if !s.Nextactiondatescheduled.IsUnset() { - vals = append(vals, "nextactiondatescheduled") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Symbology.IsUnset() { - vals = append(vals, "symbology") - } - if !s.ShapeLength.IsUnset() { - vals = append(vals, "shape__length") - } - if !s.Usetype.IsUnset() { - vals = append(vals, "usetype") - } - if !s.Waterorigin.IsUnset() { - vals = append(vals, "waterorigin") - } - if !s.WidthFT.IsUnset() { - vals = append(vals, "width_ft") - } - if !s.WidthMeters.IsUnset() { - vals = append(vals, "width_meters") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSLinelocationSetter) Overwrite(t *FSLinelocation) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accessdesc.IsUnset() { - t.Accessdesc = s.Accessdesc.MustGetNull() - } - if !s.Acres.IsUnset() { - t.Acres = s.Acres.MustGetNull() - } - if !s.Active.IsUnset() { - t.Active = s.Active.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Description.IsUnset() { - t.Description = s.Description.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Habitat.IsUnset() { - t.Habitat = s.Habitat.MustGetNull() - } - if !s.Hectares.IsUnset() { - t.Hectares = s.Hectares.MustGetNull() - } - if !s.Jurisdiction.IsUnset() { - t.Jurisdiction = s.Jurisdiction.MustGetNull() - } - if !s.Larvinspectinterval.IsUnset() { - t.Larvinspectinterval = s.Larvinspectinterval.MustGetNull() - } - if !s.Lastinspectactiontaken.IsUnset() { - t.Lastinspectactiontaken = s.Lastinspectactiontaken.MustGetNull() - } - if !s.Lastinspectactivity.IsUnset() { - t.Lastinspectactivity = s.Lastinspectactivity.MustGetNull() - } - if !s.Lastinspectavglarvae.IsUnset() { - t.Lastinspectavglarvae = s.Lastinspectavglarvae.MustGetNull() - } - if !s.Lastinspectavgpupae.IsUnset() { - t.Lastinspectavgpupae = s.Lastinspectavgpupae.MustGetNull() - } - if !s.Lastinspectbreeding.IsUnset() { - t.Lastinspectbreeding = s.Lastinspectbreeding.MustGetNull() - } - if !s.Lastinspectconditions.IsUnset() { - t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() - } - if !s.Lastinspectdate.IsUnset() { - t.Lastinspectdate = s.Lastinspectdate.MustGetNull() - } - if !s.Lastinspectfieldspecies.IsUnset() { - t.Lastinspectfieldspecies = s.Lastinspectfieldspecies.MustGetNull() - } - if !s.Lastinspectlstages.IsUnset() { - t.Lastinspectlstages = s.Lastinspectlstages.MustGetNull() - } - if !s.Lasttreatactivity.IsUnset() { - t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() - } - if !s.Lasttreatdate.IsUnset() { - t.Lasttreatdate = s.Lasttreatdate.MustGetNull() - } - if !s.Lasttreatproduct.IsUnset() { - t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() - } - if !s.Lasttreatqty.IsUnset() { - t.Lasttreatqty = s.Lasttreatqty.MustGetNull() - } - if !s.Lasttreatqtyunit.IsUnset() { - t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() - } - if !s.LengthFT.IsUnset() { - t.LengthFT = s.LengthFT.MustGetNull() - } - if !s.LengthMeters.IsUnset() { - t.LengthMeters = s.LengthMeters.MustGetNull() - } - if !s.Locationnumber.IsUnset() { - t.Locationnumber = s.Locationnumber.MustGetNull() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if !s.Nextactiondatescheduled.IsUnset() { - t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Symbology.IsUnset() { - t.Symbology = s.Symbology.MustGetNull() - } - if !s.ShapeLength.IsUnset() { - t.ShapeLength = s.ShapeLength.MustGetNull() - } - if !s.Usetype.IsUnset() { - t.Usetype = s.Usetype.MustGetNull() - } - if !s.Waterorigin.IsUnset() { - t.Waterorigin = s.Waterorigin.MustGetNull() - } - if !s.WidthFT.IsUnset() { - t.WidthFT = s.WidthFT.MustGetNull() - } - if !s.WidthMeters.IsUnset() { - t.WidthMeters = s.WidthMeters.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSLinelocationSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSLinelocations.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 52) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accessdesc.IsUnset() { - vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Acres.IsUnset() { - vals[2] = psql.Arg(s.Acres.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Active.IsUnset() { - vals[3] = psql.Arg(s.Active.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[4] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[5] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[6] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Description.IsUnset() { - vals[7] = psql.Arg(s.Description.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[8] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[9] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[10] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[11] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Habitat.IsUnset() { - vals[12] = psql.Arg(s.Habitat.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Hectares.IsUnset() { - vals[13] = psql.Arg(s.Hectares.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Jurisdiction.IsUnset() { - vals[14] = psql.Arg(s.Jurisdiction.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Larvinspectinterval.IsUnset() { - vals[15] = psql.Arg(s.Larvinspectinterval.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectactiontaken.IsUnset() { - vals[16] = psql.Arg(s.Lastinspectactiontaken.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectactivity.IsUnset() { - vals[17] = psql.Arg(s.Lastinspectactivity.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectavglarvae.IsUnset() { - vals[18] = psql.Arg(s.Lastinspectavglarvae.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectavgpupae.IsUnset() { - vals[19] = psql.Arg(s.Lastinspectavgpupae.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectbreeding.IsUnset() { - vals[20] = psql.Arg(s.Lastinspectbreeding.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectconditions.IsUnset() { - vals[21] = psql.Arg(s.Lastinspectconditions.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectdate.IsUnset() { - vals[22] = psql.Arg(s.Lastinspectdate.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectfieldspecies.IsUnset() { - vals[23] = psql.Arg(s.Lastinspectfieldspecies.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectlstages.IsUnset() { - vals[24] = psql.Arg(s.Lastinspectlstages.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatactivity.IsUnset() { - vals[25] = psql.Arg(s.Lasttreatactivity.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatdate.IsUnset() { - vals[26] = psql.Arg(s.Lasttreatdate.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatproduct.IsUnset() { - vals[27] = psql.Arg(s.Lasttreatproduct.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqty.IsUnset() { - vals[28] = psql.Arg(s.Lasttreatqty.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqtyunit.IsUnset() { - vals[29] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.LengthFT.IsUnset() { - vals[30] = psql.Arg(s.LengthFT.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.LengthMeters.IsUnset() { - vals[31] = psql.Arg(s.LengthMeters.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Locationnumber.IsUnset() { - vals[32] = psql.Arg(s.Locationnumber.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[33] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Nextactiondatescheduled.IsUnset() { - vals[34] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[35] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[36] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.Symbology.IsUnset() { - vals[37] = psql.Arg(s.Symbology.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.ShapeLength.IsUnset() { - vals[38] = psql.Arg(s.ShapeLength.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Usetype.IsUnset() { - vals[39] = psql.Arg(s.Usetype.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Waterorigin.IsUnset() { - vals[40] = psql.Arg(s.Waterorigin.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.WidthFT.IsUnset() { - vals[41] = psql.Arg(s.WidthFT.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.WidthMeters.IsUnset() { - vals[42] = psql.Arg(s.WidthMeters.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[43] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[44] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[45] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[46] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[47] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[47] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[48] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[48] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[49] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[49] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[50] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[50] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[51] = psql.Arg(s.Updated.MustGet()) - } else { - vals[51] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSLinelocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSLinelocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 52) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accessdesc.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accessdesc")...), - psql.Arg(s.Accessdesc), - }}) - } - - if !s.Acres.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "acres")...), - psql.Arg(s.Acres), - }}) - } - - if !s.Active.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "active")...), - psql.Arg(s.Active), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Description.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "description")...), - psql.Arg(s.Description), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitat")...), - psql.Arg(s.Habitat), - }}) - } - - if !s.Hectares.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "hectares")...), - psql.Arg(s.Hectares), - }}) - } - - if !s.Jurisdiction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "jurisdiction")...), - psql.Arg(s.Jurisdiction), - }}) - } - - if !s.Larvinspectinterval.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvinspectinterval")...), - psql.Arg(s.Larvinspectinterval), - }}) - } - - if !s.Lastinspectactiontaken.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectactiontaken")...), - psql.Arg(s.Lastinspectactiontaken), - }}) - } - - if !s.Lastinspectactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectactivity")...), - psql.Arg(s.Lastinspectactivity), - }}) - } - - if !s.Lastinspectavglarvae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectavglarvae")...), - psql.Arg(s.Lastinspectavglarvae), - }}) - } - - if !s.Lastinspectavgpupae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectavgpupae")...), - psql.Arg(s.Lastinspectavgpupae), - }}) - } - - if !s.Lastinspectbreeding.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectbreeding")...), - psql.Arg(s.Lastinspectbreeding), - }}) - } - - if !s.Lastinspectconditions.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectconditions")...), - psql.Arg(s.Lastinspectconditions), - }}) - } - - if !s.Lastinspectdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectdate")...), - psql.Arg(s.Lastinspectdate), - }}) - } - - if !s.Lastinspectfieldspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectfieldspecies")...), - psql.Arg(s.Lastinspectfieldspecies), - }}) - } - - if !s.Lastinspectlstages.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectlstages")...), - psql.Arg(s.Lastinspectlstages), - }}) - } - - if !s.Lasttreatactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatactivity")...), - psql.Arg(s.Lasttreatactivity), - }}) - } - - if !s.Lasttreatdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatdate")...), - psql.Arg(s.Lasttreatdate), - }}) - } - - if !s.Lasttreatproduct.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatproduct")...), - psql.Arg(s.Lasttreatproduct), - }}) - } - - if !s.Lasttreatqty.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqty")...), - psql.Arg(s.Lasttreatqty), - }}) - } - - if !s.Lasttreatqtyunit.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqtyunit")...), - psql.Arg(s.Lasttreatqtyunit), - }}) - } - - if !s.LengthFT.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "length_ft")...), - psql.Arg(s.LengthFT), - }}) - } - - if !s.LengthMeters.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "length_meters")...), - psql.Arg(s.LengthMeters), - }}) - } - - if !s.Locationnumber.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationnumber")...), - psql.Arg(s.Locationnumber), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if !s.Nextactiondatescheduled.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nextactiondatescheduled")...), - psql.Arg(s.Nextactiondatescheduled), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Symbology.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "symbology")...), - psql.Arg(s.Symbology), - }}) - } - - if !s.ShapeLength.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__length")...), - psql.Arg(s.ShapeLength), - }}) - } - - if !s.Usetype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "usetype")...), - psql.Arg(s.Usetype), - }}) - } - - if !s.Waterorigin.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "waterorigin")...), - psql.Arg(s.Waterorigin), - }}) - } - - if !s.WidthFT.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "width_ft")...), - psql.Arg(s.WidthFT), - }}) - } - - if !s.WidthMeters.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "width_meters")...), - psql.Arg(s.WidthMeters), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSLinelocation retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSLinelocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSLinelocation, error) { - if len(cols) == 0 { - return FSLinelocations.Query( - sm.Where(FSLinelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSLinelocations.Query( - sm.Where(FSLinelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSLinelocations.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSLinelocationExists checks the presence of a single record by primary key -func FSLinelocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSLinelocations.Query( - sm.Where(FSLinelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSLinelocation is retrieved from the database -func (o *FSLinelocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSLinelocations.AfterSelectHooks.RunHooks(ctx, exec, FSLinelocationSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSLinelocations.AfterInsertHooks.RunHooks(ctx, exec, FSLinelocationSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSLinelocations.AfterUpdateHooks.RunHooks(ctx, exec, FSLinelocationSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSLinelocations.AfterDeleteHooks.RunHooks(ctx, exec, FSLinelocationSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSLinelocation -func (o *FSLinelocation) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSLinelocation) pkEQ() dialect.Expression { - return psql.Quote("fs_linelocation", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSLinelocation -func (o *FSLinelocation) Update(ctx context.Context, exec bob.Executor, s *FSLinelocationSetter) error { - v, err := FSLinelocations.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 FSLinelocation record with an executor -func (o *FSLinelocation) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSLinelocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSLinelocation using the executor -func (o *FSLinelocation) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSLinelocations.Query( - sm.Where(FSLinelocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSLinelocationSlice is retrieved from the database -func (o FSLinelocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSLinelocations.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSLinelocations.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSLinelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSLinelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSLinelocationSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_linelocation", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSLinelocationSlice) copyMatchingRows(from ...*FSLinelocation) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSLinelocationSlice) 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 FSLinelocations.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 *FSLinelocation: - o.copyMatchingRows(retrieved) - case []*FSLinelocation: - o.copyMatchingRows(retrieved...) - case FSLinelocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSLinelocation or a slice of FSLinelocation - // then run the AfterUpdateHooks on the slice - _, err = FSLinelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSLinelocationSlice) 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 FSLinelocations.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 *FSLinelocation: - o.copyMatchingRows(retrieved) - case []*FSLinelocation: - o.copyMatchingRows(retrieved...) - case FSLinelocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSLinelocation or a slice of FSLinelocation - // then run the AfterDeleteHooks on the slice - _, err = FSLinelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSLinelocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSLinelocationSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSLinelocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSLinelocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSLinelocations.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSLinelocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSLinelocations.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 *FSLinelocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSLinelocationSlice) 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 attachFSLinelocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsLinelocation0 *FSLinelocation, organization1 *Organization) (*FSLinelocation, error) { - setter := &FSLinelocationSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsLinelocation0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSLinelocationOrganization0: %w", err) - } - - return fsLinelocation0, nil -} - -func (fsLinelocation0 *FSLinelocation) 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 = attachFSLinelocationOrganization0(ctx, exec, 1, fsLinelocation0, organization1) - if err != nil { - return err - } - - fsLinelocation0.R.Organization = organization1 - - organization1.R.FSLinelocations = append(organization1.R.FSLinelocations, fsLinelocation0) - - return nil -} - -func (fsLinelocation0 *FSLinelocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSLinelocationOrganization0(ctx, exec, 1, fsLinelocation0, organization1) - if err != nil { - return err - } - - fsLinelocation0.R.Organization = organization1 - - organization1.R.FSLinelocations = append(organization1.R.FSLinelocations, fsLinelocation0) - - return nil -} - -type fsLinelocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accessdesc psql.WhereNullMod[Q, string] - Acres psql.WhereNullMod[Q, float64] - Active psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Description psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Habitat psql.WhereNullMod[Q, string] - Hectares psql.WhereNullMod[Q, float64] - Jurisdiction psql.WhereNullMod[Q, string] - Larvinspectinterval psql.WhereNullMod[Q, int16] - Lastinspectactiontaken psql.WhereNullMod[Q, string] - Lastinspectactivity psql.WhereNullMod[Q, string] - Lastinspectavglarvae psql.WhereNullMod[Q, float64] - Lastinspectavgpupae psql.WhereNullMod[Q, float64] - Lastinspectbreeding psql.WhereNullMod[Q, string] - Lastinspectconditions psql.WhereNullMod[Q, string] - Lastinspectdate psql.WhereNullMod[Q, int64] - Lastinspectfieldspecies psql.WhereNullMod[Q, string] - Lastinspectlstages psql.WhereNullMod[Q, string] - Lasttreatactivity psql.WhereNullMod[Q, string] - Lasttreatdate psql.WhereNullMod[Q, int64] - Lasttreatproduct psql.WhereNullMod[Q, string] - Lasttreatqty psql.WhereNullMod[Q, float64] - Lasttreatqtyunit psql.WhereNullMod[Q, string] - LengthFT psql.WhereNullMod[Q, float64] - LengthMeters psql.WhereNullMod[Q, float64] - Locationnumber psql.WhereNullMod[Q, int64] - Name psql.WhereNullMod[Q, string] - Nextactiondatescheduled psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Priority psql.WhereNullMod[Q, string] - Symbology psql.WhereNullMod[Q, string] - ShapeLength psql.WhereNullMod[Q, float64] - Usetype psql.WhereNullMod[Q, string] - Waterorigin psql.WhereNullMod[Q, string] - WidthFT psql.WhereNullMod[Q, float64] - WidthMeters psql.WhereNullMod[Q, float64] - Zone psql.WhereNullMod[Q, string] - 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] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsLinelocationWhere[Q]) AliasedAs(alias string) fsLinelocationWhere[Q] { - return buildFSLinelocationWhere[Q](buildFSLinelocationColumns(alias)) -} - -func buildFSLinelocationWhere[Q psql.Filterable](cols fsLinelocationColumns) fsLinelocationWhere[Q] { - return fsLinelocationWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), - Acres: psql.WhereNull[Q, float64](cols.Acres), - Active: psql.WhereNull[Q, int16](cols.Active), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Description: psql.WhereNull[Q, string](cols.Description), - Externalid: psql.WhereNull[Q, string](cols.Externalid), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - 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), - Larvinspectinterval: psql.WhereNull[Q, int16](cols.Larvinspectinterval), - Lastinspectactiontaken: psql.WhereNull[Q, string](cols.Lastinspectactiontaken), - Lastinspectactivity: psql.WhereNull[Q, string](cols.Lastinspectactivity), - Lastinspectavglarvae: psql.WhereNull[Q, float64](cols.Lastinspectavglarvae), - Lastinspectavgpupae: psql.WhereNull[Q, float64](cols.Lastinspectavgpupae), - Lastinspectbreeding: psql.WhereNull[Q, string](cols.Lastinspectbreeding), - Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), - Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), - Lastinspectfieldspecies: psql.WhereNull[Q, string](cols.Lastinspectfieldspecies), - Lastinspectlstages: psql.WhereNull[Q, string](cols.Lastinspectlstages), - Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), - Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), - Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), - Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), - Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), - LengthFT: psql.WhereNull[Q, float64](cols.LengthFT), - LengthMeters: psql.WhereNull[Q, float64](cols.LengthMeters), - Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), - Name: psql.WhereNull[Q, string](cols.Name), - Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), - Objectid: psql.Where[Q, int32](cols.Objectid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Symbology: psql.WhereNull[Q, string](cols.Symbology), - ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), - Usetype: psql.WhereNull[Q, string](cols.Usetype), - Waterorigin: psql.WhereNull[Q, string](cols.Waterorigin), - WidthFT: psql.WhereNull[Q, float64](cols.WidthFT), - WidthMeters: psql.WhereNull[Q, float64](cols.WidthMeters), - Zone: psql.WhereNull[Q, string](cols.Zone), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSLinelocation) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsLinelocation cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSLinelocations = FSLinelocationSlice{o} - } - return nil - default: - return fmt.Errorf("fsLinelocation has no relationship %q", name) - } -} - -type fsLinelocationPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSLinelocationPreloader() fsLinelocationPreloader { - return fsLinelocationPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSLinelocations, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsLinelocationThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSLinelocationThenLoader[Q orm.Loadable]() fsLinelocationThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsLinelocationThenLoader[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 fsLinelocation's Organization into the .R struct -func (o *FSLinelocation) 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.FSLinelocations = FSLinelocationSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsLinelocation's Organization into the .R struct -func (os FSLinelocationSlice) 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.FSLinelocations = append(rel.R.FSLinelocations, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsLinelocationJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsLinelocationJoins[Q]) aliasedAs(alias string) fsLinelocationJoins[Q] { - return buildFSLinelocationJoins[Q](buildFSLinelocationColumns(alias), j.typ) -} - -func buildFSLinelocationJoins[Q dialect.Joinable](cols fsLinelocationColumns, typ string) fsLinelocationJoins[Q] { - return fsLinelocationJoins[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/db/models/fs_locationtracking.bob.go b/db/models/fs_locationtracking.bob.go deleted file mode 100644 index d5f72a45..00000000 --- a/db/models/fs_locationtracking.bob.go +++ /dev/null @@ -1,955 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSLocationtracking is an object representing the database table. -type FSLocationtracking struct { - OrganizationID int32 `db:"organization_id" ` - Accuracy null.Val[float64] `db:"accuracy" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Globalid string `db:"globalid" ` - Objectid int32 `db:"objectid,pk" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsLocationtrackingR `db:"-" ` -} - -// FSLocationtrackingSlice is an alias for a slice of pointers to FSLocationtracking. -// This should almost always be used instead of []*FSLocationtracking. -type FSLocationtrackingSlice []*FSLocationtracking - -// FSLocationtrackings contains methods to work with the fs_locationtracking table -var FSLocationtrackings = psql.NewTablex[*FSLocationtracking, FSLocationtrackingSlice, *FSLocationtrackingSetter]("", "fs_locationtracking", buildFSLocationtrackingColumns("fs_locationtracking")) - -// FSLocationtrackingsQuery is a query on the fs_locationtracking table -type FSLocationtrackingsQuery = *psql.ViewQuery[*FSLocationtracking, FSLocationtrackingSlice] - -// fsLocationtrackingR is where relationships are stored. -type fsLocationtrackingR struct { - Organization *Organization // fs_locationtracking.fs_locationtracking_organization_id_fkey -} - -func buildFSLocationtrackingColumns(alias string) fsLocationtrackingColumns { - return fsLocationtrackingColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accuracy", "creationdate", "creator", "editdate", "editor", "fieldtech", "globalid", "objectid", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "updated", - ).WithParent("fs_locationtracking"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accuracy: psql.Quote(alias, "accuracy"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fieldtech: psql.Quote(alias, "fieldtech"), - Globalid: psql.Quote(alias, "globalid"), - Objectid: psql.Quote(alias, "objectid"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsLocationtrackingColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accuracy psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fieldtech psql.Expression - Globalid psql.Expression - Objectid psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Updated psql.Expression -} - -func (c fsLocationtrackingColumns) Alias() string { - return c.tableAlias -} - -func (fsLocationtrackingColumns) AliasedAs(alias string) fsLocationtrackingColumns { - return buildFSLocationtrackingColumns(alias) -} - -// FSLocationtrackingSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSLocationtrackingSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Accuracy omitnull.Val[float64] `db:"accuracy" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - 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" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSLocationtrackingSetter) SetColumns() []string { - vals := make([]string, 0, 16) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accuracy.IsUnset() { - vals = append(vals, "accuracy") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fieldtech.IsUnset() { - vals = append(vals, "fieldtech") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSLocationtrackingSetter) Overwrite(t *FSLocationtracking) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accuracy.IsUnset() { - t.Accuracy = s.Accuracy.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fieldtech.IsUnset() { - t.Fieldtech = s.Fieldtech.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSLocationtrackingSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSLocationtrackings.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 16) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accuracy.IsUnset() { - vals[1] = psql.Arg(s.Accuracy.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[2] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[3] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[4] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[5] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Fieldtech.IsUnset() { - vals[6] = psql.Arg(s.Fieldtech.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[7] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[8] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[9] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[10] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[11] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[12] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[13] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[14] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[15] = psql.Arg(s.Updated.MustGet()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSLocationtrackingSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSLocationtrackingSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 16) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accuracy.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accuracy")...), - psql.Arg(s.Accuracy), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fieldtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldtech")...), - psql.Arg(s.Fieldtech), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSLocationtracking retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSLocationtracking(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSLocationtracking, error) { - if len(cols) == 0 { - return FSLocationtrackings.Query( - sm.Where(FSLocationtrackings.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSLocationtrackings.Query( - sm.Where(FSLocationtrackings.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSLocationtrackings.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSLocationtrackingExists checks the presence of a single record by primary key -func FSLocationtrackingExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSLocationtrackings.Query( - sm.Where(FSLocationtrackings.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSLocationtracking is retrieved from the database -func (o *FSLocationtracking) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSLocationtrackings.AfterSelectHooks.RunHooks(ctx, exec, FSLocationtrackingSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSLocationtrackings.AfterInsertHooks.RunHooks(ctx, exec, FSLocationtrackingSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSLocationtrackings.AfterUpdateHooks.RunHooks(ctx, exec, FSLocationtrackingSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSLocationtrackings.AfterDeleteHooks.RunHooks(ctx, exec, FSLocationtrackingSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSLocationtracking -func (o *FSLocationtracking) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSLocationtracking) pkEQ() dialect.Expression { - return psql.Quote("fs_locationtracking", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSLocationtracking -func (o *FSLocationtracking) Update(ctx context.Context, exec bob.Executor, s *FSLocationtrackingSetter) error { - v, err := FSLocationtrackings.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 FSLocationtracking record with an executor -func (o *FSLocationtracking) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSLocationtrackings.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSLocationtracking using the executor -func (o *FSLocationtracking) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSLocationtrackings.Query( - sm.Where(FSLocationtrackings.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSLocationtrackingSlice is retrieved from the database -func (o FSLocationtrackingSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSLocationtrackings.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSLocationtrackings.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSLocationtrackings.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSLocationtrackings.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSLocationtrackingSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_locationtracking", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSLocationtrackingSlice) copyMatchingRows(from ...*FSLocationtracking) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSLocationtrackingSlice) 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 FSLocationtrackings.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 *FSLocationtracking: - o.copyMatchingRows(retrieved) - case []*FSLocationtracking: - o.copyMatchingRows(retrieved...) - case FSLocationtrackingSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSLocationtracking or a slice of FSLocationtracking - // then run the AfterUpdateHooks on the slice - _, err = FSLocationtrackings.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSLocationtrackingSlice) 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 FSLocationtrackings.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 *FSLocationtracking: - o.copyMatchingRows(retrieved) - case []*FSLocationtracking: - o.copyMatchingRows(retrieved...) - case FSLocationtrackingSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSLocationtracking or a slice of FSLocationtracking - // then run the AfterDeleteHooks on the slice - _, err = FSLocationtrackings.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSLocationtrackingSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSLocationtrackingSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSLocationtrackings.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSLocationtrackingSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSLocationtrackings.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSLocationtrackingSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSLocationtrackings.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 *FSLocationtracking) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSLocationtrackingSlice) 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 attachFSLocationtrackingOrganization0(ctx context.Context, exec bob.Executor, count int, fsLocationtracking0 *FSLocationtracking, organization1 *Organization) (*FSLocationtracking, error) { - setter := &FSLocationtrackingSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsLocationtracking0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSLocationtrackingOrganization0: %w", err) - } - - return fsLocationtracking0, nil -} - -func (fsLocationtracking0 *FSLocationtracking) 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 = attachFSLocationtrackingOrganization0(ctx, exec, 1, fsLocationtracking0, organization1) - if err != nil { - return err - } - - fsLocationtracking0.R.Organization = organization1 - - organization1.R.FSLocationtrackings = append(organization1.R.FSLocationtrackings, fsLocationtracking0) - - return nil -} - -func (fsLocationtracking0 *FSLocationtracking) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSLocationtrackingOrganization0(ctx, exec, 1, fsLocationtracking0, organization1) - if err != nil { - return err - } - - fsLocationtracking0.R.Organization = organization1 - - organization1.R.FSLocationtrackings = append(organization1.R.FSLocationtrackings, fsLocationtracking0) - - return nil -} - -type fsLocationtrackingWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accuracy psql.WhereNullMod[Q, float64] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fieldtech psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Objectid psql.WhereMod[Q, int32] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsLocationtrackingWhere[Q]) AliasedAs(alias string) fsLocationtrackingWhere[Q] { - return buildFSLocationtrackingWhere[Q](buildFSLocationtrackingColumns(alias)) -} - -func buildFSLocationtrackingWhere[Q psql.Filterable](cols fsLocationtrackingColumns) fsLocationtrackingWhere[Q] { - return fsLocationtrackingWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accuracy: psql.WhereNull[Q, float64](cols.Accuracy), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), - 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), - GeometryX: psql.WhereNull[Q, float64](cols.GeometryX), - GeometryY: psql.WhereNull[Q, float64](cols.GeometryY), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSLocationtracking) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsLocationtracking cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSLocationtrackings = FSLocationtrackingSlice{o} - } - return nil - default: - return fmt.Errorf("fsLocationtracking has no relationship %q", name) - } -} - -type fsLocationtrackingPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSLocationtrackingPreloader() fsLocationtrackingPreloader { - return fsLocationtrackingPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSLocationtrackings, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsLocationtrackingThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSLocationtrackingThenLoader[Q orm.Loadable]() fsLocationtrackingThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsLocationtrackingThenLoader[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 fsLocationtracking's Organization into the .R struct -func (o *FSLocationtracking) 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.FSLocationtrackings = FSLocationtrackingSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsLocationtracking's Organization into the .R struct -func (os FSLocationtrackingSlice) 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.FSLocationtrackings = append(rel.R.FSLocationtrackings, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsLocationtrackingJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsLocationtrackingJoins[Q]) aliasedAs(alias string) fsLocationtrackingJoins[Q] { - return buildFSLocationtrackingJoins[Q](buildFSLocationtrackingColumns(alias), j.typ) -} - -func buildFSLocationtrackingJoins[Q dialect.Joinable](cols fsLocationtrackingColumns, typ string) fsLocationtrackingJoins[Q] { - return fsLocationtrackingJoins[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/db/models/fs_mosquitoinspection.bob.go b/db/models/fs_mosquitoinspection.bob.go deleted file mode 100644 index ee5edd1f..00000000 --- a/db/models/fs_mosquitoinspection.bob.go +++ /dev/null @@ -1,2105 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSMosquitoinspection is an object representing the database table. -type FSMosquitoinspection struct { - OrganizationID int32 `db:"organization_id" ` - Actiontaken null.Val[string] `db:"actiontaken" ` - Activity null.Val[string] `db:"activity" ` - Adultact null.Val[string] `db:"adultact" ` - Avetemp null.Val[float64] `db:"avetemp" ` - Avglarvae null.Val[float64] `db:"avglarvae" ` - Avgpupae null.Val[float64] `db:"avgpupae" ` - Breeding null.Val[string] `db:"breeding" ` - Cbcount null.Val[int16] `db:"cbcount" ` - Comments null.Val[string] `db:"comments" ` - Containercount null.Val[int16] `db:"containercount" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Domstage null.Val[string] `db:"domstage" ` - Eggs null.Val[int16] `db:"eggs" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldspecies null.Val[string] `db:"fieldspecies" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Globalid string `db:"globalid" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Larvaepresent null.Val[int16] `db:"larvaepresent" ` - Linelocid null.Val[string] `db:"linelocid" ` - Locationname null.Val[string] `db:"locationname" ` - Lstages null.Val[string] `db:"lstages" ` - Numdips null.Val[int16] `db:"numdips" ` - Objectid int32 `db:"objectid,pk" ` - Personalcontact null.Val[int16] `db:"personalcontact" ` - Pointlocid null.Val[string] `db:"pointlocid" ` - Polygonlocid null.Val[string] `db:"polygonlocid" ` - Posdips null.Val[int16] `db:"posdips" ` - Positivecontainercount null.Val[int16] `db:"positivecontainercount" ` - Pupaepresent null.Val[int16] `db:"pupaepresent" ` - Raingauge null.Val[float64] `db:"raingauge" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Sdid null.Val[string] `db:"sdid" ` - Sitecond null.Val[string] `db:"sitecond" ` - Srid null.Val[string] `db:"srid" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Tirecount null.Val[int16] `db:"tirecount" ` - Totlarvae null.Val[int16] `db:"totlarvae" ` - Totpupae null.Val[int16] `db:"totpupae" ` - Visualmonitoring null.Val[int16] `db:"visualmonitoring" ` - Vmcomments null.Val[string] `db:"vmcomments" ` - Winddir null.Val[string] `db:"winddir" ` - Windspeed null.Val[float64] `db:"windspeed" ` - 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" ` - Adminaction null.Val[string] `db:"adminaction" ` - Ptaid null.Val[string] `db:"ptaid" ` - Updated time.Time `db:"updated" ` - Geom null.Val[string] `db:"geom" ` - - R fsMosquitoinspectionR `db:"-" ` -} - -// FSMosquitoinspectionSlice is an alias for a slice of pointers to FSMosquitoinspection. -// This should almost always be used instead of []*FSMosquitoinspection. -type FSMosquitoinspectionSlice []*FSMosquitoinspection - -// FSMosquitoinspections contains methods to work with the fs_mosquitoinspection table -var FSMosquitoinspections = psql.NewTablex[*FSMosquitoinspection, FSMosquitoinspectionSlice, *FSMosquitoinspectionSetter]("", "fs_mosquitoinspection", buildFSMosquitoinspectionColumns("fs_mosquitoinspection")) - -// FSMosquitoinspectionsQuery is a query on the fs_mosquitoinspection table -type FSMosquitoinspectionsQuery = *psql.ViewQuery[*FSMosquitoinspection, FSMosquitoinspectionSlice] - -// fsMosquitoinspectionR is where relationships are stored. -type fsMosquitoinspectionR struct { - Organization *Organization // fs_mosquitoinspection.fs_mosquitoinspection_organization_id_fkey -} - -func buildFSMosquitoinspectionColumns(alias string) fsMosquitoinspectionColumns { - return fsMosquitoinspectionColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "actiontaken", "activity", "adultact", "avetemp", "avglarvae", "avgpupae", "breeding", "cbcount", "comments", "containercount", "creationdate", "creator", "domstage", "eggs", "enddatetime", "editdate", "editor", "fieldspecies", "fieldtech", "globalid", "jurisdiction", "larvaepresent", "linelocid", "locationname", "lstages", "numdips", "objectid", "personalcontact", "pointlocid", "polygonlocid", "posdips", "positivecontainercount", "pupaepresent", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sdid", "sitecond", "srid", "startdatetime", "tirecount", "totlarvae", "totpupae", "visualmonitoring", "vmcomments", "winddir", "windspeed", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "adminaction", "ptaid", "updated", "geom", - ).WithParent("fs_mosquitoinspection"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Actiontaken: psql.Quote(alias, "actiontaken"), - Activity: psql.Quote(alias, "activity"), - Adultact: psql.Quote(alias, "adultact"), - Avetemp: psql.Quote(alias, "avetemp"), - Avglarvae: psql.Quote(alias, "avglarvae"), - Avgpupae: psql.Quote(alias, "avgpupae"), - Breeding: psql.Quote(alias, "breeding"), - Cbcount: psql.Quote(alias, "cbcount"), - Comments: psql.Quote(alias, "comments"), - Containercount: psql.Quote(alias, "containercount"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Domstage: psql.Quote(alias, "domstage"), - Eggs: psql.Quote(alias, "eggs"), - Enddatetime: psql.Quote(alias, "enddatetime"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fieldspecies: psql.Quote(alias, "fieldspecies"), - Fieldtech: psql.Quote(alias, "fieldtech"), - Globalid: psql.Quote(alias, "globalid"), - Jurisdiction: psql.Quote(alias, "jurisdiction"), - Larvaepresent: psql.Quote(alias, "larvaepresent"), - Linelocid: psql.Quote(alias, "linelocid"), - Locationname: psql.Quote(alias, "locationname"), - Lstages: psql.Quote(alias, "lstages"), - Numdips: psql.Quote(alias, "numdips"), - Objectid: psql.Quote(alias, "objectid"), - Personalcontact: psql.Quote(alias, "personalcontact"), - Pointlocid: psql.Quote(alias, "pointlocid"), - Polygonlocid: psql.Quote(alias, "polygonlocid"), - Posdips: psql.Quote(alias, "posdips"), - Positivecontainercount: psql.Quote(alias, "positivecontainercount"), - Pupaepresent: psql.Quote(alias, "pupaepresent"), - Raingauge: psql.Quote(alias, "raingauge"), - Recordstatus: psql.Quote(alias, "recordstatus"), - Reviewed: psql.Quote(alias, "reviewed"), - Reviewedby: psql.Quote(alias, "reviewedby"), - Revieweddate: psql.Quote(alias, "revieweddate"), - Sdid: psql.Quote(alias, "sdid"), - Sitecond: psql.Quote(alias, "sitecond"), - Srid: psql.Quote(alias, "srid"), - Startdatetime: psql.Quote(alias, "startdatetime"), - Tirecount: psql.Quote(alias, "tirecount"), - Totlarvae: psql.Quote(alias, "totlarvae"), - Totpupae: psql.Quote(alias, "totpupae"), - Visualmonitoring: psql.Quote(alias, "visualmonitoring"), - Vmcomments: psql.Quote(alias, "vmcomments"), - Winddir: psql.Quote(alias, "winddir"), - Windspeed: psql.Quote(alias, "windspeed"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Adminaction: psql.Quote(alias, "adminaction"), - Ptaid: psql.Quote(alias, "ptaid"), - Updated: psql.Quote(alias, "updated"), - Geom: psql.Quote(alias, "geom"), - } -} - -type fsMosquitoinspectionColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Actiontaken psql.Expression - Activity psql.Expression - Adultact psql.Expression - Avetemp psql.Expression - Avglarvae psql.Expression - Avgpupae psql.Expression - Breeding psql.Expression - Cbcount psql.Expression - Comments psql.Expression - Containercount psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Domstage psql.Expression - Eggs psql.Expression - Enddatetime psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fieldspecies psql.Expression - Fieldtech psql.Expression - Globalid psql.Expression - Jurisdiction psql.Expression - Larvaepresent psql.Expression - Linelocid psql.Expression - Locationname psql.Expression - Lstages psql.Expression - Numdips psql.Expression - Objectid psql.Expression - Personalcontact psql.Expression - Pointlocid psql.Expression - Polygonlocid psql.Expression - Posdips psql.Expression - Positivecontainercount psql.Expression - Pupaepresent psql.Expression - Raingauge psql.Expression - Recordstatus psql.Expression - Reviewed psql.Expression - Reviewedby psql.Expression - Revieweddate psql.Expression - Sdid psql.Expression - Sitecond psql.Expression - Srid psql.Expression - Startdatetime psql.Expression - Tirecount psql.Expression - Totlarvae psql.Expression - Totpupae psql.Expression - Visualmonitoring psql.Expression - Vmcomments psql.Expression - Winddir psql.Expression - Windspeed psql.Expression - Zone psql.Expression - Zone2 psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Adminaction psql.Expression - Ptaid psql.Expression - Updated psql.Expression - Geom psql.Expression -} - -func (c fsMosquitoinspectionColumns) Alias() string { - return c.tableAlias -} - -func (fsMosquitoinspectionColumns) AliasedAs(alias string) fsMosquitoinspectionColumns { - return buildFSMosquitoinspectionColumns(alias) -} - -// FSMosquitoinspectionSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSMosquitoinspectionSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Actiontaken omitnull.Val[string] `db:"actiontaken" ` - Activity omitnull.Val[string] `db:"activity" ` - Adultact omitnull.Val[string] `db:"adultact" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Avglarvae omitnull.Val[float64] `db:"avglarvae" ` - Avgpupae omitnull.Val[float64] `db:"avgpupae" ` - Breeding omitnull.Val[string] `db:"breeding" ` - Cbcount omitnull.Val[int16] `db:"cbcount" ` - Comments omitnull.Val[string] `db:"comments" ` - Containercount omitnull.Val[int16] `db:"containercount" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Domstage omitnull.Val[string] `db:"domstage" ` - Eggs omitnull.Val[int16] `db:"eggs" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldspecies omitnull.Val[string] `db:"fieldspecies" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Globalid omit.Val[string] `db:"globalid" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Larvaepresent omitnull.Val[int16] `db:"larvaepresent" ` - Linelocid omitnull.Val[string] `db:"linelocid" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Lstages omitnull.Val[string] `db:"lstages" ` - Numdips omitnull.Val[int16] `db:"numdips" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Personalcontact omitnull.Val[int16] `db:"personalcontact" ` - Pointlocid omitnull.Val[string] `db:"pointlocid" ` - Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` - Posdips omitnull.Val[int16] `db:"posdips" ` - Positivecontainercount omitnull.Val[int16] `db:"positivecontainercount" ` - Pupaepresent omitnull.Val[int16] `db:"pupaepresent" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Sdid omitnull.Val[string] `db:"sdid" ` - Sitecond omitnull.Val[string] `db:"sitecond" ` - Srid omitnull.Val[string] `db:"srid" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Tirecount omitnull.Val[int16] `db:"tirecount" ` - Totlarvae omitnull.Val[int16] `db:"totlarvae" ` - Totpupae omitnull.Val[int16] `db:"totpupae" ` - Visualmonitoring omitnull.Val[int16] `db:"visualmonitoring" ` - Vmcomments omitnull.Val[string] `db:"vmcomments" ` - Winddir omitnull.Val[string] `db:"winddir" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - 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" ` - Adminaction omitnull.Val[string] `db:"adminaction" ` - Ptaid omitnull.Val[string] `db:"ptaid" ` - Updated omit.Val[time.Time] `db:"updated" ` - Geom omitnull.Val[string] `db:"geom" ` -} - -func (s FSMosquitoinspectionSetter) SetColumns() []string { - vals := make([]string, 0, 62) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Actiontaken.IsUnset() { - vals = append(vals, "actiontaken") - } - if !s.Activity.IsUnset() { - vals = append(vals, "activity") - } - if !s.Adultact.IsUnset() { - vals = append(vals, "adultact") - } - if !s.Avetemp.IsUnset() { - vals = append(vals, "avetemp") - } - if !s.Avglarvae.IsUnset() { - vals = append(vals, "avglarvae") - } - if !s.Avgpupae.IsUnset() { - vals = append(vals, "avgpupae") - } - if !s.Breeding.IsUnset() { - vals = append(vals, "breeding") - } - if !s.Cbcount.IsUnset() { - vals = append(vals, "cbcount") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Containercount.IsUnset() { - vals = append(vals, "containercount") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Domstage.IsUnset() { - vals = append(vals, "domstage") - } - if !s.Eggs.IsUnset() { - vals = append(vals, "eggs") - } - if !s.Enddatetime.IsUnset() { - vals = append(vals, "enddatetime") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fieldspecies.IsUnset() { - vals = append(vals, "fieldspecies") - } - if !s.Fieldtech.IsUnset() { - vals = append(vals, "fieldtech") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Jurisdiction.IsUnset() { - vals = append(vals, "jurisdiction") - } - if !s.Larvaepresent.IsUnset() { - vals = append(vals, "larvaepresent") - } - if !s.Linelocid.IsUnset() { - vals = append(vals, "linelocid") - } - if !s.Locationname.IsUnset() { - vals = append(vals, "locationname") - } - if !s.Lstages.IsUnset() { - vals = append(vals, "lstages") - } - if !s.Numdips.IsUnset() { - vals = append(vals, "numdips") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Personalcontact.IsUnset() { - vals = append(vals, "personalcontact") - } - if !s.Pointlocid.IsUnset() { - vals = append(vals, "pointlocid") - } - if !s.Polygonlocid.IsUnset() { - vals = append(vals, "polygonlocid") - } - if !s.Posdips.IsUnset() { - vals = append(vals, "posdips") - } - if !s.Positivecontainercount.IsUnset() { - vals = append(vals, "positivecontainercount") - } - if !s.Pupaepresent.IsUnset() { - vals = append(vals, "pupaepresent") - } - if !s.Raingauge.IsUnset() { - vals = append(vals, "raingauge") - } - if !s.Recordstatus.IsUnset() { - vals = append(vals, "recordstatus") - } - if !s.Reviewed.IsUnset() { - vals = append(vals, "reviewed") - } - if !s.Reviewedby.IsUnset() { - vals = append(vals, "reviewedby") - } - if !s.Revieweddate.IsUnset() { - vals = append(vals, "revieweddate") - } - if !s.Sdid.IsUnset() { - vals = append(vals, "sdid") - } - if !s.Sitecond.IsUnset() { - vals = append(vals, "sitecond") - } - if !s.Srid.IsUnset() { - vals = append(vals, "srid") - } - if !s.Startdatetime.IsUnset() { - vals = append(vals, "startdatetime") - } - if !s.Tirecount.IsUnset() { - vals = append(vals, "tirecount") - } - if !s.Totlarvae.IsUnset() { - vals = append(vals, "totlarvae") - } - if !s.Totpupae.IsUnset() { - vals = append(vals, "totpupae") - } - if !s.Visualmonitoring.IsUnset() { - vals = append(vals, "visualmonitoring") - } - if !s.Vmcomments.IsUnset() { - vals = append(vals, "vmcomments") - } - if !s.Winddir.IsUnset() { - vals = append(vals, "winddir") - } - if !s.Windspeed.IsUnset() { - vals = append(vals, "windspeed") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Adminaction.IsUnset() { - vals = append(vals, "adminaction") - } - if !s.Ptaid.IsUnset() { - vals = append(vals, "ptaid") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - if !s.Geom.IsUnset() { - vals = append(vals, "geom") - } - return vals -} - -func (s FSMosquitoinspectionSetter) Overwrite(t *FSMosquitoinspection) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Actiontaken.IsUnset() { - t.Actiontaken = s.Actiontaken.MustGetNull() - } - if !s.Activity.IsUnset() { - t.Activity = s.Activity.MustGetNull() - } - if !s.Adultact.IsUnset() { - t.Adultact = s.Adultact.MustGetNull() - } - if !s.Avetemp.IsUnset() { - t.Avetemp = s.Avetemp.MustGetNull() - } - if !s.Avglarvae.IsUnset() { - t.Avglarvae = s.Avglarvae.MustGetNull() - } - if !s.Avgpupae.IsUnset() { - t.Avgpupae = s.Avgpupae.MustGetNull() - } - if !s.Breeding.IsUnset() { - t.Breeding = s.Breeding.MustGetNull() - } - if !s.Cbcount.IsUnset() { - t.Cbcount = s.Cbcount.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Containercount.IsUnset() { - t.Containercount = s.Containercount.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Domstage.IsUnset() { - t.Domstage = s.Domstage.MustGetNull() - } - if !s.Eggs.IsUnset() { - t.Eggs = s.Eggs.MustGetNull() - } - if !s.Enddatetime.IsUnset() { - t.Enddatetime = s.Enddatetime.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fieldspecies.IsUnset() { - t.Fieldspecies = s.Fieldspecies.MustGetNull() - } - if !s.Fieldtech.IsUnset() { - t.Fieldtech = s.Fieldtech.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Jurisdiction.IsUnset() { - t.Jurisdiction = s.Jurisdiction.MustGetNull() - } - if !s.Larvaepresent.IsUnset() { - t.Larvaepresent = s.Larvaepresent.MustGetNull() - } - if !s.Linelocid.IsUnset() { - t.Linelocid = s.Linelocid.MustGetNull() - } - if !s.Locationname.IsUnset() { - t.Locationname = s.Locationname.MustGetNull() - } - if !s.Lstages.IsUnset() { - t.Lstages = s.Lstages.MustGetNull() - } - if !s.Numdips.IsUnset() { - t.Numdips = s.Numdips.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Personalcontact.IsUnset() { - t.Personalcontact = s.Personalcontact.MustGetNull() - } - if !s.Pointlocid.IsUnset() { - t.Pointlocid = s.Pointlocid.MustGetNull() - } - if !s.Polygonlocid.IsUnset() { - t.Polygonlocid = s.Polygonlocid.MustGetNull() - } - if !s.Posdips.IsUnset() { - t.Posdips = s.Posdips.MustGetNull() - } - if !s.Positivecontainercount.IsUnset() { - t.Positivecontainercount = s.Positivecontainercount.MustGetNull() - } - if !s.Pupaepresent.IsUnset() { - t.Pupaepresent = s.Pupaepresent.MustGetNull() - } - if !s.Raingauge.IsUnset() { - t.Raingauge = s.Raingauge.MustGetNull() - } - if !s.Recordstatus.IsUnset() { - t.Recordstatus = s.Recordstatus.MustGetNull() - } - if !s.Reviewed.IsUnset() { - t.Reviewed = s.Reviewed.MustGetNull() - } - if !s.Reviewedby.IsUnset() { - t.Reviewedby = s.Reviewedby.MustGetNull() - } - if !s.Revieweddate.IsUnset() { - t.Revieweddate = s.Revieweddate.MustGetNull() - } - if !s.Sdid.IsUnset() { - t.Sdid = s.Sdid.MustGetNull() - } - if !s.Sitecond.IsUnset() { - t.Sitecond = s.Sitecond.MustGetNull() - } - if !s.Srid.IsUnset() { - t.Srid = s.Srid.MustGetNull() - } - if !s.Startdatetime.IsUnset() { - t.Startdatetime = s.Startdatetime.MustGetNull() - } - if !s.Tirecount.IsUnset() { - t.Tirecount = s.Tirecount.MustGetNull() - } - if !s.Totlarvae.IsUnset() { - t.Totlarvae = s.Totlarvae.MustGetNull() - } - if !s.Totpupae.IsUnset() { - t.Totpupae = s.Totpupae.MustGetNull() - } - if !s.Visualmonitoring.IsUnset() { - t.Visualmonitoring = s.Visualmonitoring.MustGetNull() - } - if !s.Vmcomments.IsUnset() { - t.Vmcomments = s.Vmcomments.MustGetNull() - } - if !s.Winddir.IsUnset() { - t.Winddir = s.Winddir.MustGetNull() - } - if !s.Windspeed.IsUnset() { - t.Windspeed = s.Windspeed.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Adminaction.IsUnset() { - t.Adminaction = s.Adminaction.MustGetNull() - } - if !s.Ptaid.IsUnset() { - t.Ptaid = s.Ptaid.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } - if !s.Geom.IsUnset() { - t.Geom = s.Geom.MustGetNull() - } -} - -func (s *FSMosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSMosquitoinspections.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 62) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Actiontaken.IsUnset() { - vals[1] = psql.Arg(s.Actiontaken.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Activity.IsUnset() { - vals[2] = psql.Arg(s.Activity.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Adultact.IsUnset() { - vals[3] = psql.Arg(s.Adultact.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Avetemp.IsUnset() { - vals[4] = psql.Arg(s.Avetemp.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Avglarvae.IsUnset() { - vals[5] = psql.Arg(s.Avglarvae.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Avgpupae.IsUnset() { - vals[6] = psql.Arg(s.Avgpupae.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Breeding.IsUnset() { - vals[7] = psql.Arg(s.Breeding.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Cbcount.IsUnset() { - vals[8] = psql.Arg(s.Cbcount.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[9] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Containercount.IsUnset() { - vals[10] = psql.Arg(s.Containercount.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[11] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[12] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Domstage.IsUnset() { - vals[13] = psql.Arg(s.Domstage.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Eggs.IsUnset() { - vals[14] = psql.Arg(s.Eggs.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Enddatetime.IsUnset() { - vals[15] = psql.Arg(s.Enddatetime.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[16] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[17] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Fieldspecies.IsUnset() { - vals[18] = psql.Arg(s.Fieldspecies.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Fieldtech.IsUnset() { - vals[19] = psql.Arg(s.Fieldtech.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[20] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Jurisdiction.IsUnset() { - vals[21] = psql.Arg(s.Jurisdiction.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Larvaepresent.IsUnset() { - vals[22] = psql.Arg(s.Larvaepresent.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Linelocid.IsUnset() { - vals[23] = psql.Arg(s.Linelocid.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Locationname.IsUnset() { - vals[24] = psql.Arg(s.Locationname.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Lstages.IsUnset() { - vals[25] = psql.Arg(s.Lstages.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Numdips.IsUnset() { - vals[26] = psql.Arg(s.Numdips.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[27] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Personalcontact.IsUnset() { - vals[28] = psql.Arg(s.Personalcontact.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Pointlocid.IsUnset() { - vals[29] = psql.Arg(s.Pointlocid.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Polygonlocid.IsUnset() { - vals[30] = psql.Arg(s.Polygonlocid.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Posdips.IsUnset() { - vals[31] = psql.Arg(s.Posdips.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Positivecontainercount.IsUnset() { - vals[32] = psql.Arg(s.Positivecontainercount.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Pupaepresent.IsUnset() { - vals[33] = psql.Arg(s.Pupaepresent.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Raingauge.IsUnset() { - vals[34] = psql.Arg(s.Raingauge.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Recordstatus.IsUnset() { - vals[35] = psql.Arg(s.Recordstatus.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Reviewed.IsUnset() { - vals[36] = psql.Arg(s.Reviewed.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.Reviewedby.IsUnset() { - vals[37] = psql.Arg(s.Reviewedby.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.Revieweddate.IsUnset() { - vals[38] = psql.Arg(s.Revieweddate.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Sdid.IsUnset() { - vals[39] = psql.Arg(s.Sdid.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Sitecond.IsUnset() { - vals[40] = psql.Arg(s.Sitecond.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.Srid.IsUnset() { - vals[41] = psql.Arg(s.Srid.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.Startdatetime.IsUnset() { - vals[42] = psql.Arg(s.Startdatetime.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.Tirecount.IsUnset() { - vals[43] = psql.Arg(s.Tirecount.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.Totlarvae.IsUnset() { - vals[44] = psql.Arg(s.Totlarvae.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if !s.Totpupae.IsUnset() { - vals[45] = psql.Arg(s.Totpupae.MustGetNull()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if !s.Visualmonitoring.IsUnset() { - vals[46] = psql.Arg(s.Visualmonitoring.MustGetNull()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - if !s.Vmcomments.IsUnset() { - vals[47] = psql.Arg(s.Vmcomments.MustGetNull()) - } else { - vals[47] = psql.Raw("DEFAULT") - } - - if !s.Winddir.IsUnset() { - vals[48] = psql.Arg(s.Winddir.MustGetNull()) - } else { - vals[48] = psql.Raw("DEFAULT") - } - - if !s.Windspeed.IsUnset() { - vals[49] = psql.Arg(s.Windspeed.MustGetNull()) - } else { - vals[49] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[50] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[50] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[51] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[51] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[52] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[52] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[53] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[53] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[54] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[54] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[55] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[55] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[56] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[56] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[57] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[57] = psql.Raw("DEFAULT") - } - - if !s.Adminaction.IsUnset() { - vals[58] = psql.Arg(s.Adminaction.MustGetNull()) - } else { - vals[58] = psql.Raw("DEFAULT") - } - - if !s.Ptaid.IsUnset() { - vals[59] = psql.Arg(s.Ptaid.MustGetNull()) - } else { - vals[59] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[60] = psql.Arg(s.Updated.MustGet()) - } else { - vals[60] = psql.Raw("DEFAULT") - } - - if !s.Geom.IsUnset() { - vals[61] = psql.Arg(s.Geom.MustGetNull()) - } else { - vals[61] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSMosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSMosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 62) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Actiontaken.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "actiontaken")...), - psql.Arg(s.Actiontaken), - }}) - } - - if !s.Activity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "activity")...), - psql.Arg(s.Activity), - }}) - } - - if !s.Adultact.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "adultact")...), - psql.Arg(s.Adultact), - }}) - } - - if !s.Avetemp.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "avetemp")...), - psql.Arg(s.Avetemp), - }}) - } - - if !s.Avglarvae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "avglarvae")...), - psql.Arg(s.Avglarvae), - }}) - } - - if !s.Avgpupae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "avgpupae")...), - psql.Arg(s.Avgpupae), - }}) - } - - if !s.Breeding.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "breeding")...), - psql.Arg(s.Breeding), - }}) - } - - if !s.Cbcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "cbcount")...), - psql.Arg(s.Cbcount), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Containercount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "containercount")...), - psql.Arg(s.Containercount), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Domstage.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "domstage")...), - psql.Arg(s.Domstage), - }}) - } - - if !s.Eggs.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "eggs")...), - psql.Arg(s.Eggs), - }}) - } - - if !s.Enddatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "enddatetime")...), - psql.Arg(s.Enddatetime), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fieldspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldspecies")...), - psql.Arg(s.Fieldspecies), - }}) - } - - if !s.Fieldtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldtech")...), - psql.Arg(s.Fieldtech), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Jurisdiction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "jurisdiction")...), - psql.Arg(s.Jurisdiction), - }}) - } - - if !s.Larvaepresent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvaepresent")...), - psql.Arg(s.Larvaepresent), - }}) - } - - if !s.Linelocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "linelocid")...), - psql.Arg(s.Linelocid), - }}) - } - - if !s.Locationname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationname")...), - psql.Arg(s.Locationname), - }}) - } - - if !s.Lstages.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lstages")...), - psql.Arg(s.Lstages), - }}) - } - - if !s.Numdips.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "numdips")...), - psql.Arg(s.Numdips), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Personalcontact.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "personalcontact")...), - psql.Arg(s.Personalcontact), - }}) - } - - if !s.Pointlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pointlocid")...), - psql.Arg(s.Pointlocid), - }}) - } - - if !s.Polygonlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "polygonlocid")...), - psql.Arg(s.Polygonlocid), - }}) - } - - if !s.Posdips.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "posdips")...), - psql.Arg(s.Posdips), - }}) - } - - if !s.Positivecontainercount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "positivecontainercount")...), - psql.Arg(s.Positivecontainercount), - }}) - } - - if !s.Pupaepresent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pupaepresent")...), - psql.Arg(s.Pupaepresent), - }}) - } - - if !s.Raingauge.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "raingauge")...), - psql.Arg(s.Raingauge), - }}) - } - - if !s.Recordstatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "recordstatus")...), - psql.Arg(s.Recordstatus), - }}) - } - - if !s.Reviewed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewed")...), - psql.Arg(s.Reviewed), - }}) - } - - if !s.Reviewedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewedby")...), - psql.Arg(s.Reviewedby), - }}) - } - - if !s.Revieweddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "revieweddate")...), - psql.Arg(s.Revieweddate), - }}) - } - - if !s.Sdid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sdid")...), - psql.Arg(s.Sdid), - }}) - } - - if !s.Sitecond.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sitecond")...), - psql.Arg(s.Sitecond), - }}) - } - - if !s.Srid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "srid")...), - psql.Arg(s.Srid), - }}) - } - - if !s.Startdatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "startdatetime")...), - psql.Arg(s.Startdatetime), - }}) - } - - if !s.Tirecount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "tirecount")...), - psql.Arg(s.Tirecount), - }}) - } - - if !s.Totlarvae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "totlarvae")...), - psql.Arg(s.Totlarvae), - }}) - } - - if !s.Totpupae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "totpupae")...), - psql.Arg(s.Totpupae), - }}) - } - - if !s.Visualmonitoring.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "visualmonitoring")...), - psql.Arg(s.Visualmonitoring), - }}) - } - - if !s.Vmcomments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vmcomments")...), - psql.Arg(s.Vmcomments), - }}) - } - - if !s.Winddir.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "winddir")...), - psql.Arg(s.Winddir), - }}) - } - - if !s.Windspeed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "windspeed")...), - psql.Arg(s.Windspeed), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Adminaction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "adminaction")...), - psql.Arg(s.Adminaction), - }}) - } - - if !s.Ptaid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "ptaid")...), - psql.Arg(s.Ptaid), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - if !s.Geom.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geom")...), - psql.Arg(s.Geom), - }}) - } - - return exprs -} - -// FindFSMosquitoinspection retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSMosquitoinspection(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSMosquitoinspection, error) { - if len(cols) == 0 { - return FSMosquitoinspections.Query( - sm.Where(FSMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSMosquitoinspections.Query( - sm.Where(FSMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSMosquitoinspections.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSMosquitoinspectionExists checks the presence of a single record by primary key -func FSMosquitoinspectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSMosquitoinspections.Query( - sm.Where(FSMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSMosquitoinspection is retrieved from the database -func (o *FSMosquitoinspection) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSMosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, FSMosquitoinspectionSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSMosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, FSMosquitoinspectionSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSMosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, FSMosquitoinspectionSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSMosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, FSMosquitoinspectionSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSMosquitoinspection -func (o *FSMosquitoinspection) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSMosquitoinspection) pkEQ() dialect.Expression { - return psql.Quote("fs_mosquitoinspection", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSMosquitoinspection -func (o *FSMosquitoinspection) Update(ctx context.Context, exec bob.Executor, s *FSMosquitoinspectionSetter) error { - v, err := FSMosquitoinspections.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 FSMosquitoinspection record with an executor -func (o *FSMosquitoinspection) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSMosquitoinspections.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSMosquitoinspection using the executor -func (o *FSMosquitoinspection) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSMosquitoinspections.Query( - sm.Where(FSMosquitoinspections.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSMosquitoinspectionSlice is retrieved from the database -func (o FSMosquitoinspectionSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSMosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSMosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSMosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSMosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSMosquitoinspectionSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_mosquitoinspection", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSMosquitoinspectionSlice) copyMatchingRows(from ...*FSMosquitoinspection) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSMosquitoinspectionSlice) 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 FSMosquitoinspections.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 *FSMosquitoinspection: - o.copyMatchingRows(retrieved) - case []*FSMosquitoinspection: - o.copyMatchingRows(retrieved...) - case FSMosquitoinspectionSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSMosquitoinspection or a slice of FSMosquitoinspection - // then run the AfterUpdateHooks on the slice - _, err = FSMosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSMosquitoinspectionSlice) 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 FSMosquitoinspections.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 *FSMosquitoinspection: - o.copyMatchingRows(retrieved) - case []*FSMosquitoinspection: - o.copyMatchingRows(retrieved...) - case FSMosquitoinspectionSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSMosquitoinspection or a slice of FSMosquitoinspection - // then run the AfterDeleteHooks on the slice - _, err = FSMosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSMosquitoinspectionSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSMosquitoinspectionSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSMosquitoinspections.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSMosquitoinspectionSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSMosquitoinspections.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSMosquitoinspectionSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSMosquitoinspections.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 *FSMosquitoinspection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSMosquitoinspectionSlice) 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 attachFSMosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, fsMosquitoinspection0 *FSMosquitoinspection, organization1 *Organization) (*FSMosquitoinspection, error) { - setter := &FSMosquitoinspectionSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsMosquitoinspection0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSMosquitoinspectionOrganization0: %w", err) - } - - return fsMosquitoinspection0, nil -} - -func (fsMosquitoinspection0 *FSMosquitoinspection) 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 = attachFSMosquitoinspectionOrganization0(ctx, exec, 1, fsMosquitoinspection0, organization1) - if err != nil { - return err - } - - fsMosquitoinspection0.R.Organization = organization1 - - organization1.R.FSMosquitoinspections = append(organization1.R.FSMosquitoinspections, fsMosquitoinspection0) - - return nil -} - -func (fsMosquitoinspection0 *FSMosquitoinspection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSMosquitoinspectionOrganization0(ctx, exec, 1, fsMosquitoinspection0, organization1) - if err != nil { - return err - } - - fsMosquitoinspection0.R.Organization = organization1 - - organization1.R.FSMosquitoinspections = append(organization1.R.FSMosquitoinspections, fsMosquitoinspection0) - - return nil -} - -type fsMosquitoinspectionWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Actiontaken psql.WhereNullMod[Q, string] - Activity psql.WhereNullMod[Q, string] - Adultact psql.WhereNullMod[Q, string] - Avetemp psql.WhereNullMod[Q, float64] - Avglarvae psql.WhereNullMod[Q, float64] - Avgpupae psql.WhereNullMod[Q, float64] - Breeding psql.WhereNullMod[Q, string] - Cbcount psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Containercount psql.WhereNullMod[Q, int16] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Domstage psql.WhereNullMod[Q, string] - Eggs psql.WhereNullMod[Q, int16] - Enddatetime psql.WhereNullMod[Q, int64] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fieldspecies psql.WhereNullMod[Q, string] - Fieldtech psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Jurisdiction psql.WhereNullMod[Q, string] - Larvaepresent psql.WhereNullMod[Q, int16] - Linelocid psql.WhereNullMod[Q, string] - Locationname psql.WhereNullMod[Q, string] - Lstages psql.WhereNullMod[Q, string] - Numdips psql.WhereNullMod[Q, int16] - Objectid psql.WhereMod[Q, int32] - Personalcontact psql.WhereNullMod[Q, int16] - Pointlocid psql.WhereNullMod[Q, string] - Polygonlocid psql.WhereNullMod[Q, string] - Posdips psql.WhereNullMod[Q, int16] - Positivecontainercount psql.WhereNullMod[Q, int16] - Pupaepresent psql.WhereNullMod[Q, int16] - Raingauge psql.WhereNullMod[Q, float64] - Recordstatus psql.WhereNullMod[Q, int16] - Reviewed psql.WhereNullMod[Q, int16] - Reviewedby psql.WhereNullMod[Q, string] - Revieweddate psql.WhereNullMod[Q, int64] - Sdid psql.WhereNullMod[Q, string] - Sitecond psql.WhereNullMod[Q, string] - Srid psql.WhereNullMod[Q, string] - Startdatetime psql.WhereNullMod[Q, int64] - Tirecount psql.WhereNullMod[Q, int16] - Totlarvae psql.WhereNullMod[Q, int16] - Totpupae psql.WhereNullMod[Q, int16] - Visualmonitoring psql.WhereNullMod[Q, int16] - Vmcomments psql.WhereNullMod[Q, string] - Winddir psql.WhereNullMod[Q, string] - Windspeed psql.WhereNullMod[Q, float64] - Zone psql.WhereNullMod[Q, string] - 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] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Adminaction psql.WhereNullMod[Q, string] - Ptaid psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] - Geom psql.WhereNullMod[Q, string] -} - -func (fsMosquitoinspectionWhere[Q]) AliasedAs(alias string) fsMosquitoinspectionWhere[Q] { - return buildFSMosquitoinspectionWhere[Q](buildFSMosquitoinspectionColumns(alias)) -} - -func buildFSMosquitoinspectionWhere[Q psql.Filterable](cols fsMosquitoinspectionColumns) fsMosquitoinspectionWhere[Q] { - return fsMosquitoinspectionWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Actiontaken: psql.WhereNull[Q, string](cols.Actiontaken), - Activity: psql.WhereNull[Q, string](cols.Activity), - Adultact: psql.WhereNull[Q, string](cols.Adultact), - Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), - Avglarvae: psql.WhereNull[Q, float64](cols.Avglarvae), - Avgpupae: psql.WhereNull[Q, float64](cols.Avgpupae), - Breeding: psql.WhereNull[Q, string](cols.Breeding), - Cbcount: psql.WhereNull[Q, int16](cols.Cbcount), - Comments: psql.WhereNull[Q, string](cols.Comments), - Containercount: psql.WhereNull[Q, int16](cols.Containercount), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Domstage: psql.WhereNull[Q, string](cols.Domstage), - Eggs: psql.WhereNull[Q, int16](cols.Eggs), - Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Fieldspecies: psql.WhereNull[Q, string](cols.Fieldspecies), - Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), - 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), - Locationname: psql.WhereNull[Q, string](cols.Locationname), - Lstages: psql.WhereNull[Q, string](cols.Lstages), - Numdips: psql.WhereNull[Q, int16](cols.Numdips), - Objectid: psql.Where[Q, int32](cols.Objectid), - Personalcontact: psql.WhereNull[Q, int16](cols.Personalcontact), - Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), - Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), - Posdips: psql.WhereNull[Q, int16](cols.Posdips), - Positivecontainercount: psql.WhereNull[Q, int16](cols.Positivecontainercount), - Pupaepresent: psql.WhereNull[Q, int16](cols.Pupaepresent), - Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), - Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), - Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), - Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), - Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), - Sdid: psql.WhereNull[Q, string](cols.Sdid), - Sitecond: psql.WhereNull[Q, string](cols.Sitecond), - Srid: psql.WhereNull[Q, string](cols.Srid), - Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), - Tirecount: psql.WhereNull[Q, int16](cols.Tirecount), - Totlarvae: psql.WhereNull[Q, int16](cols.Totlarvae), - Totpupae: psql.WhereNull[Q, int16](cols.Totpupae), - Visualmonitoring: psql.WhereNull[Q, int16](cols.Visualmonitoring), - Vmcomments: psql.WhereNull[Q, string](cols.Vmcomments), - Winddir: psql.WhereNull[Q, string](cols.Winddir), - Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), - Zone: psql.WhereNull[Q, string](cols.Zone), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Adminaction: psql.WhereNull[Q, string](cols.Adminaction), - Ptaid: psql.WhereNull[Q, string](cols.Ptaid), - Updated: psql.Where[Q, time.Time](cols.Updated), - Geom: psql.WhereNull[Q, string](cols.Geom), - } -} - -func (o *FSMosquitoinspection) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsMosquitoinspection cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSMosquitoinspections = FSMosquitoinspectionSlice{o} - } - return nil - default: - return fmt.Errorf("fsMosquitoinspection has no relationship %q", name) - } -} - -type fsMosquitoinspectionPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSMosquitoinspectionPreloader() fsMosquitoinspectionPreloader { - return fsMosquitoinspectionPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSMosquitoinspections, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsMosquitoinspectionThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSMosquitoinspectionThenLoader[Q orm.Loadable]() fsMosquitoinspectionThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsMosquitoinspectionThenLoader[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 fsMosquitoinspection's Organization into the .R struct -func (o *FSMosquitoinspection) 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.FSMosquitoinspections = FSMosquitoinspectionSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsMosquitoinspection's Organization into the .R struct -func (os FSMosquitoinspectionSlice) 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.FSMosquitoinspections = append(rel.R.FSMosquitoinspections, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsMosquitoinspectionJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsMosquitoinspectionJoins[Q]) aliasedAs(alias string) fsMosquitoinspectionJoins[Q] { - return buildFSMosquitoinspectionJoins[Q](buildFSMosquitoinspectionColumns(alias), j.typ) -} - -func buildFSMosquitoinspectionJoins[Q dialect.Joinable](cols fsMosquitoinspectionColumns, typ string) fsMosquitoinspectionJoins[Q] { - return fsMosquitoinspectionJoins[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/db/models/fs_pointlocation.bob.go b/db/models/fs_pointlocation.bob.go deleted file mode 100644 index 85166e2a..00000000 --- a/db/models/fs_pointlocation.bob.go +++ /dev/null @@ -1,1780 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSPointlocation is an object representing the database table. -type FSPointlocation struct { - OrganizationID int32 `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid string `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Larvinspectinterval null.Val[int16] `db:"larvinspectinterval" ` - Lastinspectactiontaken null.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectactivity null.Val[string] `db:"lastinspectactivity" ` - Lastinspectavglarvae null.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae null.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectbreeding null.Val[string] `db:"lastinspectbreeding" ` - Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate null.Val[int64] `db:"lastinspectdate" ` - Lastinspectfieldspecies null.Val[string] `db:"lastinspectfieldspecies" ` - Lastinspectlstages null.Val[string] `db:"lastinspectlstages" ` - Lasttreatactivity null.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate null.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct null.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty null.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit null.Val[string] `db:"lasttreatqtyunit" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Name null.Val[string] `db:"name" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Stype null.Val[string] `db:"stype" ` - Symbology null.Val[string] `db:"symbology" ` - Usetype null.Val[string] `db:"usetype" ` - Waterorigin null.Val[string] `db:"waterorigin" ` - X null.Val[float64] `db:"x" ` - Y null.Val[float64] `db:"y" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - 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" ` - Sourcestatus null.Val[string] `db:"sourcestatus" ` - Updated time.Time `db:"updated" ` - Geom null.Val[string] `db:"geom" ` - - R fsPointlocationR `db:"-" ` -} - -// FSPointlocationSlice is an alias for a slice of pointers to FSPointlocation. -// This should almost always be used instead of []*FSPointlocation. -type FSPointlocationSlice []*FSPointlocation - -// FSPointlocations contains methods to work with the fs_pointlocation table -var FSPointlocations = psql.NewTablex[*FSPointlocation, FSPointlocationSlice, *FSPointlocationSetter]("", "fs_pointlocation", buildFSPointlocationColumns("fs_pointlocation")) - -// FSPointlocationsQuery is a query on the fs_pointlocation table -type FSPointlocationsQuery = *psql.ViewQuery[*FSPointlocation, FSPointlocationSlice] - -// fsPointlocationR is where relationships are stored. -type fsPointlocationR struct { - Organization *Organization // fs_pointlocation.fs_pointlocation_organization_id_fkey -} - -func buildFSPointlocationColumns(alias string) fsPointlocationColumns { - return fsPointlocationColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "globalid", "habitat", "jurisdiction", "larvinspectinterval", "lastinspectactiontaken", "lastinspectactivity", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectbreeding", "lastinspectconditions", "lastinspectdate", "lastinspectfieldspecies", "lastinspectlstages", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "stype", "symbology", "usetype", "waterorigin", "x", "y", "zone", "zone2", "geometry_x", "geometry_y", "assignedtech", "deactivate_reason", "scalarpriority", "sourcestatus", "updated", "geom", - ).WithParent("fs_pointlocation"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accessdesc: psql.Quote(alias, "accessdesc"), - Active: psql.Quote(alias, "active"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Description: psql.Quote(alias, "description"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Habitat: psql.Quote(alias, "habitat"), - Jurisdiction: psql.Quote(alias, "jurisdiction"), - Larvinspectinterval: psql.Quote(alias, "larvinspectinterval"), - Lastinspectactiontaken: psql.Quote(alias, "lastinspectactiontaken"), - Lastinspectactivity: psql.Quote(alias, "lastinspectactivity"), - Lastinspectavglarvae: psql.Quote(alias, "lastinspectavglarvae"), - Lastinspectavgpupae: psql.Quote(alias, "lastinspectavgpupae"), - Lastinspectbreeding: psql.Quote(alias, "lastinspectbreeding"), - Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), - Lastinspectdate: psql.Quote(alias, "lastinspectdate"), - Lastinspectfieldspecies: psql.Quote(alias, "lastinspectfieldspecies"), - Lastinspectlstages: psql.Quote(alias, "lastinspectlstages"), - Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), - Lasttreatdate: psql.Quote(alias, "lasttreatdate"), - Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), - Lasttreatqty: psql.Quote(alias, "lasttreatqty"), - Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), - Locationnumber: psql.Quote(alias, "locationnumber"), - Name: psql.Quote(alias, "name"), - Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), - Objectid: psql.Quote(alias, "objectid"), - Priority: psql.Quote(alias, "priority"), - Stype: psql.Quote(alias, "stype"), - Symbology: psql.Quote(alias, "symbology"), - Usetype: psql.Quote(alias, "usetype"), - Waterorigin: psql.Quote(alias, "waterorigin"), - X: psql.Quote(alias, "x"), - Y: psql.Quote(alias, "y"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - Assignedtech: psql.Quote(alias, "assignedtech"), - DeactivateReason: psql.Quote(alias, "deactivate_reason"), - Scalarpriority: psql.Quote(alias, "scalarpriority"), - Sourcestatus: psql.Quote(alias, "sourcestatus"), - Updated: psql.Quote(alias, "updated"), - Geom: psql.Quote(alias, "geom"), - } -} - -type fsPointlocationColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accessdesc psql.Expression - Active psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Description psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Habitat psql.Expression - Jurisdiction psql.Expression - Larvinspectinterval psql.Expression - Lastinspectactiontaken psql.Expression - Lastinspectactivity psql.Expression - Lastinspectavglarvae psql.Expression - Lastinspectavgpupae psql.Expression - Lastinspectbreeding psql.Expression - Lastinspectconditions psql.Expression - Lastinspectdate psql.Expression - Lastinspectfieldspecies psql.Expression - Lastinspectlstages psql.Expression - Lasttreatactivity psql.Expression - Lasttreatdate psql.Expression - Lasttreatproduct psql.Expression - Lasttreatqty psql.Expression - Lasttreatqtyunit psql.Expression - Locationnumber psql.Expression - Name psql.Expression - Nextactiondatescheduled psql.Expression - Objectid psql.Expression - Priority psql.Expression - Stype psql.Expression - Symbology psql.Expression - Usetype psql.Expression - Waterorigin psql.Expression - X psql.Expression - Y psql.Expression - Zone psql.Expression - Zone2 psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - Assignedtech psql.Expression - DeactivateReason psql.Expression - Scalarpriority psql.Expression - Sourcestatus psql.Expression - Updated psql.Expression - Geom psql.Expression -} - -func (c fsPointlocationColumns) Alias() string { - return c.tableAlias -} - -func (fsPointlocationColumns) AliasedAs(alias string) fsPointlocationColumns { - return buildFSPointlocationColumns(alias) -} - -// FSPointlocationSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSPointlocationSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omit.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Larvinspectinterval omitnull.Val[int16] `db:"larvinspectinterval" ` - Lastinspectactiontaken omitnull.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectactivity omitnull.Val[string] `db:"lastinspectactivity" ` - Lastinspectavglarvae omitnull.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae omitnull.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectbreeding omitnull.Val[string] `db:"lastinspectbreeding" ` - Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate omitnull.Val[int64] `db:"lastinspectdate" ` - Lastinspectfieldspecies omitnull.Val[string] `db:"lastinspectfieldspecies" ` - Lastinspectlstages omitnull.Val[string] `db:"lastinspectlstages" ` - Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate omitnull.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Name omitnull.Val[string] `db:"name" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Stype omitnull.Val[string] `db:"stype" ` - Symbology omitnull.Val[string] `db:"symbology" ` - Usetype omitnull.Val[string] `db:"usetype" ` - Waterorigin omitnull.Val[string] `db:"waterorigin" ` - X omitnull.Val[float64] `db:"x" ` - Y omitnull.Val[float64] `db:"y" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - 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" ` - Sourcestatus omitnull.Val[string] `db:"sourcestatus" ` - Updated omit.Val[time.Time] `db:"updated" ` - Geom omitnull.Val[string] `db:"geom" ` -} - -func (s FSPointlocationSetter) SetColumns() []string { - vals := make([]string, 0, 49) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accessdesc.IsUnset() { - vals = append(vals, "accessdesc") - } - if !s.Active.IsUnset() { - vals = append(vals, "active") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Description.IsUnset() { - vals = append(vals, "description") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Habitat.IsUnset() { - vals = append(vals, "habitat") - } - if !s.Jurisdiction.IsUnset() { - vals = append(vals, "jurisdiction") - } - if !s.Larvinspectinterval.IsUnset() { - vals = append(vals, "larvinspectinterval") - } - if !s.Lastinspectactiontaken.IsUnset() { - vals = append(vals, "lastinspectactiontaken") - } - if !s.Lastinspectactivity.IsUnset() { - vals = append(vals, "lastinspectactivity") - } - if !s.Lastinspectavglarvae.IsUnset() { - vals = append(vals, "lastinspectavglarvae") - } - if !s.Lastinspectavgpupae.IsUnset() { - vals = append(vals, "lastinspectavgpupae") - } - if !s.Lastinspectbreeding.IsUnset() { - vals = append(vals, "lastinspectbreeding") - } - if !s.Lastinspectconditions.IsUnset() { - vals = append(vals, "lastinspectconditions") - } - if !s.Lastinspectdate.IsUnset() { - vals = append(vals, "lastinspectdate") - } - if !s.Lastinspectfieldspecies.IsUnset() { - vals = append(vals, "lastinspectfieldspecies") - } - if !s.Lastinspectlstages.IsUnset() { - vals = append(vals, "lastinspectlstages") - } - if !s.Lasttreatactivity.IsUnset() { - vals = append(vals, "lasttreatactivity") - } - if !s.Lasttreatdate.IsUnset() { - vals = append(vals, "lasttreatdate") - } - if !s.Lasttreatproduct.IsUnset() { - vals = append(vals, "lasttreatproduct") - } - if !s.Lasttreatqty.IsUnset() { - vals = append(vals, "lasttreatqty") - } - if !s.Lasttreatqtyunit.IsUnset() { - vals = append(vals, "lasttreatqtyunit") - } - if !s.Locationnumber.IsUnset() { - vals = append(vals, "locationnumber") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if !s.Nextactiondatescheduled.IsUnset() { - vals = append(vals, "nextactiondatescheduled") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Stype.IsUnset() { - vals = append(vals, "stype") - } - if !s.Symbology.IsUnset() { - vals = append(vals, "symbology") - } - if !s.Usetype.IsUnset() { - vals = append(vals, "usetype") - } - if !s.Waterorigin.IsUnset() { - vals = append(vals, "waterorigin") - } - if !s.X.IsUnset() { - vals = append(vals, "x") - } - if !s.Y.IsUnset() { - vals = append(vals, "y") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if s.GeometryX.IsValue() { - vals = append(vals, "geometry_x") - } - if s.GeometryY.IsValue() { - vals = append(vals, "geometry_y") - } - if !s.Assignedtech.IsUnset() { - vals = append(vals, "assignedtech") - } - if !s.DeactivateReason.IsUnset() { - vals = append(vals, "deactivate_reason") - } - if !s.Scalarpriority.IsUnset() { - vals = append(vals, "scalarpriority") - } - if !s.Sourcestatus.IsUnset() { - vals = append(vals, "sourcestatus") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - if !s.Geom.IsUnset() { - vals = append(vals, "geom") - } - return vals -} - -func (s FSPointlocationSetter) Overwrite(t *FSPointlocation) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accessdesc.IsUnset() { - t.Accessdesc = s.Accessdesc.MustGetNull() - } - if !s.Active.IsUnset() { - t.Active = s.Active.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Description.IsUnset() { - t.Description = s.Description.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Habitat.IsUnset() { - t.Habitat = s.Habitat.MustGetNull() - } - if !s.Jurisdiction.IsUnset() { - t.Jurisdiction = s.Jurisdiction.MustGetNull() - } - if !s.Larvinspectinterval.IsUnset() { - t.Larvinspectinterval = s.Larvinspectinterval.MustGetNull() - } - if !s.Lastinspectactiontaken.IsUnset() { - t.Lastinspectactiontaken = s.Lastinspectactiontaken.MustGetNull() - } - if !s.Lastinspectactivity.IsUnset() { - t.Lastinspectactivity = s.Lastinspectactivity.MustGetNull() - } - if !s.Lastinspectavglarvae.IsUnset() { - t.Lastinspectavglarvae = s.Lastinspectavglarvae.MustGetNull() - } - if !s.Lastinspectavgpupae.IsUnset() { - t.Lastinspectavgpupae = s.Lastinspectavgpupae.MustGetNull() - } - if !s.Lastinspectbreeding.IsUnset() { - t.Lastinspectbreeding = s.Lastinspectbreeding.MustGetNull() - } - if !s.Lastinspectconditions.IsUnset() { - t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() - } - if !s.Lastinspectdate.IsUnset() { - t.Lastinspectdate = s.Lastinspectdate.MustGetNull() - } - if !s.Lastinspectfieldspecies.IsUnset() { - t.Lastinspectfieldspecies = s.Lastinspectfieldspecies.MustGetNull() - } - if !s.Lastinspectlstages.IsUnset() { - t.Lastinspectlstages = s.Lastinspectlstages.MustGetNull() - } - if !s.Lasttreatactivity.IsUnset() { - t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() - } - if !s.Lasttreatdate.IsUnset() { - t.Lasttreatdate = s.Lasttreatdate.MustGetNull() - } - if !s.Lasttreatproduct.IsUnset() { - t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() - } - if !s.Lasttreatqty.IsUnset() { - t.Lasttreatqty = s.Lasttreatqty.MustGetNull() - } - if !s.Lasttreatqtyunit.IsUnset() { - t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() - } - if !s.Locationnumber.IsUnset() { - t.Locationnumber = s.Locationnumber.MustGetNull() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if !s.Nextactiondatescheduled.IsUnset() { - t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Stype.IsUnset() { - t.Stype = s.Stype.MustGetNull() - } - if !s.Symbology.IsUnset() { - t.Symbology = s.Symbology.MustGetNull() - } - if !s.Usetype.IsUnset() { - t.Usetype = s.Usetype.MustGetNull() - } - if !s.Waterorigin.IsUnset() { - t.Waterorigin = s.Waterorigin.MustGetNull() - } - if !s.X.IsUnset() { - t.X = s.X.MustGetNull() - } - if !s.Y.IsUnset() { - t.Y = s.Y.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if s.GeometryX.IsValue() { - t.GeometryX = s.GeometryX.MustGet() - } - if s.GeometryY.IsValue() { - t.GeometryY = s.GeometryY.MustGet() - } - if !s.Assignedtech.IsUnset() { - t.Assignedtech = s.Assignedtech.MustGetNull() - } - if !s.DeactivateReason.IsUnset() { - t.DeactivateReason = s.DeactivateReason.MustGetNull() - } - if !s.Scalarpriority.IsUnset() { - t.Scalarpriority = s.Scalarpriority.MustGetNull() - } - if !s.Sourcestatus.IsUnset() { - t.Sourcestatus = s.Sourcestatus.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } - if !s.Geom.IsUnset() { - t.Geom = s.Geom.MustGetNull() - } -} - -func (s *FSPointlocationSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSPointlocations.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 49) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accessdesc.IsUnset() { - vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Active.IsUnset() { - vals[2] = psql.Arg(s.Active.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[3] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[4] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[5] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Description.IsUnset() { - vals[6] = psql.Arg(s.Description.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[7] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[8] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[9] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[10] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Habitat.IsUnset() { - vals[11] = psql.Arg(s.Habitat.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Jurisdiction.IsUnset() { - vals[12] = psql.Arg(s.Jurisdiction.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Larvinspectinterval.IsUnset() { - vals[13] = psql.Arg(s.Larvinspectinterval.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectactiontaken.IsUnset() { - vals[14] = psql.Arg(s.Lastinspectactiontaken.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectactivity.IsUnset() { - vals[15] = psql.Arg(s.Lastinspectactivity.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectavglarvae.IsUnset() { - vals[16] = psql.Arg(s.Lastinspectavglarvae.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectavgpupae.IsUnset() { - vals[17] = psql.Arg(s.Lastinspectavgpupae.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectbreeding.IsUnset() { - vals[18] = psql.Arg(s.Lastinspectbreeding.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectconditions.IsUnset() { - vals[19] = psql.Arg(s.Lastinspectconditions.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectdate.IsUnset() { - vals[20] = psql.Arg(s.Lastinspectdate.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectfieldspecies.IsUnset() { - vals[21] = psql.Arg(s.Lastinspectfieldspecies.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectlstages.IsUnset() { - vals[22] = psql.Arg(s.Lastinspectlstages.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatactivity.IsUnset() { - vals[23] = psql.Arg(s.Lasttreatactivity.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatdate.IsUnset() { - vals[24] = psql.Arg(s.Lasttreatdate.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatproduct.IsUnset() { - vals[25] = psql.Arg(s.Lasttreatproduct.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqty.IsUnset() { - vals[26] = psql.Arg(s.Lasttreatqty.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqtyunit.IsUnset() { - vals[27] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Locationnumber.IsUnset() { - vals[28] = psql.Arg(s.Locationnumber.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[29] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Nextactiondatescheduled.IsUnset() { - vals[30] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[31] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[32] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Stype.IsUnset() { - vals[33] = psql.Arg(s.Stype.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Symbology.IsUnset() { - vals[34] = psql.Arg(s.Symbology.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Usetype.IsUnset() { - vals[35] = psql.Arg(s.Usetype.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Waterorigin.IsUnset() { - vals[36] = psql.Arg(s.Waterorigin.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.X.IsUnset() { - vals[37] = psql.Arg(s.X.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.Y.IsUnset() { - vals[38] = psql.Arg(s.Y.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[39] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[40] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if s.GeometryX.IsValue() { - vals[41] = psql.Arg(s.GeometryX.MustGet()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if s.GeometryY.IsValue() { - vals[42] = psql.Arg(s.GeometryY.MustGet()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.Assignedtech.IsUnset() { - vals[43] = psql.Arg(s.Assignedtech.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.DeactivateReason.IsUnset() { - vals[44] = psql.Arg(s.DeactivateReason.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if !s.Scalarpriority.IsUnset() { - vals[45] = psql.Arg(s.Scalarpriority.MustGetNull()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if !s.Sourcestatus.IsUnset() { - vals[46] = psql.Arg(s.Sourcestatus.MustGetNull()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[47] = psql.Arg(s.Updated.MustGet()) - } else { - vals[47] = psql.Raw("DEFAULT") - } - - if !s.Geom.IsUnset() { - vals[48] = psql.Arg(s.Geom.MustGetNull()) - } else { - vals[48] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSPointlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSPointlocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 49) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accessdesc.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accessdesc")...), - psql.Arg(s.Accessdesc), - }}) - } - - if !s.Active.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "active")...), - psql.Arg(s.Active), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Description.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "description")...), - psql.Arg(s.Description), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitat")...), - psql.Arg(s.Habitat), - }}) - } - - if !s.Jurisdiction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "jurisdiction")...), - psql.Arg(s.Jurisdiction), - }}) - } - - if !s.Larvinspectinterval.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvinspectinterval")...), - psql.Arg(s.Larvinspectinterval), - }}) - } - - if !s.Lastinspectactiontaken.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectactiontaken")...), - psql.Arg(s.Lastinspectactiontaken), - }}) - } - - if !s.Lastinspectactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectactivity")...), - psql.Arg(s.Lastinspectactivity), - }}) - } - - if !s.Lastinspectavglarvae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectavglarvae")...), - psql.Arg(s.Lastinspectavglarvae), - }}) - } - - if !s.Lastinspectavgpupae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectavgpupae")...), - psql.Arg(s.Lastinspectavgpupae), - }}) - } - - if !s.Lastinspectbreeding.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectbreeding")...), - psql.Arg(s.Lastinspectbreeding), - }}) - } - - if !s.Lastinspectconditions.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectconditions")...), - psql.Arg(s.Lastinspectconditions), - }}) - } - - if !s.Lastinspectdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectdate")...), - psql.Arg(s.Lastinspectdate), - }}) - } - - if !s.Lastinspectfieldspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectfieldspecies")...), - psql.Arg(s.Lastinspectfieldspecies), - }}) - } - - if !s.Lastinspectlstages.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectlstages")...), - psql.Arg(s.Lastinspectlstages), - }}) - } - - if !s.Lasttreatactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatactivity")...), - psql.Arg(s.Lasttreatactivity), - }}) - } - - if !s.Lasttreatdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatdate")...), - psql.Arg(s.Lasttreatdate), - }}) - } - - if !s.Lasttreatproduct.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatproduct")...), - psql.Arg(s.Lasttreatproduct), - }}) - } - - if !s.Lasttreatqty.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqty")...), - psql.Arg(s.Lasttreatqty), - }}) - } - - if !s.Lasttreatqtyunit.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqtyunit")...), - psql.Arg(s.Lasttreatqtyunit), - }}) - } - - if !s.Locationnumber.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationnumber")...), - psql.Arg(s.Locationnumber), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if !s.Nextactiondatescheduled.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nextactiondatescheduled")...), - psql.Arg(s.Nextactiondatescheduled), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Stype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "stype")...), - psql.Arg(s.Stype), - }}) - } - - if !s.Symbology.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "symbology")...), - psql.Arg(s.Symbology), - }}) - } - - if !s.Usetype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "usetype")...), - psql.Arg(s.Usetype), - }}) - } - - if !s.Waterorigin.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "waterorigin")...), - psql.Arg(s.Waterorigin), - }}) - } - - if !s.X.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "x")...), - psql.Arg(s.X), - }}) - } - - if !s.Y.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "y")...), - psql.Arg(s.Y), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - 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.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.Assignedtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "assignedtech")...), - psql.Arg(s.Assignedtech), - }}) - } - - if !s.DeactivateReason.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "deactivate_reason")...), - psql.Arg(s.DeactivateReason), - }}) - } - - if !s.Scalarpriority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "scalarpriority")...), - psql.Arg(s.Scalarpriority), - }}) - } - - if !s.Sourcestatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sourcestatus")...), - psql.Arg(s.Sourcestatus), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - if !s.Geom.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geom")...), - psql.Arg(s.Geom), - }}) - } - - return exprs -} - -// FindFSPointlocation retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSPointlocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSPointlocation, error) { - if len(cols) == 0 { - return FSPointlocations.Query( - sm.Where(FSPointlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSPointlocations.Query( - sm.Where(FSPointlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSPointlocations.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSPointlocationExists checks the presence of a single record by primary key -func FSPointlocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSPointlocations.Query( - sm.Where(FSPointlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSPointlocation is retrieved from the database -func (o *FSPointlocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSPointlocations.AfterSelectHooks.RunHooks(ctx, exec, FSPointlocationSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSPointlocations.AfterInsertHooks.RunHooks(ctx, exec, FSPointlocationSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSPointlocations.AfterUpdateHooks.RunHooks(ctx, exec, FSPointlocationSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSPointlocations.AfterDeleteHooks.RunHooks(ctx, exec, FSPointlocationSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSPointlocation -func (o *FSPointlocation) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSPointlocation) pkEQ() dialect.Expression { - return psql.Quote("fs_pointlocation", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSPointlocation -func (o *FSPointlocation) Update(ctx context.Context, exec bob.Executor, s *FSPointlocationSetter) error { - v, err := FSPointlocations.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 FSPointlocation record with an executor -func (o *FSPointlocation) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSPointlocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSPointlocation using the executor -func (o *FSPointlocation) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSPointlocations.Query( - sm.Where(FSPointlocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSPointlocationSlice is retrieved from the database -func (o FSPointlocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSPointlocations.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSPointlocations.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSPointlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSPointlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSPointlocationSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_pointlocation", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSPointlocationSlice) copyMatchingRows(from ...*FSPointlocation) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSPointlocationSlice) 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 FSPointlocations.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 *FSPointlocation: - o.copyMatchingRows(retrieved) - case []*FSPointlocation: - o.copyMatchingRows(retrieved...) - case FSPointlocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSPointlocation or a slice of FSPointlocation - // then run the AfterUpdateHooks on the slice - _, err = FSPointlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSPointlocationSlice) 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 FSPointlocations.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 *FSPointlocation: - o.copyMatchingRows(retrieved) - case []*FSPointlocation: - o.copyMatchingRows(retrieved...) - case FSPointlocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSPointlocation or a slice of FSPointlocation - // then run the AfterDeleteHooks on the slice - _, err = FSPointlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSPointlocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSPointlocationSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSPointlocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSPointlocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSPointlocations.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSPointlocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSPointlocations.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 *FSPointlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSPointlocationSlice) 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 attachFSPointlocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsPointlocation0 *FSPointlocation, organization1 *Organization) (*FSPointlocation, error) { - setter := &FSPointlocationSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsPointlocation0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSPointlocationOrganization0: %w", err) - } - - return fsPointlocation0, nil -} - -func (fsPointlocation0 *FSPointlocation) 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 = attachFSPointlocationOrganization0(ctx, exec, 1, fsPointlocation0, organization1) - if err != nil { - return err - } - - fsPointlocation0.R.Organization = organization1 - - organization1.R.FSPointlocations = append(organization1.R.FSPointlocations, fsPointlocation0) - - return nil -} - -func (fsPointlocation0 *FSPointlocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSPointlocationOrganization0(ctx, exec, 1, fsPointlocation0, organization1) - if err != nil { - return err - } - - fsPointlocation0.R.Organization = organization1 - - organization1.R.FSPointlocations = append(organization1.R.FSPointlocations, fsPointlocation0) - - return nil -} - -type fsPointlocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accessdesc psql.WhereNullMod[Q, string] - Active psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Description psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Habitat psql.WhereNullMod[Q, string] - Jurisdiction psql.WhereNullMod[Q, string] - Larvinspectinterval psql.WhereNullMod[Q, int16] - Lastinspectactiontaken psql.WhereNullMod[Q, string] - Lastinspectactivity psql.WhereNullMod[Q, string] - Lastinspectavglarvae psql.WhereNullMod[Q, float64] - Lastinspectavgpupae psql.WhereNullMod[Q, float64] - Lastinspectbreeding psql.WhereNullMod[Q, string] - Lastinspectconditions psql.WhereNullMod[Q, string] - Lastinspectdate psql.WhereNullMod[Q, int64] - Lastinspectfieldspecies psql.WhereNullMod[Q, string] - Lastinspectlstages psql.WhereNullMod[Q, string] - Lasttreatactivity psql.WhereNullMod[Q, string] - Lasttreatdate psql.WhereNullMod[Q, int64] - Lasttreatproduct psql.WhereNullMod[Q, string] - Lasttreatqty psql.WhereNullMod[Q, float64] - Lasttreatqtyunit psql.WhereNullMod[Q, string] - Locationnumber psql.WhereNullMod[Q, int64] - Name psql.WhereNullMod[Q, string] - Nextactiondatescheduled psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Priority psql.WhereNullMod[Q, string] - Stype psql.WhereNullMod[Q, string] - Symbology psql.WhereNullMod[Q, string] - Usetype psql.WhereNullMod[Q, string] - Waterorigin psql.WhereNullMod[Q, string] - X psql.WhereNullMod[Q, float64] - Y psql.WhereNullMod[Q, float64] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - 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] - Sourcestatus psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] - Geom psql.WhereNullMod[Q, string] -} - -func (fsPointlocationWhere[Q]) AliasedAs(alias string) fsPointlocationWhere[Q] { - return buildFSPointlocationWhere[Q](buildFSPointlocationColumns(alias)) -} - -func buildFSPointlocationWhere[Q psql.Filterable](cols fsPointlocationColumns) fsPointlocationWhere[Q] { - return fsPointlocationWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), - Active: psql.WhereNull[Q, int16](cols.Active), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Description: psql.WhereNull[Q, string](cols.Description), - Externalid: psql.WhereNull[Q, string](cols.Externalid), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - 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), - Lastinspectactiontaken: psql.WhereNull[Q, string](cols.Lastinspectactiontaken), - Lastinspectactivity: psql.WhereNull[Q, string](cols.Lastinspectactivity), - Lastinspectavglarvae: psql.WhereNull[Q, float64](cols.Lastinspectavglarvae), - Lastinspectavgpupae: psql.WhereNull[Q, float64](cols.Lastinspectavgpupae), - Lastinspectbreeding: psql.WhereNull[Q, string](cols.Lastinspectbreeding), - Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), - Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), - Lastinspectfieldspecies: psql.WhereNull[Q, string](cols.Lastinspectfieldspecies), - Lastinspectlstages: psql.WhereNull[Q, string](cols.Lastinspectlstages), - Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), - Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), - Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), - Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), - Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), - Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), - Name: psql.WhereNull[Q, string](cols.Name), - Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), - Objectid: psql.Where[Q, int32](cols.Objectid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Stype: psql.WhereNull[Q, string](cols.Stype), - Symbology: psql.WhereNull[Q, string](cols.Symbology), - Usetype: psql.WhereNull[Q, string](cols.Usetype), - Waterorigin: psql.WhereNull[Q, string](cols.Waterorigin), - X: psql.WhereNull[Q, float64](cols.X), - Y: psql.WhereNull[Q, float64](cols.Y), - Zone: psql.WhereNull[Q, string](cols.Zone), - Zone2: psql.WhereNull[Q, string](cols.Zone2), - 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), - Sourcestatus: psql.WhereNull[Q, string](cols.Sourcestatus), - Updated: psql.Where[Q, time.Time](cols.Updated), - Geom: psql.WhereNull[Q, string](cols.Geom), - } -} - -func (o *FSPointlocation) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsPointlocation cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSPointlocations = FSPointlocationSlice{o} - } - return nil - default: - return fmt.Errorf("fsPointlocation has no relationship %q", name) - } -} - -type fsPointlocationPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSPointlocationPreloader() fsPointlocationPreloader { - return fsPointlocationPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSPointlocations, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsPointlocationThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSPointlocationThenLoader[Q orm.Loadable]() fsPointlocationThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsPointlocationThenLoader[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 fsPointlocation's Organization into the .R struct -func (o *FSPointlocation) 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.FSPointlocations = FSPointlocationSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsPointlocation's Organization into the .R struct -func (os FSPointlocationSlice) 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.FSPointlocations = append(rel.R.FSPointlocations, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsPointlocationJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsPointlocationJoins[Q]) aliasedAs(alias string) fsPointlocationJoins[Q] { - return buildFSPointlocationJoins[Q](buildFSPointlocationColumns(alias), j.typ) -} - -func buildFSPointlocationJoins[Q dialect.Joinable](cols fsPointlocationColumns, typ string) fsPointlocationJoins[Q] { - return fsPointlocationJoins[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/db/models/fs_polygonlocation.bob.go b/db/models/fs_polygonlocation.bob.go deleted file mode 100644 index 75971afe..00000000 --- a/db/models/fs_polygonlocation.bob.go +++ /dev/null @@ -1,1705 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSPolygonlocation is an object representing the database table. -type FSPolygonlocation struct { - OrganizationID int32 `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Acres null.Val[float64] `db:"acres" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Filter null.Val[string] `db:"filter" ` - Globalid string `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Hectares null.Val[float64] `db:"hectares" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Larvinspectinterval null.Val[int16] `db:"larvinspectinterval" ` - Lastinspectactiontaken null.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectactivity null.Val[string] `db:"lastinspectactivity" ` - Lastinspectavglarvae null.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae null.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectbreeding null.Val[string] `db:"lastinspectbreeding" ` - Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate null.Val[int64] `db:"lastinspectdate" ` - Lastinspectfieldspecies null.Val[string] `db:"lastinspectfieldspecies" ` - Lastinspectlstages null.Val[string] `db:"lastinspectlstages" ` - Lasttreatactivity null.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate null.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct null.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty null.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit null.Val[string] `db:"lasttreatqtyunit" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Name null.Val[string] `db:"name" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Symbology null.Val[string] `db:"symbology" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - Usetype null.Val[string] `db:"usetype" ` - Waterorigin null.Val[string] `db:"waterorigin" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsPolygonlocationR `db:"-" ` -} - -// FSPolygonlocationSlice is an alias for a slice of pointers to FSPolygonlocation. -// This should almost always be used instead of []*FSPolygonlocation. -type FSPolygonlocationSlice []*FSPolygonlocation - -// FSPolygonlocations contains methods to work with the fs_polygonlocation table -var FSPolygonlocations = psql.NewTablex[*FSPolygonlocation, FSPolygonlocationSlice, *FSPolygonlocationSetter]("", "fs_polygonlocation", buildFSPolygonlocationColumns("fs_polygonlocation")) - -// FSPolygonlocationsQuery is a query on the fs_polygonlocation table -type FSPolygonlocationsQuery = *psql.ViewQuery[*FSPolygonlocation, FSPolygonlocationSlice] - -// fsPolygonlocationR is where relationships are stored. -type fsPolygonlocationR struct { - Organization *Organization // fs_polygonlocation.fs_polygonlocation_organization_id_fkey -} - -func buildFSPolygonlocationColumns(alias string) fsPolygonlocationColumns { - return fsPolygonlocationColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "acres", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "filter", "globalid", "habitat", "hectares", "jurisdiction", "larvinspectinterval", "lastinspectactiontaken", "lastinspectactivity", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectbreeding", "lastinspectconditions", "lastinspectdate", "lastinspectfieldspecies", "lastinspectlstages", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "symbology", "shape__area", "shape__length", "usetype", "waterorigin", "zone", "zone2", "geometry_x", "geometry_y", "updated", - ).WithParent("fs_polygonlocation"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accessdesc: psql.Quote(alias, "accessdesc"), - Acres: psql.Quote(alias, "acres"), - Active: psql.Quote(alias, "active"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Description: psql.Quote(alias, "description"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Filter: psql.Quote(alias, "filter"), - Globalid: psql.Quote(alias, "globalid"), - Habitat: psql.Quote(alias, "habitat"), - Hectares: psql.Quote(alias, "hectares"), - Jurisdiction: psql.Quote(alias, "jurisdiction"), - Larvinspectinterval: psql.Quote(alias, "larvinspectinterval"), - Lastinspectactiontaken: psql.Quote(alias, "lastinspectactiontaken"), - Lastinspectactivity: psql.Quote(alias, "lastinspectactivity"), - Lastinspectavglarvae: psql.Quote(alias, "lastinspectavglarvae"), - Lastinspectavgpupae: psql.Quote(alias, "lastinspectavgpupae"), - Lastinspectbreeding: psql.Quote(alias, "lastinspectbreeding"), - Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), - Lastinspectdate: psql.Quote(alias, "lastinspectdate"), - Lastinspectfieldspecies: psql.Quote(alias, "lastinspectfieldspecies"), - Lastinspectlstages: psql.Quote(alias, "lastinspectlstages"), - Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), - Lasttreatdate: psql.Quote(alias, "lasttreatdate"), - Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), - Lasttreatqty: psql.Quote(alias, "lasttreatqty"), - Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), - Locationnumber: psql.Quote(alias, "locationnumber"), - Name: psql.Quote(alias, "name"), - Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), - Objectid: psql.Quote(alias, "objectid"), - Priority: psql.Quote(alias, "priority"), - Symbology: psql.Quote(alias, "symbology"), - ShapeArea: psql.Quote(alias, "shape__area"), - ShapeLength: psql.Quote(alias, "shape__length"), - Usetype: psql.Quote(alias, "usetype"), - Waterorigin: psql.Quote(alias, "waterorigin"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsPolygonlocationColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accessdesc psql.Expression - Acres psql.Expression - Active psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Description psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Filter psql.Expression - Globalid psql.Expression - Habitat psql.Expression - Hectares psql.Expression - Jurisdiction psql.Expression - Larvinspectinterval psql.Expression - Lastinspectactiontaken psql.Expression - Lastinspectactivity psql.Expression - Lastinspectavglarvae psql.Expression - Lastinspectavgpupae psql.Expression - Lastinspectbreeding psql.Expression - Lastinspectconditions psql.Expression - Lastinspectdate psql.Expression - Lastinspectfieldspecies psql.Expression - Lastinspectlstages psql.Expression - Lasttreatactivity psql.Expression - Lasttreatdate psql.Expression - Lasttreatproduct psql.Expression - Lasttreatqty psql.Expression - Lasttreatqtyunit psql.Expression - Locationnumber psql.Expression - Name psql.Expression - Nextactiondatescheduled psql.Expression - Objectid psql.Expression - Priority psql.Expression - Symbology psql.Expression - ShapeArea psql.Expression - ShapeLength psql.Expression - Usetype psql.Expression - Waterorigin psql.Expression - Zone psql.Expression - Zone2 psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - Updated psql.Expression -} - -func (c fsPolygonlocationColumns) Alias() string { - return c.tableAlias -} - -func (fsPolygonlocationColumns) AliasedAs(alias string) fsPolygonlocationColumns { - return buildFSPolygonlocationColumns(alias) -} - -// FSPolygonlocationSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSPolygonlocationSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Acres omitnull.Val[float64] `db:"acres" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Filter omitnull.Val[string] `db:"filter" ` - Globalid omit.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Hectares omitnull.Val[float64] `db:"hectares" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Larvinspectinterval omitnull.Val[int16] `db:"larvinspectinterval" ` - Lastinspectactiontaken omitnull.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectactivity omitnull.Val[string] `db:"lastinspectactivity" ` - Lastinspectavglarvae omitnull.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae omitnull.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectbreeding omitnull.Val[string] `db:"lastinspectbreeding" ` - Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate omitnull.Val[int64] `db:"lastinspectdate" ` - Lastinspectfieldspecies omitnull.Val[string] `db:"lastinspectfieldspecies" ` - Lastinspectlstages omitnull.Val[string] `db:"lastinspectlstages" ` - Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate omitnull.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Name omitnull.Val[string] `db:"name" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Symbology omitnull.Val[string] `db:"symbology" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Usetype omitnull.Val[string] `db:"usetype" ` - Waterorigin omitnull.Val[string] `db:"waterorigin" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSPolygonlocationSetter) SetColumns() []string { - vals := make([]string, 0, 46) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accessdesc.IsUnset() { - vals = append(vals, "accessdesc") - } - if !s.Acres.IsUnset() { - vals = append(vals, "acres") - } - if !s.Active.IsUnset() { - vals = append(vals, "active") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Description.IsUnset() { - vals = append(vals, "description") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Filter.IsUnset() { - vals = append(vals, "filter") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Habitat.IsUnset() { - vals = append(vals, "habitat") - } - if !s.Hectares.IsUnset() { - vals = append(vals, "hectares") - } - if !s.Jurisdiction.IsUnset() { - vals = append(vals, "jurisdiction") - } - if !s.Larvinspectinterval.IsUnset() { - vals = append(vals, "larvinspectinterval") - } - if !s.Lastinspectactiontaken.IsUnset() { - vals = append(vals, "lastinspectactiontaken") - } - if !s.Lastinspectactivity.IsUnset() { - vals = append(vals, "lastinspectactivity") - } - if !s.Lastinspectavglarvae.IsUnset() { - vals = append(vals, "lastinspectavglarvae") - } - if !s.Lastinspectavgpupae.IsUnset() { - vals = append(vals, "lastinspectavgpupae") - } - if !s.Lastinspectbreeding.IsUnset() { - vals = append(vals, "lastinspectbreeding") - } - if !s.Lastinspectconditions.IsUnset() { - vals = append(vals, "lastinspectconditions") - } - if !s.Lastinspectdate.IsUnset() { - vals = append(vals, "lastinspectdate") - } - if !s.Lastinspectfieldspecies.IsUnset() { - vals = append(vals, "lastinspectfieldspecies") - } - if !s.Lastinspectlstages.IsUnset() { - vals = append(vals, "lastinspectlstages") - } - if !s.Lasttreatactivity.IsUnset() { - vals = append(vals, "lasttreatactivity") - } - if !s.Lasttreatdate.IsUnset() { - vals = append(vals, "lasttreatdate") - } - if !s.Lasttreatproduct.IsUnset() { - vals = append(vals, "lasttreatproduct") - } - if !s.Lasttreatqty.IsUnset() { - vals = append(vals, "lasttreatqty") - } - if !s.Lasttreatqtyunit.IsUnset() { - vals = append(vals, "lasttreatqtyunit") - } - if !s.Locationnumber.IsUnset() { - vals = append(vals, "locationnumber") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if !s.Nextactiondatescheduled.IsUnset() { - vals = append(vals, "nextactiondatescheduled") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Symbology.IsUnset() { - vals = append(vals, "symbology") - } - if !s.ShapeArea.IsUnset() { - vals = append(vals, "shape__area") - } - if !s.ShapeLength.IsUnset() { - vals = append(vals, "shape__length") - } - if !s.Usetype.IsUnset() { - vals = append(vals, "usetype") - } - if !s.Waterorigin.IsUnset() { - vals = append(vals, "waterorigin") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSPolygonlocationSetter) Overwrite(t *FSPolygonlocation) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accessdesc.IsUnset() { - t.Accessdesc = s.Accessdesc.MustGetNull() - } - if !s.Acres.IsUnset() { - t.Acres = s.Acres.MustGetNull() - } - if !s.Active.IsUnset() { - t.Active = s.Active.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Description.IsUnset() { - t.Description = s.Description.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Filter.IsUnset() { - t.Filter = s.Filter.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Habitat.IsUnset() { - t.Habitat = s.Habitat.MustGetNull() - } - if !s.Hectares.IsUnset() { - t.Hectares = s.Hectares.MustGetNull() - } - if !s.Jurisdiction.IsUnset() { - t.Jurisdiction = s.Jurisdiction.MustGetNull() - } - if !s.Larvinspectinterval.IsUnset() { - t.Larvinspectinterval = s.Larvinspectinterval.MustGetNull() - } - if !s.Lastinspectactiontaken.IsUnset() { - t.Lastinspectactiontaken = s.Lastinspectactiontaken.MustGetNull() - } - if !s.Lastinspectactivity.IsUnset() { - t.Lastinspectactivity = s.Lastinspectactivity.MustGetNull() - } - if !s.Lastinspectavglarvae.IsUnset() { - t.Lastinspectavglarvae = s.Lastinspectavglarvae.MustGetNull() - } - if !s.Lastinspectavgpupae.IsUnset() { - t.Lastinspectavgpupae = s.Lastinspectavgpupae.MustGetNull() - } - if !s.Lastinspectbreeding.IsUnset() { - t.Lastinspectbreeding = s.Lastinspectbreeding.MustGetNull() - } - if !s.Lastinspectconditions.IsUnset() { - t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() - } - if !s.Lastinspectdate.IsUnset() { - t.Lastinspectdate = s.Lastinspectdate.MustGetNull() - } - if !s.Lastinspectfieldspecies.IsUnset() { - t.Lastinspectfieldspecies = s.Lastinspectfieldspecies.MustGetNull() - } - if !s.Lastinspectlstages.IsUnset() { - t.Lastinspectlstages = s.Lastinspectlstages.MustGetNull() - } - if !s.Lasttreatactivity.IsUnset() { - t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() - } - if !s.Lasttreatdate.IsUnset() { - t.Lasttreatdate = s.Lasttreatdate.MustGetNull() - } - if !s.Lasttreatproduct.IsUnset() { - t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() - } - if !s.Lasttreatqty.IsUnset() { - t.Lasttreatqty = s.Lasttreatqty.MustGetNull() - } - if !s.Lasttreatqtyunit.IsUnset() { - t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() - } - if !s.Locationnumber.IsUnset() { - t.Locationnumber = s.Locationnumber.MustGetNull() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if !s.Nextactiondatescheduled.IsUnset() { - t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Symbology.IsUnset() { - t.Symbology = s.Symbology.MustGetNull() - } - if !s.ShapeArea.IsUnset() { - t.ShapeArea = s.ShapeArea.MustGetNull() - } - if !s.ShapeLength.IsUnset() { - t.ShapeLength = s.ShapeLength.MustGetNull() - } - if !s.Usetype.IsUnset() { - t.Usetype = s.Usetype.MustGetNull() - } - if !s.Waterorigin.IsUnset() { - t.Waterorigin = s.Waterorigin.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSPolygonlocationSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSPolygonlocations.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 46) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accessdesc.IsUnset() { - vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Acres.IsUnset() { - vals[2] = psql.Arg(s.Acres.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Active.IsUnset() { - vals[3] = psql.Arg(s.Active.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[4] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[5] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[6] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Description.IsUnset() { - vals[7] = psql.Arg(s.Description.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[8] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[9] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[10] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Filter.IsUnset() { - vals[11] = psql.Arg(s.Filter.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[12] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Habitat.IsUnset() { - vals[13] = psql.Arg(s.Habitat.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Hectares.IsUnset() { - vals[14] = psql.Arg(s.Hectares.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Jurisdiction.IsUnset() { - vals[15] = psql.Arg(s.Jurisdiction.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Larvinspectinterval.IsUnset() { - vals[16] = psql.Arg(s.Larvinspectinterval.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectactiontaken.IsUnset() { - vals[17] = psql.Arg(s.Lastinspectactiontaken.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectactivity.IsUnset() { - vals[18] = psql.Arg(s.Lastinspectactivity.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectavglarvae.IsUnset() { - vals[19] = psql.Arg(s.Lastinspectavglarvae.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectavgpupae.IsUnset() { - vals[20] = psql.Arg(s.Lastinspectavgpupae.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectbreeding.IsUnset() { - vals[21] = psql.Arg(s.Lastinspectbreeding.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectconditions.IsUnset() { - vals[22] = psql.Arg(s.Lastinspectconditions.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectdate.IsUnset() { - vals[23] = psql.Arg(s.Lastinspectdate.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectfieldspecies.IsUnset() { - vals[24] = psql.Arg(s.Lastinspectfieldspecies.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectlstages.IsUnset() { - vals[25] = psql.Arg(s.Lastinspectlstages.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatactivity.IsUnset() { - vals[26] = psql.Arg(s.Lasttreatactivity.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatdate.IsUnset() { - vals[27] = psql.Arg(s.Lasttreatdate.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatproduct.IsUnset() { - vals[28] = psql.Arg(s.Lasttreatproduct.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqty.IsUnset() { - vals[29] = psql.Arg(s.Lasttreatqty.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqtyunit.IsUnset() { - vals[30] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Locationnumber.IsUnset() { - vals[31] = psql.Arg(s.Locationnumber.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[32] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Nextactiondatescheduled.IsUnset() { - vals[33] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[34] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[35] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Symbology.IsUnset() { - vals[36] = psql.Arg(s.Symbology.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.ShapeArea.IsUnset() { - vals[37] = psql.Arg(s.ShapeArea.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.ShapeLength.IsUnset() { - vals[38] = psql.Arg(s.ShapeLength.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Usetype.IsUnset() { - vals[39] = psql.Arg(s.Usetype.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Waterorigin.IsUnset() { - vals[40] = psql.Arg(s.Waterorigin.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[41] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[42] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[43] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[44] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[45] = psql.Arg(s.Updated.MustGet()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSPolygonlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSPolygonlocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 46) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accessdesc.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accessdesc")...), - psql.Arg(s.Accessdesc), - }}) - } - - if !s.Acres.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "acres")...), - psql.Arg(s.Acres), - }}) - } - - if !s.Active.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "active")...), - psql.Arg(s.Active), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Description.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "description")...), - psql.Arg(s.Description), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Filter.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "filter")...), - psql.Arg(s.Filter), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitat")...), - psql.Arg(s.Habitat), - }}) - } - - if !s.Hectares.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "hectares")...), - psql.Arg(s.Hectares), - }}) - } - - if !s.Jurisdiction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "jurisdiction")...), - psql.Arg(s.Jurisdiction), - }}) - } - - if !s.Larvinspectinterval.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvinspectinterval")...), - psql.Arg(s.Larvinspectinterval), - }}) - } - - if !s.Lastinspectactiontaken.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectactiontaken")...), - psql.Arg(s.Lastinspectactiontaken), - }}) - } - - if !s.Lastinspectactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectactivity")...), - psql.Arg(s.Lastinspectactivity), - }}) - } - - if !s.Lastinspectavglarvae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectavglarvae")...), - psql.Arg(s.Lastinspectavglarvae), - }}) - } - - if !s.Lastinspectavgpupae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectavgpupae")...), - psql.Arg(s.Lastinspectavgpupae), - }}) - } - - if !s.Lastinspectbreeding.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectbreeding")...), - psql.Arg(s.Lastinspectbreeding), - }}) - } - - if !s.Lastinspectconditions.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectconditions")...), - psql.Arg(s.Lastinspectconditions), - }}) - } - - if !s.Lastinspectdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectdate")...), - psql.Arg(s.Lastinspectdate), - }}) - } - - if !s.Lastinspectfieldspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectfieldspecies")...), - psql.Arg(s.Lastinspectfieldspecies), - }}) - } - - if !s.Lastinspectlstages.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectlstages")...), - psql.Arg(s.Lastinspectlstages), - }}) - } - - if !s.Lasttreatactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatactivity")...), - psql.Arg(s.Lasttreatactivity), - }}) - } - - if !s.Lasttreatdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatdate")...), - psql.Arg(s.Lasttreatdate), - }}) - } - - if !s.Lasttreatproduct.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatproduct")...), - psql.Arg(s.Lasttreatproduct), - }}) - } - - if !s.Lasttreatqty.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqty")...), - psql.Arg(s.Lasttreatqty), - }}) - } - - if !s.Lasttreatqtyunit.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqtyunit")...), - psql.Arg(s.Lasttreatqtyunit), - }}) - } - - if !s.Locationnumber.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationnumber")...), - psql.Arg(s.Locationnumber), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if !s.Nextactiondatescheduled.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nextactiondatescheduled")...), - psql.Arg(s.Nextactiondatescheduled), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Symbology.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "symbology")...), - psql.Arg(s.Symbology), - }}) - } - - if !s.ShapeArea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__area")...), - psql.Arg(s.ShapeArea), - }}) - } - - if !s.ShapeLength.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__length")...), - psql.Arg(s.ShapeLength), - }}) - } - - if !s.Usetype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "usetype")...), - psql.Arg(s.Usetype), - }}) - } - - if !s.Waterorigin.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "waterorigin")...), - psql.Arg(s.Waterorigin), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSPolygonlocation retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSPolygonlocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSPolygonlocation, error) { - if len(cols) == 0 { - return FSPolygonlocations.Query( - sm.Where(FSPolygonlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSPolygonlocations.Query( - sm.Where(FSPolygonlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSPolygonlocations.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSPolygonlocationExists checks the presence of a single record by primary key -func FSPolygonlocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSPolygonlocations.Query( - sm.Where(FSPolygonlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSPolygonlocation is retrieved from the database -func (o *FSPolygonlocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSPolygonlocations.AfterSelectHooks.RunHooks(ctx, exec, FSPolygonlocationSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSPolygonlocations.AfterInsertHooks.RunHooks(ctx, exec, FSPolygonlocationSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSPolygonlocations.AfterUpdateHooks.RunHooks(ctx, exec, FSPolygonlocationSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSPolygonlocations.AfterDeleteHooks.RunHooks(ctx, exec, FSPolygonlocationSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSPolygonlocation -func (o *FSPolygonlocation) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSPolygonlocation) pkEQ() dialect.Expression { - return psql.Quote("fs_polygonlocation", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSPolygonlocation -func (o *FSPolygonlocation) Update(ctx context.Context, exec bob.Executor, s *FSPolygonlocationSetter) error { - v, err := FSPolygonlocations.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 FSPolygonlocation record with an executor -func (o *FSPolygonlocation) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSPolygonlocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSPolygonlocation using the executor -func (o *FSPolygonlocation) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSPolygonlocations.Query( - sm.Where(FSPolygonlocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSPolygonlocationSlice is retrieved from the database -func (o FSPolygonlocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSPolygonlocations.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSPolygonlocations.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSPolygonlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSPolygonlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSPolygonlocationSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_polygonlocation", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSPolygonlocationSlice) copyMatchingRows(from ...*FSPolygonlocation) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSPolygonlocationSlice) 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 FSPolygonlocations.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 *FSPolygonlocation: - o.copyMatchingRows(retrieved) - case []*FSPolygonlocation: - o.copyMatchingRows(retrieved...) - case FSPolygonlocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSPolygonlocation or a slice of FSPolygonlocation - // then run the AfterUpdateHooks on the slice - _, err = FSPolygonlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSPolygonlocationSlice) 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 FSPolygonlocations.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 *FSPolygonlocation: - o.copyMatchingRows(retrieved) - case []*FSPolygonlocation: - o.copyMatchingRows(retrieved...) - case FSPolygonlocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSPolygonlocation or a slice of FSPolygonlocation - // then run the AfterDeleteHooks on the slice - _, err = FSPolygonlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSPolygonlocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSPolygonlocationSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSPolygonlocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSPolygonlocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSPolygonlocations.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSPolygonlocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSPolygonlocations.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 *FSPolygonlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSPolygonlocationSlice) 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 attachFSPolygonlocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsPolygonlocation0 *FSPolygonlocation, organization1 *Organization) (*FSPolygonlocation, error) { - setter := &FSPolygonlocationSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsPolygonlocation0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSPolygonlocationOrganization0: %w", err) - } - - return fsPolygonlocation0, nil -} - -func (fsPolygonlocation0 *FSPolygonlocation) 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 = attachFSPolygonlocationOrganization0(ctx, exec, 1, fsPolygonlocation0, organization1) - if err != nil { - return err - } - - fsPolygonlocation0.R.Organization = organization1 - - organization1.R.FSPolygonlocations = append(organization1.R.FSPolygonlocations, fsPolygonlocation0) - - return nil -} - -func (fsPolygonlocation0 *FSPolygonlocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSPolygonlocationOrganization0(ctx, exec, 1, fsPolygonlocation0, organization1) - if err != nil { - return err - } - - fsPolygonlocation0.R.Organization = organization1 - - organization1.R.FSPolygonlocations = append(organization1.R.FSPolygonlocations, fsPolygonlocation0) - - return nil -} - -type fsPolygonlocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accessdesc psql.WhereNullMod[Q, string] - Acres psql.WhereNullMod[Q, float64] - Active psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Description psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Filter psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Habitat psql.WhereNullMod[Q, string] - Hectares psql.WhereNullMod[Q, float64] - Jurisdiction psql.WhereNullMod[Q, string] - Larvinspectinterval psql.WhereNullMod[Q, int16] - Lastinspectactiontaken psql.WhereNullMod[Q, string] - Lastinspectactivity psql.WhereNullMod[Q, string] - Lastinspectavglarvae psql.WhereNullMod[Q, float64] - Lastinspectavgpupae psql.WhereNullMod[Q, float64] - Lastinspectbreeding psql.WhereNullMod[Q, string] - Lastinspectconditions psql.WhereNullMod[Q, string] - Lastinspectdate psql.WhereNullMod[Q, int64] - Lastinspectfieldspecies psql.WhereNullMod[Q, string] - Lastinspectlstages psql.WhereNullMod[Q, string] - Lasttreatactivity psql.WhereNullMod[Q, string] - Lasttreatdate psql.WhereNullMod[Q, int64] - Lasttreatproduct psql.WhereNullMod[Q, string] - Lasttreatqty psql.WhereNullMod[Q, float64] - Lasttreatqtyunit psql.WhereNullMod[Q, string] - Locationnumber psql.WhereNullMod[Q, int64] - Name psql.WhereNullMod[Q, string] - Nextactiondatescheduled psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Priority psql.WhereNullMod[Q, string] - Symbology psql.WhereNullMod[Q, string] - ShapeArea psql.WhereNullMod[Q, float64] - ShapeLength psql.WhereNullMod[Q, float64] - Usetype psql.WhereNullMod[Q, string] - Waterorigin psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsPolygonlocationWhere[Q]) AliasedAs(alias string) fsPolygonlocationWhere[Q] { - return buildFSPolygonlocationWhere[Q](buildFSPolygonlocationColumns(alias)) -} - -func buildFSPolygonlocationWhere[Q psql.Filterable](cols fsPolygonlocationColumns) fsPolygonlocationWhere[Q] { - return fsPolygonlocationWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), - Acres: psql.WhereNull[Q, float64](cols.Acres), - Active: psql.WhereNull[Q, int16](cols.Active), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Description: psql.WhereNull[Q, string](cols.Description), - Externalid: psql.WhereNull[Q, string](cols.Externalid), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Filter: psql.WhereNull[Q, string](cols.Filter), - 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), - Larvinspectinterval: psql.WhereNull[Q, int16](cols.Larvinspectinterval), - Lastinspectactiontaken: psql.WhereNull[Q, string](cols.Lastinspectactiontaken), - Lastinspectactivity: psql.WhereNull[Q, string](cols.Lastinspectactivity), - Lastinspectavglarvae: psql.WhereNull[Q, float64](cols.Lastinspectavglarvae), - Lastinspectavgpupae: psql.WhereNull[Q, float64](cols.Lastinspectavgpupae), - Lastinspectbreeding: psql.WhereNull[Q, string](cols.Lastinspectbreeding), - Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), - Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), - Lastinspectfieldspecies: psql.WhereNull[Q, string](cols.Lastinspectfieldspecies), - Lastinspectlstages: psql.WhereNull[Q, string](cols.Lastinspectlstages), - Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), - Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), - Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), - Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), - Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), - Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), - Name: psql.WhereNull[Q, string](cols.Name), - Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), - Objectid: psql.Where[Q, int32](cols.Objectid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Symbology: psql.WhereNull[Q, string](cols.Symbology), - ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), - ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), - Usetype: psql.WhereNull[Q, string](cols.Usetype), - Waterorigin: psql.WhereNull[Q, string](cols.Waterorigin), - 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), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSPolygonlocation) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsPolygonlocation cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSPolygonlocations = FSPolygonlocationSlice{o} - } - return nil - default: - return fmt.Errorf("fsPolygonlocation has no relationship %q", name) - } -} - -type fsPolygonlocationPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSPolygonlocationPreloader() fsPolygonlocationPreloader { - return fsPolygonlocationPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSPolygonlocations, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsPolygonlocationThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSPolygonlocationThenLoader[Q orm.Loadable]() fsPolygonlocationThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsPolygonlocationThenLoader[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 fsPolygonlocation's Organization into the .R struct -func (o *FSPolygonlocation) 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.FSPolygonlocations = FSPolygonlocationSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsPolygonlocation's Organization into the .R struct -func (os FSPolygonlocationSlice) 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.FSPolygonlocations = append(rel.R.FSPolygonlocations, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsPolygonlocationJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsPolygonlocationJoins[Q]) aliasedAs(alias string) fsPolygonlocationJoins[Q] { - return buildFSPolygonlocationJoins[Q](buildFSPolygonlocationColumns(alias), j.typ) -} - -func buildFSPolygonlocationJoins[Q dialect.Joinable](cols fsPolygonlocationColumns, typ string) fsPolygonlocationJoins[Q] { - return fsPolygonlocationJoins[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/db/models/fs_pool.bob.go b/db/models/fs_pool.bob.go deleted file mode 100644 index a633cf4d..00000000 --- a/db/models/fs_pool.bob.go +++ /dev/null @@ -1,1355 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSPool is an object representing the database table. -type FSPool struct { - OrganizationID int32 `db:"organization_id" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Datesent null.Val[int64] `db:"datesent" ` - Datetested null.Val[int64] `db:"datetested" ` - Diseasepos null.Val[string] `db:"diseasepos" ` - Diseasetested null.Val[string] `db:"diseasetested" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid string `db:"globalid" ` - Lab null.Val[string] `db:"lab" ` - LabID null.Val[string] `db:"lab_id" ` - Objectid int32 `db:"objectid,pk" ` - Poolyear null.Val[int16] `db:"poolyear" ` - Processed null.Val[int16] `db:"processed" ` - Sampleid null.Val[string] `db:"sampleid" ` - Survtech null.Val[string] `db:"survtech" ` - Testmethod null.Val[string] `db:"testmethod" ` - Testtech null.Val[string] `db:"testtech" ` - TrapdataID null.Val[string] `db:"trapdata_id" ` - 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" ` - Vectorsurvcollectionid null.Val[string] `db:"vectorsurvcollectionid" ` - Vectorsurvpoolid null.Val[string] `db:"vectorsurvpoolid" ` - Vectorsurvtrapdataid null.Val[string] `db:"vectorsurvtrapdataid" ` - Updated time.Time `db:"updated" ` - - R fsPoolR `db:"-" ` -} - -// FSPoolSlice is an alias for a slice of pointers to FSPool. -// This should almost always be used instead of []*FSPool. -type FSPoolSlice []*FSPool - -// FSPools contains methods to work with the fs_pool table -var FSPools = psql.NewTablex[*FSPool, FSPoolSlice, *FSPoolSetter]("", "fs_pool", buildFSPoolColumns("fs_pool")) - -// FSPoolsQuery is a query on the fs_pool table -type FSPoolsQuery = *psql.ViewQuery[*FSPool, FSPoolSlice] - -// fsPoolR is where relationships are stored. -type fsPoolR struct { - Organization *Organization // fs_pool.fs_pool_organization_id_fkey -} - -func buildFSPoolColumns(alias string) fsPoolColumns { - return fsPoolColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "comments", "creationdate", "creator", "datesent", "datetested", "diseasepos", "diseasetested", "editdate", "editor", "gatewaysync", "globalid", "lab", "lab_id", "objectid", "poolyear", "processed", "sampleid", "survtech", "testmethod", "testtech", "trapdata_id", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "vectorsurvcollectionid", "vectorsurvpoolid", "vectorsurvtrapdataid", "updated", - ).WithParent("fs_pool"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Datesent: psql.Quote(alias, "datesent"), - Datetested: psql.Quote(alias, "datetested"), - Diseasepos: psql.Quote(alias, "diseasepos"), - Diseasetested: psql.Quote(alias, "diseasetested"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Gatewaysync: psql.Quote(alias, "gatewaysync"), - Globalid: psql.Quote(alias, "globalid"), - Lab: psql.Quote(alias, "lab"), - LabID: psql.Quote(alias, "lab_id"), - Objectid: psql.Quote(alias, "objectid"), - Poolyear: psql.Quote(alias, "poolyear"), - Processed: psql.Quote(alias, "processed"), - Sampleid: psql.Quote(alias, "sampleid"), - Survtech: psql.Quote(alias, "survtech"), - Testmethod: psql.Quote(alias, "testmethod"), - Testtech: psql.Quote(alias, "testtech"), - TrapdataID: psql.Quote(alias, "trapdata_id"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Vectorsurvcollectionid: psql.Quote(alias, "vectorsurvcollectionid"), - Vectorsurvpoolid: psql.Quote(alias, "vectorsurvpoolid"), - Vectorsurvtrapdataid: psql.Quote(alias, "vectorsurvtrapdataid"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsPoolColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Datesent psql.Expression - Datetested psql.Expression - Diseasepos psql.Expression - Diseasetested psql.Expression - Editdate psql.Expression - Editor psql.Expression - Gatewaysync psql.Expression - Globalid psql.Expression - Lab psql.Expression - LabID psql.Expression - Objectid psql.Expression - Poolyear psql.Expression - Processed psql.Expression - Sampleid psql.Expression - Survtech psql.Expression - Testmethod psql.Expression - Testtech psql.Expression - TrapdataID psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Vectorsurvcollectionid psql.Expression - Vectorsurvpoolid psql.Expression - Vectorsurvtrapdataid psql.Expression - Updated psql.Expression -} - -func (c fsPoolColumns) Alias() string { - return c.tableAlias -} - -func (fsPoolColumns) AliasedAs(alias string) fsPoolColumns { - return buildFSPoolColumns(alias) -} - -// FSPoolSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSPoolSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Datesent omitnull.Val[int64] `db:"datesent" ` - Datetested omitnull.Val[int64] `db:"datetested" ` - Diseasepos omitnull.Val[string] `db:"diseasepos" ` - Diseasetested omitnull.Val[string] `db:"diseasetested" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - 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" ` - Poolyear omitnull.Val[int16] `db:"poolyear" ` - Processed omitnull.Val[int16] `db:"processed" ` - Sampleid omitnull.Val[string] `db:"sampleid" ` - Survtech omitnull.Val[string] `db:"survtech" ` - Testmethod omitnull.Val[string] `db:"testmethod" ` - Testtech omitnull.Val[string] `db:"testtech" ` - TrapdataID omitnull.Val[string] `db:"trapdata_id" ` - 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" ` - Vectorsurvcollectionid omitnull.Val[string] `db:"vectorsurvcollectionid" ` - Vectorsurvpoolid omitnull.Val[string] `db:"vectorsurvpoolid" ` - Vectorsurvtrapdataid omitnull.Val[string] `db:"vectorsurvtrapdataid" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSPoolSetter) SetColumns() []string { - vals := make([]string, 0, 32) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Datesent.IsUnset() { - vals = append(vals, "datesent") - } - if !s.Datetested.IsUnset() { - vals = append(vals, "datetested") - } - if !s.Diseasepos.IsUnset() { - vals = append(vals, "diseasepos") - } - if !s.Diseasetested.IsUnset() { - vals = append(vals, "diseasetested") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Gatewaysync.IsUnset() { - vals = append(vals, "gatewaysync") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Lab.IsUnset() { - vals = append(vals, "lab") - } - if !s.LabID.IsUnset() { - vals = append(vals, "lab_id") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Poolyear.IsUnset() { - vals = append(vals, "poolyear") - } - if !s.Processed.IsUnset() { - vals = append(vals, "processed") - } - if !s.Sampleid.IsUnset() { - vals = append(vals, "sampleid") - } - if !s.Survtech.IsUnset() { - vals = append(vals, "survtech") - } - if !s.Testmethod.IsUnset() { - vals = append(vals, "testmethod") - } - if !s.Testtech.IsUnset() { - vals = append(vals, "testtech") - } - if !s.TrapdataID.IsUnset() { - vals = append(vals, "trapdata_id") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Vectorsurvcollectionid.IsUnset() { - vals = append(vals, "vectorsurvcollectionid") - } - if !s.Vectorsurvpoolid.IsUnset() { - vals = append(vals, "vectorsurvpoolid") - } - if !s.Vectorsurvtrapdataid.IsUnset() { - vals = append(vals, "vectorsurvtrapdataid") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSPoolSetter) Overwrite(t *FSPool) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Datesent.IsUnset() { - t.Datesent = s.Datesent.MustGetNull() - } - if !s.Datetested.IsUnset() { - t.Datetested = s.Datetested.MustGetNull() - } - if !s.Diseasepos.IsUnset() { - t.Diseasepos = s.Diseasepos.MustGetNull() - } - if !s.Diseasetested.IsUnset() { - t.Diseasetested = s.Diseasetested.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Gatewaysync.IsUnset() { - t.Gatewaysync = s.Gatewaysync.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Lab.IsUnset() { - t.Lab = s.Lab.MustGetNull() - } - if !s.LabID.IsUnset() { - t.LabID = s.LabID.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Poolyear.IsUnset() { - t.Poolyear = s.Poolyear.MustGetNull() - } - if !s.Processed.IsUnset() { - t.Processed = s.Processed.MustGetNull() - } - if !s.Sampleid.IsUnset() { - t.Sampleid = s.Sampleid.MustGetNull() - } - if !s.Survtech.IsUnset() { - t.Survtech = s.Survtech.MustGetNull() - } - if !s.Testmethod.IsUnset() { - t.Testmethod = s.Testmethod.MustGetNull() - } - if !s.Testtech.IsUnset() { - t.Testtech = s.Testtech.MustGetNull() - } - if !s.TrapdataID.IsUnset() { - t.TrapdataID = s.TrapdataID.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Vectorsurvcollectionid.IsUnset() { - t.Vectorsurvcollectionid = s.Vectorsurvcollectionid.MustGetNull() - } - if !s.Vectorsurvpoolid.IsUnset() { - t.Vectorsurvpoolid = s.Vectorsurvpoolid.MustGetNull() - } - if !s.Vectorsurvtrapdataid.IsUnset() { - t.Vectorsurvtrapdataid = s.Vectorsurvtrapdataid.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSPoolSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSPools.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 32) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[1] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[2] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[3] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Datesent.IsUnset() { - vals[4] = psql.Arg(s.Datesent.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Datetested.IsUnset() { - vals[5] = psql.Arg(s.Datetested.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Diseasepos.IsUnset() { - vals[6] = psql.Arg(s.Diseasepos.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Diseasetested.IsUnset() { - vals[7] = psql.Arg(s.Diseasetested.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[8] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[9] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Gatewaysync.IsUnset() { - vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[11] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Lab.IsUnset() { - vals[12] = psql.Arg(s.Lab.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.LabID.IsUnset() { - vals[13] = psql.Arg(s.LabID.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[14] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Poolyear.IsUnset() { - vals[15] = psql.Arg(s.Poolyear.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Processed.IsUnset() { - vals[16] = psql.Arg(s.Processed.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Sampleid.IsUnset() { - vals[17] = psql.Arg(s.Sampleid.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Survtech.IsUnset() { - vals[18] = psql.Arg(s.Survtech.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Testmethod.IsUnset() { - vals[19] = psql.Arg(s.Testmethod.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Testtech.IsUnset() { - vals[20] = psql.Arg(s.Testtech.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.TrapdataID.IsUnset() { - vals[21] = psql.Arg(s.TrapdataID.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[22] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[23] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[24] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[25] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[26] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[27] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Vectorsurvcollectionid.IsUnset() { - vals[28] = psql.Arg(s.Vectorsurvcollectionid.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Vectorsurvpoolid.IsUnset() { - vals[29] = psql.Arg(s.Vectorsurvpoolid.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Vectorsurvtrapdataid.IsUnset() { - vals[30] = psql.Arg(s.Vectorsurvtrapdataid.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[31] = psql.Arg(s.Updated.MustGet()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSPoolSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSPoolSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 32) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Datesent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "datesent")...), - psql.Arg(s.Datesent), - }}) - } - - if !s.Datetested.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "datetested")...), - psql.Arg(s.Datetested), - }}) - } - - if !s.Diseasepos.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "diseasepos")...), - psql.Arg(s.Diseasepos), - }}) - } - - if !s.Diseasetested.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "diseasetested")...), - psql.Arg(s.Diseasetested), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Gatewaysync.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "gatewaysync")...), - psql.Arg(s.Gatewaysync), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Lab.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lab")...), - psql.Arg(s.Lab), - }}) - } - - if !s.LabID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lab_id")...), - psql.Arg(s.LabID), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Poolyear.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "poolyear")...), - psql.Arg(s.Poolyear), - }}) - } - - if !s.Processed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "processed")...), - psql.Arg(s.Processed), - }}) - } - - if !s.Sampleid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sampleid")...), - psql.Arg(s.Sampleid), - }}) - } - - if !s.Survtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "survtech")...), - psql.Arg(s.Survtech), - }}) - } - - if !s.Testmethod.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "testmethod")...), - psql.Arg(s.Testmethod), - }}) - } - - if !s.Testtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "testtech")...), - psql.Arg(s.Testtech), - }}) - } - - if !s.TrapdataID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "trapdata_id")...), - psql.Arg(s.TrapdataID), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Vectorsurvcollectionid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vectorsurvcollectionid")...), - psql.Arg(s.Vectorsurvcollectionid), - }}) - } - - if !s.Vectorsurvpoolid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vectorsurvpoolid")...), - psql.Arg(s.Vectorsurvpoolid), - }}) - } - - if !s.Vectorsurvtrapdataid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vectorsurvtrapdataid")...), - psql.Arg(s.Vectorsurvtrapdataid), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSPool retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSPool(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSPool, error) { - if len(cols) == 0 { - return FSPools.Query( - sm.Where(FSPools.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSPools.Query( - sm.Where(FSPools.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSPools.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSPoolExists checks the presence of a single record by primary key -func FSPoolExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSPools.Query( - sm.Where(FSPools.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSPool is retrieved from the database -func (o *FSPool) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSPools.AfterSelectHooks.RunHooks(ctx, exec, FSPoolSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSPools.AfterInsertHooks.RunHooks(ctx, exec, FSPoolSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSPools.AfterUpdateHooks.RunHooks(ctx, exec, FSPoolSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSPools.AfterDeleteHooks.RunHooks(ctx, exec, FSPoolSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSPool -func (o *FSPool) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSPool) pkEQ() dialect.Expression { - return psql.Quote("fs_pool", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSPool -func (o *FSPool) Update(ctx context.Context, exec bob.Executor, s *FSPoolSetter) error { - v, err := FSPools.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 FSPool record with an executor -func (o *FSPool) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSPools.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSPool using the executor -func (o *FSPool) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSPools.Query( - sm.Where(FSPools.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSPoolSlice is retrieved from the database -func (o FSPoolSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSPools.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSPools.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSPools.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSPools.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSPoolSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_pool", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSPoolSlice) copyMatchingRows(from ...*FSPool) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSPoolSlice) 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 FSPools.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 *FSPool: - o.copyMatchingRows(retrieved) - case []*FSPool: - o.copyMatchingRows(retrieved...) - case FSPoolSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSPool or a slice of FSPool - // then run the AfterUpdateHooks on the slice - _, err = FSPools.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSPoolSlice) 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 FSPools.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 *FSPool: - o.copyMatchingRows(retrieved) - case []*FSPool: - o.copyMatchingRows(retrieved...) - case FSPoolSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSPool or a slice of FSPool - // then run the AfterDeleteHooks on the slice - _, err = FSPools.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSPoolSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSPoolSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSPools.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSPoolSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSPools.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSPoolSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSPools.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 *FSPool) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSPoolSlice) 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 attachFSPoolOrganization0(ctx context.Context, exec bob.Executor, count int, fsPool0 *FSPool, organization1 *Organization) (*FSPool, error) { - setter := &FSPoolSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsPool0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSPoolOrganization0: %w", err) - } - - return fsPool0, nil -} - -func (fsPool0 *FSPool) 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 = attachFSPoolOrganization0(ctx, exec, 1, fsPool0, organization1) - if err != nil { - return err - } - - fsPool0.R.Organization = organization1 - - organization1.R.FSPools = append(organization1.R.FSPools, fsPool0) - - return nil -} - -func (fsPool0 *FSPool) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSPoolOrganization0(ctx, exec, 1, fsPool0, organization1) - if err != nil { - return err - } - - fsPool0.R.Organization = organization1 - - organization1.R.FSPools = append(organization1.R.FSPools, fsPool0) - - return nil -} - -type fsPoolWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Datesent psql.WhereNullMod[Q, int64] - Datetested psql.WhereNullMod[Q, int64] - Diseasepos psql.WhereNullMod[Q, string] - Diseasetested psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Gatewaysync psql.WhereNullMod[Q, int16] - Globalid psql.WhereMod[Q, string] - Lab psql.WhereNullMod[Q, string] - LabID psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Poolyear psql.WhereNullMod[Q, int16] - Processed psql.WhereNullMod[Q, int16] - Sampleid psql.WhereNullMod[Q, string] - Survtech psql.WhereNullMod[Q, string] - Testmethod psql.WhereNullMod[Q, string] - Testtech psql.WhereNullMod[Q, string] - TrapdataID psql.WhereNullMod[Q, string] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Vectorsurvcollectionid psql.WhereNullMod[Q, string] - Vectorsurvpoolid psql.WhereNullMod[Q, string] - Vectorsurvtrapdataid psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsPoolWhere[Q]) AliasedAs(alias string) fsPoolWhere[Q] { - return buildFSPoolWhere[Q](buildFSPoolColumns(alias)) -} - -func buildFSPoolWhere[Q psql.Filterable](cols fsPoolColumns) fsPoolWhere[Q] { - return fsPoolWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Datesent: psql.WhereNull[Q, int64](cols.Datesent), - Datetested: psql.WhereNull[Q, int64](cols.Datetested), - Diseasepos: psql.WhereNull[Q, string](cols.Diseasepos), - Diseasetested: psql.WhereNull[Q, string](cols.Diseasetested), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), - 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), - Poolyear: psql.WhereNull[Q, int16](cols.Poolyear), - Processed: psql.WhereNull[Q, int16](cols.Processed), - Sampleid: psql.WhereNull[Q, string](cols.Sampleid), - Survtech: psql.WhereNull[Q, string](cols.Survtech), - Testmethod: psql.WhereNull[Q, string](cols.Testmethod), - Testtech: psql.WhereNull[Q, string](cols.Testtech), - TrapdataID: psql.WhereNull[Q, string](cols.TrapdataID), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Vectorsurvcollectionid: psql.WhereNull[Q, string](cols.Vectorsurvcollectionid), - Vectorsurvpoolid: psql.WhereNull[Q, string](cols.Vectorsurvpoolid), - Vectorsurvtrapdataid: psql.WhereNull[Q, string](cols.Vectorsurvtrapdataid), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSPool) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsPool cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSPools = FSPoolSlice{o} - } - return nil - default: - return fmt.Errorf("fsPool has no relationship %q", name) - } -} - -type fsPoolPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSPoolPreloader() fsPoolPreloader { - return fsPoolPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSPools, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsPoolThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSPoolThenLoader[Q orm.Loadable]() fsPoolThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsPoolThenLoader[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 fsPool's Organization into the .R struct -func (o *FSPool) 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.FSPools = FSPoolSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsPool's Organization into the .R struct -func (os FSPoolSlice) 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.FSPools = append(rel.R.FSPools, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsPoolJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsPoolJoins[Q]) aliasedAs(alias string) fsPoolJoins[Q] { - return buildFSPoolJoins[Q](buildFSPoolColumns(alias), j.typ) -} - -func buildFSPoolJoins[Q dialect.Joinable](cols fsPoolColumns, typ string) fsPoolJoins[Q] { - return fsPoolJoins[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/db/models/fs_pooldetail.bob.go b/db/models/fs_pooldetail.bob.go deleted file mode 100644 index 7a23d1da..00000000 --- a/db/models/fs_pooldetail.bob.go +++ /dev/null @@ -1,1005 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSPooldetail is an object representing the database table. -type FSPooldetail struct { - OrganizationID int32 `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Females null.Val[int16] `db:"females" ` - Globalid string `db:"globalid" ` - Objectid int32 `db:"objectid,pk" ` - PoolID null.Val[string] `db:"pool_id" ` - Species null.Val[string] `db:"species" ` - TrapdataID null.Val[string] `db:"trapdata_id" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsPooldetailR `db:"-" ` -} - -// FSPooldetailSlice is an alias for a slice of pointers to FSPooldetail. -// This should almost always be used instead of []*FSPooldetail. -type FSPooldetailSlice []*FSPooldetail - -// FSPooldetails contains methods to work with the fs_pooldetail table -var FSPooldetails = psql.NewTablex[*FSPooldetail, FSPooldetailSlice, *FSPooldetailSetter]("", "fs_pooldetail", buildFSPooldetailColumns("fs_pooldetail")) - -// FSPooldetailsQuery is a query on the fs_pooldetail table -type FSPooldetailsQuery = *psql.ViewQuery[*FSPooldetail, FSPooldetailSlice] - -// fsPooldetailR is where relationships are stored. -type fsPooldetailR struct { - Organization *Organization // fs_pooldetail.fs_pooldetail_organization_id_fkey -} - -func buildFSPooldetailColumns(alias string) fsPooldetailColumns { - return fsPooldetailColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "females", "globalid", "objectid", "pool_id", "species", "trapdata_id", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "updated", - ).WithParent("fs_pooldetail"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Females: psql.Quote(alias, "females"), - Globalid: psql.Quote(alias, "globalid"), - Objectid: psql.Quote(alias, "objectid"), - PoolID: psql.Quote(alias, "pool_id"), - Species: psql.Quote(alias, "species"), - TrapdataID: psql.Quote(alias, "trapdata_id"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsPooldetailColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Females psql.Expression - Globalid psql.Expression - Objectid psql.Expression - PoolID psql.Expression - Species psql.Expression - TrapdataID psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Updated psql.Expression -} - -func (c fsPooldetailColumns) Alias() string { - return c.tableAlias -} - -func (fsPooldetailColumns) AliasedAs(alias string) fsPooldetailColumns { - return buildFSPooldetailColumns(alias) -} - -// FSPooldetailSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSPooldetailSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Females omitnull.Val[int16] `db:"females" ` - 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" ` - TrapdataID omitnull.Val[string] `db:"trapdata_id" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSPooldetailSetter) SetColumns() []string { - vals := make([]string, 0, 18) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Females.IsUnset() { - vals = append(vals, "females") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.PoolID.IsUnset() { - vals = append(vals, "pool_id") - } - if !s.Species.IsUnset() { - vals = append(vals, "species") - } - if !s.TrapdataID.IsUnset() { - vals = append(vals, "trapdata_id") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSPooldetailSetter) Overwrite(t *FSPooldetail) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Females.IsUnset() { - t.Females = s.Females.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.PoolID.IsUnset() { - t.PoolID = s.PoolID.MustGetNull() - } - if !s.Species.IsUnset() { - t.Species = s.Species.MustGetNull() - } - if !s.TrapdataID.IsUnset() { - t.TrapdataID = s.TrapdataID.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSPooldetailSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSPooldetails.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 18) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[1] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[2] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[3] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[4] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Females.IsUnset() { - vals[5] = psql.Arg(s.Females.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[6] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[7] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.PoolID.IsUnset() { - vals[8] = psql.Arg(s.PoolID.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Species.IsUnset() { - vals[9] = psql.Arg(s.Species.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.TrapdataID.IsUnset() { - vals[10] = psql.Arg(s.TrapdataID.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[13] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[14] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[16] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[17] = psql.Arg(s.Updated.MustGet()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSPooldetailSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSPooldetailSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 18) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Females.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "females")...), - psql.Arg(s.Females), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.PoolID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pool_id")...), - psql.Arg(s.PoolID), - }}) - } - - if !s.Species.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "species")...), - psql.Arg(s.Species), - }}) - } - - if !s.TrapdataID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "trapdata_id")...), - psql.Arg(s.TrapdataID), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSPooldetail retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSPooldetail(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSPooldetail, error) { - if len(cols) == 0 { - return FSPooldetails.Query( - sm.Where(FSPooldetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSPooldetails.Query( - sm.Where(FSPooldetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSPooldetails.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSPooldetailExists checks the presence of a single record by primary key -func FSPooldetailExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSPooldetails.Query( - sm.Where(FSPooldetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSPooldetail is retrieved from the database -func (o *FSPooldetail) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSPooldetails.AfterSelectHooks.RunHooks(ctx, exec, FSPooldetailSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSPooldetails.AfterInsertHooks.RunHooks(ctx, exec, FSPooldetailSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSPooldetails.AfterUpdateHooks.RunHooks(ctx, exec, FSPooldetailSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSPooldetails.AfterDeleteHooks.RunHooks(ctx, exec, FSPooldetailSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSPooldetail -func (o *FSPooldetail) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSPooldetail) pkEQ() dialect.Expression { - return psql.Quote("fs_pooldetail", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSPooldetail -func (o *FSPooldetail) Update(ctx context.Context, exec bob.Executor, s *FSPooldetailSetter) error { - v, err := FSPooldetails.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 FSPooldetail record with an executor -func (o *FSPooldetail) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSPooldetails.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSPooldetail using the executor -func (o *FSPooldetail) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSPooldetails.Query( - sm.Where(FSPooldetails.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSPooldetailSlice is retrieved from the database -func (o FSPooldetailSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSPooldetails.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSPooldetails.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSPooldetails.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSPooldetails.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSPooldetailSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_pooldetail", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSPooldetailSlice) copyMatchingRows(from ...*FSPooldetail) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSPooldetailSlice) 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 FSPooldetails.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 *FSPooldetail: - o.copyMatchingRows(retrieved) - case []*FSPooldetail: - o.copyMatchingRows(retrieved...) - case FSPooldetailSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSPooldetail or a slice of FSPooldetail - // then run the AfterUpdateHooks on the slice - _, err = FSPooldetails.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSPooldetailSlice) 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 FSPooldetails.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 *FSPooldetail: - o.copyMatchingRows(retrieved) - case []*FSPooldetail: - o.copyMatchingRows(retrieved...) - case FSPooldetailSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSPooldetail or a slice of FSPooldetail - // then run the AfterDeleteHooks on the slice - _, err = FSPooldetails.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSPooldetailSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSPooldetailSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSPooldetails.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSPooldetailSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSPooldetails.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSPooldetailSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSPooldetails.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 *FSPooldetail) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSPooldetailSlice) 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 attachFSPooldetailOrganization0(ctx context.Context, exec bob.Executor, count int, fsPooldetail0 *FSPooldetail, organization1 *Organization) (*FSPooldetail, error) { - setter := &FSPooldetailSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsPooldetail0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSPooldetailOrganization0: %w", err) - } - - return fsPooldetail0, nil -} - -func (fsPooldetail0 *FSPooldetail) 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 = attachFSPooldetailOrganization0(ctx, exec, 1, fsPooldetail0, organization1) - if err != nil { - return err - } - - fsPooldetail0.R.Organization = organization1 - - organization1.R.FSPooldetails = append(organization1.R.FSPooldetails, fsPooldetail0) - - return nil -} - -func (fsPooldetail0 *FSPooldetail) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSPooldetailOrganization0(ctx, exec, 1, fsPooldetail0, organization1) - if err != nil { - return err - } - - fsPooldetail0.R.Organization = organization1 - - organization1.R.FSPooldetails = append(organization1.R.FSPooldetails, fsPooldetail0) - - return nil -} - -type fsPooldetailWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Females psql.WhereNullMod[Q, int16] - Globalid psql.WhereMod[Q, string] - Objectid psql.WhereMod[Q, int32] - PoolID psql.WhereNullMod[Q, string] - Species psql.WhereNullMod[Q, string] - TrapdataID psql.WhereNullMod[Q, string] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsPooldetailWhere[Q]) AliasedAs(alias string) fsPooldetailWhere[Q] { - return buildFSPooldetailWhere[Q](buildFSPooldetailColumns(alias)) -} - -func buildFSPooldetailWhere[Q psql.Filterable](cols fsPooldetailColumns) fsPooldetailWhere[Q] { - return fsPooldetailWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Females: psql.WhereNull[Q, int16](cols.Females), - 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), - TrapdataID: psql.WhereNull[Q, string](cols.TrapdataID), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSPooldetail) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsPooldetail cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSPooldetails = FSPooldetailSlice{o} - } - return nil - default: - return fmt.Errorf("fsPooldetail has no relationship %q", name) - } -} - -type fsPooldetailPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSPooldetailPreloader() fsPooldetailPreloader { - return fsPooldetailPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSPooldetails, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsPooldetailThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSPooldetailThenLoader[Q orm.Loadable]() fsPooldetailThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsPooldetailThenLoader[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 fsPooldetail's Organization into the .R struct -func (o *FSPooldetail) 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.FSPooldetails = FSPooldetailSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsPooldetail's Organization into the .R struct -func (os FSPooldetailSlice) 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.FSPooldetails = append(rel.R.FSPooldetails, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsPooldetailJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsPooldetailJoins[Q]) aliasedAs(alias string) fsPooldetailJoins[Q] { - return buildFSPooldetailJoins[Q](buildFSPooldetailColumns(alias), j.typ) -} - -func buildFSPooldetailJoins[Q dialect.Joinable](cols fsPooldetailColumns, typ string) fsPooldetailJoins[Q] { - return fsPooldetailJoins[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/db/models/fs_proposedtreatmentarea.bob.go b/db/models/fs_proposedtreatmentarea.bob.go deleted file mode 100644 index 0a7da9a9..00000000 --- a/db/models/fs_proposedtreatmentarea.bob.go +++ /dev/null @@ -1,1480 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSProposedtreatmentarea is an object representing the database table. -type FSProposedtreatmentarea struct { - OrganizationID int32 `db:"organization_id" ` - Acres null.Val[float64] `db:"acres" ` - Comments null.Val[string] `db:"comments" ` - Completed null.Val[int16] `db:"completed" ` - Completedby null.Val[string] `db:"completedby" ` - Completeddate null.Val[int64] `db:"completeddate" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Duedate null.Val[int64] `db:"duedate" ` - Exported null.Val[int16] `db:"exported" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid string `db:"globalid" ` - Hectares null.Val[float64] `db:"hectares" ` - Issprayroute null.Val[int16] `db:"issprayroute" ` - Lasttreatactivity null.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate null.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct null.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty null.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit null.Val[string] `db:"lasttreatqtyunit" ` - Method null.Val[string] `db:"method" ` - Name null.Val[string] `db:"name" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - Targetapprate null.Val[float64] `db:"targetapprate" ` - Targetproduct null.Val[string] `db:"targetproduct" ` - Targetspecies null.Val[string] `db:"targetspecies" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsProposedtreatmentareaR `db:"-" ` -} - -// FSProposedtreatmentareaSlice is an alias for a slice of pointers to FSProposedtreatmentarea. -// This should almost always be used instead of []*FSProposedtreatmentarea. -type FSProposedtreatmentareaSlice []*FSProposedtreatmentarea - -// FSProposedtreatmentareas contains methods to work with the fs_proposedtreatmentarea table -var FSProposedtreatmentareas = psql.NewTablex[*FSProposedtreatmentarea, FSProposedtreatmentareaSlice, *FSProposedtreatmentareaSetter]("", "fs_proposedtreatmentarea", buildFSProposedtreatmentareaColumns("fs_proposedtreatmentarea")) - -// FSProposedtreatmentareasQuery is a query on the fs_proposedtreatmentarea table -type FSProposedtreatmentareasQuery = *psql.ViewQuery[*FSProposedtreatmentarea, FSProposedtreatmentareaSlice] - -// fsProposedtreatmentareaR is where relationships are stored. -type fsProposedtreatmentareaR struct { - Organization *Organization // fs_proposedtreatmentarea.fs_proposedtreatmentarea_organization_id_fkey -} - -func buildFSProposedtreatmentareaColumns(alias string) fsProposedtreatmentareaColumns { - return fsProposedtreatmentareaColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "acres", "comments", "completed", "completedby", "completeddate", "creationdate", "creator", "duedate", "exported", "editdate", "editor", "globalid", "hectares", "issprayroute", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "method", "name", "objectid", "priority", "reviewed", "reviewedby", "revieweddate", "shape__area", "shape__length", "targetapprate", "targetproduct", "targetspecies", "zone", "zone2", "geometry_x", "geometry_y", "updated", - ).WithParent("fs_proposedtreatmentarea"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Acres: psql.Quote(alias, "acres"), - Comments: psql.Quote(alias, "comments"), - Completed: psql.Quote(alias, "completed"), - Completedby: psql.Quote(alias, "completedby"), - Completeddate: psql.Quote(alias, "completeddate"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Duedate: psql.Quote(alias, "duedate"), - Exported: psql.Quote(alias, "exported"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Hectares: psql.Quote(alias, "hectares"), - Issprayroute: psql.Quote(alias, "issprayroute"), - Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), - Lasttreatdate: psql.Quote(alias, "lasttreatdate"), - Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), - Lasttreatqty: psql.Quote(alias, "lasttreatqty"), - Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), - Method: psql.Quote(alias, "method"), - Name: psql.Quote(alias, "name"), - Objectid: psql.Quote(alias, "objectid"), - Priority: psql.Quote(alias, "priority"), - Reviewed: psql.Quote(alias, "reviewed"), - Reviewedby: psql.Quote(alias, "reviewedby"), - Revieweddate: psql.Quote(alias, "revieweddate"), - ShapeArea: psql.Quote(alias, "shape__area"), - ShapeLength: psql.Quote(alias, "shape__length"), - Targetapprate: psql.Quote(alias, "targetapprate"), - Targetproduct: psql.Quote(alias, "targetproduct"), - Targetspecies: psql.Quote(alias, "targetspecies"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsProposedtreatmentareaColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Acres psql.Expression - Comments psql.Expression - Completed psql.Expression - Completedby psql.Expression - Completeddate psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Duedate psql.Expression - Exported psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Hectares psql.Expression - Issprayroute psql.Expression - Lasttreatactivity psql.Expression - Lasttreatdate psql.Expression - Lasttreatproduct psql.Expression - Lasttreatqty psql.Expression - Lasttreatqtyunit psql.Expression - Method psql.Expression - Name psql.Expression - Objectid psql.Expression - Priority psql.Expression - Reviewed psql.Expression - Reviewedby psql.Expression - Revieweddate psql.Expression - ShapeArea psql.Expression - ShapeLength psql.Expression - Targetapprate psql.Expression - Targetproduct psql.Expression - Targetspecies psql.Expression - Zone psql.Expression - Zone2 psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - Updated psql.Expression -} - -func (c fsProposedtreatmentareaColumns) Alias() string { - return c.tableAlias -} - -func (fsProposedtreatmentareaColumns) AliasedAs(alias string) fsProposedtreatmentareaColumns { - return buildFSProposedtreatmentareaColumns(alias) -} - -// FSProposedtreatmentareaSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSProposedtreatmentareaSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Acres omitnull.Val[float64] `db:"acres" ` - Comments omitnull.Val[string] `db:"comments" ` - Completed omitnull.Val[int16] `db:"completed" ` - Completedby omitnull.Val[string] `db:"completedby" ` - Completeddate omitnull.Val[int64] `db:"completeddate" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Duedate omitnull.Val[int64] `db:"duedate" ` - Exported omitnull.Val[int16] `db:"exported" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omit.Val[string] `db:"globalid" ` - Hectares omitnull.Val[float64] `db:"hectares" ` - Issprayroute omitnull.Val[int16] `db:"issprayroute" ` - Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate omitnull.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` - Method omitnull.Val[string] `db:"method" ` - Name omitnull.Val[string] `db:"name" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Targetapprate omitnull.Val[float64] `db:"targetapprate" ` - Targetproduct omitnull.Val[string] `db:"targetproduct" ` - Targetspecies omitnull.Val[string] `db:"targetspecies" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSProposedtreatmentareaSetter) SetColumns() []string { - vals := make([]string, 0, 37) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Acres.IsUnset() { - vals = append(vals, "acres") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Completed.IsUnset() { - vals = append(vals, "completed") - } - if !s.Completedby.IsUnset() { - vals = append(vals, "completedby") - } - if !s.Completeddate.IsUnset() { - vals = append(vals, "completeddate") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Duedate.IsUnset() { - vals = append(vals, "duedate") - } - if !s.Exported.IsUnset() { - vals = append(vals, "exported") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Hectares.IsUnset() { - vals = append(vals, "hectares") - } - if !s.Issprayroute.IsUnset() { - vals = append(vals, "issprayroute") - } - if !s.Lasttreatactivity.IsUnset() { - vals = append(vals, "lasttreatactivity") - } - if !s.Lasttreatdate.IsUnset() { - vals = append(vals, "lasttreatdate") - } - if !s.Lasttreatproduct.IsUnset() { - vals = append(vals, "lasttreatproduct") - } - if !s.Lasttreatqty.IsUnset() { - vals = append(vals, "lasttreatqty") - } - if !s.Lasttreatqtyunit.IsUnset() { - vals = append(vals, "lasttreatqtyunit") - } - if !s.Method.IsUnset() { - vals = append(vals, "method") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Reviewed.IsUnset() { - vals = append(vals, "reviewed") - } - if !s.Reviewedby.IsUnset() { - vals = append(vals, "reviewedby") - } - if !s.Revieweddate.IsUnset() { - vals = append(vals, "revieweddate") - } - if !s.ShapeArea.IsUnset() { - vals = append(vals, "shape__area") - } - if !s.ShapeLength.IsUnset() { - vals = append(vals, "shape__length") - } - if !s.Targetapprate.IsUnset() { - vals = append(vals, "targetapprate") - } - if !s.Targetproduct.IsUnset() { - vals = append(vals, "targetproduct") - } - if !s.Targetspecies.IsUnset() { - vals = append(vals, "targetspecies") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSProposedtreatmentareaSetter) Overwrite(t *FSProposedtreatmentarea) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Acres.IsUnset() { - t.Acres = s.Acres.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Completed.IsUnset() { - t.Completed = s.Completed.MustGetNull() - } - if !s.Completedby.IsUnset() { - t.Completedby = s.Completedby.MustGetNull() - } - if !s.Completeddate.IsUnset() { - t.Completeddate = s.Completeddate.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Duedate.IsUnset() { - t.Duedate = s.Duedate.MustGetNull() - } - if !s.Exported.IsUnset() { - t.Exported = s.Exported.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Hectares.IsUnset() { - t.Hectares = s.Hectares.MustGetNull() - } - if !s.Issprayroute.IsUnset() { - t.Issprayroute = s.Issprayroute.MustGetNull() - } - if !s.Lasttreatactivity.IsUnset() { - t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() - } - if !s.Lasttreatdate.IsUnset() { - t.Lasttreatdate = s.Lasttreatdate.MustGetNull() - } - if !s.Lasttreatproduct.IsUnset() { - t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() - } - if !s.Lasttreatqty.IsUnset() { - t.Lasttreatqty = s.Lasttreatqty.MustGetNull() - } - if !s.Lasttreatqtyunit.IsUnset() { - t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() - } - if !s.Method.IsUnset() { - t.Method = s.Method.MustGetNull() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Reviewed.IsUnset() { - t.Reviewed = s.Reviewed.MustGetNull() - } - if !s.Reviewedby.IsUnset() { - t.Reviewedby = s.Reviewedby.MustGetNull() - } - if !s.Revieweddate.IsUnset() { - t.Revieweddate = s.Revieweddate.MustGetNull() - } - if !s.ShapeArea.IsUnset() { - t.ShapeArea = s.ShapeArea.MustGetNull() - } - if !s.ShapeLength.IsUnset() { - t.ShapeLength = s.ShapeLength.MustGetNull() - } - if !s.Targetapprate.IsUnset() { - t.Targetapprate = s.Targetapprate.MustGetNull() - } - if !s.Targetproduct.IsUnset() { - t.Targetproduct = s.Targetproduct.MustGetNull() - } - if !s.Targetspecies.IsUnset() { - t.Targetspecies = s.Targetspecies.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSProposedtreatmentareaSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSProposedtreatmentareas.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 37) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Acres.IsUnset() { - vals[1] = psql.Arg(s.Acres.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[2] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Completed.IsUnset() { - vals[3] = psql.Arg(s.Completed.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Completedby.IsUnset() { - vals[4] = psql.Arg(s.Completedby.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Completeddate.IsUnset() { - vals[5] = psql.Arg(s.Completeddate.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[6] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[7] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Duedate.IsUnset() { - vals[8] = psql.Arg(s.Duedate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Exported.IsUnset() { - vals[9] = psql.Arg(s.Exported.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[10] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[11] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[12] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Hectares.IsUnset() { - vals[13] = psql.Arg(s.Hectares.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Issprayroute.IsUnset() { - vals[14] = psql.Arg(s.Issprayroute.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatactivity.IsUnset() { - vals[15] = psql.Arg(s.Lasttreatactivity.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatdate.IsUnset() { - vals[16] = psql.Arg(s.Lasttreatdate.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatproduct.IsUnset() { - vals[17] = psql.Arg(s.Lasttreatproduct.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqty.IsUnset() { - vals[18] = psql.Arg(s.Lasttreatqty.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqtyunit.IsUnset() { - vals[19] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Method.IsUnset() { - vals[20] = psql.Arg(s.Method.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[21] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[22] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[23] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Reviewed.IsUnset() { - vals[24] = psql.Arg(s.Reviewed.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Reviewedby.IsUnset() { - vals[25] = psql.Arg(s.Reviewedby.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Revieweddate.IsUnset() { - vals[26] = psql.Arg(s.Revieweddate.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.ShapeArea.IsUnset() { - vals[27] = psql.Arg(s.ShapeArea.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.ShapeLength.IsUnset() { - vals[28] = psql.Arg(s.ShapeLength.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Targetapprate.IsUnset() { - vals[29] = psql.Arg(s.Targetapprate.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Targetproduct.IsUnset() { - vals[30] = psql.Arg(s.Targetproduct.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Targetspecies.IsUnset() { - vals[31] = psql.Arg(s.Targetspecies.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[32] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[33] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[34] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[35] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[36] = psql.Arg(s.Updated.MustGet()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSProposedtreatmentareaSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSProposedtreatmentareaSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 37) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Acres.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "acres")...), - psql.Arg(s.Acres), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Completed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "completed")...), - psql.Arg(s.Completed), - }}) - } - - if !s.Completedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "completedby")...), - psql.Arg(s.Completedby), - }}) - } - - if !s.Completeddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "completeddate")...), - psql.Arg(s.Completeddate), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Duedate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "duedate")...), - psql.Arg(s.Duedate), - }}) - } - - if !s.Exported.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "exported")...), - psql.Arg(s.Exported), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Hectares.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "hectares")...), - psql.Arg(s.Hectares), - }}) - } - - if !s.Issprayroute.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "issprayroute")...), - psql.Arg(s.Issprayroute), - }}) - } - - if !s.Lasttreatactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatactivity")...), - psql.Arg(s.Lasttreatactivity), - }}) - } - - if !s.Lasttreatdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatdate")...), - psql.Arg(s.Lasttreatdate), - }}) - } - - if !s.Lasttreatproduct.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatproduct")...), - psql.Arg(s.Lasttreatproduct), - }}) - } - - if !s.Lasttreatqty.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqty")...), - psql.Arg(s.Lasttreatqty), - }}) - } - - if !s.Lasttreatqtyunit.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqtyunit")...), - psql.Arg(s.Lasttreatqtyunit), - }}) - } - - if !s.Method.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "method")...), - psql.Arg(s.Method), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Reviewed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewed")...), - psql.Arg(s.Reviewed), - }}) - } - - if !s.Reviewedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewedby")...), - psql.Arg(s.Reviewedby), - }}) - } - - if !s.Revieweddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "revieweddate")...), - psql.Arg(s.Revieweddate), - }}) - } - - if !s.ShapeArea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__area")...), - psql.Arg(s.ShapeArea), - }}) - } - - if !s.ShapeLength.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__length")...), - psql.Arg(s.ShapeLength), - }}) - } - - if !s.Targetapprate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "targetapprate")...), - psql.Arg(s.Targetapprate), - }}) - } - - if !s.Targetproduct.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "targetproduct")...), - psql.Arg(s.Targetproduct), - }}) - } - - if !s.Targetspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "targetspecies")...), - psql.Arg(s.Targetspecies), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSProposedtreatmentarea retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSProposedtreatmentarea(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSProposedtreatmentarea, error) { - if len(cols) == 0 { - return FSProposedtreatmentareas.Query( - sm.Where(FSProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSProposedtreatmentareas.Query( - sm.Where(FSProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSProposedtreatmentareas.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSProposedtreatmentareaExists checks the presence of a single record by primary key -func FSProposedtreatmentareaExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSProposedtreatmentareas.Query( - sm.Where(FSProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSProposedtreatmentarea is retrieved from the database -func (o *FSProposedtreatmentarea) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSProposedtreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, FSProposedtreatmentareaSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSProposedtreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, FSProposedtreatmentareaSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSProposedtreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, FSProposedtreatmentareaSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSProposedtreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, FSProposedtreatmentareaSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSProposedtreatmentarea -func (o *FSProposedtreatmentarea) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSProposedtreatmentarea) pkEQ() dialect.Expression { - return psql.Quote("fs_proposedtreatmentarea", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSProposedtreatmentarea -func (o *FSProposedtreatmentarea) Update(ctx context.Context, exec bob.Executor, s *FSProposedtreatmentareaSetter) error { - v, err := FSProposedtreatmentareas.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 FSProposedtreatmentarea record with an executor -func (o *FSProposedtreatmentarea) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSProposedtreatmentareas.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSProposedtreatmentarea using the executor -func (o *FSProposedtreatmentarea) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSProposedtreatmentareas.Query( - sm.Where(FSProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSProposedtreatmentareaSlice is retrieved from the database -func (o FSProposedtreatmentareaSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSProposedtreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSProposedtreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSProposedtreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSProposedtreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSProposedtreatmentareaSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_proposedtreatmentarea", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSProposedtreatmentareaSlice) copyMatchingRows(from ...*FSProposedtreatmentarea) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSProposedtreatmentareaSlice) 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 FSProposedtreatmentareas.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 *FSProposedtreatmentarea: - o.copyMatchingRows(retrieved) - case []*FSProposedtreatmentarea: - o.copyMatchingRows(retrieved...) - case FSProposedtreatmentareaSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSProposedtreatmentarea or a slice of FSProposedtreatmentarea - // then run the AfterUpdateHooks on the slice - _, err = FSProposedtreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSProposedtreatmentareaSlice) 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 FSProposedtreatmentareas.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 *FSProposedtreatmentarea: - o.copyMatchingRows(retrieved) - case []*FSProposedtreatmentarea: - o.copyMatchingRows(retrieved...) - case FSProposedtreatmentareaSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSProposedtreatmentarea or a slice of FSProposedtreatmentarea - // then run the AfterDeleteHooks on the slice - _, err = FSProposedtreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSProposedtreatmentareaSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSProposedtreatmentareaSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSProposedtreatmentareas.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSProposedtreatmentareaSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSProposedtreatmentareas.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSProposedtreatmentareaSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSProposedtreatmentareas.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 *FSProposedtreatmentarea) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSProposedtreatmentareaSlice) 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 attachFSProposedtreatmentareaOrganization0(ctx context.Context, exec bob.Executor, count int, fsProposedtreatmentarea0 *FSProposedtreatmentarea, organization1 *Organization) (*FSProposedtreatmentarea, error) { - setter := &FSProposedtreatmentareaSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsProposedtreatmentarea0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSProposedtreatmentareaOrganization0: %w", err) - } - - return fsProposedtreatmentarea0, nil -} - -func (fsProposedtreatmentarea0 *FSProposedtreatmentarea) 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 = attachFSProposedtreatmentareaOrganization0(ctx, exec, 1, fsProposedtreatmentarea0, organization1) - if err != nil { - return err - } - - fsProposedtreatmentarea0.R.Organization = organization1 - - organization1.R.FSProposedtreatmentareas = append(organization1.R.FSProposedtreatmentareas, fsProposedtreatmentarea0) - - return nil -} - -func (fsProposedtreatmentarea0 *FSProposedtreatmentarea) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSProposedtreatmentareaOrganization0(ctx, exec, 1, fsProposedtreatmentarea0, organization1) - if err != nil { - return err - } - - fsProposedtreatmentarea0.R.Organization = organization1 - - organization1.R.FSProposedtreatmentareas = append(organization1.R.FSProposedtreatmentareas, fsProposedtreatmentarea0) - - return nil -} - -type fsProposedtreatmentareaWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Acres psql.WhereNullMod[Q, float64] - Comments psql.WhereNullMod[Q, string] - Completed psql.WhereNullMod[Q, int16] - Completedby psql.WhereNullMod[Q, string] - Completeddate psql.WhereNullMod[Q, int64] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Duedate psql.WhereNullMod[Q, int64] - Exported psql.WhereNullMod[Q, int16] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Hectares psql.WhereNullMod[Q, float64] - Issprayroute psql.WhereNullMod[Q, int16] - Lasttreatactivity psql.WhereNullMod[Q, string] - Lasttreatdate psql.WhereNullMod[Q, int64] - Lasttreatproduct psql.WhereNullMod[Q, string] - Lasttreatqty psql.WhereNullMod[Q, float64] - Lasttreatqtyunit psql.WhereNullMod[Q, string] - Method psql.WhereNullMod[Q, string] - Name psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Priority psql.WhereNullMod[Q, string] - Reviewed psql.WhereNullMod[Q, int16] - Reviewedby psql.WhereNullMod[Q, string] - Revieweddate psql.WhereNullMod[Q, int64] - ShapeArea psql.WhereNullMod[Q, float64] - ShapeLength psql.WhereNullMod[Q, float64] - Targetapprate psql.WhereNullMod[Q, float64] - Targetproduct psql.WhereNullMod[Q, string] - Targetspecies psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsProposedtreatmentareaWhere[Q]) AliasedAs(alias string) fsProposedtreatmentareaWhere[Q] { - return buildFSProposedtreatmentareaWhere[Q](buildFSProposedtreatmentareaColumns(alias)) -} - -func buildFSProposedtreatmentareaWhere[Q psql.Filterable](cols fsProposedtreatmentareaColumns) fsProposedtreatmentareaWhere[Q] { - return fsProposedtreatmentareaWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Acres: psql.WhereNull[Q, float64](cols.Acres), - Comments: psql.WhereNull[Q, string](cols.Comments), - Completed: psql.WhereNull[Q, int16](cols.Completed), - Completedby: psql.WhereNull[Q, string](cols.Completedby), - Completeddate: psql.WhereNull[Q, int64](cols.Completeddate), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Duedate: psql.WhereNull[Q, int64](cols.Duedate), - Exported: psql.WhereNull[Q, int16](cols.Exported), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - 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), - Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), - Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), - Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), - Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), - Method: psql.WhereNull[Q, string](cols.Method), - Name: psql.WhereNull[Q, string](cols.Name), - Objectid: psql.Where[Q, int32](cols.Objectid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), - Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), - Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), - ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), - ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), - Targetapprate: psql.WhereNull[Q, float64](cols.Targetapprate), - Targetproduct: psql.WhereNull[Q, string](cols.Targetproduct), - Targetspecies: psql.WhereNull[Q, string](cols.Targetspecies), - 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), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSProposedtreatmentarea) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsProposedtreatmentarea cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSProposedtreatmentareas = FSProposedtreatmentareaSlice{o} - } - return nil - default: - return fmt.Errorf("fsProposedtreatmentarea has no relationship %q", name) - } -} - -type fsProposedtreatmentareaPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSProposedtreatmentareaPreloader() fsProposedtreatmentareaPreloader { - return fsProposedtreatmentareaPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSProposedtreatmentareas, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsProposedtreatmentareaThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSProposedtreatmentareaThenLoader[Q orm.Loadable]() fsProposedtreatmentareaThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsProposedtreatmentareaThenLoader[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 fsProposedtreatmentarea's Organization into the .R struct -func (o *FSProposedtreatmentarea) 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.FSProposedtreatmentareas = FSProposedtreatmentareaSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsProposedtreatmentarea's Organization into the .R struct -func (os FSProposedtreatmentareaSlice) 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.FSProposedtreatmentareas = append(rel.R.FSProposedtreatmentareas, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsProposedtreatmentareaJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsProposedtreatmentareaJoins[Q]) aliasedAs(alias string) fsProposedtreatmentareaJoins[Q] { - return buildFSProposedtreatmentareaJoins[Q](buildFSProposedtreatmentareaColumns(alias), j.typ) -} - -func buildFSProposedtreatmentareaJoins[Q dialect.Joinable](cols fsProposedtreatmentareaColumns, typ string) fsProposedtreatmentareaJoins[Q] { - return fsProposedtreatmentareaJoins[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/db/models/fs_qamosquitoinspection.bob.go b/db/models/fs_qamosquitoinspection.bob.go deleted file mode 100644 index 5e9ab024..00000000 --- a/db/models/fs_qamosquitoinspection.bob.go +++ /dev/null @@ -1,2205 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSQamosquitoinspection is an object representing the database table. -type FSQamosquitoinspection struct { - OrganizationID int32 `db:"organization_id" ` - Acresbreeding null.Val[float64] `db:"acresbreeding" ` - Actiontaken null.Val[string] `db:"actiontaken" ` - Adultactivity null.Val[int16] `db:"adultactivity" ` - Aquaticorganisms null.Val[string] `db:"aquaticorganisms" ` - Avetemp null.Val[float64] `db:"avetemp" ` - Breedingpotential null.Val[string] `db:"breedingpotential" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Fish null.Val[int16] `db:"fish" ` - Globalid string `db:"globalid" ` - Habvalue1 null.Val[int16] `db:"habvalue1" ` - Habvalue1percent null.Val[int16] `db:"habvalue1percent" ` - Habvalue2 null.Val[int16] `db:"habvalue2" ` - Habvalue2percent null.Val[int16] `db:"habvalue2percent" ` - Larvaeinsidetreatedarea null.Val[int16] `db:"larvaeinsidetreatedarea" ` - Larvaeoutsidetreatedarea null.Val[int16] `db:"larvaeoutsidetreatedarea" ` - Larvaepresent null.Val[int16] `db:"larvaepresent" ` - Larvaereason null.Val[string] `db:"larvaereason" ` - Linelocid null.Val[string] `db:"linelocid" ` - Locationname null.Val[string] `db:"locationname" ` - LR null.Val[int16] `db:"lr" ` - Mosquitohabitat null.Val[string] `db:"mosquitohabitat" ` - Movingwater null.Val[int16] `db:"movingwater" ` - Negdips null.Val[int16] `db:"negdips" ` - Nowaterever null.Val[int16] `db:"nowaterever" ` - Objectid int32 `db:"objectid,pk" ` - Pointlocid null.Val[string] `db:"pointlocid" ` - Polygonlocid null.Val[string] `db:"polygonlocid" ` - Posdips null.Val[int16] `db:"posdips" ` - Potential null.Val[int16] `db:"potential" ` - Raingauge null.Val[float64] `db:"raingauge" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Sitetype null.Val[string] `db:"sitetype" ` - Soilconditions null.Val[string] `db:"soilconditions" ` - Sourcereduction null.Val[string] `db:"sourcereduction" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Totalacres null.Val[float64] `db:"totalacres" ` - Vegetation null.Val[string] `db:"vegetation" ` - Waterconditions null.Val[string] `db:"waterconditions" ` - Waterduration null.Val[string] `db:"waterduration" ` - Watermovement1 null.Val[string] `db:"watermovement1" ` - Watermovement1percent null.Val[int16] `db:"watermovement1percent" ` - Watermovement2 null.Val[string] `db:"watermovement2" ` - Watermovement2percent null.Val[int16] `db:"watermovement2percent" ` - Waterpresent null.Val[int16] `db:"waterpresent" ` - Watersource null.Val[string] `db:"watersource" ` - Winddir null.Val[string] `db:"winddir" ` - Windspeed null.Val[float64] `db:"windspeed" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsQamosquitoinspectionR `db:"-" ` -} - -// FSQamosquitoinspectionSlice is an alias for a slice of pointers to FSQamosquitoinspection. -// This should almost always be used instead of []*FSQamosquitoinspection. -type FSQamosquitoinspectionSlice []*FSQamosquitoinspection - -// FSQamosquitoinspections contains methods to work with the fs_qamosquitoinspection table -var FSQamosquitoinspections = psql.NewTablex[*FSQamosquitoinspection, FSQamosquitoinspectionSlice, *FSQamosquitoinspectionSetter]("", "fs_qamosquitoinspection", buildFSQamosquitoinspectionColumns("fs_qamosquitoinspection")) - -// FSQamosquitoinspectionsQuery is a query on the fs_qamosquitoinspection table -type FSQamosquitoinspectionsQuery = *psql.ViewQuery[*FSQamosquitoinspection, FSQamosquitoinspectionSlice] - -// fsQamosquitoinspectionR is where relationships are stored. -type fsQamosquitoinspectionR struct { - Organization *Organization // fs_qamosquitoinspection.fs_qamosquitoinspection_organization_id_fkey -} - -func buildFSQamosquitoinspectionColumns(alias string) fsQamosquitoinspectionColumns { - return fsQamosquitoinspectionColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "acresbreeding", "actiontaken", "adultactivity", "aquaticorganisms", "avetemp", "breedingpotential", "comments", "creationdate", "creator", "enddatetime", "editdate", "editor", "fieldtech", "fish", "globalid", "habvalue1", "habvalue1percent", "habvalue2", "habvalue2percent", "larvaeinsidetreatedarea", "larvaeoutsidetreatedarea", "larvaepresent", "larvaereason", "linelocid", "locationname", "lr", "mosquitohabitat", "movingwater", "negdips", "nowaterever", "objectid", "pointlocid", "polygonlocid", "posdips", "potential", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sitetype", "soilconditions", "sourcereduction", "startdatetime", "totalacres", "vegetation", "waterconditions", "waterduration", "watermovement1", "watermovement1percent", "watermovement2", "watermovement2percent", "waterpresent", "watersource", "winddir", "windspeed", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "updated", - ).WithParent("fs_qamosquitoinspection"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Acresbreeding: psql.Quote(alias, "acresbreeding"), - Actiontaken: psql.Quote(alias, "actiontaken"), - Adultactivity: psql.Quote(alias, "adultactivity"), - Aquaticorganisms: psql.Quote(alias, "aquaticorganisms"), - Avetemp: psql.Quote(alias, "avetemp"), - Breedingpotential: psql.Quote(alias, "breedingpotential"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Enddatetime: psql.Quote(alias, "enddatetime"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fieldtech: psql.Quote(alias, "fieldtech"), - Fish: psql.Quote(alias, "fish"), - Globalid: psql.Quote(alias, "globalid"), - Habvalue1: psql.Quote(alias, "habvalue1"), - Habvalue1percent: psql.Quote(alias, "habvalue1percent"), - Habvalue2: psql.Quote(alias, "habvalue2"), - Habvalue2percent: psql.Quote(alias, "habvalue2percent"), - Larvaeinsidetreatedarea: psql.Quote(alias, "larvaeinsidetreatedarea"), - Larvaeoutsidetreatedarea: psql.Quote(alias, "larvaeoutsidetreatedarea"), - Larvaepresent: psql.Quote(alias, "larvaepresent"), - Larvaereason: psql.Quote(alias, "larvaereason"), - Linelocid: psql.Quote(alias, "linelocid"), - Locationname: psql.Quote(alias, "locationname"), - LR: psql.Quote(alias, "lr"), - Mosquitohabitat: psql.Quote(alias, "mosquitohabitat"), - Movingwater: psql.Quote(alias, "movingwater"), - Negdips: psql.Quote(alias, "negdips"), - Nowaterever: psql.Quote(alias, "nowaterever"), - Objectid: psql.Quote(alias, "objectid"), - Pointlocid: psql.Quote(alias, "pointlocid"), - Polygonlocid: psql.Quote(alias, "polygonlocid"), - Posdips: psql.Quote(alias, "posdips"), - Potential: psql.Quote(alias, "potential"), - Raingauge: psql.Quote(alias, "raingauge"), - Recordstatus: psql.Quote(alias, "recordstatus"), - Reviewed: psql.Quote(alias, "reviewed"), - Reviewedby: psql.Quote(alias, "reviewedby"), - Revieweddate: psql.Quote(alias, "revieweddate"), - Sitetype: psql.Quote(alias, "sitetype"), - Soilconditions: psql.Quote(alias, "soilconditions"), - Sourcereduction: psql.Quote(alias, "sourcereduction"), - Startdatetime: psql.Quote(alias, "startdatetime"), - Totalacres: psql.Quote(alias, "totalacres"), - Vegetation: psql.Quote(alias, "vegetation"), - Waterconditions: psql.Quote(alias, "waterconditions"), - Waterduration: psql.Quote(alias, "waterduration"), - Watermovement1: psql.Quote(alias, "watermovement1"), - Watermovement1percent: psql.Quote(alias, "watermovement1percent"), - Watermovement2: psql.Quote(alias, "watermovement2"), - Watermovement2percent: psql.Quote(alias, "watermovement2percent"), - Waterpresent: psql.Quote(alias, "waterpresent"), - Watersource: psql.Quote(alias, "watersource"), - Winddir: psql.Quote(alias, "winddir"), - Windspeed: psql.Quote(alias, "windspeed"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsQamosquitoinspectionColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Acresbreeding psql.Expression - Actiontaken psql.Expression - Adultactivity psql.Expression - Aquaticorganisms psql.Expression - Avetemp psql.Expression - Breedingpotential psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Enddatetime psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fieldtech psql.Expression - Fish psql.Expression - Globalid psql.Expression - Habvalue1 psql.Expression - Habvalue1percent psql.Expression - Habvalue2 psql.Expression - Habvalue2percent psql.Expression - Larvaeinsidetreatedarea psql.Expression - Larvaeoutsidetreatedarea psql.Expression - Larvaepresent psql.Expression - Larvaereason psql.Expression - Linelocid psql.Expression - Locationname psql.Expression - LR psql.Expression - Mosquitohabitat psql.Expression - Movingwater psql.Expression - Negdips psql.Expression - Nowaterever psql.Expression - Objectid psql.Expression - Pointlocid psql.Expression - Polygonlocid psql.Expression - Posdips psql.Expression - Potential psql.Expression - Raingauge psql.Expression - Recordstatus psql.Expression - Reviewed psql.Expression - Reviewedby psql.Expression - Revieweddate psql.Expression - Sitetype psql.Expression - Soilconditions psql.Expression - Sourcereduction psql.Expression - Startdatetime psql.Expression - Totalacres psql.Expression - Vegetation psql.Expression - Waterconditions psql.Expression - Waterduration psql.Expression - Watermovement1 psql.Expression - Watermovement1percent psql.Expression - Watermovement2 psql.Expression - Watermovement2percent psql.Expression - Waterpresent psql.Expression - Watersource psql.Expression - Winddir psql.Expression - Windspeed psql.Expression - Zone psql.Expression - Zone2 psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Updated psql.Expression -} - -func (c fsQamosquitoinspectionColumns) Alias() string { - return c.tableAlias -} - -func (fsQamosquitoinspectionColumns) AliasedAs(alias string) fsQamosquitoinspectionColumns { - return buildFSQamosquitoinspectionColumns(alias) -} - -// FSQamosquitoinspectionSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSQamosquitoinspectionSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Acresbreeding omitnull.Val[float64] `db:"acresbreeding" ` - Actiontaken omitnull.Val[string] `db:"actiontaken" ` - Adultactivity omitnull.Val[int16] `db:"adultactivity" ` - Aquaticorganisms omitnull.Val[string] `db:"aquaticorganisms" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Breedingpotential omitnull.Val[string] `db:"breedingpotential" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Fish omitnull.Val[int16] `db:"fish" ` - Globalid omit.Val[string] `db:"globalid" ` - Habvalue1 omitnull.Val[int16] `db:"habvalue1" ` - Habvalue1percent omitnull.Val[int16] `db:"habvalue1percent" ` - Habvalue2 omitnull.Val[int16] `db:"habvalue2" ` - Habvalue2percent omitnull.Val[int16] `db:"habvalue2percent" ` - Larvaeinsidetreatedarea omitnull.Val[int16] `db:"larvaeinsidetreatedarea" ` - Larvaeoutsidetreatedarea omitnull.Val[int16] `db:"larvaeoutsidetreatedarea" ` - Larvaepresent omitnull.Val[int16] `db:"larvaepresent" ` - Larvaereason omitnull.Val[string] `db:"larvaereason" ` - Linelocid omitnull.Val[string] `db:"linelocid" ` - Locationname omitnull.Val[string] `db:"locationname" ` - LR omitnull.Val[int16] `db:"lr" ` - Mosquitohabitat omitnull.Val[string] `db:"mosquitohabitat" ` - Movingwater omitnull.Val[int16] `db:"movingwater" ` - Negdips omitnull.Val[int16] `db:"negdips" ` - Nowaterever omitnull.Val[int16] `db:"nowaterever" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Pointlocid omitnull.Val[string] `db:"pointlocid" ` - Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` - Posdips omitnull.Val[int16] `db:"posdips" ` - Potential omitnull.Val[int16] `db:"potential" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Sitetype omitnull.Val[string] `db:"sitetype" ` - Soilconditions omitnull.Val[string] `db:"soilconditions" ` - Sourcereduction omitnull.Val[string] `db:"sourcereduction" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Totalacres omitnull.Val[float64] `db:"totalacres" ` - Vegetation omitnull.Val[string] `db:"vegetation" ` - Waterconditions omitnull.Val[string] `db:"waterconditions" ` - Waterduration omitnull.Val[string] `db:"waterduration" ` - Watermovement1 omitnull.Val[string] `db:"watermovement1" ` - Watermovement1percent omitnull.Val[int16] `db:"watermovement1percent" ` - Watermovement2 omitnull.Val[string] `db:"watermovement2" ` - Watermovement2percent omitnull.Val[int16] `db:"watermovement2percent" ` - Waterpresent omitnull.Val[int16] `db:"waterpresent" ` - Watersource omitnull.Val[string] `db:"watersource" ` - Winddir omitnull.Val[string] `db:"winddir" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSQamosquitoinspectionSetter) SetColumns() []string { - vals := make([]string, 0, 66) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Acresbreeding.IsUnset() { - vals = append(vals, "acresbreeding") - } - if !s.Actiontaken.IsUnset() { - vals = append(vals, "actiontaken") - } - if !s.Adultactivity.IsUnset() { - vals = append(vals, "adultactivity") - } - if !s.Aquaticorganisms.IsUnset() { - vals = append(vals, "aquaticorganisms") - } - if !s.Avetemp.IsUnset() { - vals = append(vals, "avetemp") - } - if !s.Breedingpotential.IsUnset() { - vals = append(vals, "breedingpotential") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Enddatetime.IsUnset() { - vals = append(vals, "enddatetime") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fieldtech.IsUnset() { - vals = append(vals, "fieldtech") - } - if !s.Fish.IsUnset() { - vals = append(vals, "fish") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Habvalue1.IsUnset() { - vals = append(vals, "habvalue1") - } - if !s.Habvalue1percent.IsUnset() { - vals = append(vals, "habvalue1percent") - } - if !s.Habvalue2.IsUnset() { - vals = append(vals, "habvalue2") - } - if !s.Habvalue2percent.IsUnset() { - vals = append(vals, "habvalue2percent") - } - if !s.Larvaeinsidetreatedarea.IsUnset() { - vals = append(vals, "larvaeinsidetreatedarea") - } - if !s.Larvaeoutsidetreatedarea.IsUnset() { - vals = append(vals, "larvaeoutsidetreatedarea") - } - if !s.Larvaepresent.IsUnset() { - vals = append(vals, "larvaepresent") - } - if !s.Larvaereason.IsUnset() { - vals = append(vals, "larvaereason") - } - if !s.Linelocid.IsUnset() { - vals = append(vals, "linelocid") - } - if !s.Locationname.IsUnset() { - vals = append(vals, "locationname") - } - if !s.LR.IsUnset() { - vals = append(vals, "lr") - } - if !s.Mosquitohabitat.IsUnset() { - vals = append(vals, "mosquitohabitat") - } - if !s.Movingwater.IsUnset() { - vals = append(vals, "movingwater") - } - if !s.Negdips.IsUnset() { - vals = append(vals, "negdips") - } - if !s.Nowaterever.IsUnset() { - vals = append(vals, "nowaterever") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Pointlocid.IsUnset() { - vals = append(vals, "pointlocid") - } - if !s.Polygonlocid.IsUnset() { - vals = append(vals, "polygonlocid") - } - if !s.Posdips.IsUnset() { - vals = append(vals, "posdips") - } - if !s.Potential.IsUnset() { - vals = append(vals, "potential") - } - if !s.Raingauge.IsUnset() { - vals = append(vals, "raingauge") - } - if !s.Recordstatus.IsUnset() { - vals = append(vals, "recordstatus") - } - if !s.Reviewed.IsUnset() { - vals = append(vals, "reviewed") - } - if !s.Reviewedby.IsUnset() { - vals = append(vals, "reviewedby") - } - if !s.Revieweddate.IsUnset() { - vals = append(vals, "revieweddate") - } - if !s.Sitetype.IsUnset() { - vals = append(vals, "sitetype") - } - if !s.Soilconditions.IsUnset() { - vals = append(vals, "soilconditions") - } - if !s.Sourcereduction.IsUnset() { - vals = append(vals, "sourcereduction") - } - if !s.Startdatetime.IsUnset() { - vals = append(vals, "startdatetime") - } - if !s.Totalacres.IsUnset() { - vals = append(vals, "totalacres") - } - if !s.Vegetation.IsUnset() { - vals = append(vals, "vegetation") - } - if !s.Waterconditions.IsUnset() { - vals = append(vals, "waterconditions") - } - if !s.Waterduration.IsUnset() { - vals = append(vals, "waterduration") - } - if !s.Watermovement1.IsUnset() { - vals = append(vals, "watermovement1") - } - if !s.Watermovement1percent.IsUnset() { - vals = append(vals, "watermovement1percent") - } - if !s.Watermovement2.IsUnset() { - vals = append(vals, "watermovement2") - } - if !s.Watermovement2percent.IsUnset() { - vals = append(vals, "watermovement2percent") - } - if !s.Waterpresent.IsUnset() { - vals = append(vals, "waterpresent") - } - if !s.Watersource.IsUnset() { - vals = append(vals, "watersource") - } - if !s.Winddir.IsUnset() { - vals = append(vals, "winddir") - } - if !s.Windspeed.IsUnset() { - vals = append(vals, "windspeed") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSQamosquitoinspectionSetter) Overwrite(t *FSQamosquitoinspection) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Acresbreeding.IsUnset() { - t.Acresbreeding = s.Acresbreeding.MustGetNull() - } - if !s.Actiontaken.IsUnset() { - t.Actiontaken = s.Actiontaken.MustGetNull() - } - if !s.Adultactivity.IsUnset() { - t.Adultactivity = s.Adultactivity.MustGetNull() - } - if !s.Aquaticorganisms.IsUnset() { - t.Aquaticorganisms = s.Aquaticorganisms.MustGetNull() - } - if !s.Avetemp.IsUnset() { - t.Avetemp = s.Avetemp.MustGetNull() - } - if !s.Breedingpotential.IsUnset() { - t.Breedingpotential = s.Breedingpotential.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Enddatetime.IsUnset() { - t.Enddatetime = s.Enddatetime.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fieldtech.IsUnset() { - t.Fieldtech = s.Fieldtech.MustGetNull() - } - if !s.Fish.IsUnset() { - t.Fish = s.Fish.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Habvalue1.IsUnset() { - t.Habvalue1 = s.Habvalue1.MustGetNull() - } - if !s.Habvalue1percent.IsUnset() { - t.Habvalue1percent = s.Habvalue1percent.MustGetNull() - } - if !s.Habvalue2.IsUnset() { - t.Habvalue2 = s.Habvalue2.MustGetNull() - } - if !s.Habvalue2percent.IsUnset() { - t.Habvalue2percent = s.Habvalue2percent.MustGetNull() - } - if !s.Larvaeinsidetreatedarea.IsUnset() { - t.Larvaeinsidetreatedarea = s.Larvaeinsidetreatedarea.MustGetNull() - } - if !s.Larvaeoutsidetreatedarea.IsUnset() { - t.Larvaeoutsidetreatedarea = s.Larvaeoutsidetreatedarea.MustGetNull() - } - if !s.Larvaepresent.IsUnset() { - t.Larvaepresent = s.Larvaepresent.MustGetNull() - } - if !s.Larvaereason.IsUnset() { - t.Larvaereason = s.Larvaereason.MustGetNull() - } - if !s.Linelocid.IsUnset() { - t.Linelocid = s.Linelocid.MustGetNull() - } - if !s.Locationname.IsUnset() { - t.Locationname = s.Locationname.MustGetNull() - } - if !s.LR.IsUnset() { - t.LR = s.LR.MustGetNull() - } - if !s.Mosquitohabitat.IsUnset() { - t.Mosquitohabitat = s.Mosquitohabitat.MustGetNull() - } - if !s.Movingwater.IsUnset() { - t.Movingwater = s.Movingwater.MustGetNull() - } - if !s.Negdips.IsUnset() { - t.Negdips = s.Negdips.MustGetNull() - } - if !s.Nowaterever.IsUnset() { - t.Nowaterever = s.Nowaterever.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Pointlocid.IsUnset() { - t.Pointlocid = s.Pointlocid.MustGetNull() - } - if !s.Polygonlocid.IsUnset() { - t.Polygonlocid = s.Polygonlocid.MustGetNull() - } - if !s.Posdips.IsUnset() { - t.Posdips = s.Posdips.MustGetNull() - } - if !s.Potential.IsUnset() { - t.Potential = s.Potential.MustGetNull() - } - if !s.Raingauge.IsUnset() { - t.Raingauge = s.Raingauge.MustGetNull() - } - if !s.Recordstatus.IsUnset() { - t.Recordstatus = s.Recordstatus.MustGetNull() - } - if !s.Reviewed.IsUnset() { - t.Reviewed = s.Reviewed.MustGetNull() - } - if !s.Reviewedby.IsUnset() { - t.Reviewedby = s.Reviewedby.MustGetNull() - } - if !s.Revieweddate.IsUnset() { - t.Revieweddate = s.Revieweddate.MustGetNull() - } - if !s.Sitetype.IsUnset() { - t.Sitetype = s.Sitetype.MustGetNull() - } - if !s.Soilconditions.IsUnset() { - t.Soilconditions = s.Soilconditions.MustGetNull() - } - if !s.Sourcereduction.IsUnset() { - t.Sourcereduction = s.Sourcereduction.MustGetNull() - } - if !s.Startdatetime.IsUnset() { - t.Startdatetime = s.Startdatetime.MustGetNull() - } - if !s.Totalacres.IsUnset() { - t.Totalacres = s.Totalacres.MustGetNull() - } - if !s.Vegetation.IsUnset() { - t.Vegetation = s.Vegetation.MustGetNull() - } - if !s.Waterconditions.IsUnset() { - t.Waterconditions = s.Waterconditions.MustGetNull() - } - if !s.Waterduration.IsUnset() { - t.Waterduration = s.Waterduration.MustGetNull() - } - if !s.Watermovement1.IsUnset() { - t.Watermovement1 = s.Watermovement1.MustGetNull() - } - if !s.Watermovement1percent.IsUnset() { - t.Watermovement1percent = s.Watermovement1percent.MustGetNull() - } - if !s.Watermovement2.IsUnset() { - t.Watermovement2 = s.Watermovement2.MustGetNull() - } - if !s.Watermovement2percent.IsUnset() { - t.Watermovement2percent = s.Watermovement2percent.MustGetNull() - } - if !s.Waterpresent.IsUnset() { - t.Waterpresent = s.Waterpresent.MustGetNull() - } - if !s.Watersource.IsUnset() { - t.Watersource = s.Watersource.MustGetNull() - } - if !s.Winddir.IsUnset() { - t.Winddir = s.Winddir.MustGetNull() - } - if !s.Windspeed.IsUnset() { - t.Windspeed = s.Windspeed.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSQamosquitoinspections.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 66) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Acresbreeding.IsUnset() { - vals[1] = psql.Arg(s.Acresbreeding.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Actiontaken.IsUnset() { - vals[2] = psql.Arg(s.Actiontaken.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Adultactivity.IsUnset() { - vals[3] = psql.Arg(s.Adultactivity.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Aquaticorganisms.IsUnset() { - vals[4] = psql.Arg(s.Aquaticorganisms.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Avetemp.IsUnset() { - vals[5] = psql.Arg(s.Avetemp.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Breedingpotential.IsUnset() { - vals[6] = psql.Arg(s.Breedingpotential.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[7] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[8] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[9] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Enddatetime.IsUnset() { - vals[10] = psql.Arg(s.Enddatetime.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[11] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[12] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Fieldtech.IsUnset() { - vals[13] = psql.Arg(s.Fieldtech.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Fish.IsUnset() { - vals[14] = psql.Arg(s.Fish.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[15] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Habvalue1.IsUnset() { - vals[16] = psql.Arg(s.Habvalue1.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Habvalue1percent.IsUnset() { - vals[17] = psql.Arg(s.Habvalue1percent.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Habvalue2.IsUnset() { - vals[18] = psql.Arg(s.Habvalue2.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Habvalue2percent.IsUnset() { - vals[19] = psql.Arg(s.Habvalue2percent.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Larvaeinsidetreatedarea.IsUnset() { - vals[20] = psql.Arg(s.Larvaeinsidetreatedarea.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Larvaeoutsidetreatedarea.IsUnset() { - vals[21] = psql.Arg(s.Larvaeoutsidetreatedarea.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Larvaepresent.IsUnset() { - vals[22] = psql.Arg(s.Larvaepresent.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Larvaereason.IsUnset() { - vals[23] = psql.Arg(s.Larvaereason.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Linelocid.IsUnset() { - vals[24] = psql.Arg(s.Linelocid.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Locationname.IsUnset() { - vals[25] = psql.Arg(s.Locationname.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.LR.IsUnset() { - vals[26] = psql.Arg(s.LR.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Mosquitohabitat.IsUnset() { - vals[27] = psql.Arg(s.Mosquitohabitat.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Movingwater.IsUnset() { - vals[28] = psql.Arg(s.Movingwater.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Negdips.IsUnset() { - vals[29] = psql.Arg(s.Negdips.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Nowaterever.IsUnset() { - vals[30] = psql.Arg(s.Nowaterever.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[31] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Pointlocid.IsUnset() { - vals[32] = psql.Arg(s.Pointlocid.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Polygonlocid.IsUnset() { - vals[33] = psql.Arg(s.Polygonlocid.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Posdips.IsUnset() { - vals[34] = psql.Arg(s.Posdips.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Potential.IsUnset() { - vals[35] = psql.Arg(s.Potential.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Raingauge.IsUnset() { - vals[36] = psql.Arg(s.Raingauge.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.Recordstatus.IsUnset() { - vals[37] = psql.Arg(s.Recordstatus.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.Reviewed.IsUnset() { - vals[38] = psql.Arg(s.Reviewed.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Reviewedby.IsUnset() { - vals[39] = psql.Arg(s.Reviewedby.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Revieweddate.IsUnset() { - vals[40] = psql.Arg(s.Revieweddate.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.Sitetype.IsUnset() { - vals[41] = psql.Arg(s.Sitetype.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.Soilconditions.IsUnset() { - vals[42] = psql.Arg(s.Soilconditions.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.Sourcereduction.IsUnset() { - vals[43] = psql.Arg(s.Sourcereduction.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.Startdatetime.IsUnset() { - vals[44] = psql.Arg(s.Startdatetime.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if !s.Totalacres.IsUnset() { - vals[45] = psql.Arg(s.Totalacres.MustGetNull()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if !s.Vegetation.IsUnset() { - vals[46] = psql.Arg(s.Vegetation.MustGetNull()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - if !s.Waterconditions.IsUnset() { - vals[47] = psql.Arg(s.Waterconditions.MustGetNull()) - } else { - vals[47] = psql.Raw("DEFAULT") - } - - if !s.Waterduration.IsUnset() { - vals[48] = psql.Arg(s.Waterduration.MustGetNull()) - } else { - vals[48] = psql.Raw("DEFAULT") - } - - if !s.Watermovement1.IsUnset() { - vals[49] = psql.Arg(s.Watermovement1.MustGetNull()) - } else { - vals[49] = psql.Raw("DEFAULT") - } - - if !s.Watermovement1percent.IsUnset() { - vals[50] = psql.Arg(s.Watermovement1percent.MustGetNull()) - } else { - vals[50] = psql.Raw("DEFAULT") - } - - if !s.Watermovement2.IsUnset() { - vals[51] = psql.Arg(s.Watermovement2.MustGetNull()) - } else { - vals[51] = psql.Raw("DEFAULT") - } - - if !s.Watermovement2percent.IsUnset() { - vals[52] = psql.Arg(s.Watermovement2percent.MustGetNull()) - } else { - vals[52] = psql.Raw("DEFAULT") - } - - if !s.Waterpresent.IsUnset() { - vals[53] = psql.Arg(s.Waterpresent.MustGetNull()) - } else { - vals[53] = psql.Raw("DEFAULT") - } - - if !s.Watersource.IsUnset() { - vals[54] = psql.Arg(s.Watersource.MustGetNull()) - } else { - vals[54] = psql.Raw("DEFAULT") - } - - if !s.Winddir.IsUnset() { - vals[55] = psql.Arg(s.Winddir.MustGetNull()) - } else { - vals[55] = psql.Raw("DEFAULT") - } - - if !s.Windspeed.IsUnset() { - vals[56] = psql.Arg(s.Windspeed.MustGetNull()) - } else { - vals[56] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[57] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[57] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[58] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[58] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[59] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[59] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[60] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[60] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[61] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[61] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[62] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[62] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[63] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[63] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[64] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[64] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[65] = psql.Arg(s.Updated.MustGet()) - } else { - vals[65] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSQamosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSQamosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 66) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Acresbreeding.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "acresbreeding")...), - psql.Arg(s.Acresbreeding), - }}) - } - - if !s.Actiontaken.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "actiontaken")...), - psql.Arg(s.Actiontaken), - }}) - } - - if !s.Adultactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "adultactivity")...), - psql.Arg(s.Adultactivity), - }}) - } - - if !s.Aquaticorganisms.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "aquaticorganisms")...), - psql.Arg(s.Aquaticorganisms), - }}) - } - - if !s.Avetemp.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "avetemp")...), - psql.Arg(s.Avetemp), - }}) - } - - if !s.Breedingpotential.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "breedingpotential")...), - psql.Arg(s.Breedingpotential), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Enddatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "enddatetime")...), - psql.Arg(s.Enddatetime), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fieldtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldtech")...), - psql.Arg(s.Fieldtech), - }}) - } - - if !s.Fish.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fish")...), - psql.Arg(s.Fish), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habvalue1.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habvalue1")...), - psql.Arg(s.Habvalue1), - }}) - } - - if !s.Habvalue1percent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habvalue1percent")...), - psql.Arg(s.Habvalue1percent), - }}) - } - - if !s.Habvalue2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habvalue2")...), - psql.Arg(s.Habvalue2), - }}) - } - - if !s.Habvalue2percent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habvalue2percent")...), - psql.Arg(s.Habvalue2percent), - }}) - } - - if !s.Larvaeinsidetreatedarea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvaeinsidetreatedarea")...), - psql.Arg(s.Larvaeinsidetreatedarea), - }}) - } - - if !s.Larvaeoutsidetreatedarea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvaeoutsidetreatedarea")...), - psql.Arg(s.Larvaeoutsidetreatedarea), - }}) - } - - if !s.Larvaepresent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvaepresent")...), - psql.Arg(s.Larvaepresent), - }}) - } - - if !s.Larvaereason.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvaereason")...), - psql.Arg(s.Larvaereason), - }}) - } - - if !s.Linelocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "linelocid")...), - psql.Arg(s.Linelocid), - }}) - } - - if !s.Locationname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationname")...), - psql.Arg(s.Locationname), - }}) - } - - if !s.LR.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lr")...), - psql.Arg(s.LR), - }}) - } - - if !s.Mosquitohabitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "mosquitohabitat")...), - psql.Arg(s.Mosquitohabitat), - }}) - } - - if !s.Movingwater.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "movingwater")...), - psql.Arg(s.Movingwater), - }}) - } - - if !s.Negdips.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "negdips")...), - psql.Arg(s.Negdips), - }}) - } - - if !s.Nowaterever.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nowaterever")...), - psql.Arg(s.Nowaterever), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Pointlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pointlocid")...), - psql.Arg(s.Pointlocid), - }}) - } - - if !s.Polygonlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "polygonlocid")...), - psql.Arg(s.Polygonlocid), - }}) - } - - if !s.Posdips.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "posdips")...), - psql.Arg(s.Posdips), - }}) - } - - if !s.Potential.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "potential")...), - psql.Arg(s.Potential), - }}) - } - - if !s.Raingauge.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "raingauge")...), - psql.Arg(s.Raingauge), - }}) - } - - if !s.Recordstatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "recordstatus")...), - psql.Arg(s.Recordstatus), - }}) - } - - if !s.Reviewed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewed")...), - psql.Arg(s.Reviewed), - }}) - } - - if !s.Reviewedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewedby")...), - psql.Arg(s.Reviewedby), - }}) - } - - if !s.Revieweddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "revieweddate")...), - psql.Arg(s.Revieweddate), - }}) - } - - if !s.Sitetype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sitetype")...), - psql.Arg(s.Sitetype), - }}) - } - - if !s.Soilconditions.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "soilconditions")...), - psql.Arg(s.Soilconditions), - }}) - } - - if !s.Sourcereduction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sourcereduction")...), - psql.Arg(s.Sourcereduction), - }}) - } - - if !s.Startdatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "startdatetime")...), - psql.Arg(s.Startdatetime), - }}) - } - - if !s.Totalacres.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "totalacres")...), - psql.Arg(s.Totalacres), - }}) - } - - if !s.Vegetation.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vegetation")...), - psql.Arg(s.Vegetation), - }}) - } - - if !s.Waterconditions.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "waterconditions")...), - psql.Arg(s.Waterconditions), - }}) - } - - if !s.Waterduration.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "waterduration")...), - psql.Arg(s.Waterduration), - }}) - } - - if !s.Watermovement1.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "watermovement1")...), - psql.Arg(s.Watermovement1), - }}) - } - - if !s.Watermovement1percent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "watermovement1percent")...), - psql.Arg(s.Watermovement1percent), - }}) - } - - if !s.Watermovement2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "watermovement2")...), - psql.Arg(s.Watermovement2), - }}) - } - - if !s.Watermovement2percent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "watermovement2percent")...), - psql.Arg(s.Watermovement2percent), - }}) - } - - if !s.Waterpresent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "waterpresent")...), - psql.Arg(s.Waterpresent), - }}) - } - - if !s.Watersource.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "watersource")...), - psql.Arg(s.Watersource), - }}) - } - - if !s.Winddir.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "winddir")...), - psql.Arg(s.Winddir), - }}) - } - - if !s.Windspeed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "windspeed")...), - psql.Arg(s.Windspeed), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSQamosquitoinspection retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSQamosquitoinspection(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSQamosquitoinspection, error) { - if len(cols) == 0 { - return FSQamosquitoinspections.Query( - sm.Where(FSQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSQamosquitoinspections.Query( - sm.Where(FSQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSQamosquitoinspections.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSQamosquitoinspectionExists checks the presence of a single record by primary key -func FSQamosquitoinspectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSQamosquitoinspections.Query( - sm.Where(FSQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSQamosquitoinspection is retrieved from the database -func (o *FSQamosquitoinspection) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSQamosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, FSQamosquitoinspectionSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSQamosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, FSQamosquitoinspectionSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSQamosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, FSQamosquitoinspectionSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSQamosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, FSQamosquitoinspectionSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSQamosquitoinspection -func (o *FSQamosquitoinspection) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSQamosquitoinspection) pkEQ() dialect.Expression { - return psql.Quote("fs_qamosquitoinspection", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSQamosquitoinspection -func (o *FSQamosquitoinspection) Update(ctx context.Context, exec bob.Executor, s *FSQamosquitoinspectionSetter) error { - v, err := FSQamosquitoinspections.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 FSQamosquitoinspection record with an executor -func (o *FSQamosquitoinspection) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSQamosquitoinspections.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSQamosquitoinspection using the executor -func (o *FSQamosquitoinspection) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSQamosquitoinspections.Query( - sm.Where(FSQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSQamosquitoinspectionSlice is retrieved from the database -func (o FSQamosquitoinspectionSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSQamosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSQamosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSQamosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSQamosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSQamosquitoinspectionSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_qamosquitoinspection", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSQamosquitoinspectionSlice) copyMatchingRows(from ...*FSQamosquitoinspection) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSQamosquitoinspectionSlice) 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 FSQamosquitoinspections.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 *FSQamosquitoinspection: - o.copyMatchingRows(retrieved) - case []*FSQamosquitoinspection: - o.copyMatchingRows(retrieved...) - case FSQamosquitoinspectionSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSQamosquitoinspection or a slice of FSQamosquitoinspection - // then run the AfterUpdateHooks on the slice - _, err = FSQamosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSQamosquitoinspectionSlice) 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 FSQamosquitoinspections.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 *FSQamosquitoinspection: - o.copyMatchingRows(retrieved) - case []*FSQamosquitoinspection: - o.copyMatchingRows(retrieved...) - case FSQamosquitoinspectionSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSQamosquitoinspection or a slice of FSQamosquitoinspection - // then run the AfterDeleteHooks on the slice - _, err = FSQamosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSQamosquitoinspectionSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSQamosquitoinspectionSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSQamosquitoinspections.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSQamosquitoinspectionSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSQamosquitoinspections.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSQamosquitoinspectionSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSQamosquitoinspections.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 *FSQamosquitoinspection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSQamosquitoinspectionSlice) 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 attachFSQamosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, fsQamosquitoinspection0 *FSQamosquitoinspection, organization1 *Organization) (*FSQamosquitoinspection, error) { - setter := &FSQamosquitoinspectionSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsQamosquitoinspection0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSQamosquitoinspectionOrganization0: %w", err) - } - - return fsQamosquitoinspection0, nil -} - -func (fsQamosquitoinspection0 *FSQamosquitoinspection) 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 = attachFSQamosquitoinspectionOrganization0(ctx, exec, 1, fsQamosquitoinspection0, organization1) - if err != nil { - return err - } - - fsQamosquitoinspection0.R.Organization = organization1 - - organization1.R.FSQamosquitoinspections = append(organization1.R.FSQamosquitoinspections, fsQamosquitoinspection0) - - return nil -} - -func (fsQamosquitoinspection0 *FSQamosquitoinspection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSQamosquitoinspectionOrganization0(ctx, exec, 1, fsQamosquitoinspection0, organization1) - if err != nil { - return err - } - - fsQamosquitoinspection0.R.Organization = organization1 - - organization1.R.FSQamosquitoinspections = append(organization1.R.FSQamosquitoinspections, fsQamosquitoinspection0) - - return nil -} - -type fsQamosquitoinspectionWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Acresbreeding psql.WhereNullMod[Q, float64] - Actiontaken psql.WhereNullMod[Q, string] - Adultactivity psql.WhereNullMod[Q, int16] - Aquaticorganisms psql.WhereNullMod[Q, string] - Avetemp psql.WhereNullMod[Q, float64] - Breedingpotential psql.WhereNullMod[Q, string] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Enddatetime psql.WhereNullMod[Q, int64] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fieldtech psql.WhereNullMod[Q, string] - Fish psql.WhereNullMod[Q, int16] - Globalid psql.WhereMod[Q, string] - Habvalue1 psql.WhereNullMod[Q, int16] - Habvalue1percent psql.WhereNullMod[Q, int16] - Habvalue2 psql.WhereNullMod[Q, int16] - Habvalue2percent psql.WhereNullMod[Q, int16] - Larvaeinsidetreatedarea psql.WhereNullMod[Q, int16] - Larvaeoutsidetreatedarea psql.WhereNullMod[Q, int16] - Larvaepresent psql.WhereNullMod[Q, int16] - Larvaereason psql.WhereNullMod[Q, string] - Linelocid psql.WhereNullMod[Q, string] - Locationname psql.WhereNullMod[Q, string] - LR psql.WhereNullMod[Q, int16] - Mosquitohabitat psql.WhereNullMod[Q, string] - Movingwater psql.WhereNullMod[Q, int16] - Negdips psql.WhereNullMod[Q, int16] - Nowaterever psql.WhereNullMod[Q, int16] - Objectid psql.WhereMod[Q, int32] - Pointlocid psql.WhereNullMod[Q, string] - Polygonlocid psql.WhereNullMod[Q, string] - Posdips psql.WhereNullMod[Q, int16] - Potential psql.WhereNullMod[Q, int16] - Raingauge psql.WhereNullMod[Q, float64] - Recordstatus psql.WhereNullMod[Q, int16] - Reviewed psql.WhereNullMod[Q, int16] - Reviewedby psql.WhereNullMod[Q, string] - Revieweddate psql.WhereNullMod[Q, int64] - Sitetype psql.WhereNullMod[Q, string] - Soilconditions psql.WhereNullMod[Q, string] - Sourcereduction psql.WhereNullMod[Q, string] - Startdatetime psql.WhereNullMod[Q, int64] - Totalacres psql.WhereNullMod[Q, float64] - Vegetation psql.WhereNullMod[Q, string] - Waterconditions psql.WhereNullMod[Q, string] - Waterduration psql.WhereNullMod[Q, string] - Watermovement1 psql.WhereNullMod[Q, string] - Watermovement1percent psql.WhereNullMod[Q, int16] - Watermovement2 psql.WhereNullMod[Q, string] - Watermovement2percent psql.WhereNullMod[Q, int16] - Waterpresent psql.WhereNullMod[Q, int16] - Watersource psql.WhereNullMod[Q, string] - Winddir psql.WhereNullMod[Q, string] - Windspeed psql.WhereNullMod[Q, float64] - Zone psql.WhereNullMod[Q, string] - 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] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsQamosquitoinspectionWhere[Q]) AliasedAs(alias string) fsQamosquitoinspectionWhere[Q] { - return buildFSQamosquitoinspectionWhere[Q](buildFSQamosquitoinspectionColumns(alias)) -} - -func buildFSQamosquitoinspectionWhere[Q psql.Filterable](cols fsQamosquitoinspectionColumns) fsQamosquitoinspectionWhere[Q] { - return fsQamosquitoinspectionWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Acresbreeding: psql.WhereNull[Q, float64](cols.Acresbreeding), - Actiontaken: psql.WhereNull[Q, string](cols.Actiontaken), - Adultactivity: psql.WhereNull[Q, int16](cols.Adultactivity), - Aquaticorganisms: psql.WhereNull[Q, string](cols.Aquaticorganisms), - Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), - Breedingpotential: psql.WhereNull[Q, string](cols.Breedingpotential), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), - Fish: psql.WhereNull[Q, int16](cols.Fish), - 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), - Habvalue2percent: psql.WhereNull[Q, int16](cols.Habvalue2percent), - Larvaeinsidetreatedarea: psql.WhereNull[Q, int16](cols.Larvaeinsidetreatedarea), - Larvaeoutsidetreatedarea: psql.WhereNull[Q, int16](cols.Larvaeoutsidetreatedarea), - Larvaepresent: psql.WhereNull[Q, int16](cols.Larvaepresent), - Larvaereason: psql.WhereNull[Q, string](cols.Larvaereason), - Linelocid: psql.WhereNull[Q, string](cols.Linelocid), - Locationname: psql.WhereNull[Q, string](cols.Locationname), - LR: psql.WhereNull[Q, int16](cols.LR), - Mosquitohabitat: psql.WhereNull[Q, string](cols.Mosquitohabitat), - Movingwater: psql.WhereNull[Q, int16](cols.Movingwater), - Negdips: psql.WhereNull[Q, int16](cols.Negdips), - Nowaterever: psql.WhereNull[Q, int16](cols.Nowaterever), - Objectid: psql.Where[Q, int32](cols.Objectid), - Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), - Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), - Posdips: psql.WhereNull[Q, int16](cols.Posdips), - Potential: psql.WhereNull[Q, int16](cols.Potential), - Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), - Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), - Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), - Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), - Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), - Sitetype: psql.WhereNull[Q, string](cols.Sitetype), - Soilconditions: psql.WhereNull[Q, string](cols.Soilconditions), - Sourcereduction: psql.WhereNull[Q, string](cols.Sourcereduction), - Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), - Totalacres: psql.WhereNull[Q, float64](cols.Totalacres), - Vegetation: psql.WhereNull[Q, string](cols.Vegetation), - Waterconditions: psql.WhereNull[Q, string](cols.Waterconditions), - Waterduration: psql.WhereNull[Q, string](cols.Waterduration), - Watermovement1: psql.WhereNull[Q, string](cols.Watermovement1), - Watermovement1percent: psql.WhereNull[Q, int16](cols.Watermovement1percent), - Watermovement2: psql.WhereNull[Q, string](cols.Watermovement2), - Watermovement2percent: psql.WhereNull[Q, int16](cols.Watermovement2percent), - Waterpresent: psql.WhereNull[Q, int16](cols.Waterpresent), - Watersource: psql.WhereNull[Q, string](cols.Watersource), - Winddir: psql.WhereNull[Q, string](cols.Winddir), - Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), - Zone: psql.WhereNull[Q, string](cols.Zone), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSQamosquitoinspection) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsQamosquitoinspection cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSQamosquitoinspections = FSQamosquitoinspectionSlice{o} - } - return nil - default: - return fmt.Errorf("fsQamosquitoinspection has no relationship %q", name) - } -} - -type fsQamosquitoinspectionPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSQamosquitoinspectionPreloader() fsQamosquitoinspectionPreloader { - return fsQamosquitoinspectionPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSQamosquitoinspections, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsQamosquitoinspectionThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSQamosquitoinspectionThenLoader[Q orm.Loadable]() fsQamosquitoinspectionThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsQamosquitoinspectionThenLoader[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 fsQamosquitoinspection's Organization into the .R struct -func (o *FSQamosquitoinspection) 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.FSQamosquitoinspections = FSQamosquitoinspectionSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsQamosquitoinspection's Organization into the .R struct -func (os FSQamosquitoinspectionSlice) 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.FSQamosquitoinspections = append(rel.R.FSQamosquitoinspections, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsQamosquitoinspectionJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsQamosquitoinspectionJoins[Q]) aliasedAs(alias string) fsQamosquitoinspectionJoins[Q] { - return buildFSQamosquitoinspectionJoins[Q](buildFSQamosquitoinspectionColumns(alias), j.typ) -} - -func buildFSQamosquitoinspectionJoins[Q dialect.Joinable](cols fsQamosquitoinspectionColumns, typ string) fsQamosquitoinspectionJoins[Q] { - return fsQamosquitoinspectionJoins[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/db/models/fs_rodentlocation.bob.go b/db/models/fs_rodentlocation.bob.go deleted file mode 100644 index c60f1b50..00000000 --- a/db/models/fs_rodentlocation.bob.go +++ /dev/null @@ -1,1405 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSRodentlocation is an object representing the database table. -type FSRodentlocation struct { - OrganizationID int32 `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid string `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Lastinspectaction null.Val[string] `db:"lastinspectaction" ` - Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate null.Val[int64] `db:"lastinspectdate" ` - Lastinspectrodentevidence null.Val[string] `db:"lastinspectrodentevidence" ` - Lastinspectspecies null.Val[string] `db:"lastinspectspecies" ` - Locationname null.Val[string] `db:"locationname" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Symbology null.Val[string] `db:"symbology" ` - Usetype null.Val[string] `db:"usetype" ` - 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" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Updated time.Time `db:"updated" ` - - R fsRodentlocationR `db:"-" ` -} - -// FSRodentlocationSlice is an alias for a slice of pointers to FSRodentlocation. -// This should almost always be used instead of []*FSRodentlocation. -type FSRodentlocationSlice []*FSRodentlocation - -// FSRodentlocations contains methods to work with the fs_rodentlocation table -var FSRodentlocations = psql.NewTablex[*FSRodentlocation, FSRodentlocationSlice, *FSRodentlocationSetter]("", "fs_rodentlocation", buildFSRodentlocationColumns("fs_rodentlocation")) - -// FSRodentlocationsQuery is a query on the fs_rodentlocation table -type FSRodentlocationsQuery = *psql.ViewQuery[*FSRodentlocation, FSRodentlocationSlice] - -// fsRodentlocationR is where relationships are stored. -type fsRodentlocationR struct { - Organization *Organization // fs_rodentlocation.fs_rodentlocation_organization_id_fkey -} - -func buildFSRodentlocationColumns(alias string) fsRodentlocationColumns { - return fsRodentlocationColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "globalid", "habitat", "lastinspectaction", "lastinspectconditions", "lastinspectdate", "lastinspectrodentevidence", "lastinspectspecies", "locationname", "locationnumber", "nextactiondatescheduled", "objectid", "priority", "symbology", "usetype", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "jurisdiction", "updated", - ).WithParent("fs_rodentlocation"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accessdesc: psql.Quote(alias, "accessdesc"), - Active: psql.Quote(alias, "active"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Description: psql.Quote(alias, "description"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Habitat: psql.Quote(alias, "habitat"), - Lastinspectaction: psql.Quote(alias, "lastinspectaction"), - Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), - Lastinspectdate: psql.Quote(alias, "lastinspectdate"), - Lastinspectrodentevidence: psql.Quote(alias, "lastinspectrodentevidence"), - Lastinspectspecies: psql.Quote(alias, "lastinspectspecies"), - Locationname: psql.Quote(alias, "locationname"), - Locationnumber: psql.Quote(alias, "locationnumber"), - Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), - Objectid: psql.Quote(alias, "objectid"), - Priority: psql.Quote(alias, "priority"), - Symbology: psql.Quote(alias, "symbology"), - Usetype: psql.Quote(alias, "usetype"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Jurisdiction: psql.Quote(alias, "jurisdiction"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsRodentlocationColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accessdesc psql.Expression - Active psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Description psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Habitat psql.Expression - Lastinspectaction psql.Expression - Lastinspectconditions psql.Expression - Lastinspectdate psql.Expression - Lastinspectrodentevidence psql.Expression - Lastinspectspecies psql.Expression - Locationname psql.Expression - Locationnumber psql.Expression - Nextactiondatescheduled psql.Expression - Objectid psql.Expression - Priority psql.Expression - Symbology psql.Expression - Usetype psql.Expression - Zone psql.Expression - Zone2 psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Jurisdiction psql.Expression - Updated psql.Expression -} - -func (c fsRodentlocationColumns) Alias() string { - return c.tableAlias -} - -func (fsRodentlocationColumns) AliasedAs(alias string) fsRodentlocationColumns { - return buildFSRodentlocationColumns(alias) -} - -// FSRodentlocationSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSRodentlocationSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omit.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Lastinspectaction omitnull.Val[string] `db:"lastinspectaction" ` - Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate omitnull.Val[int64] `db:"lastinspectdate" ` - Lastinspectrodentevidence omitnull.Val[string] `db:"lastinspectrodentevidence" ` - Lastinspectspecies omitnull.Val[string] `db:"lastinspectspecies" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Symbology omitnull.Val[string] `db:"symbology" ` - Usetype omitnull.Val[string] `db:"usetype" ` - 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" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSRodentlocationSetter) SetColumns() []string { - vals := make([]string, 0, 34) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accessdesc.IsUnset() { - vals = append(vals, "accessdesc") - } - if !s.Active.IsUnset() { - vals = append(vals, "active") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Description.IsUnset() { - vals = append(vals, "description") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Habitat.IsUnset() { - vals = append(vals, "habitat") - } - if !s.Lastinspectaction.IsUnset() { - vals = append(vals, "lastinspectaction") - } - if !s.Lastinspectconditions.IsUnset() { - vals = append(vals, "lastinspectconditions") - } - if !s.Lastinspectdate.IsUnset() { - vals = append(vals, "lastinspectdate") - } - if !s.Lastinspectrodentevidence.IsUnset() { - vals = append(vals, "lastinspectrodentevidence") - } - if !s.Lastinspectspecies.IsUnset() { - vals = append(vals, "lastinspectspecies") - } - if !s.Locationname.IsUnset() { - vals = append(vals, "locationname") - } - if !s.Locationnumber.IsUnset() { - vals = append(vals, "locationnumber") - } - if !s.Nextactiondatescheduled.IsUnset() { - vals = append(vals, "nextactiondatescheduled") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Symbology.IsUnset() { - vals = append(vals, "symbology") - } - if !s.Usetype.IsUnset() { - vals = append(vals, "usetype") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Jurisdiction.IsUnset() { - vals = append(vals, "jurisdiction") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSRodentlocationSetter) Overwrite(t *FSRodentlocation) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accessdesc.IsUnset() { - t.Accessdesc = s.Accessdesc.MustGetNull() - } - if !s.Active.IsUnset() { - t.Active = s.Active.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Description.IsUnset() { - t.Description = s.Description.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Habitat.IsUnset() { - t.Habitat = s.Habitat.MustGetNull() - } - if !s.Lastinspectaction.IsUnset() { - t.Lastinspectaction = s.Lastinspectaction.MustGetNull() - } - if !s.Lastinspectconditions.IsUnset() { - t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() - } - if !s.Lastinspectdate.IsUnset() { - t.Lastinspectdate = s.Lastinspectdate.MustGetNull() - } - if !s.Lastinspectrodentevidence.IsUnset() { - t.Lastinspectrodentevidence = s.Lastinspectrodentevidence.MustGetNull() - } - if !s.Lastinspectspecies.IsUnset() { - t.Lastinspectspecies = s.Lastinspectspecies.MustGetNull() - } - if !s.Locationname.IsUnset() { - t.Locationname = s.Locationname.MustGetNull() - } - if !s.Locationnumber.IsUnset() { - t.Locationnumber = s.Locationnumber.MustGetNull() - } - if !s.Nextactiondatescheduled.IsUnset() { - t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Symbology.IsUnset() { - t.Symbology = s.Symbology.MustGetNull() - } - if !s.Usetype.IsUnset() { - t.Usetype = s.Usetype.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Jurisdiction.IsUnset() { - t.Jurisdiction = s.Jurisdiction.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSRodentlocationSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSRodentlocations.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 34) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accessdesc.IsUnset() { - vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Active.IsUnset() { - vals[2] = psql.Arg(s.Active.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[3] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[4] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[5] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Description.IsUnset() { - vals[6] = psql.Arg(s.Description.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[7] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[8] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[9] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[10] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Habitat.IsUnset() { - vals[11] = psql.Arg(s.Habitat.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectaction.IsUnset() { - vals[12] = psql.Arg(s.Lastinspectaction.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectconditions.IsUnset() { - vals[13] = psql.Arg(s.Lastinspectconditions.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectdate.IsUnset() { - vals[14] = psql.Arg(s.Lastinspectdate.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectrodentevidence.IsUnset() { - vals[15] = psql.Arg(s.Lastinspectrodentevidence.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectspecies.IsUnset() { - vals[16] = psql.Arg(s.Lastinspectspecies.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Locationname.IsUnset() { - vals[17] = psql.Arg(s.Locationname.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Locationnumber.IsUnset() { - vals[18] = psql.Arg(s.Locationnumber.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Nextactiondatescheduled.IsUnset() { - vals[19] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[20] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[21] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Symbology.IsUnset() { - vals[22] = psql.Arg(s.Symbology.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Usetype.IsUnset() { - vals[23] = psql.Arg(s.Usetype.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[24] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[25] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[26] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[27] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[28] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[29] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[30] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[31] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Jurisdiction.IsUnset() { - vals[32] = psql.Arg(s.Jurisdiction.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[33] = psql.Arg(s.Updated.MustGet()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSRodentlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSRodentlocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 34) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accessdesc.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accessdesc")...), - psql.Arg(s.Accessdesc), - }}) - } - - if !s.Active.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "active")...), - psql.Arg(s.Active), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Description.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "description")...), - psql.Arg(s.Description), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitat")...), - psql.Arg(s.Habitat), - }}) - } - - if !s.Lastinspectaction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectaction")...), - psql.Arg(s.Lastinspectaction), - }}) - } - - if !s.Lastinspectconditions.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectconditions")...), - psql.Arg(s.Lastinspectconditions), - }}) - } - - if !s.Lastinspectdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectdate")...), - psql.Arg(s.Lastinspectdate), - }}) - } - - if !s.Lastinspectrodentevidence.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectrodentevidence")...), - psql.Arg(s.Lastinspectrodentevidence), - }}) - } - - if !s.Lastinspectspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectspecies")...), - psql.Arg(s.Lastinspectspecies), - }}) - } - - if !s.Locationname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationname")...), - psql.Arg(s.Locationname), - }}) - } - - if !s.Locationnumber.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationnumber")...), - psql.Arg(s.Locationnumber), - }}) - } - - if !s.Nextactiondatescheduled.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nextactiondatescheduled")...), - psql.Arg(s.Nextactiondatescheduled), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Symbology.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "symbology")...), - psql.Arg(s.Symbology), - }}) - } - - if !s.Usetype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "usetype")...), - psql.Arg(s.Usetype), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Jurisdiction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "jurisdiction")...), - psql.Arg(s.Jurisdiction), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSRodentlocation retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSRodentlocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSRodentlocation, error) { - if len(cols) == 0 { - return FSRodentlocations.Query( - sm.Where(FSRodentlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSRodentlocations.Query( - sm.Where(FSRodentlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSRodentlocations.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSRodentlocationExists checks the presence of a single record by primary key -func FSRodentlocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSRodentlocations.Query( - sm.Where(FSRodentlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSRodentlocation is retrieved from the database -func (o *FSRodentlocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSRodentlocations.AfterSelectHooks.RunHooks(ctx, exec, FSRodentlocationSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSRodentlocations.AfterInsertHooks.RunHooks(ctx, exec, FSRodentlocationSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSRodentlocations.AfterUpdateHooks.RunHooks(ctx, exec, FSRodentlocationSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSRodentlocations.AfterDeleteHooks.RunHooks(ctx, exec, FSRodentlocationSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSRodentlocation -func (o *FSRodentlocation) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSRodentlocation) pkEQ() dialect.Expression { - return psql.Quote("fs_rodentlocation", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSRodentlocation -func (o *FSRodentlocation) Update(ctx context.Context, exec bob.Executor, s *FSRodentlocationSetter) error { - v, err := FSRodentlocations.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 FSRodentlocation record with an executor -func (o *FSRodentlocation) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSRodentlocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSRodentlocation using the executor -func (o *FSRodentlocation) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSRodentlocations.Query( - sm.Where(FSRodentlocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSRodentlocationSlice is retrieved from the database -func (o FSRodentlocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSRodentlocations.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSRodentlocations.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSRodentlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSRodentlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSRodentlocationSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_rodentlocation", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSRodentlocationSlice) copyMatchingRows(from ...*FSRodentlocation) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSRodentlocationSlice) 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 FSRodentlocations.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 *FSRodentlocation: - o.copyMatchingRows(retrieved) - case []*FSRodentlocation: - o.copyMatchingRows(retrieved...) - case FSRodentlocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSRodentlocation or a slice of FSRodentlocation - // then run the AfterUpdateHooks on the slice - _, err = FSRodentlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSRodentlocationSlice) 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 FSRodentlocations.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 *FSRodentlocation: - o.copyMatchingRows(retrieved) - case []*FSRodentlocation: - o.copyMatchingRows(retrieved...) - case FSRodentlocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSRodentlocation or a slice of FSRodentlocation - // then run the AfterDeleteHooks on the slice - _, err = FSRodentlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSRodentlocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSRodentlocationSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSRodentlocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSRodentlocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSRodentlocations.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSRodentlocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSRodentlocations.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 *FSRodentlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSRodentlocationSlice) 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 attachFSRodentlocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsRodentlocation0 *FSRodentlocation, organization1 *Organization) (*FSRodentlocation, error) { - setter := &FSRodentlocationSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsRodentlocation0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSRodentlocationOrganization0: %w", err) - } - - return fsRodentlocation0, nil -} - -func (fsRodentlocation0 *FSRodentlocation) 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 = attachFSRodentlocationOrganization0(ctx, exec, 1, fsRodentlocation0, organization1) - if err != nil { - return err - } - - fsRodentlocation0.R.Organization = organization1 - - organization1.R.FSRodentlocations = append(organization1.R.FSRodentlocations, fsRodentlocation0) - - return nil -} - -func (fsRodentlocation0 *FSRodentlocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSRodentlocationOrganization0(ctx, exec, 1, fsRodentlocation0, organization1) - if err != nil { - return err - } - - fsRodentlocation0.R.Organization = organization1 - - organization1.R.FSRodentlocations = append(organization1.R.FSRodentlocations, fsRodentlocation0) - - return nil -} - -type fsRodentlocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accessdesc psql.WhereNullMod[Q, string] - Active psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Description psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Habitat psql.WhereNullMod[Q, string] - Lastinspectaction psql.WhereNullMod[Q, string] - Lastinspectconditions psql.WhereNullMod[Q, string] - Lastinspectdate psql.WhereNullMod[Q, int64] - Lastinspectrodentevidence psql.WhereNullMod[Q, string] - Lastinspectspecies psql.WhereNullMod[Q, string] - Locationname psql.WhereNullMod[Q, string] - Locationnumber psql.WhereNullMod[Q, int64] - Nextactiondatescheduled psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Priority psql.WhereNullMod[Q, string] - Symbology psql.WhereNullMod[Q, string] - Usetype psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - 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] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Jurisdiction psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsRodentlocationWhere[Q]) AliasedAs(alias string) fsRodentlocationWhere[Q] { - return buildFSRodentlocationWhere[Q](buildFSRodentlocationColumns(alias)) -} - -func buildFSRodentlocationWhere[Q psql.Filterable](cols fsRodentlocationColumns) fsRodentlocationWhere[Q] { - return fsRodentlocationWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), - Active: psql.WhereNull[Q, int16](cols.Active), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Description: psql.WhereNull[Q, string](cols.Description), - Externalid: psql.WhereNull[Q, string](cols.Externalid), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - 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), - Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), - Lastinspectrodentevidence: psql.WhereNull[Q, string](cols.Lastinspectrodentevidence), - Lastinspectspecies: psql.WhereNull[Q, string](cols.Lastinspectspecies), - Locationname: psql.WhereNull[Q, string](cols.Locationname), - Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), - Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), - Objectid: psql.Where[Q, int32](cols.Objectid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Symbology: psql.WhereNull[Q, string](cols.Symbology), - Usetype: psql.WhereNull[Q, string](cols.Usetype), - Zone: psql.WhereNull[Q, string](cols.Zone), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSRodentlocation) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsRodentlocation cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSRodentlocations = FSRodentlocationSlice{o} - } - return nil - default: - return fmt.Errorf("fsRodentlocation has no relationship %q", name) - } -} - -type fsRodentlocationPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSRodentlocationPreloader() fsRodentlocationPreloader { - return fsRodentlocationPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSRodentlocations, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsRodentlocationThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSRodentlocationThenLoader[Q orm.Loadable]() fsRodentlocationThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsRodentlocationThenLoader[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 fsRodentlocation's Organization into the .R struct -func (o *FSRodentlocation) 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.FSRodentlocations = FSRodentlocationSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsRodentlocation's Organization into the .R struct -func (os FSRodentlocationSlice) 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.FSRodentlocations = append(rel.R.FSRodentlocations, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsRodentlocationJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsRodentlocationJoins[Q]) aliasedAs(alias string) fsRodentlocationJoins[Q] { - return buildFSRodentlocationJoins[Q](buildFSRodentlocationColumns(alias), j.typ) -} - -func buildFSRodentlocationJoins[Q dialect.Joinable](cols fsRodentlocationColumns, typ string) fsRodentlocationJoins[Q] { - return fsRodentlocationJoins[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/db/models/fs_samplecollection.bob.go b/db/models/fs_samplecollection.bob.go deleted file mode 100644 index e7a5bcf8..00000000 --- a/db/models/fs_samplecollection.bob.go +++ /dev/null @@ -1,1805 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSSamplecollection is an object representing the database table. -type FSSamplecollection struct { - OrganizationID int32 `db:"organization_id" ` - Activity null.Val[string] `db:"activity" ` - Avetemp null.Val[float64] `db:"avetemp" ` - Chickenid null.Val[string] `db:"chickenid" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Datesent null.Val[int64] `db:"datesent" ` - Datetested null.Val[int64] `db:"datetested" ` - Diseasepos null.Val[string] `db:"diseasepos" ` - Diseasetested null.Val[string] `db:"diseasetested" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Flockid null.Val[string] `db:"flockid" ` - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid string `db:"globalid" ` - Lab null.Val[string] `db:"lab" ` - Locationname null.Val[string] `db:"locationname" ` - LocID null.Val[string] `db:"loc_id" ` - Objectid int32 `db:"objectid,pk" ` - Processed null.Val[int16] `db:"processed" ` - Raingauge null.Val[float64] `db:"raingauge" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Samplecond null.Val[string] `db:"samplecond" ` - Samplecount null.Val[int16] `db:"samplecount" ` - Sampleid null.Val[string] `db:"sampleid" ` - Sampletype null.Val[string] `db:"sampletype" ` - Sex null.Val[string] `db:"sex" ` - Sitecond null.Val[string] `db:"sitecond" ` - Species null.Val[string] `db:"species" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Survtech null.Val[string] `db:"survtech" ` - Testmethod null.Val[string] `db:"testmethod" ` - Testtech null.Val[string] `db:"testtech" ` - Winddir null.Val[string] `db:"winddir" ` - Windspeed null.Val[float64] `db:"windspeed" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsSamplecollectionR `db:"-" ` -} - -// FSSamplecollectionSlice is an alias for a slice of pointers to FSSamplecollection. -// This should almost always be used instead of []*FSSamplecollection. -type FSSamplecollectionSlice []*FSSamplecollection - -// FSSamplecollections contains methods to work with the fs_samplecollection table -var FSSamplecollections = psql.NewTablex[*FSSamplecollection, FSSamplecollectionSlice, *FSSamplecollectionSetter]("", "fs_samplecollection", buildFSSamplecollectionColumns("fs_samplecollection")) - -// FSSamplecollectionsQuery is a query on the fs_samplecollection table -type FSSamplecollectionsQuery = *psql.ViewQuery[*FSSamplecollection, FSSamplecollectionSlice] - -// fsSamplecollectionR is where relationships are stored. -type fsSamplecollectionR struct { - Organization *Organization // fs_samplecollection.fs_samplecollection_organization_id_fkey -} - -func buildFSSamplecollectionColumns(alias string) fsSamplecollectionColumns { - return fsSamplecollectionColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "activity", "avetemp", "chickenid", "comments", "creationdate", "creator", "datesent", "datetested", "diseasepos", "diseasetested", "enddatetime", "editdate", "editor", "fieldtech", "flockid", "gatewaysync", "globalid", "lab", "locationname", "loc_id", "objectid", "processed", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "samplecond", "samplecount", "sampleid", "sampletype", "sex", "sitecond", "species", "startdatetime", "survtech", "testmethod", "testtech", "winddir", "windspeed", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "updated", - ).WithParent("fs_samplecollection"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Activity: psql.Quote(alias, "activity"), - Avetemp: psql.Quote(alias, "avetemp"), - Chickenid: psql.Quote(alias, "chickenid"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Datesent: psql.Quote(alias, "datesent"), - Datetested: psql.Quote(alias, "datetested"), - Diseasepos: psql.Quote(alias, "diseasepos"), - Diseasetested: psql.Quote(alias, "diseasetested"), - Enddatetime: psql.Quote(alias, "enddatetime"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fieldtech: psql.Quote(alias, "fieldtech"), - Flockid: psql.Quote(alias, "flockid"), - Gatewaysync: psql.Quote(alias, "gatewaysync"), - Globalid: psql.Quote(alias, "globalid"), - Lab: psql.Quote(alias, "lab"), - Locationname: psql.Quote(alias, "locationname"), - LocID: psql.Quote(alias, "loc_id"), - Objectid: psql.Quote(alias, "objectid"), - Processed: psql.Quote(alias, "processed"), - Raingauge: psql.Quote(alias, "raingauge"), - Recordstatus: psql.Quote(alias, "recordstatus"), - Reviewed: psql.Quote(alias, "reviewed"), - Reviewedby: psql.Quote(alias, "reviewedby"), - Revieweddate: psql.Quote(alias, "revieweddate"), - Samplecond: psql.Quote(alias, "samplecond"), - Samplecount: psql.Quote(alias, "samplecount"), - Sampleid: psql.Quote(alias, "sampleid"), - Sampletype: psql.Quote(alias, "sampletype"), - Sex: psql.Quote(alias, "sex"), - Sitecond: psql.Quote(alias, "sitecond"), - Species: psql.Quote(alias, "species"), - Startdatetime: psql.Quote(alias, "startdatetime"), - Survtech: psql.Quote(alias, "survtech"), - Testmethod: psql.Quote(alias, "testmethod"), - Testtech: psql.Quote(alias, "testtech"), - Winddir: psql.Quote(alias, "winddir"), - Windspeed: psql.Quote(alias, "windspeed"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsSamplecollectionColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Activity psql.Expression - Avetemp psql.Expression - Chickenid psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Datesent psql.Expression - Datetested psql.Expression - Diseasepos psql.Expression - Diseasetested psql.Expression - Enddatetime psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fieldtech psql.Expression - Flockid psql.Expression - Gatewaysync psql.Expression - Globalid psql.Expression - Lab psql.Expression - Locationname psql.Expression - LocID psql.Expression - Objectid psql.Expression - Processed psql.Expression - Raingauge psql.Expression - Recordstatus psql.Expression - Reviewed psql.Expression - Reviewedby psql.Expression - Revieweddate psql.Expression - Samplecond psql.Expression - Samplecount psql.Expression - Sampleid psql.Expression - Sampletype psql.Expression - Sex psql.Expression - Sitecond psql.Expression - Species psql.Expression - Startdatetime psql.Expression - Survtech psql.Expression - Testmethod psql.Expression - Testtech psql.Expression - Winddir psql.Expression - Windspeed psql.Expression - Zone psql.Expression - Zone2 psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Updated psql.Expression -} - -func (c fsSamplecollectionColumns) Alias() string { - return c.tableAlias -} - -func (fsSamplecollectionColumns) AliasedAs(alias string) fsSamplecollectionColumns { - return buildFSSamplecollectionColumns(alias) -} - -// FSSamplecollectionSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSSamplecollectionSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Activity omitnull.Val[string] `db:"activity" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Chickenid omitnull.Val[string] `db:"chickenid" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Datesent omitnull.Val[int64] `db:"datesent" ` - Datetested omitnull.Val[int64] `db:"datetested" ` - Diseasepos omitnull.Val[string] `db:"diseasepos" ` - Diseasetested omitnull.Val[string] `db:"diseasetested" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Flockid omitnull.Val[string] `db:"flockid" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - 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" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Processed omitnull.Val[int16] `db:"processed" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Samplecond omitnull.Val[string] `db:"samplecond" ` - Samplecount omitnull.Val[int16] `db:"samplecount" ` - Sampleid omitnull.Val[string] `db:"sampleid" ` - Sampletype omitnull.Val[string] `db:"sampletype" ` - Sex omitnull.Val[string] `db:"sex" ` - Sitecond omitnull.Val[string] `db:"sitecond" ` - Species omitnull.Val[string] `db:"species" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Survtech omitnull.Val[string] `db:"survtech" ` - Testmethod omitnull.Val[string] `db:"testmethod" ` - Testtech omitnull.Val[string] `db:"testtech" ` - Winddir omitnull.Val[string] `db:"winddir" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSSamplecollectionSetter) SetColumns() []string { - vals := make([]string, 0, 50) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Activity.IsUnset() { - vals = append(vals, "activity") - } - if !s.Avetemp.IsUnset() { - vals = append(vals, "avetemp") - } - if !s.Chickenid.IsUnset() { - vals = append(vals, "chickenid") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Datesent.IsUnset() { - vals = append(vals, "datesent") - } - if !s.Datetested.IsUnset() { - vals = append(vals, "datetested") - } - if !s.Diseasepos.IsUnset() { - vals = append(vals, "diseasepos") - } - if !s.Diseasetested.IsUnset() { - vals = append(vals, "diseasetested") - } - if !s.Enddatetime.IsUnset() { - vals = append(vals, "enddatetime") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fieldtech.IsUnset() { - vals = append(vals, "fieldtech") - } - if !s.Flockid.IsUnset() { - vals = append(vals, "flockid") - } - if !s.Gatewaysync.IsUnset() { - vals = append(vals, "gatewaysync") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Lab.IsUnset() { - vals = append(vals, "lab") - } - if !s.Locationname.IsUnset() { - vals = append(vals, "locationname") - } - if !s.LocID.IsUnset() { - vals = append(vals, "loc_id") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Processed.IsUnset() { - vals = append(vals, "processed") - } - if !s.Raingauge.IsUnset() { - vals = append(vals, "raingauge") - } - if !s.Recordstatus.IsUnset() { - vals = append(vals, "recordstatus") - } - if !s.Reviewed.IsUnset() { - vals = append(vals, "reviewed") - } - if !s.Reviewedby.IsUnset() { - vals = append(vals, "reviewedby") - } - if !s.Revieweddate.IsUnset() { - vals = append(vals, "revieweddate") - } - if !s.Samplecond.IsUnset() { - vals = append(vals, "samplecond") - } - if !s.Samplecount.IsUnset() { - vals = append(vals, "samplecount") - } - if !s.Sampleid.IsUnset() { - vals = append(vals, "sampleid") - } - if !s.Sampletype.IsUnset() { - vals = append(vals, "sampletype") - } - if !s.Sex.IsUnset() { - vals = append(vals, "sex") - } - if !s.Sitecond.IsUnset() { - vals = append(vals, "sitecond") - } - if !s.Species.IsUnset() { - vals = append(vals, "species") - } - if !s.Startdatetime.IsUnset() { - vals = append(vals, "startdatetime") - } - if !s.Survtech.IsUnset() { - vals = append(vals, "survtech") - } - if !s.Testmethod.IsUnset() { - vals = append(vals, "testmethod") - } - if !s.Testtech.IsUnset() { - vals = append(vals, "testtech") - } - if !s.Winddir.IsUnset() { - vals = append(vals, "winddir") - } - if !s.Windspeed.IsUnset() { - vals = append(vals, "windspeed") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSSamplecollectionSetter) Overwrite(t *FSSamplecollection) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Activity.IsUnset() { - t.Activity = s.Activity.MustGetNull() - } - if !s.Avetemp.IsUnset() { - t.Avetemp = s.Avetemp.MustGetNull() - } - if !s.Chickenid.IsUnset() { - t.Chickenid = s.Chickenid.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Datesent.IsUnset() { - t.Datesent = s.Datesent.MustGetNull() - } - if !s.Datetested.IsUnset() { - t.Datetested = s.Datetested.MustGetNull() - } - if !s.Diseasepos.IsUnset() { - t.Diseasepos = s.Diseasepos.MustGetNull() - } - if !s.Diseasetested.IsUnset() { - t.Diseasetested = s.Diseasetested.MustGetNull() - } - if !s.Enddatetime.IsUnset() { - t.Enddatetime = s.Enddatetime.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fieldtech.IsUnset() { - t.Fieldtech = s.Fieldtech.MustGetNull() - } - if !s.Flockid.IsUnset() { - t.Flockid = s.Flockid.MustGetNull() - } - if !s.Gatewaysync.IsUnset() { - t.Gatewaysync = s.Gatewaysync.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Lab.IsUnset() { - t.Lab = s.Lab.MustGetNull() - } - if !s.Locationname.IsUnset() { - t.Locationname = s.Locationname.MustGetNull() - } - if !s.LocID.IsUnset() { - t.LocID = s.LocID.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Processed.IsUnset() { - t.Processed = s.Processed.MustGetNull() - } - if !s.Raingauge.IsUnset() { - t.Raingauge = s.Raingauge.MustGetNull() - } - if !s.Recordstatus.IsUnset() { - t.Recordstatus = s.Recordstatus.MustGetNull() - } - if !s.Reviewed.IsUnset() { - t.Reviewed = s.Reviewed.MustGetNull() - } - if !s.Reviewedby.IsUnset() { - t.Reviewedby = s.Reviewedby.MustGetNull() - } - if !s.Revieweddate.IsUnset() { - t.Revieweddate = s.Revieweddate.MustGetNull() - } - if !s.Samplecond.IsUnset() { - t.Samplecond = s.Samplecond.MustGetNull() - } - if !s.Samplecount.IsUnset() { - t.Samplecount = s.Samplecount.MustGetNull() - } - if !s.Sampleid.IsUnset() { - t.Sampleid = s.Sampleid.MustGetNull() - } - if !s.Sampletype.IsUnset() { - t.Sampletype = s.Sampletype.MustGetNull() - } - if !s.Sex.IsUnset() { - t.Sex = s.Sex.MustGetNull() - } - if !s.Sitecond.IsUnset() { - t.Sitecond = s.Sitecond.MustGetNull() - } - if !s.Species.IsUnset() { - t.Species = s.Species.MustGetNull() - } - if !s.Startdatetime.IsUnset() { - t.Startdatetime = s.Startdatetime.MustGetNull() - } - if !s.Survtech.IsUnset() { - t.Survtech = s.Survtech.MustGetNull() - } - if !s.Testmethod.IsUnset() { - t.Testmethod = s.Testmethod.MustGetNull() - } - if !s.Testtech.IsUnset() { - t.Testtech = s.Testtech.MustGetNull() - } - if !s.Winddir.IsUnset() { - t.Winddir = s.Winddir.MustGetNull() - } - if !s.Windspeed.IsUnset() { - t.Windspeed = s.Windspeed.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSSamplecollectionSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSSamplecollections.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 50) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Activity.IsUnset() { - vals[1] = psql.Arg(s.Activity.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Avetemp.IsUnset() { - vals[2] = psql.Arg(s.Avetemp.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Chickenid.IsUnset() { - vals[3] = psql.Arg(s.Chickenid.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[4] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[5] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[6] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Datesent.IsUnset() { - vals[7] = psql.Arg(s.Datesent.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Datetested.IsUnset() { - vals[8] = psql.Arg(s.Datetested.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Diseasepos.IsUnset() { - vals[9] = psql.Arg(s.Diseasepos.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Diseasetested.IsUnset() { - vals[10] = psql.Arg(s.Diseasetested.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Enddatetime.IsUnset() { - vals[11] = psql.Arg(s.Enddatetime.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[12] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[13] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Fieldtech.IsUnset() { - vals[14] = psql.Arg(s.Fieldtech.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Flockid.IsUnset() { - vals[15] = psql.Arg(s.Flockid.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Gatewaysync.IsUnset() { - vals[16] = psql.Arg(s.Gatewaysync.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[17] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Lab.IsUnset() { - vals[18] = psql.Arg(s.Lab.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Locationname.IsUnset() { - vals[19] = psql.Arg(s.Locationname.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.LocID.IsUnset() { - vals[20] = psql.Arg(s.LocID.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[21] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Processed.IsUnset() { - vals[22] = psql.Arg(s.Processed.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Raingauge.IsUnset() { - vals[23] = psql.Arg(s.Raingauge.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Recordstatus.IsUnset() { - vals[24] = psql.Arg(s.Recordstatus.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Reviewed.IsUnset() { - vals[25] = psql.Arg(s.Reviewed.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Reviewedby.IsUnset() { - vals[26] = psql.Arg(s.Reviewedby.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Revieweddate.IsUnset() { - vals[27] = psql.Arg(s.Revieweddate.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Samplecond.IsUnset() { - vals[28] = psql.Arg(s.Samplecond.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Samplecount.IsUnset() { - vals[29] = psql.Arg(s.Samplecount.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Sampleid.IsUnset() { - vals[30] = psql.Arg(s.Sampleid.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Sampletype.IsUnset() { - vals[31] = psql.Arg(s.Sampletype.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Sex.IsUnset() { - vals[32] = psql.Arg(s.Sex.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Sitecond.IsUnset() { - vals[33] = psql.Arg(s.Sitecond.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Species.IsUnset() { - vals[34] = psql.Arg(s.Species.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Startdatetime.IsUnset() { - vals[35] = psql.Arg(s.Startdatetime.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Survtech.IsUnset() { - vals[36] = psql.Arg(s.Survtech.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.Testmethod.IsUnset() { - vals[37] = psql.Arg(s.Testmethod.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.Testtech.IsUnset() { - vals[38] = psql.Arg(s.Testtech.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Winddir.IsUnset() { - vals[39] = psql.Arg(s.Winddir.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Windspeed.IsUnset() { - vals[40] = psql.Arg(s.Windspeed.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[41] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[42] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[43] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[44] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[45] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[46] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[47] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[47] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[48] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[48] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[49] = psql.Arg(s.Updated.MustGet()) - } else { - vals[49] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSSamplecollectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSSamplecollectionSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 50) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Activity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "activity")...), - psql.Arg(s.Activity), - }}) - } - - if !s.Avetemp.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "avetemp")...), - psql.Arg(s.Avetemp), - }}) - } - - if !s.Chickenid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "chickenid")...), - psql.Arg(s.Chickenid), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Datesent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "datesent")...), - psql.Arg(s.Datesent), - }}) - } - - if !s.Datetested.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "datetested")...), - psql.Arg(s.Datetested), - }}) - } - - if !s.Diseasepos.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "diseasepos")...), - psql.Arg(s.Diseasepos), - }}) - } - - if !s.Diseasetested.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "diseasetested")...), - psql.Arg(s.Diseasetested), - }}) - } - - if !s.Enddatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "enddatetime")...), - psql.Arg(s.Enddatetime), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fieldtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldtech")...), - psql.Arg(s.Fieldtech), - }}) - } - - if !s.Flockid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "flockid")...), - psql.Arg(s.Flockid), - }}) - } - - if !s.Gatewaysync.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "gatewaysync")...), - psql.Arg(s.Gatewaysync), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Lab.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lab")...), - psql.Arg(s.Lab), - }}) - } - - if !s.Locationname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationname")...), - psql.Arg(s.Locationname), - }}) - } - - if !s.LocID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "loc_id")...), - psql.Arg(s.LocID), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Processed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "processed")...), - psql.Arg(s.Processed), - }}) - } - - if !s.Raingauge.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "raingauge")...), - psql.Arg(s.Raingauge), - }}) - } - - if !s.Recordstatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "recordstatus")...), - psql.Arg(s.Recordstatus), - }}) - } - - if !s.Reviewed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewed")...), - psql.Arg(s.Reviewed), - }}) - } - - if !s.Reviewedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewedby")...), - psql.Arg(s.Reviewedby), - }}) - } - - if !s.Revieweddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "revieweddate")...), - psql.Arg(s.Revieweddate), - }}) - } - - if !s.Samplecond.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "samplecond")...), - psql.Arg(s.Samplecond), - }}) - } - - if !s.Samplecount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "samplecount")...), - psql.Arg(s.Samplecount), - }}) - } - - if !s.Sampleid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sampleid")...), - psql.Arg(s.Sampleid), - }}) - } - - if !s.Sampletype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sampletype")...), - psql.Arg(s.Sampletype), - }}) - } - - if !s.Sex.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sex")...), - psql.Arg(s.Sex), - }}) - } - - if !s.Sitecond.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sitecond")...), - psql.Arg(s.Sitecond), - }}) - } - - if !s.Species.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "species")...), - psql.Arg(s.Species), - }}) - } - - if !s.Startdatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "startdatetime")...), - psql.Arg(s.Startdatetime), - }}) - } - - if !s.Survtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "survtech")...), - psql.Arg(s.Survtech), - }}) - } - - if !s.Testmethod.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "testmethod")...), - psql.Arg(s.Testmethod), - }}) - } - - if !s.Testtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "testtech")...), - psql.Arg(s.Testtech), - }}) - } - - if !s.Winddir.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "winddir")...), - psql.Arg(s.Winddir), - }}) - } - - if !s.Windspeed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "windspeed")...), - psql.Arg(s.Windspeed), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSSamplecollection retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSSamplecollection(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSSamplecollection, error) { - if len(cols) == 0 { - return FSSamplecollections.Query( - sm.Where(FSSamplecollections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSSamplecollections.Query( - sm.Where(FSSamplecollections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSSamplecollections.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSSamplecollectionExists checks the presence of a single record by primary key -func FSSamplecollectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSSamplecollections.Query( - sm.Where(FSSamplecollections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSSamplecollection is retrieved from the database -func (o *FSSamplecollection) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSSamplecollections.AfterSelectHooks.RunHooks(ctx, exec, FSSamplecollectionSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSSamplecollections.AfterInsertHooks.RunHooks(ctx, exec, FSSamplecollectionSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSSamplecollections.AfterUpdateHooks.RunHooks(ctx, exec, FSSamplecollectionSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSSamplecollections.AfterDeleteHooks.RunHooks(ctx, exec, FSSamplecollectionSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSSamplecollection -func (o *FSSamplecollection) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSSamplecollection) pkEQ() dialect.Expression { - return psql.Quote("fs_samplecollection", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSSamplecollection -func (o *FSSamplecollection) Update(ctx context.Context, exec bob.Executor, s *FSSamplecollectionSetter) error { - v, err := FSSamplecollections.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 FSSamplecollection record with an executor -func (o *FSSamplecollection) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSSamplecollections.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSSamplecollection using the executor -func (o *FSSamplecollection) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSSamplecollections.Query( - sm.Where(FSSamplecollections.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSSamplecollectionSlice is retrieved from the database -func (o FSSamplecollectionSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSSamplecollections.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSSamplecollections.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSSamplecollections.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSSamplecollections.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSSamplecollectionSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_samplecollection", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSSamplecollectionSlice) copyMatchingRows(from ...*FSSamplecollection) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSSamplecollectionSlice) 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 FSSamplecollections.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 *FSSamplecollection: - o.copyMatchingRows(retrieved) - case []*FSSamplecollection: - o.copyMatchingRows(retrieved...) - case FSSamplecollectionSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSSamplecollection or a slice of FSSamplecollection - // then run the AfterUpdateHooks on the slice - _, err = FSSamplecollections.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSSamplecollectionSlice) 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 FSSamplecollections.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 *FSSamplecollection: - o.copyMatchingRows(retrieved) - case []*FSSamplecollection: - o.copyMatchingRows(retrieved...) - case FSSamplecollectionSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSSamplecollection or a slice of FSSamplecollection - // then run the AfterDeleteHooks on the slice - _, err = FSSamplecollections.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSSamplecollectionSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSSamplecollectionSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSSamplecollections.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSSamplecollectionSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSSamplecollections.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSSamplecollectionSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSSamplecollections.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 *FSSamplecollection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSSamplecollectionSlice) 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 attachFSSamplecollectionOrganization0(ctx context.Context, exec bob.Executor, count int, fsSamplecollection0 *FSSamplecollection, organization1 *Organization) (*FSSamplecollection, error) { - setter := &FSSamplecollectionSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsSamplecollection0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSSamplecollectionOrganization0: %w", err) - } - - return fsSamplecollection0, nil -} - -func (fsSamplecollection0 *FSSamplecollection) 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 = attachFSSamplecollectionOrganization0(ctx, exec, 1, fsSamplecollection0, organization1) - if err != nil { - return err - } - - fsSamplecollection0.R.Organization = organization1 - - organization1.R.FSSamplecollections = append(organization1.R.FSSamplecollections, fsSamplecollection0) - - return nil -} - -func (fsSamplecollection0 *FSSamplecollection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSSamplecollectionOrganization0(ctx, exec, 1, fsSamplecollection0, organization1) - if err != nil { - return err - } - - fsSamplecollection0.R.Organization = organization1 - - organization1.R.FSSamplecollections = append(organization1.R.FSSamplecollections, fsSamplecollection0) - - return nil -} - -type fsSamplecollectionWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Activity psql.WhereNullMod[Q, string] - Avetemp psql.WhereNullMod[Q, float64] - Chickenid psql.WhereNullMod[Q, string] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Datesent psql.WhereNullMod[Q, int64] - Datetested psql.WhereNullMod[Q, int64] - Diseasepos psql.WhereNullMod[Q, string] - Diseasetested psql.WhereNullMod[Q, string] - Enddatetime psql.WhereNullMod[Q, int64] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fieldtech psql.WhereNullMod[Q, string] - Flockid psql.WhereNullMod[Q, string] - Gatewaysync psql.WhereNullMod[Q, int16] - Globalid psql.WhereMod[Q, string] - Lab psql.WhereNullMod[Q, string] - Locationname psql.WhereNullMod[Q, string] - LocID psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Processed psql.WhereNullMod[Q, int16] - Raingauge psql.WhereNullMod[Q, float64] - Recordstatus psql.WhereNullMod[Q, int16] - Reviewed psql.WhereNullMod[Q, int16] - Reviewedby psql.WhereNullMod[Q, string] - Revieweddate psql.WhereNullMod[Q, int64] - Samplecond psql.WhereNullMod[Q, string] - Samplecount psql.WhereNullMod[Q, int16] - Sampleid psql.WhereNullMod[Q, string] - Sampletype psql.WhereNullMod[Q, string] - Sex psql.WhereNullMod[Q, string] - Sitecond psql.WhereNullMod[Q, string] - Species psql.WhereNullMod[Q, string] - Startdatetime psql.WhereNullMod[Q, int64] - Survtech psql.WhereNullMod[Q, string] - Testmethod psql.WhereNullMod[Q, string] - Testtech psql.WhereNullMod[Q, string] - Winddir psql.WhereNullMod[Q, string] - Windspeed psql.WhereNullMod[Q, float64] - Zone psql.WhereNullMod[Q, string] - 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] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsSamplecollectionWhere[Q]) AliasedAs(alias string) fsSamplecollectionWhere[Q] { - return buildFSSamplecollectionWhere[Q](buildFSSamplecollectionColumns(alias)) -} - -func buildFSSamplecollectionWhere[Q psql.Filterable](cols fsSamplecollectionColumns) fsSamplecollectionWhere[Q] { - return fsSamplecollectionWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Activity: psql.WhereNull[Q, string](cols.Activity), - Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), - Chickenid: psql.WhereNull[Q, string](cols.Chickenid), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Datesent: psql.WhereNull[Q, int64](cols.Datesent), - Datetested: psql.WhereNull[Q, int64](cols.Datetested), - Diseasepos: psql.WhereNull[Q, string](cols.Diseasepos), - Diseasetested: psql.WhereNull[Q, string](cols.Diseasetested), - Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), - Flockid: psql.WhereNull[Q, string](cols.Flockid), - Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), - 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), - Objectid: psql.Where[Q, int32](cols.Objectid), - Processed: psql.WhereNull[Q, int16](cols.Processed), - Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), - Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), - Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), - Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), - Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), - Samplecond: psql.WhereNull[Q, string](cols.Samplecond), - Samplecount: psql.WhereNull[Q, int16](cols.Samplecount), - Sampleid: psql.WhereNull[Q, string](cols.Sampleid), - Sampletype: psql.WhereNull[Q, string](cols.Sampletype), - Sex: psql.WhereNull[Q, string](cols.Sex), - Sitecond: psql.WhereNull[Q, string](cols.Sitecond), - Species: psql.WhereNull[Q, string](cols.Species), - Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), - Survtech: psql.WhereNull[Q, string](cols.Survtech), - Testmethod: psql.WhereNull[Q, string](cols.Testmethod), - Testtech: psql.WhereNull[Q, string](cols.Testtech), - Winddir: psql.WhereNull[Q, string](cols.Winddir), - Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), - Zone: psql.WhereNull[Q, string](cols.Zone), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSSamplecollection) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsSamplecollection cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSSamplecollections = FSSamplecollectionSlice{o} - } - return nil - default: - return fmt.Errorf("fsSamplecollection has no relationship %q", name) - } -} - -type fsSamplecollectionPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSSamplecollectionPreloader() fsSamplecollectionPreloader { - return fsSamplecollectionPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSSamplecollections, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsSamplecollectionThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSSamplecollectionThenLoader[Q orm.Loadable]() fsSamplecollectionThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsSamplecollectionThenLoader[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 fsSamplecollection's Organization into the .R struct -func (o *FSSamplecollection) 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.FSSamplecollections = FSSamplecollectionSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsSamplecollection's Organization into the .R struct -func (os FSSamplecollectionSlice) 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.FSSamplecollections = append(rel.R.FSSamplecollections, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsSamplecollectionJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsSamplecollectionJoins[Q]) aliasedAs(alias string) fsSamplecollectionJoins[Q] { - return buildFSSamplecollectionJoins[Q](buildFSSamplecollectionColumns(alias), j.typ) -} - -func buildFSSamplecollectionJoins[Q dialect.Joinable](cols fsSamplecollectionColumns, typ string) fsSamplecollectionJoins[Q] { - return fsSamplecollectionJoins[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/db/models/fs_samplelocation.bob.go b/db/models/fs_samplelocation.bob.go deleted file mode 100644 index ab6d7acc..00000000 --- a/db/models/fs_samplelocation.bob.go +++ /dev/null @@ -1,1255 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSSamplelocation is an object representing the database table. -type FSSamplelocation struct { - OrganizationID int32 `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid string `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Name null.Val[string] `db:"name" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Usetype null.Val[string] `db:"usetype" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsSamplelocationR `db:"-" ` -} - -// FSSamplelocationSlice is an alias for a slice of pointers to FSSamplelocation. -// This should almost always be used instead of []*FSSamplelocation. -type FSSamplelocationSlice []*FSSamplelocation - -// FSSamplelocations contains methods to work with the fs_samplelocation table -var FSSamplelocations = psql.NewTablex[*FSSamplelocation, FSSamplelocationSlice, *FSSamplelocationSetter]("", "fs_samplelocation", buildFSSamplelocationColumns("fs_samplelocation")) - -// FSSamplelocationsQuery is a query on the fs_samplelocation table -type FSSamplelocationsQuery = *psql.ViewQuery[*FSSamplelocation, FSSamplelocationSlice] - -// fsSamplelocationR is where relationships are stored. -type fsSamplelocationR struct { - Organization *Organization // fs_samplelocation.fs_samplelocation_organization_id_fkey -} - -func buildFSSamplelocationColumns(alias string) fsSamplelocationColumns { - return fsSamplelocationColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "gatewaysync", "globalid", "habitat", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "usetype", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "updated", - ).WithParent("fs_samplelocation"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accessdesc: psql.Quote(alias, "accessdesc"), - Active: psql.Quote(alias, "active"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Description: psql.Quote(alias, "description"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Gatewaysync: psql.Quote(alias, "gatewaysync"), - Globalid: psql.Quote(alias, "globalid"), - Habitat: psql.Quote(alias, "habitat"), - Locationnumber: psql.Quote(alias, "locationnumber"), - Name: psql.Quote(alias, "name"), - Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), - Objectid: psql.Quote(alias, "objectid"), - Priority: psql.Quote(alias, "priority"), - Usetype: psql.Quote(alias, "usetype"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsSamplelocationColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accessdesc psql.Expression - Active psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Description psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Gatewaysync psql.Expression - Globalid psql.Expression - Habitat psql.Expression - Locationnumber psql.Expression - Name psql.Expression - Nextactiondatescheduled psql.Expression - Objectid psql.Expression - Priority psql.Expression - Usetype psql.Expression - Zone psql.Expression - Zone2 psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Updated psql.Expression -} - -func (c fsSamplelocationColumns) Alias() string { - return c.tableAlias -} - -func (fsSamplelocationColumns) AliasedAs(alias string) fsSamplelocationColumns { - return buildFSSamplelocationColumns(alias) -} - -// FSSamplelocationSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSSamplelocationSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omit.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Name omitnull.Val[string] `db:"name" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Usetype omitnull.Val[string] `db:"usetype" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSSamplelocationSetter) SetColumns() []string { - vals := make([]string, 0, 28) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accessdesc.IsUnset() { - vals = append(vals, "accessdesc") - } - if !s.Active.IsUnset() { - vals = append(vals, "active") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Description.IsUnset() { - vals = append(vals, "description") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Gatewaysync.IsUnset() { - vals = append(vals, "gatewaysync") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Habitat.IsUnset() { - vals = append(vals, "habitat") - } - if !s.Locationnumber.IsUnset() { - vals = append(vals, "locationnumber") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if !s.Nextactiondatescheduled.IsUnset() { - vals = append(vals, "nextactiondatescheduled") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Usetype.IsUnset() { - vals = append(vals, "usetype") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSSamplelocationSetter) Overwrite(t *FSSamplelocation) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accessdesc.IsUnset() { - t.Accessdesc = s.Accessdesc.MustGetNull() - } - if !s.Active.IsUnset() { - t.Active = s.Active.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Description.IsUnset() { - t.Description = s.Description.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Gatewaysync.IsUnset() { - t.Gatewaysync = s.Gatewaysync.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Habitat.IsUnset() { - t.Habitat = s.Habitat.MustGetNull() - } - if !s.Locationnumber.IsUnset() { - t.Locationnumber = s.Locationnumber.MustGetNull() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if !s.Nextactiondatescheduled.IsUnset() { - t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Usetype.IsUnset() { - t.Usetype = s.Usetype.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSSamplelocationSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSSamplelocations.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 28) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accessdesc.IsUnset() { - vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Active.IsUnset() { - vals[2] = psql.Arg(s.Active.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[3] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[4] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[5] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Description.IsUnset() { - vals[6] = psql.Arg(s.Description.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[7] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[8] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[9] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Gatewaysync.IsUnset() { - vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[11] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Habitat.IsUnset() { - vals[12] = psql.Arg(s.Habitat.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Locationnumber.IsUnset() { - vals[13] = psql.Arg(s.Locationnumber.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[14] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Nextactiondatescheduled.IsUnset() { - vals[15] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[16] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[17] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Usetype.IsUnset() { - vals[18] = psql.Arg(s.Usetype.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[19] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[20] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[21] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[22] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[23] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[24] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[25] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[26] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[27] = psql.Arg(s.Updated.MustGet()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSSamplelocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSSamplelocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 28) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accessdesc.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accessdesc")...), - psql.Arg(s.Accessdesc), - }}) - } - - if !s.Active.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "active")...), - psql.Arg(s.Active), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Description.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "description")...), - psql.Arg(s.Description), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Gatewaysync.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "gatewaysync")...), - psql.Arg(s.Gatewaysync), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitat")...), - psql.Arg(s.Habitat), - }}) - } - - if !s.Locationnumber.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationnumber")...), - psql.Arg(s.Locationnumber), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if !s.Nextactiondatescheduled.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nextactiondatescheduled")...), - psql.Arg(s.Nextactiondatescheduled), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Usetype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "usetype")...), - psql.Arg(s.Usetype), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSSamplelocation retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSSamplelocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSSamplelocation, error) { - if len(cols) == 0 { - return FSSamplelocations.Query( - sm.Where(FSSamplelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSSamplelocations.Query( - sm.Where(FSSamplelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSSamplelocations.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSSamplelocationExists checks the presence of a single record by primary key -func FSSamplelocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSSamplelocations.Query( - sm.Where(FSSamplelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSSamplelocation is retrieved from the database -func (o *FSSamplelocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSSamplelocations.AfterSelectHooks.RunHooks(ctx, exec, FSSamplelocationSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSSamplelocations.AfterInsertHooks.RunHooks(ctx, exec, FSSamplelocationSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSSamplelocations.AfterUpdateHooks.RunHooks(ctx, exec, FSSamplelocationSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSSamplelocations.AfterDeleteHooks.RunHooks(ctx, exec, FSSamplelocationSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSSamplelocation -func (o *FSSamplelocation) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSSamplelocation) pkEQ() dialect.Expression { - return psql.Quote("fs_samplelocation", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSSamplelocation -func (o *FSSamplelocation) Update(ctx context.Context, exec bob.Executor, s *FSSamplelocationSetter) error { - v, err := FSSamplelocations.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 FSSamplelocation record with an executor -func (o *FSSamplelocation) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSSamplelocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSSamplelocation using the executor -func (o *FSSamplelocation) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSSamplelocations.Query( - sm.Where(FSSamplelocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSSamplelocationSlice is retrieved from the database -func (o FSSamplelocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSSamplelocations.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSSamplelocations.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSSamplelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSSamplelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSSamplelocationSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_samplelocation", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSSamplelocationSlice) copyMatchingRows(from ...*FSSamplelocation) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSSamplelocationSlice) 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 FSSamplelocations.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 *FSSamplelocation: - o.copyMatchingRows(retrieved) - case []*FSSamplelocation: - o.copyMatchingRows(retrieved...) - case FSSamplelocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSSamplelocation or a slice of FSSamplelocation - // then run the AfterUpdateHooks on the slice - _, err = FSSamplelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSSamplelocationSlice) 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 FSSamplelocations.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 *FSSamplelocation: - o.copyMatchingRows(retrieved) - case []*FSSamplelocation: - o.copyMatchingRows(retrieved...) - case FSSamplelocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSSamplelocation or a slice of FSSamplelocation - // then run the AfterDeleteHooks on the slice - _, err = FSSamplelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSSamplelocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSSamplelocationSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSSamplelocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSSamplelocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSSamplelocations.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSSamplelocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSSamplelocations.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 *FSSamplelocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSSamplelocationSlice) 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 attachFSSamplelocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsSamplelocation0 *FSSamplelocation, organization1 *Organization) (*FSSamplelocation, error) { - setter := &FSSamplelocationSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsSamplelocation0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSSamplelocationOrganization0: %w", err) - } - - return fsSamplelocation0, nil -} - -func (fsSamplelocation0 *FSSamplelocation) 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 = attachFSSamplelocationOrganization0(ctx, exec, 1, fsSamplelocation0, organization1) - if err != nil { - return err - } - - fsSamplelocation0.R.Organization = organization1 - - organization1.R.FSSamplelocations = append(organization1.R.FSSamplelocations, fsSamplelocation0) - - return nil -} - -func (fsSamplelocation0 *FSSamplelocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSSamplelocationOrganization0(ctx, exec, 1, fsSamplelocation0, organization1) - if err != nil { - return err - } - - fsSamplelocation0.R.Organization = organization1 - - organization1.R.FSSamplelocations = append(organization1.R.FSSamplelocations, fsSamplelocation0) - - return nil -} - -type fsSamplelocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accessdesc psql.WhereNullMod[Q, string] - Active psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Description psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Gatewaysync psql.WhereNullMod[Q, int16] - Globalid psql.WhereMod[Q, string] - Habitat psql.WhereNullMod[Q, string] - Locationnumber psql.WhereNullMod[Q, int64] - Name psql.WhereNullMod[Q, string] - Nextactiondatescheduled psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Priority psql.WhereNullMod[Q, string] - Usetype psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - 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] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsSamplelocationWhere[Q]) AliasedAs(alias string) fsSamplelocationWhere[Q] { - return buildFSSamplelocationWhere[Q](buildFSSamplelocationColumns(alias)) -} - -func buildFSSamplelocationWhere[Q psql.Filterable](cols fsSamplelocationColumns) fsSamplelocationWhere[Q] { - return fsSamplelocationWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), - Active: psql.WhereNull[Q, int16](cols.Active), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Description: psql.WhereNull[Q, string](cols.Description), - Externalid: psql.WhereNull[Q, string](cols.Externalid), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), - 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), - Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), - Objectid: psql.Where[Q, int32](cols.Objectid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Usetype: psql.WhereNull[Q, string](cols.Usetype), - Zone: psql.WhereNull[Q, string](cols.Zone), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSSamplelocation) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsSamplelocation cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSSamplelocations = FSSamplelocationSlice{o} - } - return nil - default: - return fmt.Errorf("fsSamplelocation has no relationship %q", name) - } -} - -type fsSamplelocationPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSSamplelocationPreloader() fsSamplelocationPreloader { - return fsSamplelocationPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSSamplelocations, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsSamplelocationThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSSamplelocationThenLoader[Q orm.Loadable]() fsSamplelocationThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsSamplelocationThenLoader[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 fsSamplelocation's Organization into the .R struct -func (o *FSSamplelocation) 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.FSSamplelocations = FSSamplelocationSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsSamplelocation's Organization into the .R struct -func (os FSSamplelocationSlice) 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.FSSamplelocations = append(rel.R.FSSamplelocations, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsSamplelocationJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsSamplelocationJoins[Q]) aliasedAs(alias string) fsSamplelocationJoins[Q] { - return buildFSSamplelocationJoins[Q](buildFSSamplelocationColumns(alias), j.typ) -} - -func buildFSSamplelocationJoins[Q dialect.Joinable](cols fsSamplelocationColumns, typ string) fsSamplelocationJoins[Q] { - return fsSamplelocationJoins[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/db/models/fs_servicerequest.bob.go b/db/models/fs_servicerequest.bob.go deleted file mode 100644 index 95ae51cf..00000000 --- a/db/models/fs_servicerequest.bob.go +++ /dev/null @@ -1,2805 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// 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 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:"-" ` -} - -// FSServicerequestSlice is an alias for a slice of pointers to FSServicerequest. -// This should almost always be used instead of []*FSServicerequest. -type FSServicerequestSlice []*FSServicerequest - -// FSServicerequests contains methods to work with the fs_servicerequest table -var FSServicerequests = psql.NewTablex[*FSServicerequest, FSServicerequestSlice, *FSServicerequestSetter]("", "fs_servicerequest", buildFSServicerequestColumns("fs_servicerequest")) - -// FSServicerequestsQuery is a query on the fs_servicerequest table -type FSServicerequestsQuery = *psql.ViewQuery[*FSServicerequest, FSServicerequestSlice] - -// fsServicerequestR is where relationships are stored. -type fsServicerequestR struct { - Organization *Organization // fs_servicerequest.fs_servicerequest_organization_id_fkey -} - -func buildFSServicerequestColumns(alias string) fsServicerequestColumns { - return fsServicerequestColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accepted", "acceptedby", "accepteddate", "allowed", "assignedtech", "clraddr1", "clraddr2", "clranon", "clrcity", "clrcompany", "clrcontpref", "clremail", "clrfname", "clrother", "clrphone1", "clrphone2", "clrstate", "clrzip", "comments", "creationdate", "creator", "datetimeclosed", "duedate", "entrytech", "estcompletedate", "externalerror", "externalid", "editdate", "editor", "firstresponsedate", "globalid", "issuesreported", "jurisdiction", "nextaction", "notificationtimestamp", "notified", "notifieddate", "objectid", "pointlocid", "priority", "recdatetime", "recordstatus", "rejectedby", "rejecteddate", "rejectedreason", "reqaddr1", "reqaddr2", "reqcity", "reqcompany", "reqcrossst", "reqdescr", "reqfldnotes", "reqmapgrid", "reqnotesforcust", "reqnotesfortech", "reqpermission", "reqprogramactions", "reqstate", "reqsubdiv", "reqtarget", "reqzip", "responsedaycount", "reviewed", "reviewedby", "revieweddate", "scheduled", "scheduleddate", "source", "sr_number", "status", "supervisor", "techclosed", "validx", "validy", "xvalue", "yvalue", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "dog", "spanish", "schedule_notes", "schedule_period", "updated", - ).WithParent("fs_servicerequest"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accepted: psql.Quote(alias, "accepted"), - Acceptedby: psql.Quote(alias, "acceptedby"), - Accepteddate: psql.Quote(alias, "accepteddate"), - Allowed: psql.Quote(alias, "allowed"), - Assignedtech: psql.Quote(alias, "assignedtech"), - Clraddr1: psql.Quote(alias, "clraddr1"), - Clraddr2: psql.Quote(alias, "clraddr2"), - Clranon: psql.Quote(alias, "clranon"), - Clrcity: psql.Quote(alias, "clrcity"), - Clrcompany: psql.Quote(alias, "clrcompany"), - Clrcontpref: psql.Quote(alias, "clrcontpref"), - Clremail: psql.Quote(alias, "clremail"), - Clrfname: psql.Quote(alias, "clrfname"), - Clrother: psql.Quote(alias, "clrother"), - Clrphone1: psql.Quote(alias, "clrphone1"), - Clrphone2: psql.Quote(alias, "clrphone2"), - Clrstate: psql.Quote(alias, "clrstate"), - Clrzip: psql.Quote(alias, "clrzip"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Datetimeclosed: psql.Quote(alias, "datetimeclosed"), - Duedate: psql.Quote(alias, "duedate"), - Entrytech: psql.Quote(alias, "entrytech"), - Estcompletedate: psql.Quote(alias, "estcompletedate"), - Externalerror: psql.Quote(alias, "externalerror"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Firstresponsedate: psql.Quote(alias, "firstresponsedate"), - Globalid: psql.Quote(alias, "globalid"), - Issuesreported: psql.Quote(alias, "issuesreported"), - Jurisdiction: psql.Quote(alias, "jurisdiction"), - Nextaction: psql.Quote(alias, "nextaction"), - Notificationtimestamp: psql.Quote(alias, "notificationtimestamp"), - Notified: psql.Quote(alias, "notified"), - Notifieddate: psql.Quote(alias, "notifieddate"), - Objectid: psql.Quote(alias, "objectid"), - Pointlocid: psql.Quote(alias, "pointlocid"), - Priority: psql.Quote(alias, "priority"), - Recdatetime: psql.Quote(alias, "recdatetime"), - Recordstatus: psql.Quote(alias, "recordstatus"), - Rejectedby: psql.Quote(alias, "rejectedby"), - Rejecteddate: psql.Quote(alias, "rejecteddate"), - Rejectedreason: psql.Quote(alias, "rejectedreason"), - Reqaddr1: psql.Quote(alias, "reqaddr1"), - Reqaddr2: psql.Quote(alias, "reqaddr2"), - Reqcity: psql.Quote(alias, "reqcity"), - Reqcompany: psql.Quote(alias, "reqcompany"), - Reqcrossst: psql.Quote(alias, "reqcrossst"), - Reqdescr: psql.Quote(alias, "reqdescr"), - Reqfldnotes: psql.Quote(alias, "reqfldnotes"), - Reqmapgrid: psql.Quote(alias, "reqmapgrid"), - Reqnotesforcust: psql.Quote(alias, "reqnotesforcust"), - Reqnotesfortech: psql.Quote(alias, "reqnotesfortech"), - Reqpermission: psql.Quote(alias, "reqpermission"), - Reqprogramactions: psql.Quote(alias, "reqprogramactions"), - Reqstate: psql.Quote(alias, "reqstate"), - Reqsubdiv: psql.Quote(alias, "reqsubdiv"), - Reqtarget: psql.Quote(alias, "reqtarget"), - Reqzip: psql.Quote(alias, "reqzip"), - Responsedaycount: psql.Quote(alias, "responsedaycount"), - Reviewed: psql.Quote(alias, "reviewed"), - Reviewedby: psql.Quote(alias, "reviewedby"), - Revieweddate: psql.Quote(alias, "revieweddate"), - Scheduled: psql.Quote(alias, "scheduled"), - Scheduleddate: psql.Quote(alias, "scheduleddate"), - Source: psql.Quote(alias, "source"), - SRNumber: psql.Quote(alias, "sr_number"), - Status: psql.Quote(alias, "status"), - Supervisor: psql.Quote(alias, "supervisor"), - Techclosed: psql.Quote(alias, "techclosed"), - Validx: psql.Quote(alias, "validx"), - Validy: psql.Quote(alias, "validy"), - Xvalue: psql.Quote(alias, "xvalue"), - Yvalue: psql.Quote(alias, "yvalue"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Dog: psql.Quote(alias, "dog"), - Spanish: psql.Quote(alias, "spanish"), - ScheduleNotes: psql.Quote(alias, "schedule_notes"), - SchedulePeriod: psql.Quote(alias, "schedule_period"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsServicerequestColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accepted psql.Expression - Acceptedby psql.Expression - Accepteddate psql.Expression - Allowed psql.Expression - Assignedtech psql.Expression - Clraddr1 psql.Expression - Clraddr2 psql.Expression - Clranon psql.Expression - Clrcity psql.Expression - Clrcompany psql.Expression - Clrcontpref psql.Expression - Clremail psql.Expression - Clrfname psql.Expression - Clrother psql.Expression - Clrphone1 psql.Expression - Clrphone2 psql.Expression - Clrstate psql.Expression - Clrzip psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Datetimeclosed psql.Expression - Duedate psql.Expression - Entrytech psql.Expression - Estcompletedate psql.Expression - Externalerror psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Firstresponsedate psql.Expression - Globalid psql.Expression - Issuesreported psql.Expression - Jurisdiction psql.Expression - Nextaction psql.Expression - Notificationtimestamp psql.Expression - Notified psql.Expression - Notifieddate psql.Expression - Objectid psql.Expression - Pointlocid psql.Expression - Priority psql.Expression - Recdatetime psql.Expression - Recordstatus psql.Expression - Rejectedby psql.Expression - Rejecteddate psql.Expression - Rejectedreason psql.Expression - Reqaddr1 psql.Expression - Reqaddr2 psql.Expression - Reqcity psql.Expression - Reqcompany psql.Expression - Reqcrossst psql.Expression - Reqdescr psql.Expression - Reqfldnotes psql.Expression - Reqmapgrid psql.Expression - Reqnotesforcust psql.Expression - Reqnotesfortech psql.Expression - Reqpermission psql.Expression - Reqprogramactions psql.Expression - Reqstate psql.Expression - Reqsubdiv psql.Expression - Reqtarget psql.Expression - Reqzip psql.Expression - Responsedaycount psql.Expression - Reviewed psql.Expression - Reviewedby psql.Expression - Revieweddate psql.Expression - Scheduled psql.Expression - Scheduleddate psql.Expression - Source psql.Expression - SRNumber psql.Expression - Status psql.Expression - Supervisor psql.Expression - Techclosed psql.Expression - Validx psql.Expression - Validy psql.Expression - Xvalue psql.Expression - Yvalue psql.Expression - Zone psql.Expression - Zone2 psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Dog psql.Expression - Spanish psql.Expression - ScheduleNotes psql.Expression - SchedulePeriod psql.Expression - Updated psql.Expression -} - -func (c fsServicerequestColumns) Alias() string { - return c.tableAlias -} - -func (fsServicerequestColumns) AliasedAs(alias string) fsServicerequestColumns { - return buildFSServicerequestColumns(alias) -} - -// FSServicerequestSetter is used for insert/upsert/update operations -// 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 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 { - vals := make([]string, 0, 90) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accepted.IsUnset() { - vals = append(vals, "accepted") - } - if !s.Acceptedby.IsUnset() { - vals = append(vals, "acceptedby") - } - if !s.Accepteddate.IsUnset() { - vals = append(vals, "accepteddate") - } - if !s.Allowed.IsUnset() { - vals = append(vals, "allowed") - } - if !s.Assignedtech.IsUnset() { - vals = append(vals, "assignedtech") - } - if !s.Clraddr1.IsUnset() { - vals = append(vals, "clraddr1") - } - if !s.Clraddr2.IsUnset() { - vals = append(vals, "clraddr2") - } - if !s.Clranon.IsUnset() { - vals = append(vals, "clranon") - } - if !s.Clrcity.IsUnset() { - vals = append(vals, "clrcity") - } - if !s.Clrcompany.IsUnset() { - vals = append(vals, "clrcompany") - } - if !s.Clrcontpref.IsUnset() { - vals = append(vals, "clrcontpref") - } - if !s.Clremail.IsUnset() { - vals = append(vals, "clremail") - } - if !s.Clrfname.IsUnset() { - vals = append(vals, "clrfname") - } - if !s.Clrother.IsUnset() { - vals = append(vals, "clrother") - } - if !s.Clrphone1.IsUnset() { - vals = append(vals, "clrphone1") - } - if !s.Clrphone2.IsUnset() { - vals = append(vals, "clrphone2") - } - if !s.Clrstate.IsUnset() { - vals = append(vals, "clrstate") - } - if !s.Clrzip.IsUnset() { - vals = append(vals, "clrzip") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Datetimeclosed.IsUnset() { - vals = append(vals, "datetimeclosed") - } - if !s.Duedate.IsUnset() { - vals = append(vals, "duedate") - } - if !s.Entrytech.IsUnset() { - vals = append(vals, "entrytech") - } - if !s.Estcompletedate.IsUnset() { - vals = append(vals, "estcompletedate") - } - if !s.Externalerror.IsUnset() { - vals = append(vals, "externalerror") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Firstresponsedate.IsUnset() { - vals = append(vals, "firstresponsedate") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Issuesreported.IsUnset() { - vals = append(vals, "issuesreported") - } - if !s.Jurisdiction.IsUnset() { - vals = append(vals, "jurisdiction") - } - if !s.Nextaction.IsUnset() { - vals = append(vals, "nextaction") - } - if !s.Notificationtimestamp.IsUnset() { - vals = append(vals, "notificationtimestamp") - } - if !s.Notified.IsUnset() { - vals = append(vals, "notified") - } - if !s.Notifieddate.IsUnset() { - vals = append(vals, "notifieddate") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Pointlocid.IsUnset() { - vals = append(vals, "pointlocid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Recdatetime.IsUnset() { - vals = append(vals, "recdatetime") - } - if !s.Recordstatus.IsUnset() { - vals = append(vals, "recordstatus") - } - if !s.Rejectedby.IsUnset() { - vals = append(vals, "rejectedby") - } - if !s.Rejecteddate.IsUnset() { - vals = append(vals, "rejecteddate") - } - if !s.Rejectedreason.IsUnset() { - vals = append(vals, "rejectedreason") - } - if !s.Reqaddr1.IsUnset() { - vals = append(vals, "reqaddr1") - } - if !s.Reqaddr2.IsUnset() { - vals = append(vals, "reqaddr2") - } - if !s.Reqcity.IsUnset() { - vals = append(vals, "reqcity") - } - if !s.Reqcompany.IsUnset() { - vals = append(vals, "reqcompany") - } - if !s.Reqcrossst.IsUnset() { - vals = append(vals, "reqcrossst") - } - if !s.Reqdescr.IsUnset() { - vals = append(vals, "reqdescr") - } - if !s.Reqfldnotes.IsUnset() { - vals = append(vals, "reqfldnotes") - } - if !s.Reqmapgrid.IsUnset() { - vals = append(vals, "reqmapgrid") - } - if !s.Reqnotesforcust.IsUnset() { - vals = append(vals, "reqnotesforcust") - } - if !s.Reqnotesfortech.IsUnset() { - vals = append(vals, "reqnotesfortech") - } - if !s.Reqpermission.IsUnset() { - vals = append(vals, "reqpermission") - } - if !s.Reqprogramactions.IsUnset() { - vals = append(vals, "reqprogramactions") - } - if !s.Reqstate.IsUnset() { - vals = append(vals, "reqstate") - } - if !s.Reqsubdiv.IsUnset() { - vals = append(vals, "reqsubdiv") - } - if !s.Reqtarget.IsUnset() { - vals = append(vals, "reqtarget") - } - if !s.Reqzip.IsUnset() { - vals = append(vals, "reqzip") - } - if !s.Responsedaycount.IsUnset() { - vals = append(vals, "responsedaycount") - } - if !s.Reviewed.IsUnset() { - vals = append(vals, "reviewed") - } - if !s.Reviewedby.IsUnset() { - vals = append(vals, "reviewedby") - } - if !s.Revieweddate.IsUnset() { - vals = append(vals, "revieweddate") - } - if !s.Scheduled.IsUnset() { - vals = append(vals, "scheduled") - } - if !s.Scheduleddate.IsUnset() { - vals = append(vals, "scheduleddate") - } - if !s.Source.IsUnset() { - vals = append(vals, "source") - } - if !s.SRNumber.IsUnset() { - vals = append(vals, "sr_number") - } - if !s.Status.IsUnset() { - vals = append(vals, "status") - } - if !s.Supervisor.IsUnset() { - vals = append(vals, "supervisor") - } - if !s.Techclosed.IsUnset() { - vals = append(vals, "techclosed") - } - if !s.Validx.IsUnset() { - vals = append(vals, "validx") - } - if !s.Validy.IsUnset() { - vals = append(vals, "validy") - } - if !s.Xvalue.IsUnset() { - vals = append(vals, "xvalue") - } - if !s.Yvalue.IsUnset() { - vals = append(vals, "yvalue") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if s.GeometryX.IsValue() { - vals = append(vals, "geometry_x") - } - if s.GeometryY.IsValue() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Dog.IsUnset() { - vals = append(vals, "dog") - } - if !s.Spanish.IsUnset() { - vals = append(vals, "spanish") - } - if !s.ScheduleNotes.IsUnset() { - vals = append(vals, "schedule_notes") - } - if !s.SchedulePeriod.IsUnset() { - vals = append(vals, "schedule_period") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSServicerequestSetter) Overwrite(t *FSServicerequest) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accepted.IsUnset() { - t.Accepted = s.Accepted.MustGetNull() - } - if !s.Acceptedby.IsUnset() { - t.Acceptedby = s.Acceptedby.MustGetNull() - } - if !s.Accepteddate.IsUnset() { - t.Accepteddate = s.Accepteddate.MustGetNull() - } - if !s.Allowed.IsUnset() { - t.Allowed = s.Allowed.MustGetNull() - } - if !s.Assignedtech.IsUnset() { - t.Assignedtech = s.Assignedtech.MustGetNull() - } - if !s.Clraddr1.IsUnset() { - t.Clraddr1 = s.Clraddr1.MustGetNull() - } - if !s.Clraddr2.IsUnset() { - t.Clraddr2 = s.Clraddr2.MustGetNull() - } - if !s.Clranon.IsUnset() { - t.Clranon = s.Clranon.MustGetNull() - } - if !s.Clrcity.IsUnset() { - t.Clrcity = s.Clrcity.MustGetNull() - } - if !s.Clrcompany.IsUnset() { - t.Clrcompany = s.Clrcompany.MustGetNull() - } - if !s.Clrcontpref.IsUnset() { - t.Clrcontpref = s.Clrcontpref.MustGetNull() - } - if !s.Clremail.IsUnset() { - t.Clremail = s.Clremail.MustGetNull() - } - if !s.Clrfname.IsUnset() { - t.Clrfname = s.Clrfname.MustGetNull() - } - if !s.Clrother.IsUnset() { - t.Clrother = s.Clrother.MustGetNull() - } - if !s.Clrphone1.IsUnset() { - t.Clrphone1 = s.Clrphone1.MustGetNull() - } - if !s.Clrphone2.IsUnset() { - t.Clrphone2 = s.Clrphone2.MustGetNull() - } - if !s.Clrstate.IsUnset() { - t.Clrstate = s.Clrstate.MustGetNull() - } - if !s.Clrzip.IsUnset() { - t.Clrzip = s.Clrzip.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Datetimeclosed.IsUnset() { - t.Datetimeclosed = s.Datetimeclosed.MustGetNull() - } - if !s.Duedate.IsUnset() { - t.Duedate = s.Duedate.MustGetNull() - } - if !s.Entrytech.IsUnset() { - t.Entrytech = s.Entrytech.MustGetNull() - } - if !s.Estcompletedate.IsUnset() { - t.Estcompletedate = s.Estcompletedate.MustGetNull() - } - if !s.Externalerror.IsUnset() { - t.Externalerror = s.Externalerror.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Firstresponsedate.IsUnset() { - t.Firstresponsedate = s.Firstresponsedate.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Issuesreported.IsUnset() { - t.Issuesreported = s.Issuesreported.MustGetNull() - } - if !s.Jurisdiction.IsUnset() { - t.Jurisdiction = s.Jurisdiction.MustGetNull() - } - if !s.Nextaction.IsUnset() { - t.Nextaction = s.Nextaction.MustGetNull() - } - if !s.Notificationtimestamp.IsUnset() { - t.Notificationtimestamp = s.Notificationtimestamp.MustGetNull() - } - if !s.Notified.IsUnset() { - t.Notified = s.Notified.MustGetNull() - } - if !s.Notifieddate.IsUnset() { - t.Notifieddate = s.Notifieddate.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Pointlocid.IsUnset() { - t.Pointlocid = s.Pointlocid.MustGetNull() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Recdatetime.IsUnset() { - t.Recdatetime = s.Recdatetime.MustGetNull() - } - if !s.Recordstatus.IsUnset() { - t.Recordstatus = s.Recordstatus.MustGetNull() - } - if !s.Rejectedby.IsUnset() { - t.Rejectedby = s.Rejectedby.MustGetNull() - } - if !s.Rejecteddate.IsUnset() { - t.Rejecteddate = s.Rejecteddate.MustGetNull() - } - if !s.Rejectedreason.IsUnset() { - t.Rejectedreason = s.Rejectedreason.MustGetNull() - } - if !s.Reqaddr1.IsUnset() { - t.Reqaddr1 = s.Reqaddr1.MustGetNull() - } - if !s.Reqaddr2.IsUnset() { - t.Reqaddr2 = s.Reqaddr2.MustGetNull() - } - if !s.Reqcity.IsUnset() { - t.Reqcity = s.Reqcity.MustGetNull() - } - if !s.Reqcompany.IsUnset() { - t.Reqcompany = s.Reqcompany.MustGetNull() - } - if !s.Reqcrossst.IsUnset() { - t.Reqcrossst = s.Reqcrossst.MustGetNull() - } - if !s.Reqdescr.IsUnset() { - t.Reqdescr = s.Reqdescr.MustGetNull() - } - if !s.Reqfldnotes.IsUnset() { - t.Reqfldnotes = s.Reqfldnotes.MustGetNull() - } - if !s.Reqmapgrid.IsUnset() { - t.Reqmapgrid = s.Reqmapgrid.MustGetNull() - } - if !s.Reqnotesforcust.IsUnset() { - t.Reqnotesforcust = s.Reqnotesforcust.MustGetNull() - } - if !s.Reqnotesfortech.IsUnset() { - t.Reqnotesfortech = s.Reqnotesfortech.MustGetNull() - } - if !s.Reqpermission.IsUnset() { - t.Reqpermission = s.Reqpermission.MustGetNull() - } - if !s.Reqprogramactions.IsUnset() { - t.Reqprogramactions = s.Reqprogramactions.MustGetNull() - } - if !s.Reqstate.IsUnset() { - t.Reqstate = s.Reqstate.MustGetNull() - } - if !s.Reqsubdiv.IsUnset() { - t.Reqsubdiv = s.Reqsubdiv.MustGetNull() - } - if !s.Reqtarget.IsUnset() { - t.Reqtarget = s.Reqtarget.MustGetNull() - } - if !s.Reqzip.IsUnset() { - t.Reqzip = s.Reqzip.MustGetNull() - } - if !s.Responsedaycount.IsUnset() { - t.Responsedaycount = s.Responsedaycount.MustGetNull() - } - if !s.Reviewed.IsUnset() { - t.Reviewed = s.Reviewed.MustGetNull() - } - if !s.Reviewedby.IsUnset() { - t.Reviewedby = s.Reviewedby.MustGetNull() - } - if !s.Revieweddate.IsUnset() { - t.Revieweddate = s.Revieweddate.MustGetNull() - } - if !s.Scheduled.IsUnset() { - t.Scheduled = s.Scheduled.MustGetNull() - } - if !s.Scheduleddate.IsUnset() { - t.Scheduleddate = s.Scheduleddate.MustGetNull() - } - if !s.Source.IsUnset() { - t.Source = s.Source.MustGetNull() - } - if !s.SRNumber.IsUnset() { - t.SRNumber = s.SRNumber.MustGetNull() - } - if !s.Status.IsUnset() { - t.Status = s.Status.MustGetNull() - } - if !s.Supervisor.IsUnset() { - t.Supervisor = s.Supervisor.MustGetNull() - } - if !s.Techclosed.IsUnset() { - t.Techclosed = s.Techclosed.MustGetNull() - } - if !s.Validx.IsUnset() { - t.Validx = s.Validx.MustGetNull() - } - if !s.Validy.IsUnset() { - t.Validy = s.Validy.MustGetNull() - } - if !s.Xvalue.IsUnset() { - t.Xvalue = s.Xvalue.MustGetNull() - } - if !s.Yvalue.IsUnset() { - t.Yvalue = s.Yvalue.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if s.GeometryX.IsValue() { - t.GeometryX = s.GeometryX.MustGet() - } - if s.GeometryY.IsValue() { - t.GeometryY = s.GeometryY.MustGet() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Dog.IsUnset() { - t.Dog = s.Dog.MustGetNull() - } - if !s.Spanish.IsUnset() { - t.Spanish = s.Spanish.MustGetNull() - } - if !s.ScheduleNotes.IsUnset() { - t.ScheduleNotes = s.ScheduleNotes.MustGetNull() - } - if !s.SchedulePeriod.IsUnset() { - t.SchedulePeriod = s.SchedulePeriod.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSServicerequestSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSServicerequests.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 90) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accepted.IsUnset() { - vals[1] = psql.Arg(s.Accepted.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Acceptedby.IsUnset() { - vals[2] = psql.Arg(s.Acceptedby.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Accepteddate.IsUnset() { - vals[3] = psql.Arg(s.Accepteddate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Allowed.IsUnset() { - vals[4] = psql.Arg(s.Allowed.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Assignedtech.IsUnset() { - vals[5] = psql.Arg(s.Assignedtech.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Clraddr1.IsUnset() { - vals[6] = psql.Arg(s.Clraddr1.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Clraddr2.IsUnset() { - vals[7] = psql.Arg(s.Clraddr2.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Clranon.IsUnset() { - vals[8] = psql.Arg(s.Clranon.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Clrcity.IsUnset() { - vals[9] = psql.Arg(s.Clrcity.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Clrcompany.IsUnset() { - vals[10] = psql.Arg(s.Clrcompany.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Clrcontpref.IsUnset() { - vals[11] = psql.Arg(s.Clrcontpref.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Clremail.IsUnset() { - vals[12] = psql.Arg(s.Clremail.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Clrfname.IsUnset() { - vals[13] = psql.Arg(s.Clrfname.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Clrother.IsUnset() { - vals[14] = psql.Arg(s.Clrother.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Clrphone1.IsUnset() { - vals[15] = psql.Arg(s.Clrphone1.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Clrphone2.IsUnset() { - vals[16] = psql.Arg(s.Clrphone2.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Clrstate.IsUnset() { - vals[17] = psql.Arg(s.Clrstate.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Clrzip.IsUnset() { - vals[18] = psql.Arg(s.Clrzip.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[19] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[20] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[21] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Datetimeclosed.IsUnset() { - vals[22] = psql.Arg(s.Datetimeclosed.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Duedate.IsUnset() { - vals[23] = psql.Arg(s.Duedate.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Entrytech.IsUnset() { - vals[24] = psql.Arg(s.Entrytech.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Estcompletedate.IsUnset() { - vals[25] = psql.Arg(s.Estcompletedate.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Externalerror.IsUnset() { - vals[26] = psql.Arg(s.Externalerror.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[27] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[28] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[29] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Firstresponsedate.IsUnset() { - vals[30] = psql.Arg(s.Firstresponsedate.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[31] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Issuesreported.IsUnset() { - vals[32] = psql.Arg(s.Issuesreported.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Jurisdiction.IsUnset() { - vals[33] = psql.Arg(s.Jurisdiction.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Nextaction.IsUnset() { - vals[34] = psql.Arg(s.Nextaction.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Notificationtimestamp.IsUnset() { - vals[35] = psql.Arg(s.Notificationtimestamp.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Notified.IsUnset() { - vals[36] = psql.Arg(s.Notified.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.Notifieddate.IsUnset() { - vals[37] = psql.Arg(s.Notifieddate.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[38] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Pointlocid.IsUnset() { - vals[39] = psql.Arg(s.Pointlocid.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[40] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.Recdatetime.IsUnset() { - vals[41] = psql.Arg(s.Recdatetime.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.Recordstatus.IsUnset() { - vals[42] = psql.Arg(s.Recordstatus.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.Rejectedby.IsUnset() { - vals[43] = psql.Arg(s.Rejectedby.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.Rejecteddate.IsUnset() { - vals[44] = psql.Arg(s.Rejecteddate.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if !s.Rejectedreason.IsUnset() { - vals[45] = psql.Arg(s.Rejectedreason.MustGetNull()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if !s.Reqaddr1.IsUnset() { - vals[46] = psql.Arg(s.Reqaddr1.MustGetNull()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - if !s.Reqaddr2.IsUnset() { - vals[47] = psql.Arg(s.Reqaddr2.MustGetNull()) - } else { - vals[47] = psql.Raw("DEFAULT") - } - - if !s.Reqcity.IsUnset() { - vals[48] = psql.Arg(s.Reqcity.MustGetNull()) - } else { - vals[48] = psql.Raw("DEFAULT") - } - - if !s.Reqcompany.IsUnset() { - vals[49] = psql.Arg(s.Reqcompany.MustGetNull()) - } else { - vals[49] = psql.Raw("DEFAULT") - } - - if !s.Reqcrossst.IsUnset() { - vals[50] = psql.Arg(s.Reqcrossst.MustGetNull()) - } else { - vals[50] = psql.Raw("DEFAULT") - } - - if !s.Reqdescr.IsUnset() { - vals[51] = psql.Arg(s.Reqdescr.MustGetNull()) - } else { - vals[51] = psql.Raw("DEFAULT") - } - - if !s.Reqfldnotes.IsUnset() { - vals[52] = psql.Arg(s.Reqfldnotes.MustGetNull()) - } else { - vals[52] = psql.Raw("DEFAULT") - } - - if !s.Reqmapgrid.IsUnset() { - vals[53] = psql.Arg(s.Reqmapgrid.MustGetNull()) - } else { - vals[53] = psql.Raw("DEFAULT") - } - - if !s.Reqnotesforcust.IsUnset() { - vals[54] = psql.Arg(s.Reqnotesforcust.MustGetNull()) - } else { - vals[54] = psql.Raw("DEFAULT") - } - - if !s.Reqnotesfortech.IsUnset() { - vals[55] = psql.Arg(s.Reqnotesfortech.MustGetNull()) - } else { - vals[55] = psql.Raw("DEFAULT") - } - - if !s.Reqpermission.IsUnset() { - vals[56] = psql.Arg(s.Reqpermission.MustGetNull()) - } else { - vals[56] = psql.Raw("DEFAULT") - } - - if !s.Reqprogramactions.IsUnset() { - vals[57] = psql.Arg(s.Reqprogramactions.MustGetNull()) - } else { - vals[57] = psql.Raw("DEFAULT") - } - - if !s.Reqstate.IsUnset() { - vals[58] = psql.Arg(s.Reqstate.MustGetNull()) - } else { - vals[58] = psql.Raw("DEFAULT") - } - - if !s.Reqsubdiv.IsUnset() { - vals[59] = psql.Arg(s.Reqsubdiv.MustGetNull()) - } else { - vals[59] = psql.Raw("DEFAULT") - } - - if !s.Reqtarget.IsUnset() { - vals[60] = psql.Arg(s.Reqtarget.MustGetNull()) - } else { - vals[60] = psql.Raw("DEFAULT") - } - - if !s.Reqzip.IsUnset() { - vals[61] = psql.Arg(s.Reqzip.MustGetNull()) - } else { - vals[61] = psql.Raw("DEFAULT") - } - - if !s.Responsedaycount.IsUnset() { - vals[62] = psql.Arg(s.Responsedaycount.MustGetNull()) - } else { - vals[62] = psql.Raw("DEFAULT") - } - - if !s.Reviewed.IsUnset() { - vals[63] = psql.Arg(s.Reviewed.MustGetNull()) - } else { - vals[63] = psql.Raw("DEFAULT") - } - - if !s.Reviewedby.IsUnset() { - vals[64] = psql.Arg(s.Reviewedby.MustGetNull()) - } else { - vals[64] = psql.Raw("DEFAULT") - } - - if !s.Revieweddate.IsUnset() { - vals[65] = psql.Arg(s.Revieweddate.MustGetNull()) - } else { - vals[65] = psql.Raw("DEFAULT") - } - - if !s.Scheduled.IsUnset() { - vals[66] = psql.Arg(s.Scheduled.MustGetNull()) - } else { - vals[66] = psql.Raw("DEFAULT") - } - - if !s.Scheduleddate.IsUnset() { - vals[67] = psql.Arg(s.Scheduleddate.MustGetNull()) - } else { - vals[67] = psql.Raw("DEFAULT") - } - - if !s.Source.IsUnset() { - vals[68] = psql.Arg(s.Source.MustGetNull()) - } else { - vals[68] = psql.Raw("DEFAULT") - } - - if !s.SRNumber.IsUnset() { - vals[69] = psql.Arg(s.SRNumber.MustGetNull()) - } else { - vals[69] = psql.Raw("DEFAULT") - } - - if !s.Status.IsUnset() { - vals[70] = psql.Arg(s.Status.MustGetNull()) - } else { - vals[70] = psql.Raw("DEFAULT") - } - - if !s.Supervisor.IsUnset() { - vals[71] = psql.Arg(s.Supervisor.MustGetNull()) - } else { - vals[71] = psql.Raw("DEFAULT") - } - - if !s.Techclosed.IsUnset() { - vals[72] = psql.Arg(s.Techclosed.MustGetNull()) - } else { - vals[72] = psql.Raw("DEFAULT") - } - - if !s.Validx.IsUnset() { - vals[73] = psql.Arg(s.Validx.MustGetNull()) - } else { - vals[73] = psql.Raw("DEFAULT") - } - - if !s.Validy.IsUnset() { - vals[74] = psql.Arg(s.Validy.MustGetNull()) - } else { - vals[74] = psql.Raw("DEFAULT") - } - - if !s.Xvalue.IsUnset() { - vals[75] = psql.Arg(s.Xvalue.MustGetNull()) - } else { - vals[75] = psql.Raw("DEFAULT") - } - - if !s.Yvalue.IsUnset() { - vals[76] = psql.Arg(s.Yvalue.MustGetNull()) - } else { - vals[76] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[77] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[77] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[78] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[78] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[79] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[79] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[80] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[80] = psql.Raw("DEFAULT") - } - - if s.GeometryX.IsValue() { - vals[81] = psql.Arg(s.GeometryX.MustGet()) - } else { - vals[81] = psql.Raw("DEFAULT") - } - - if s.GeometryY.IsValue() { - vals[82] = psql.Arg(s.GeometryY.MustGet()) - } else { - vals[82] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[83] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[83] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[84] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[84] = psql.Raw("DEFAULT") - } - - if !s.Dog.IsUnset() { - vals[85] = psql.Arg(s.Dog.MustGetNull()) - } else { - vals[85] = psql.Raw("DEFAULT") - } - - if !s.Spanish.IsUnset() { - vals[86] = psql.Arg(s.Spanish.MustGetNull()) - } else { - vals[86] = psql.Raw("DEFAULT") - } - - if !s.ScheduleNotes.IsUnset() { - vals[87] = psql.Arg(s.ScheduleNotes.MustGetNull()) - } else { - vals[87] = psql.Raw("DEFAULT") - } - - if !s.SchedulePeriod.IsUnset() { - vals[88] = psql.Arg(s.SchedulePeriod.MustGetNull()) - } else { - vals[88] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[89] = psql.Arg(s.Updated.MustGet()) - } else { - vals[89] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSServicerequestSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSServicerequestSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 90) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accepted.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accepted")...), - psql.Arg(s.Accepted), - }}) - } - - if !s.Acceptedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "acceptedby")...), - psql.Arg(s.Acceptedby), - }}) - } - - if !s.Accepteddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accepteddate")...), - psql.Arg(s.Accepteddate), - }}) - } - - if !s.Allowed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "allowed")...), - psql.Arg(s.Allowed), - }}) - } - - if !s.Assignedtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "assignedtech")...), - psql.Arg(s.Assignedtech), - }}) - } - - if !s.Clraddr1.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clraddr1")...), - psql.Arg(s.Clraddr1), - }}) - } - - if !s.Clraddr2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clraddr2")...), - psql.Arg(s.Clraddr2), - }}) - } - - if !s.Clranon.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clranon")...), - psql.Arg(s.Clranon), - }}) - } - - if !s.Clrcity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrcity")...), - psql.Arg(s.Clrcity), - }}) - } - - if !s.Clrcompany.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrcompany")...), - psql.Arg(s.Clrcompany), - }}) - } - - if !s.Clrcontpref.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrcontpref")...), - psql.Arg(s.Clrcontpref), - }}) - } - - if !s.Clremail.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clremail")...), - psql.Arg(s.Clremail), - }}) - } - - if !s.Clrfname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrfname")...), - psql.Arg(s.Clrfname), - }}) - } - - if !s.Clrother.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrother")...), - psql.Arg(s.Clrother), - }}) - } - - if !s.Clrphone1.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrphone1")...), - psql.Arg(s.Clrphone1), - }}) - } - - if !s.Clrphone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrphone2")...), - psql.Arg(s.Clrphone2), - }}) - } - - if !s.Clrstate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrstate")...), - psql.Arg(s.Clrstate), - }}) - } - - if !s.Clrzip.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrzip")...), - psql.Arg(s.Clrzip), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Datetimeclosed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "datetimeclosed")...), - psql.Arg(s.Datetimeclosed), - }}) - } - - if !s.Duedate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "duedate")...), - psql.Arg(s.Duedate), - }}) - } - - if !s.Entrytech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "entrytech")...), - psql.Arg(s.Entrytech), - }}) - } - - if !s.Estcompletedate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "estcompletedate")...), - psql.Arg(s.Estcompletedate), - }}) - } - - if !s.Externalerror.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalerror")...), - psql.Arg(s.Externalerror), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Firstresponsedate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "firstresponsedate")...), - psql.Arg(s.Firstresponsedate), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Issuesreported.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "issuesreported")...), - psql.Arg(s.Issuesreported), - }}) - } - - if !s.Jurisdiction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "jurisdiction")...), - psql.Arg(s.Jurisdiction), - }}) - } - - if !s.Nextaction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nextaction")...), - psql.Arg(s.Nextaction), - }}) - } - - if !s.Notificationtimestamp.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "notificationtimestamp")...), - psql.Arg(s.Notificationtimestamp), - }}) - } - - if !s.Notified.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "notified")...), - psql.Arg(s.Notified), - }}) - } - - if !s.Notifieddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "notifieddate")...), - psql.Arg(s.Notifieddate), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Pointlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pointlocid")...), - psql.Arg(s.Pointlocid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Recdatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "recdatetime")...), - psql.Arg(s.Recdatetime), - }}) - } - - if !s.Recordstatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "recordstatus")...), - psql.Arg(s.Recordstatus), - }}) - } - - if !s.Rejectedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "rejectedby")...), - psql.Arg(s.Rejectedby), - }}) - } - - if !s.Rejecteddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "rejecteddate")...), - psql.Arg(s.Rejecteddate), - }}) - } - - if !s.Rejectedreason.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "rejectedreason")...), - psql.Arg(s.Rejectedreason), - }}) - } - - if !s.Reqaddr1.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqaddr1")...), - psql.Arg(s.Reqaddr1), - }}) - } - - if !s.Reqaddr2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqaddr2")...), - psql.Arg(s.Reqaddr2), - }}) - } - - if !s.Reqcity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqcity")...), - psql.Arg(s.Reqcity), - }}) - } - - if !s.Reqcompany.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqcompany")...), - psql.Arg(s.Reqcompany), - }}) - } - - if !s.Reqcrossst.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqcrossst")...), - psql.Arg(s.Reqcrossst), - }}) - } - - if !s.Reqdescr.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqdescr")...), - psql.Arg(s.Reqdescr), - }}) - } - - if !s.Reqfldnotes.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqfldnotes")...), - psql.Arg(s.Reqfldnotes), - }}) - } - - if !s.Reqmapgrid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqmapgrid")...), - psql.Arg(s.Reqmapgrid), - }}) - } - - if !s.Reqnotesforcust.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqnotesforcust")...), - psql.Arg(s.Reqnotesforcust), - }}) - } - - if !s.Reqnotesfortech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqnotesfortech")...), - psql.Arg(s.Reqnotesfortech), - }}) - } - - if !s.Reqpermission.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqpermission")...), - psql.Arg(s.Reqpermission), - }}) - } - - if !s.Reqprogramactions.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqprogramactions")...), - psql.Arg(s.Reqprogramactions), - }}) - } - - if !s.Reqstate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqstate")...), - psql.Arg(s.Reqstate), - }}) - } - - if !s.Reqsubdiv.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqsubdiv")...), - psql.Arg(s.Reqsubdiv), - }}) - } - - if !s.Reqtarget.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqtarget")...), - psql.Arg(s.Reqtarget), - }}) - } - - if !s.Reqzip.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqzip")...), - psql.Arg(s.Reqzip), - }}) - } - - if !s.Responsedaycount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "responsedaycount")...), - psql.Arg(s.Responsedaycount), - }}) - } - - if !s.Reviewed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewed")...), - psql.Arg(s.Reviewed), - }}) - } - - if !s.Reviewedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewedby")...), - psql.Arg(s.Reviewedby), - }}) - } - - if !s.Revieweddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "revieweddate")...), - psql.Arg(s.Revieweddate), - }}) - } - - if !s.Scheduled.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "scheduled")...), - psql.Arg(s.Scheduled), - }}) - } - - if !s.Scheduleddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "scheduleddate")...), - psql.Arg(s.Scheduleddate), - }}) - } - - if !s.Source.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "source")...), - psql.Arg(s.Source), - }}) - } - - if !s.SRNumber.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sr_number")...), - psql.Arg(s.SRNumber), - }}) - } - - if !s.Status.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "status")...), - psql.Arg(s.Status), - }}) - } - - if !s.Supervisor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "supervisor")...), - psql.Arg(s.Supervisor), - }}) - } - - if !s.Techclosed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "techclosed")...), - psql.Arg(s.Techclosed), - }}) - } - - if !s.Validx.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "validx")...), - psql.Arg(s.Validx), - }}) - } - - if !s.Validy.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "validy")...), - psql.Arg(s.Validy), - }}) - } - - if !s.Xvalue.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "xvalue")...), - psql.Arg(s.Xvalue), - }}) - } - - if !s.Yvalue.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "yvalue")...), - psql.Arg(s.Yvalue), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - 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.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Dog.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "dog")...), - psql.Arg(s.Dog), - }}) - } - - if !s.Spanish.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "spanish")...), - psql.Arg(s.Spanish), - }}) - } - - if !s.ScheduleNotes.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "schedule_notes")...), - psql.Arg(s.ScheduleNotes), - }}) - } - - if !s.SchedulePeriod.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "schedule_period")...), - psql.Arg(s.SchedulePeriod), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSServicerequest retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSServicerequest(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSServicerequest, error) { - if len(cols) == 0 { - return FSServicerequests.Query( - sm.Where(FSServicerequests.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSServicerequests.Query( - sm.Where(FSServicerequests.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSServicerequests.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSServicerequestExists checks the presence of a single record by primary key -func FSServicerequestExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSServicerequests.Query( - sm.Where(FSServicerequests.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSServicerequest is retrieved from the database -func (o *FSServicerequest) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSServicerequests.AfterSelectHooks.RunHooks(ctx, exec, FSServicerequestSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSServicerequests.AfterInsertHooks.RunHooks(ctx, exec, FSServicerequestSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSServicerequests.AfterUpdateHooks.RunHooks(ctx, exec, FSServicerequestSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSServicerequests.AfterDeleteHooks.RunHooks(ctx, exec, FSServicerequestSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSServicerequest -func (o *FSServicerequest) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSServicerequest) pkEQ() dialect.Expression { - return psql.Quote("fs_servicerequest", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSServicerequest -func (o *FSServicerequest) Update(ctx context.Context, exec bob.Executor, s *FSServicerequestSetter) error { - v, err := FSServicerequests.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 FSServicerequest record with an executor -func (o *FSServicerequest) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSServicerequests.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSServicerequest using the executor -func (o *FSServicerequest) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSServicerequests.Query( - sm.Where(FSServicerequests.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSServicerequestSlice is retrieved from the database -func (o FSServicerequestSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSServicerequests.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSServicerequests.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSServicerequests.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSServicerequests.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSServicerequestSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_servicerequest", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSServicerequestSlice) copyMatchingRows(from ...*FSServicerequest) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSServicerequestSlice) 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 FSServicerequests.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 *FSServicerequest: - o.copyMatchingRows(retrieved) - case []*FSServicerequest: - o.copyMatchingRows(retrieved...) - case FSServicerequestSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSServicerequest or a slice of FSServicerequest - // then run the AfterUpdateHooks on the slice - _, err = FSServicerequests.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSServicerequestSlice) 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 FSServicerequests.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 *FSServicerequest: - o.copyMatchingRows(retrieved) - case []*FSServicerequest: - o.copyMatchingRows(retrieved...) - case FSServicerequestSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSServicerequest or a slice of FSServicerequest - // then run the AfterDeleteHooks on the slice - _, err = FSServicerequests.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSServicerequestSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSServicerequestSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSServicerequests.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSServicerequestSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSServicerequests.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSServicerequestSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSServicerequests.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 *FSServicerequest) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSServicerequestSlice) 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 attachFSServicerequestOrganization0(ctx context.Context, exec bob.Executor, count int, fsServicerequest0 *FSServicerequest, organization1 *Organization) (*FSServicerequest, error) { - setter := &FSServicerequestSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsServicerequest0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSServicerequestOrganization0: %w", err) - } - - return fsServicerequest0, nil -} - -func (fsServicerequest0 *FSServicerequest) 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 = attachFSServicerequestOrganization0(ctx, exec, 1, fsServicerequest0, organization1) - if err != nil { - return err - } - - fsServicerequest0.R.Organization = organization1 - - organization1.R.FSServicerequests = append(organization1.R.FSServicerequests, fsServicerequest0) - - return nil -} - -func (fsServicerequest0 *FSServicerequest) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSServicerequestOrganization0(ctx, exec, 1, fsServicerequest0, organization1) - if err != nil { - return err - } - - fsServicerequest0.R.Organization = organization1 - - organization1.R.FSServicerequests = append(organization1.R.FSServicerequests, fsServicerequest0) - - return nil -} - -type fsServicerequestWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accepted psql.WhereNullMod[Q, int16] - Acceptedby psql.WhereNullMod[Q, string] - Accepteddate psql.WhereNullMod[Q, int64] - Allowed psql.WhereNullMod[Q, string] - Assignedtech psql.WhereNullMod[Q, string] - Clraddr1 psql.WhereNullMod[Q, string] - Clraddr2 psql.WhereNullMod[Q, string] - Clranon psql.WhereNullMod[Q, int16] - Clrcity psql.WhereNullMod[Q, string] - Clrcompany psql.WhereNullMod[Q, string] - Clrcontpref psql.WhereNullMod[Q, string] - Clremail psql.WhereNullMod[Q, string] - Clrfname psql.WhereNullMod[Q, string] - Clrother psql.WhereNullMod[Q, string] - Clrphone1 psql.WhereNullMod[Q, string] - Clrphone2 psql.WhereNullMod[Q, string] - Clrstate psql.WhereNullMod[Q, string] - Clrzip psql.WhereNullMod[Q, string] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Datetimeclosed psql.WhereNullMod[Q, int64] - Duedate psql.WhereNullMod[Q, int64] - Entrytech psql.WhereNullMod[Q, string] - Estcompletedate psql.WhereNullMod[Q, int64] - Externalerror psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Firstresponsedate psql.WhereNullMod[Q, int64] - Globalid psql.WhereMod[Q, string] - Issuesreported psql.WhereNullMod[Q, string] - Jurisdiction psql.WhereNullMod[Q, string] - Nextaction psql.WhereNullMod[Q, string] - Notificationtimestamp psql.WhereNullMod[Q, string] - Notified psql.WhereNullMod[Q, int16] - Notifieddate psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Pointlocid psql.WhereNullMod[Q, string] - Priority psql.WhereNullMod[Q, string] - Recdatetime psql.WhereNullMod[Q, int64] - Recordstatus psql.WhereNullMod[Q, int16] - Rejectedby psql.WhereNullMod[Q, string] - Rejecteddate psql.WhereNullMod[Q, int64] - Rejectedreason psql.WhereNullMod[Q, string] - Reqaddr1 psql.WhereNullMod[Q, string] - Reqaddr2 psql.WhereNullMod[Q, string] - Reqcity psql.WhereNullMod[Q, string] - Reqcompany psql.WhereNullMod[Q, string] - Reqcrossst psql.WhereNullMod[Q, string] - Reqdescr psql.WhereNullMod[Q, string] - Reqfldnotes psql.WhereNullMod[Q, string] - Reqmapgrid psql.WhereNullMod[Q, string] - Reqnotesforcust psql.WhereNullMod[Q, string] - Reqnotesfortech psql.WhereNullMod[Q, string] - Reqpermission psql.WhereNullMod[Q, int16] - Reqprogramactions psql.WhereNullMod[Q, string] - Reqstate psql.WhereNullMod[Q, string] - Reqsubdiv psql.WhereNullMod[Q, string] - Reqtarget psql.WhereNullMod[Q, string] - Reqzip psql.WhereNullMod[Q, string] - Responsedaycount psql.WhereNullMod[Q, int16] - Reviewed psql.WhereNullMod[Q, int16] - Reviewedby psql.WhereNullMod[Q, string] - Revieweddate psql.WhereNullMod[Q, int64] - Scheduled psql.WhereNullMod[Q, int16] - Scheduleddate psql.WhereNullMod[Q, int64] - Source psql.WhereNullMod[Q, string] - SRNumber psql.WhereNullMod[Q, int64] - Status psql.WhereNullMod[Q, string] - Supervisor psql.WhereNullMod[Q, string] - Techclosed psql.WhereNullMod[Q, string] - Validx psql.WhereNullMod[Q, string] - Validy psql.WhereNullMod[Q, string] - Xvalue psql.WhereNullMod[Q, string] - Yvalue psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - 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] - Spanish psql.WhereNullMod[Q, int64] - ScheduleNotes psql.WhereNullMod[Q, string] - SchedulePeriod psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsServicerequestWhere[Q]) AliasedAs(alias string) fsServicerequestWhere[Q] { - return buildFSServicerequestWhere[Q](buildFSServicerequestColumns(alias)) -} - -func buildFSServicerequestWhere[Q psql.Filterable](cols fsServicerequestColumns) fsServicerequestWhere[Q] { - return fsServicerequestWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accepted: psql.WhereNull[Q, int16](cols.Accepted), - Acceptedby: psql.WhereNull[Q, string](cols.Acceptedby), - Accepteddate: psql.WhereNull[Q, int64](cols.Accepteddate), - Allowed: psql.WhereNull[Q, string](cols.Allowed), - Assignedtech: psql.WhereNull[Q, string](cols.Assignedtech), - Clraddr1: psql.WhereNull[Q, string](cols.Clraddr1), - Clraddr2: psql.WhereNull[Q, string](cols.Clraddr2), - Clranon: psql.WhereNull[Q, int16](cols.Clranon), - Clrcity: psql.WhereNull[Q, string](cols.Clrcity), - Clrcompany: psql.WhereNull[Q, string](cols.Clrcompany), - Clrcontpref: psql.WhereNull[Q, string](cols.Clrcontpref), - Clremail: psql.WhereNull[Q, string](cols.Clremail), - Clrfname: psql.WhereNull[Q, string](cols.Clrfname), - Clrother: psql.WhereNull[Q, string](cols.Clrother), - Clrphone1: psql.WhereNull[Q, string](cols.Clrphone1), - Clrphone2: psql.WhereNull[Q, string](cols.Clrphone2), - Clrstate: psql.WhereNull[Q, string](cols.Clrstate), - Clrzip: psql.WhereNull[Q, string](cols.Clrzip), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Datetimeclosed: psql.WhereNull[Q, int64](cols.Datetimeclosed), - Duedate: psql.WhereNull[Q, int64](cols.Duedate), - Entrytech: psql.WhereNull[Q, string](cols.Entrytech), - Estcompletedate: psql.WhereNull[Q, int64](cols.Estcompletedate), - Externalerror: psql.WhereNull[Q, string](cols.Externalerror), - Externalid: psql.WhereNull[Q, string](cols.Externalid), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Firstresponsedate: psql.WhereNull[Q, int64](cols.Firstresponsedate), - 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), - Notificationtimestamp: psql.WhereNull[Q, string](cols.Notificationtimestamp), - Notified: psql.WhereNull[Q, int16](cols.Notified), - Notifieddate: psql.WhereNull[Q, int64](cols.Notifieddate), - Objectid: psql.Where[Q, int32](cols.Objectid), - Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Recdatetime: psql.WhereNull[Q, int64](cols.Recdatetime), - Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), - Rejectedby: psql.WhereNull[Q, string](cols.Rejectedby), - Rejecteddate: psql.WhereNull[Q, int64](cols.Rejecteddate), - Rejectedreason: psql.WhereNull[Q, string](cols.Rejectedreason), - Reqaddr1: psql.WhereNull[Q, string](cols.Reqaddr1), - Reqaddr2: psql.WhereNull[Q, string](cols.Reqaddr2), - Reqcity: psql.WhereNull[Q, string](cols.Reqcity), - Reqcompany: psql.WhereNull[Q, string](cols.Reqcompany), - Reqcrossst: psql.WhereNull[Q, string](cols.Reqcrossst), - Reqdescr: psql.WhereNull[Q, string](cols.Reqdescr), - Reqfldnotes: psql.WhereNull[Q, string](cols.Reqfldnotes), - Reqmapgrid: psql.WhereNull[Q, string](cols.Reqmapgrid), - Reqnotesforcust: psql.WhereNull[Q, string](cols.Reqnotesforcust), - Reqnotesfortech: psql.WhereNull[Q, string](cols.Reqnotesfortech), - Reqpermission: psql.WhereNull[Q, int16](cols.Reqpermission), - Reqprogramactions: psql.WhereNull[Q, string](cols.Reqprogramactions), - Reqstate: psql.WhereNull[Q, string](cols.Reqstate), - Reqsubdiv: psql.WhereNull[Q, string](cols.Reqsubdiv), - Reqtarget: psql.WhereNull[Q, string](cols.Reqtarget), - Reqzip: psql.WhereNull[Q, string](cols.Reqzip), - Responsedaycount: psql.WhereNull[Q, int16](cols.Responsedaycount), - Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), - Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), - Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), - Scheduled: psql.WhereNull[Q, int16](cols.Scheduled), - Scheduleddate: psql.WhereNull[Q, int64](cols.Scheduleddate), - Source: psql.WhereNull[Q, string](cols.Source), - SRNumber: psql.WhereNull[Q, int64](cols.SRNumber), - Status: psql.WhereNull[Q, string](cols.Status), - Supervisor: psql.WhereNull[Q, string](cols.Supervisor), - Techclosed: psql.WhereNull[Q, string](cols.Techclosed), - Validx: psql.WhereNull[Q, string](cols.Validx), - Validy: psql.WhereNull[Q, string](cols.Validy), - Xvalue: psql.WhereNull[Q, string](cols.Xvalue), - Yvalue: psql.WhereNull[Q, string](cols.Yvalue), - Zone: psql.WhereNull[Q, string](cols.Zone), - Zone2: psql.WhereNull[Q, string](cols.Zone2), - CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate), - CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser), - 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), - Spanish: psql.WhereNull[Q, int64](cols.Spanish), - ScheduleNotes: psql.WhereNull[Q, string](cols.ScheduleNotes), - SchedulePeriod: psql.WhereNull[Q, string](cols.SchedulePeriod), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSServicerequest) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsServicerequest cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSServicerequests = FSServicerequestSlice{o} - } - return nil - default: - return fmt.Errorf("fsServicerequest has no relationship %q", name) - } -} - -type fsServicerequestPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSServicerequestPreloader() fsServicerequestPreloader { - return fsServicerequestPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSServicerequests, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsServicerequestThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSServicerequestThenLoader[Q orm.Loadable]() fsServicerequestThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsServicerequestThenLoader[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 fsServicerequest's Organization into the .R struct -func (o *FSServicerequest) 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.FSServicerequests = FSServicerequestSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsServicerequest's Organization into the .R struct -func (os FSServicerequestSlice) 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.FSServicerequests = append(rel.R.FSServicerequests, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsServicerequestJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsServicerequestJoins[Q]) aliasedAs(alias string) fsServicerequestJoins[Q] { - return buildFSServicerequestJoins[Q](buildFSServicerequestColumns(alias), j.typ) -} - -func buildFSServicerequestJoins[Q dialect.Joinable](cols fsServicerequestColumns, typ string) fsServicerequestJoins[Q] { - return fsServicerequestJoins[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/db/models/fs_speciesabundance.bob.go b/db/models/fs_speciesabundance.bob.go deleted file mode 100644 index b8ce2c74..00000000 --- a/db/models/fs_speciesabundance.bob.go +++ /dev/null @@ -1,1380 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSSpeciesabundance is an object representing the database table. -type FSSpeciesabundance struct { - OrganizationID int32 `db:"organization_id" ` - Bloodedfem null.Val[int16] `db:"bloodedfem" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Eggs null.Val[int16] `db:"eggs" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Females null.Val[int64] `db:"females" ` - Gravidfem null.Val[int16] `db:"gravidfem" ` - Globalid string `db:"globalid" ` - Larvae null.Val[int16] `db:"larvae" ` - Males null.Val[int16] `db:"males" ` - Objectid int32 `db:"objectid,pk" ` - Poolstogen null.Val[int16] `db:"poolstogen" ` - Processed null.Val[int16] `db:"processed" ` - Pupae null.Val[int16] `db:"pupae" ` - Species null.Val[string] `db:"species" ` - Total null.Val[int64] `db:"total" ` - TrapdataID null.Val[string] `db:"trapdata_id" ` - Unknown null.Val[int16] `db:"unknown" ` - 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" ` - Globalzscore null.Val[float64] `db:"globalzscore" ` - H3R7 null.Val[string] `db:"h3r7" ` - H3R8 null.Val[string] `db:"h3r8" ` - R7score null.Val[float64] `db:"r7score" ` - R8score null.Val[float64] `db:"r8score" ` - Yearweek null.Val[int64] `db:"yearweek" ` - Updated time.Time `db:"updated" ` - - R fsSpeciesabundanceR `db:"-" ` -} - -// FSSpeciesabundanceSlice is an alias for a slice of pointers to FSSpeciesabundance. -// This should almost always be used instead of []*FSSpeciesabundance. -type FSSpeciesabundanceSlice []*FSSpeciesabundance - -// FSSpeciesabundances contains methods to work with the fs_speciesabundance table -var FSSpeciesabundances = psql.NewTablex[*FSSpeciesabundance, FSSpeciesabundanceSlice, *FSSpeciesabundanceSetter]("", "fs_speciesabundance", buildFSSpeciesabundanceColumns("fs_speciesabundance")) - -// FSSpeciesabundancesQuery is a query on the fs_speciesabundance table -type FSSpeciesabundancesQuery = *psql.ViewQuery[*FSSpeciesabundance, FSSpeciesabundanceSlice] - -// fsSpeciesabundanceR is where relationships are stored. -type fsSpeciesabundanceR struct { - Organization *Organization // fs_speciesabundance.fs_speciesabundance_organization_id_fkey -} - -func buildFSSpeciesabundanceColumns(alias string) fsSpeciesabundanceColumns { - return fsSpeciesabundanceColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "bloodedfem", "creationdate", "creator", "eggs", "editdate", "editor", "females", "gravidfem", "globalid", "larvae", "males", "objectid", "poolstogen", "processed", "pupae", "species", "total", "trapdata_id", "unknown", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "globalzscore", "h3r7", "h3r8", "r7score", "r8score", "yearweek", "updated", - ).WithParent("fs_speciesabundance"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Bloodedfem: psql.Quote(alias, "bloodedfem"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Eggs: psql.Quote(alias, "eggs"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Females: psql.Quote(alias, "females"), - Gravidfem: psql.Quote(alias, "gravidfem"), - Globalid: psql.Quote(alias, "globalid"), - Larvae: psql.Quote(alias, "larvae"), - Males: psql.Quote(alias, "males"), - Objectid: psql.Quote(alias, "objectid"), - Poolstogen: psql.Quote(alias, "poolstogen"), - Processed: psql.Quote(alias, "processed"), - Pupae: psql.Quote(alias, "pupae"), - Species: psql.Quote(alias, "species"), - Total: psql.Quote(alias, "total"), - TrapdataID: psql.Quote(alias, "trapdata_id"), - Unknown: psql.Quote(alias, "unknown"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Globalzscore: psql.Quote(alias, "globalzscore"), - H3R7: psql.Quote(alias, "h3r7"), - H3R8: psql.Quote(alias, "h3r8"), - R7score: psql.Quote(alias, "r7score"), - R8score: psql.Quote(alias, "r8score"), - Yearweek: psql.Quote(alias, "yearweek"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsSpeciesabundanceColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Bloodedfem psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Eggs psql.Expression - Editdate psql.Expression - Editor psql.Expression - Females psql.Expression - Gravidfem psql.Expression - Globalid psql.Expression - Larvae psql.Expression - Males psql.Expression - Objectid psql.Expression - Poolstogen psql.Expression - Processed psql.Expression - Pupae psql.Expression - Species psql.Expression - Total psql.Expression - TrapdataID psql.Expression - Unknown psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Globalzscore psql.Expression - H3R7 psql.Expression - H3R8 psql.Expression - R7score psql.Expression - R8score psql.Expression - Yearweek psql.Expression - Updated psql.Expression -} - -func (c fsSpeciesabundanceColumns) Alias() string { - return c.tableAlias -} - -func (fsSpeciesabundanceColumns) AliasedAs(alias string) fsSpeciesabundanceColumns { - return buildFSSpeciesabundanceColumns(alias) -} - -// FSSpeciesabundanceSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSSpeciesabundanceSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Bloodedfem omitnull.Val[int16] `db:"bloodedfem" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Eggs omitnull.Val[int16] `db:"eggs" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Females omitnull.Val[int64] `db:"females" ` - Gravidfem omitnull.Val[int16] `db:"gravidfem" ` - 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" ` - Poolstogen omitnull.Val[int16] `db:"poolstogen" ` - Processed omitnull.Val[int16] `db:"processed" ` - Pupae omitnull.Val[int16] `db:"pupae" ` - Species omitnull.Val[string] `db:"species" ` - Total omitnull.Val[int64] `db:"total" ` - TrapdataID omitnull.Val[string] `db:"trapdata_id" ` - Unknown omitnull.Val[int16] `db:"unknown" ` - 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" ` - Globalzscore omitnull.Val[float64] `db:"globalzscore" ` - H3R7 omitnull.Val[string] `db:"h3r7" ` - H3R8 omitnull.Val[string] `db:"h3r8" ` - R7score omitnull.Val[float64] `db:"r7score" ` - R8score omitnull.Val[float64] `db:"r8score" ` - Yearweek omitnull.Val[int64] `db:"yearweek" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSSpeciesabundanceSetter) SetColumns() []string { - vals := make([]string, 0, 33) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Bloodedfem.IsUnset() { - vals = append(vals, "bloodedfem") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Eggs.IsUnset() { - vals = append(vals, "eggs") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Females.IsUnset() { - vals = append(vals, "females") - } - if !s.Gravidfem.IsUnset() { - vals = append(vals, "gravidfem") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Larvae.IsUnset() { - vals = append(vals, "larvae") - } - if !s.Males.IsUnset() { - vals = append(vals, "males") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Poolstogen.IsUnset() { - vals = append(vals, "poolstogen") - } - if !s.Processed.IsUnset() { - vals = append(vals, "processed") - } - if !s.Pupae.IsUnset() { - vals = append(vals, "pupae") - } - if !s.Species.IsUnset() { - vals = append(vals, "species") - } - if !s.Total.IsUnset() { - vals = append(vals, "total") - } - if !s.TrapdataID.IsUnset() { - vals = append(vals, "trapdata_id") - } - if !s.Unknown.IsUnset() { - vals = append(vals, "unknown") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Globalzscore.IsUnset() { - vals = append(vals, "globalzscore") - } - if !s.H3R7.IsUnset() { - vals = append(vals, "h3r7") - } - if !s.H3R8.IsUnset() { - vals = append(vals, "h3r8") - } - if !s.R7score.IsUnset() { - vals = append(vals, "r7score") - } - if !s.R8score.IsUnset() { - vals = append(vals, "r8score") - } - if !s.Yearweek.IsUnset() { - vals = append(vals, "yearweek") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSSpeciesabundanceSetter) Overwrite(t *FSSpeciesabundance) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Bloodedfem.IsUnset() { - t.Bloodedfem = s.Bloodedfem.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Eggs.IsUnset() { - t.Eggs = s.Eggs.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Females.IsUnset() { - t.Females = s.Females.MustGetNull() - } - if !s.Gravidfem.IsUnset() { - t.Gravidfem = s.Gravidfem.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Larvae.IsUnset() { - t.Larvae = s.Larvae.MustGetNull() - } - if !s.Males.IsUnset() { - t.Males = s.Males.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Poolstogen.IsUnset() { - t.Poolstogen = s.Poolstogen.MustGetNull() - } - if !s.Processed.IsUnset() { - t.Processed = s.Processed.MustGetNull() - } - if !s.Pupae.IsUnset() { - t.Pupae = s.Pupae.MustGetNull() - } - if !s.Species.IsUnset() { - t.Species = s.Species.MustGetNull() - } - if !s.Total.IsUnset() { - t.Total = s.Total.MustGetNull() - } - if !s.TrapdataID.IsUnset() { - t.TrapdataID = s.TrapdataID.MustGetNull() - } - if !s.Unknown.IsUnset() { - t.Unknown = s.Unknown.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Globalzscore.IsUnset() { - t.Globalzscore = s.Globalzscore.MustGetNull() - } - if !s.H3R7.IsUnset() { - t.H3R7 = s.H3R7.MustGetNull() - } - if !s.H3R8.IsUnset() { - t.H3R8 = s.H3R8.MustGetNull() - } - if !s.R7score.IsUnset() { - t.R7score = s.R7score.MustGetNull() - } - if !s.R8score.IsUnset() { - t.R8score = s.R8score.MustGetNull() - } - if !s.Yearweek.IsUnset() { - t.Yearweek = s.Yearweek.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSSpeciesabundanceSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSSpeciesabundances.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 33) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Bloodedfem.IsUnset() { - vals[1] = psql.Arg(s.Bloodedfem.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[2] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[3] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Eggs.IsUnset() { - vals[4] = psql.Arg(s.Eggs.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[5] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[6] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Females.IsUnset() { - vals[7] = psql.Arg(s.Females.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Gravidfem.IsUnset() { - vals[8] = psql.Arg(s.Gravidfem.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[9] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Larvae.IsUnset() { - vals[10] = psql.Arg(s.Larvae.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Males.IsUnset() { - vals[11] = psql.Arg(s.Males.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[12] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Poolstogen.IsUnset() { - vals[13] = psql.Arg(s.Poolstogen.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Processed.IsUnset() { - vals[14] = psql.Arg(s.Processed.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Pupae.IsUnset() { - vals[15] = psql.Arg(s.Pupae.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Species.IsUnset() { - vals[16] = psql.Arg(s.Species.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Total.IsUnset() { - vals[17] = psql.Arg(s.Total.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.TrapdataID.IsUnset() { - vals[18] = psql.Arg(s.TrapdataID.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Unknown.IsUnset() { - vals[19] = psql.Arg(s.Unknown.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[20] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[21] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[22] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[23] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[24] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[25] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Globalzscore.IsUnset() { - vals[26] = psql.Arg(s.Globalzscore.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.H3R7.IsUnset() { - vals[27] = psql.Arg(s.H3R7.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.H3R8.IsUnset() { - vals[28] = psql.Arg(s.H3R8.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.R7score.IsUnset() { - vals[29] = psql.Arg(s.R7score.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.R8score.IsUnset() { - vals[30] = psql.Arg(s.R8score.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Yearweek.IsUnset() { - vals[31] = psql.Arg(s.Yearweek.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[32] = psql.Arg(s.Updated.MustGet()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSSpeciesabundanceSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSSpeciesabundanceSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 33) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Bloodedfem.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "bloodedfem")...), - psql.Arg(s.Bloodedfem), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Eggs.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "eggs")...), - psql.Arg(s.Eggs), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Females.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "females")...), - psql.Arg(s.Females), - }}) - } - - if !s.Gravidfem.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "gravidfem")...), - psql.Arg(s.Gravidfem), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Larvae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvae")...), - psql.Arg(s.Larvae), - }}) - } - - if !s.Males.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "males")...), - psql.Arg(s.Males), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Poolstogen.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "poolstogen")...), - psql.Arg(s.Poolstogen), - }}) - } - - if !s.Processed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "processed")...), - psql.Arg(s.Processed), - }}) - } - - if !s.Pupae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pupae")...), - psql.Arg(s.Pupae), - }}) - } - - if !s.Species.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "species")...), - psql.Arg(s.Species), - }}) - } - - if !s.Total.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "total")...), - psql.Arg(s.Total), - }}) - } - - if !s.TrapdataID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "trapdata_id")...), - psql.Arg(s.TrapdataID), - }}) - } - - if !s.Unknown.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "unknown")...), - psql.Arg(s.Unknown), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Globalzscore.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalzscore")...), - psql.Arg(s.Globalzscore), - }}) - } - - if !s.H3R7.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "h3r7")...), - psql.Arg(s.H3R7), - }}) - } - - if !s.H3R8.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "h3r8")...), - psql.Arg(s.H3R8), - }}) - } - - if !s.R7score.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "r7score")...), - psql.Arg(s.R7score), - }}) - } - - if !s.R8score.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "r8score")...), - psql.Arg(s.R8score), - }}) - } - - if !s.Yearweek.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "yearweek")...), - psql.Arg(s.Yearweek), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSSpeciesabundance retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSSpeciesabundance(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSSpeciesabundance, error) { - if len(cols) == 0 { - return FSSpeciesabundances.Query( - sm.Where(FSSpeciesabundances.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSSpeciesabundances.Query( - sm.Where(FSSpeciesabundances.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSSpeciesabundances.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSSpeciesabundanceExists checks the presence of a single record by primary key -func FSSpeciesabundanceExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSSpeciesabundances.Query( - sm.Where(FSSpeciesabundances.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSSpeciesabundance is retrieved from the database -func (o *FSSpeciesabundance) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSSpeciesabundances.AfterSelectHooks.RunHooks(ctx, exec, FSSpeciesabundanceSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSSpeciesabundances.AfterInsertHooks.RunHooks(ctx, exec, FSSpeciesabundanceSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSSpeciesabundances.AfterUpdateHooks.RunHooks(ctx, exec, FSSpeciesabundanceSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSSpeciesabundances.AfterDeleteHooks.RunHooks(ctx, exec, FSSpeciesabundanceSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSSpeciesabundance -func (o *FSSpeciesabundance) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSSpeciesabundance) pkEQ() dialect.Expression { - return psql.Quote("fs_speciesabundance", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSSpeciesabundance -func (o *FSSpeciesabundance) Update(ctx context.Context, exec bob.Executor, s *FSSpeciesabundanceSetter) error { - v, err := FSSpeciesabundances.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 FSSpeciesabundance record with an executor -func (o *FSSpeciesabundance) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSSpeciesabundances.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSSpeciesabundance using the executor -func (o *FSSpeciesabundance) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSSpeciesabundances.Query( - sm.Where(FSSpeciesabundances.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSSpeciesabundanceSlice is retrieved from the database -func (o FSSpeciesabundanceSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSSpeciesabundances.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSSpeciesabundances.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSSpeciesabundances.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSSpeciesabundances.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSSpeciesabundanceSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_speciesabundance", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSSpeciesabundanceSlice) copyMatchingRows(from ...*FSSpeciesabundance) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSSpeciesabundanceSlice) 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 FSSpeciesabundances.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 *FSSpeciesabundance: - o.copyMatchingRows(retrieved) - case []*FSSpeciesabundance: - o.copyMatchingRows(retrieved...) - case FSSpeciesabundanceSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSSpeciesabundance or a slice of FSSpeciesabundance - // then run the AfterUpdateHooks on the slice - _, err = FSSpeciesabundances.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSSpeciesabundanceSlice) 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 FSSpeciesabundances.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 *FSSpeciesabundance: - o.copyMatchingRows(retrieved) - case []*FSSpeciesabundance: - o.copyMatchingRows(retrieved...) - case FSSpeciesabundanceSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSSpeciesabundance or a slice of FSSpeciesabundance - // then run the AfterDeleteHooks on the slice - _, err = FSSpeciesabundances.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSSpeciesabundanceSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSSpeciesabundanceSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSSpeciesabundances.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSSpeciesabundanceSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSSpeciesabundances.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSSpeciesabundanceSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSSpeciesabundances.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 *FSSpeciesabundance) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSSpeciesabundanceSlice) 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 attachFSSpeciesabundanceOrganization0(ctx context.Context, exec bob.Executor, count int, fsSpeciesabundance0 *FSSpeciesabundance, organization1 *Organization) (*FSSpeciesabundance, error) { - setter := &FSSpeciesabundanceSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsSpeciesabundance0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSSpeciesabundanceOrganization0: %w", err) - } - - return fsSpeciesabundance0, nil -} - -func (fsSpeciesabundance0 *FSSpeciesabundance) 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 = attachFSSpeciesabundanceOrganization0(ctx, exec, 1, fsSpeciesabundance0, organization1) - if err != nil { - return err - } - - fsSpeciesabundance0.R.Organization = organization1 - - organization1.R.FSSpeciesabundances = append(organization1.R.FSSpeciesabundances, fsSpeciesabundance0) - - return nil -} - -func (fsSpeciesabundance0 *FSSpeciesabundance) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSSpeciesabundanceOrganization0(ctx, exec, 1, fsSpeciesabundance0, organization1) - if err != nil { - return err - } - - fsSpeciesabundance0.R.Organization = organization1 - - organization1.R.FSSpeciesabundances = append(organization1.R.FSSpeciesabundances, fsSpeciesabundance0) - - return nil -} - -type fsSpeciesabundanceWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Bloodedfem psql.WhereNullMod[Q, int16] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Eggs psql.WhereNullMod[Q, int16] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Females psql.WhereNullMod[Q, int64] - Gravidfem psql.WhereNullMod[Q, int16] - Globalid psql.WhereMod[Q, string] - Larvae psql.WhereNullMod[Q, int16] - Males psql.WhereNullMod[Q, int16] - Objectid psql.WhereMod[Q, int32] - Poolstogen psql.WhereNullMod[Q, int16] - Processed psql.WhereNullMod[Q, int16] - Pupae psql.WhereNullMod[Q, int16] - Species psql.WhereNullMod[Q, string] - Total psql.WhereNullMod[Q, int64] - TrapdataID psql.WhereNullMod[Q, string] - Unknown psql.WhereNullMod[Q, int16] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Globalzscore psql.WhereNullMod[Q, float64] - H3R7 psql.WhereNullMod[Q, string] - H3R8 psql.WhereNullMod[Q, string] - R7score psql.WhereNullMod[Q, float64] - R8score psql.WhereNullMod[Q, float64] - Yearweek psql.WhereNullMod[Q, int64] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsSpeciesabundanceWhere[Q]) AliasedAs(alias string) fsSpeciesabundanceWhere[Q] { - return buildFSSpeciesabundanceWhere[Q](buildFSSpeciesabundanceColumns(alias)) -} - -func buildFSSpeciesabundanceWhere[Q psql.Filterable](cols fsSpeciesabundanceColumns) fsSpeciesabundanceWhere[Q] { - return fsSpeciesabundanceWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Bloodedfem: psql.WhereNull[Q, int16](cols.Bloodedfem), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Eggs: psql.WhereNull[Q, int16](cols.Eggs), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Females: psql.WhereNull[Q, int64](cols.Females), - Gravidfem: psql.WhereNull[Q, int16](cols.Gravidfem), - 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), - Poolstogen: psql.WhereNull[Q, int16](cols.Poolstogen), - Processed: psql.WhereNull[Q, int16](cols.Processed), - Pupae: psql.WhereNull[Q, int16](cols.Pupae), - Species: psql.WhereNull[Q, string](cols.Species), - Total: psql.WhereNull[Q, int64](cols.Total), - TrapdataID: psql.WhereNull[Q, string](cols.TrapdataID), - Unknown: psql.WhereNull[Q, int16](cols.Unknown), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Globalzscore: psql.WhereNull[Q, float64](cols.Globalzscore), - H3R7: psql.WhereNull[Q, string](cols.H3R7), - H3R8: psql.WhereNull[Q, string](cols.H3R8), - R7score: psql.WhereNull[Q, float64](cols.R7score), - R8score: psql.WhereNull[Q, float64](cols.R8score), - Yearweek: psql.WhereNull[Q, int64](cols.Yearweek), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSSpeciesabundance) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsSpeciesabundance cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSSpeciesabundances = FSSpeciesabundanceSlice{o} - } - return nil - default: - return fmt.Errorf("fsSpeciesabundance has no relationship %q", name) - } -} - -type fsSpeciesabundancePreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSSpeciesabundancePreloader() fsSpeciesabundancePreloader { - return fsSpeciesabundancePreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSSpeciesabundances, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsSpeciesabundanceThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSSpeciesabundanceThenLoader[Q orm.Loadable]() fsSpeciesabundanceThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsSpeciesabundanceThenLoader[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 fsSpeciesabundance's Organization into the .R struct -func (o *FSSpeciesabundance) 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.FSSpeciesabundances = FSSpeciesabundanceSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsSpeciesabundance's Organization into the .R struct -func (os FSSpeciesabundanceSlice) 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.FSSpeciesabundances = append(rel.R.FSSpeciesabundances, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsSpeciesabundanceJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsSpeciesabundanceJoins[Q]) aliasedAs(alias string) fsSpeciesabundanceJoins[Q] { - return buildFSSpeciesabundanceJoins[Q](buildFSSpeciesabundanceColumns(alias), j.typ) -} - -func buildFSSpeciesabundanceJoins[Q dialect.Joinable](cols fsSpeciesabundanceColumns, typ string) fsSpeciesabundanceJoins[Q] { - return fsSpeciesabundanceJoins[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/db/models/fs_stormdrain.bob.go b/db/models/fs_stormdrain.bob.go deleted file mode 100644 index f1e37b84..00000000 --- a/db/models/fs_stormdrain.bob.go +++ /dev/null @@ -1,1130 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSStormdrain is an object representing the database table. -type FSStormdrain struct { - OrganizationID int32 `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid string `db:"globalid" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Lastaction null.Val[string] `db:"lastaction" ` - Laststatus null.Val[string] `db:"laststatus" ` - Lasttreatdate null.Val[int64] `db:"lasttreatdate" ` - Nexttreatmentdate null.Val[int64] `db:"nexttreatmentdate" ` - Objectid int32 `db:"objectid,pk" ` - Symbology null.Val[string] `db:"symbology" ` - Type null.Val[string] `db:"type" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsStormdrainR `db:"-" ` -} - -// FSStormdrainSlice is an alias for a slice of pointers to FSStormdrain. -// This should almost always be used instead of []*FSStormdrain. -type FSStormdrainSlice []*FSStormdrain - -// FSStormdrains contains methods to work with the fs_stormdrain table -var FSStormdrains = psql.NewTablex[*FSStormdrain, FSStormdrainSlice, *FSStormdrainSetter]("", "fs_stormdrain", buildFSStormdrainColumns("fs_stormdrain")) - -// FSStormdrainsQuery is a query on the fs_stormdrain table -type FSStormdrainsQuery = *psql.ViewQuery[*FSStormdrain, FSStormdrainSlice] - -// fsStormdrainR is where relationships are stored. -type fsStormdrainR struct { - Organization *Organization // fs_stormdrain.fs_stormdrain_organization_id_fkey -} - -func buildFSStormdrainColumns(alias string) fsStormdrainColumns { - return fsStormdrainColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "jurisdiction", "lastaction", "laststatus", "lasttreatdate", "nexttreatmentdate", "objectid", "symbology", "type", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "updated", - ).WithParent("fs_stormdrain"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Jurisdiction: psql.Quote(alias, "jurisdiction"), - Lastaction: psql.Quote(alias, "lastaction"), - Laststatus: psql.Quote(alias, "laststatus"), - Lasttreatdate: psql.Quote(alias, "lasttreatdate"), - Nexttreatmentdate: psql.Quote(alias, "nexttreatmentdate"), - Objectid: psql.Quote(alias, "objectid"), - Symbology: psql.Quote(alias, "symbology"), - Type: psql.Quote(alias, "type"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsStormdrainColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Jurisdiction psql.Expression - Lastaction psql.Expression - Laststatus psql.Expression - Lasttreatdate psql.Expression - Nexttreatmentdate psql.Expression - Objectid psql.Expression - Symbology psql.Expression - Type psql.Expression - Zone psql.Expression - Zone2 psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Updated psql.Expression -} - -func (c fsStormdrainColumns) Alias() string { - return c.tableAlias -} - -func (fsStormdrainColumns) AliasedAs(alias string) fsStormdrainColumns { - return buildFSStormdrainColumns(alias) -} - -// FSStormdrainSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSStormdrainSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omit.Val[string] `db:"globalid" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Lastaction omitnull.Val[string] `db:"lastaction" ` - Laststatus omitnull.Val[string] `db:"laststatus" ` - Lasttreatdate omitnull.Val[int64] `db:"lasttreatdate" ` - Nexttreatmentdate omitnull.Val[int64] `db:"nexttreatmentdate" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Symbology omitnull.Val[string] `db:"symbology" ` - Type omitnull.Val[string] `db:"type" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSStormdrainSetter) SetColumns() []string { - vals := make([]string, 0, 23) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Jurisdiction.IsUnset() { - vals = append(vals, "jurisdiction") - } - if !s.Lastaction.IsUnset() { - vals = append(vals, "lastaction") - } - if !s.Laststatus.IsUnset() { - vals = append(vals, "laststatus") - } - if !s.Lasttreatdate.IsUnset() { - vals = append(vals, "lasttreatdate") - } - if !s.Nexttreatmentdate.IsUnset() { - vals = append(vals, "nexttreatmentdate") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Symbology.IsUnset() { - vals = append(vals, "symbology") - } - if !s.Type.IsUnset() { - vals = append(vals, "type") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSStormdrainSetter) Overwrite(t *FSStormdrain) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Jurisdiction.IsUnset() { - t.Jurisdiction = s.Jurisdiction.MustGetNull() - } - if !s.Lastaction.IsUnset() { - t.Lastaction = s.Lastaction.MustGetNull() - } - if !s.Laststatus.IsUnset() { - t.Laststatus = s.Laststatus.MustGetNull() - } - if !s.Lasttreatdate.IsUnset() { - t.Lasttreatdate = s.Lasttreatdate.MustGetNull() - } - if !s.Nexttreatmentdate.IsUnset() { - t.Nexttreatmentdate = s.Nexttreatmentdate.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Symbology.IsUnset() { - t.Symbology = s.Symbology.MustGetNull() - } - if !s.Type.IsUnset() { - t.Type = s.Type.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSStormdrainSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSStormdrains.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 23) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[1] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[2] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[3] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[4] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[5] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Jurisdiction.IsUnset() { - vals[6] = psql.Arg(s.Jurisdiction.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Lastaction.IsUnset() { - vals[7] = psql.Arg(s.Lastaction.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Laststatus.IsUnset() { - vals[8] = psql.Arg(s.Laststatus.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatdate.IsUnset() { - vals[9] = psql.Arg(s.Lasttreatdate.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Nexttreatmentdate.IsUnset() { - vals[10] = psql.Arg(s.Nexttreatmentdate.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[11] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Symbology.IsUnset() { - vals[12] = psql.Arg(s.Symbology.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Type.IsUnset() { - vals[13] = psql.Arg(s.Type.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[14] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[15] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[16] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[17] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[18] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[19] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[20] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[21] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[22] = psql.Arg(s.Updated.MustGet()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSStormdrainSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSStormdrainSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 23) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Jurisdiction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "jurisdiction")...), - psql.Arg(s.Jurisdiction), - }}) - } - - if !s.Lastaction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastaction")...), - psql.Arg(s.Lastaction), - }}) - } - - if !s.Laststatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "laststatus")...), - psql.Arg(s.Laststatus), - }}) - } - - if !s.Lasttreatdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatdate")...), - psql.Arg(s.Lasttreatdate), - }}) - } - - if !s.Nexttreatmentdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nexttreatmentdate")...), - psql.Arg(s.Nexttreatmentdate), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Symbology.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "symbology")...), - psql.Arg(s.Symbology), - }}) - } - - if !s.Type.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "type")...), - psql.Arg(s.Type), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSStormdrain retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSStormdrain(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSStormdrain, error) { - if len(cols) == 0 { - return FSStormdrains.Query( - sm.Where(FSStormdrains.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSStormdrains.Query( - sm.Where(FSStormdrains.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSStormdrains.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSStormdrainExists checks the presence of a single record by primary key -func FSStormdrainExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSStormdrains.Query( - sm.Where(FSStormdrains.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSStormdrain is retrieved from the database -func (o *FSStormdrain) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSStormdrains.AfterSelectHooks.RunHooks(ctx, exec, FSStormdrainSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSStormdrains.AfterInsertHooks.RunHooks(ctx, exec, FSStormdrainSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSStormdrains.AfterUpdateHooks.RunHooks(ctx, exec, FSStormdrainSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSStormdrains.AfterDeleteHooks.RunHooks(ctx, exec, FSStormdrainSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSStormdrain -func (o *FSStormdrain) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSStormdrain) pkEQ() dialect.Expression { - return psql.Quote("fs_stormdrain", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSStormdrain -func (o *FSStormdrain) Update(ctx context.Context, exec bob.Executor, s *FSStormdrainSetter) error { - v, err := FSStormdrains.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 FSStormdrain record with an executor -func (o *FSStormdrain) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSStormdrains.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSStormdrain using the executor -func (o *FSStormdrain) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSStormdrains.Query( - sm.Where(FSStormdrains.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSStormdrainSlice is retrieved from the database -func (o FSStormdrainSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSStormdrains.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSStormdrains.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSStormdrains.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSStormdrains.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSStormdrainSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_stormdrain", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSStormdrainSlice) copyMatchingRows(from ...*FSStormdrain) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSStormdrainSlice) 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 FSStormdrains.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 *FSStormdrain: - o.copyMatchingRows(retrieved) - case []*FSStormdrain: - o.copyMatchingRows(retrieved...) - case FSStormdrainSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSStormdrain or a slice of FSStormdrain - // then run the AfterUpdateHooks on the slice - _, err = FSStormdrains.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSStormdrainSlice) 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 FSStormdrains.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 *FSStormdrain: - o.copyMatchingRows(retrieved) - case []*FSStormdrain: - o.copyMatchingRows(retrieved...) - case FSStormdrainSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSStormdrain or a slice of FSStormdrain - // then run the AfterDeleteHooks on the slice - _, err = FSStormdrains.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSStormdrainSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSStormdrainSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSStormdrains.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSStormdrainSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSStormdrains.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSStormdrainSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSStormdrains.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 *FSStormdrain) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSStormdrainSlice) 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 attachFSStormdrainOrganization0(ctx context.Context, exec bob.Executor, count int, fsStormdrain0 *FSStormdrain, organization1 *Organization) (*FSStormdrain, error) { - setter := &FSStormdrainSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsStormdrain0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSStormdrainOrganization0: %w", err) - } - - return fsStormdrain0, nil -} - -func (fsStormdrain0 *FSStormdrain) 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 = attachFSStormdrainOrganization0(ctx, exec, 1, fsStormdrain0, organization1) - if err != nil { - return err - } - - fsStormdrain0.R.Organization = organization1 - - organization1.R.FSStormdrains = append(organization1.R.FSStormdrains, fsStormdrain0) - - return nil -} - -func (fsStormdrain0 *FSStormdrain) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSStormdrainOrganization0(ctx, exec, 1, fsStormdrain0, organization1) - if err != nil { - return err - } - - fsStormdrain0.R.Organization = organization1 - - organization1.R.FSStormdrains = append(organization1.R.FSStormdrains, fsStormdrain0) - - return nil -} - -type fsStormdrainWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Jurisdiction psql.WhereNullMod[Q, string] - Lastaction psql.WhereNullMod[Q, string] - Laststatus psql.WhereNullMod[Q, string] - Lasttreatdate psql.WhereNullMod[Q, int64] - Nexttreatmentdate psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Symbology psql.WhereNullMod[Q, string] - Type psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - 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] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsStormdrainWhere[Q]) AliasedAs(alias string) fsStormdrainWhere[Q] { - return buildFSStormdrainWhere[Q](buildFSStormdrainColumns(alias)) -} - -func buildFSStormdrainWhere[Q psql.Filterable](cols fsStormdrainColumns) fsStormdrainWhere[Q] { - return fsStormdrainWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - 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), - Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), - Nexttreatmentdate: psql.WhereNull[Q, int64](cols.Nexttreatmentdate), - Objectid: psql.Where[Q, int32](cols.Objectid), - Symbology: psql.WhereNull[Q, string](cols.Symbology), - Type: psql.WhereNull[Q, string](cols.Type), - Zone: psql.WhereNull[Q, string](cols.Zone), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSStormdrain) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsStormdrain cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSStormdrains = FSStormdrainSlice{o} - } - return nil - default: - return fmt.Errorf("fsStormdrain has no relationship %q", name) - } -} - -type fsStormdrainPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSStormdrainPreloader() fsStormdrainPreloader { - return fsStormdrainPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSStormdrains, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsStormdrainThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSStormdrainThenLoader[Q orm.Loadable]() fsStormdrainThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsStormdrainThenLoader[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 fsStormdrain's Organization into the .R struct -func (o *FSStormdrain) 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.FSStormdrains = FSStormdrainSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsStormdrain's Organization into the .R struct -func (os FSStormdrainSlice) 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.FSStormdrains = append(rel.R.FSStormdrains, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsStormdrainJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsStormdrainJoins[Q]) aliasedAs(alias string) fsStormdrainJoins[Q] { - return buildFSStormdrainJoins[Q](buildFSStormdrainColumns(alias), j.typ) -} - -func buildFSStormdrainJoins[Q dialect.Joinable](cols fsStormdrainColumns, typ string) fsStormdrainJoins[Q] { - return fsStormdrainJoins[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/db/models/fs_timecard.bob.go b/db/models/fs_timecard.bob.go deleted file mode 100644 index 4230a2fc..00000000 --- a/db/models/fs_timecard.bob.go +++ /dev/null @@ -1,1355 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSTimecard is an object representing the database table. -type FSTimecard struct { - OrganizationID int32 `db:"organization_id" ` - Activity null.Val[string] `db:"activity" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Equiptype null.Val[string] `db:"equiptype" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Globalid string `db:"globalid" ` - Lclocid null.Val[string] `db:"lclocid" ` - Linelocid null.Val[string] `db:"linelocid" ` - Locationname null.Val[string] `db:"locationname" ` - Objectid int32 `db:"objectid,pk" ` - Pointlocid null.Val[string] `db:"pointlocid" ` - Polygonlocid null.Val[string] `db:"polygonlocid" ` - Samplelocid null.Val[string] `db:"samplelocid" ` - Srid null.Val[string] `db:"srid" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Traplocid null.Val[string] `db:"traplocid" ` - 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" ` - Rodentlocid null.Val[string] `db:"rodentlocid" ` - Updated time.Time `db:"updated" ` - - R fsTimecardR `db:"-" ` -} - -// FSTimecardSlice is an alias for a slice of pointers to FSTimecard. -// This should almost always be used instead of []*FSTimecard. -type FSTimecardSlice []*FSTimecard - -// FSTimecards contains methods to work with the fs_timecard table -var FSTimecards = psql.NewTablex[*FSTimecard, FSTimecardSlice, *FSTimecardSetter]("", "fs_timecard", buildFSTimecardColumns("fs_timecard")) - -// FSTimecardsQuery is a query on the fs_timecard table -type FSTimecardsQuery = *psql.ViewQuery[*FSTimecard, FSTimecardSlice] - -// fsTimecardR is where relationships are stored. -type fsTimecardR struct { - Organization *Organization // fs_timecard.fs_timecard_organization_id_fkey -} - -func buildFSTimecardColumns(alias string) fsTimecardColumns { - return fsTimecardColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "activity", "comments", "creationdate", "creator", "enddatetime", "equiptype", "externalid", "editdate", "editor", "fieldtech", "globalid", "lclocid", "linelocid", "locationname", "objectid", "pointlocid", "polygonlocid", "samplelocid", "srid", "startdatetime", "traplocid", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "rodentlocid", "updated", - ).WithParent("fs_timecard"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Activity: psql.Quote(alias, "activity"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Enddatetime: psql.Quote(alias, "enddatetime"), - Equiptype: psql.Quote(alias, "equiptype"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fieldtech: psql.Quote(alias, "fieldtech"), - Globalid: psql.Quote(alias, "globalid"), - Lclocid: psql.Quote(alias, "lclocid"), - Linelocid: psql.Quote(alias, "linelocid"), - Locationname: psql.Quote(alias, "locationname"), - Objectid: psql.Quote(alias, "objectid"), - Pointlocid: psql.Quote(alias, "pointlocid"), - Polygonlocid: psql.Quote(alias, "polygonlocid"), - Samplelocid: psql.Quote(alias, "samplelocid"), - Srid: psql.Quote(alias, "srid"), - Startdatetime: psql.Quote(alias, "startdatetime"), - Traplocid: psql.Quote(alias, "traplocid"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Rodentlocid: psql.Quote(alias, "rodentlocid"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsTimecardColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Activity psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Enddatetime psql.Expression - Equiptype psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fieldtech psql.Expression - Globalid psql.Expression - Lclocid psql.Expression - Linelocid psql.Expression - Locationname psql.Expression - Objectid psql.Expression - Pointlocid psql.Expression - Polygonlocid psql.Expression - Samplelocid psql.Expression - Srid psql.Expression - Startdatetime psql.Expression - Traplocid psql.Expression - Zone psql.Expression - Zone2 psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Rodentlocid psql.Expression - Updated psql.Expression -} - -func (c fsTimecardColumns) Alias() string { - return c.tableAlias -} - -func (fsTimecardColumns) AliasedAs(alias string) fsTimecardColumns { - return buildFSTimecardColumns(alias) -} - -// FSTimecardSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSTimecardSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Activity omitnull.Val[string] `db:"activity" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Equiptype omitnull.Val[string] `db:"equiptype" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Globalid omit.Val[string] `db:"globalid" ` - Lclocid omitnull.Val[string] `db:"lclocid" ` - Linelocid omitnull.Val[string] `db:"linelocid" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Pointlocid omitnull.Val[string] `db:"pointlocid" ` - Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` - Samplelocid omitnull.Val[string] `db:"samplelocid" ` - Srid omitnull.Val[string] `db:"srid" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Traplocid omitnull.Val[string] `db:"traplocid" ` - 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" ` - Rodentlocid omitnull.Val[string] `db:"rodentlocid" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSTimecardSetter) SetColumns() []string { - vals := make([]string, 0, 32) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Activity.IsUnset() { - vals = append(vals, "activity") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Enddatetime.IsUnset() { - vals = append(vals, "enddatetime") - } - if !s.Equiptype.IsUnset() { - vals = append(vals, "equiptype") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fieldtech.IsUnset() { - vals = append(vals, "fieldtech") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Lclocid.IsUnset() { - vals = append(vals, "lclocid") - } - if !s.Linelocid.IsUnset() { - vals = append(vals, "linelocid") - } - if !s.Locationname.IsUnset() { - vals = append(vals, "locationname") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Pointlocid.IsUnset() { - vals = append(vals, "pointlocid") - } - if !s.Polygonlocid.IsUnset() { - vals = append(vals, "polygonlocid") - } - if !s.Samplelocid.IsUnset() { - vals = append(vals, "samplelocid") - } - if !s.Srid.IsUnset() { - vals = append(vals, "srid") - } - if !s.Startdatetime.IsUnset() { - vals = append(vals, "startdatetime") - } - if !s.Traplocid.IsUnset() { - vals = append(vals, "traplocid") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Rodentlocid.IsUnset() { - vals = append(vals, "rodentlocid") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSTimecardSetter) Overwrite(t *FSTimecard) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Activity.IsUnset() { - t.Activity = s.Activity.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Enddatetime.IsUnset() { - t.Enddatetime = s.Enddatetime.MustGetNull() - } - if !s.Equiptype.IsUnset() { - t.Equiptype = s.Equiptype.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fieldtech.IsUnset() { - t.Fieldtech = s.Fieldtech.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Lclocid.IsUnset() { - t.Lclocid = s.Lclocid.MustGetNull() - } - if !s.Linelocid.IsUnset() { - t.Linelocid = s.Linelocid.MustGetNull() - } - if !s.Locationname.IsUnset() { - t.Locationname = s.Locationname.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Pointlocid.IsUnset() { - t.Pointlocid = s.Pointlocid.MustGetNull() - } - if !s.Polygonlocid.IsUnset() { - t.Polygonlocid = s.Polygonlocid.MustGetNull() - } - if !s.Samplelocid.IsUnset() { - t.Samplelocid = s.Samplelocid.MustGetNull() - } - if !s.Srid.IsUnset() { - t.Srid = s.Srid.MustGetNull() - } - if !s.Startdatetime.IsUnset() { - t.Startdatetime = s.Startdatetime.MustGetNull() - } - if !s.Traplocid.IsUnset() { - t.Traplocid = s.Traplocid.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Rodentlocid.IsUnset() { - t.Rodentlocid = s.Rodentlocid.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSTimecardSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSTimecards.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 32) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Activity.IsUnset() { - vals[1] = psql.Arg(s.Activity.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[2] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[3] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[4] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Enddatetime.IsUnset() { - vals[5] = psql.Arg(s.Enddatetime.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Equiptype.IsUnset() { - vals[6] = psql.Arg(s.Equiptype.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[7] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[8] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[9] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Fieldtech.IsUnset() { - vals[10] = psql.Arg(s.Fieldtech.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[11] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Lclocid.IsUnset() { - vals[12] = psql.Arg(s.Lclocid.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Linelocid.IsUnset() { - vals[13] = psql.Arg(s.Linelocid.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Locationname.IsUnset() { - vals[14] = psql.Arg(s.Locationname.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[15] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Pointlocid.IsUnset() { - vals[16] = psql.Arg(s.Pointlocid.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Polygonlocid.IsUnset() { - vals[17] = psql.Arg(s.Polygonlocid.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Samplelocid.IsUnset() { - vals[18] = psql.Arg(s.Samplelocid.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Srid.IsUnset() { - vals[19] = psql.Arg(s.Srid.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Startdatetime.IsUnset() { - vals[20] = psql.Arg(s.Startdatetime.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Traplocid.IsUnset() { - vals[21] = psql.Arg(s.Traplocid.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[22] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[23] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[24] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[25] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[26] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[27] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[28] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[29] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Rodentlocid.IsUnset() { - vals[30] = psql.Arg(s.Rodentlocid.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[31] = psql.Arg(s.Updated.MustGet()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSTimecardSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSTimecardSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 32) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Activity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "activity")...), - psql.Arg(s.Activity), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Enddatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "enddatetime")...), - psql.Arg(s.Enddatetime), - }}) - } - - if !s.Equiptype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "equiptype")...), - psql.Arg(s.Equiptype), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fieldtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldtech")...), - psql.Arg(s.Fieldtech), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Lclocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lclocid")...), - psql.Arg(s.Lclocid), - }}) - } - - if !s.Linelocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "linelocid")...), - psql.Arg(s.Linelocid), - }}) - } - - if !s.Locationname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationname")...), - psql.Arg(s.Locationname), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Pointlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pointlocid")...), - psql.Arg(s.Pointlocid), - }}) - } - - if !s.Polygonlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "polygonlocid")...), - psql.Arg(s.Polygonlocid), - }}) - } - - if !s.Samplelocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "samplelocid")...), - psql.Arg(s.Samplelocid), - }}) - } - - if !s.Srid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "srid")...), - psql.Arg(s.Srid), - }}) - } - - if !s.Startdatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "startdatetime")...), - psql.Arg(s.Startdatetime), - }}) - } - - if !s.Traplocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "traplocid")...), - psql.Arg(s.Traplocid), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Rodentlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "rodentlocid")...), - psql.Arg(s.Rodentlocid), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSTimecard retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSTimecard(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSTimecard, error) { - if len(cols) == 0 { - return FSTimecards.Query( - sm.Where(FSTimecards.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSTimecards.Query( - sm.Where(FSTimecards.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSTimecards.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSTimecardExists checks the presence of a single record by primary key -func FSTimecardExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSTimecards.Query( - sm.Where(FSTimecards.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSTimecard is retrieved from the database -func (o *FSTimecard) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSTimecards.AfterSelectHooks.RunHooks(ctx, exec, FSTimecardSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSTimecards.AfterInsertHooks.RunHooks(ctx, exec, FSTimecardSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSTimecards.AfterUpdateHooks.RunHooks(ctx, exec, FSTimecardSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSTimecards.AfterDeleteHooks.RunHooks(ctx, exec, FSTimecardSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSTimecard -func (o *FSTimecard) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSTimecard) pkEQ() dialect.Expression { - return psql.Quote("fs_timecard", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSTimecard -func (o *FSTimecard) Update(ctx context.Context, exec bob.Executor, s *FSTimecardSetter) error { - v, err := FSTimecards.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 FSTimecard record with an executor -func (o *FSTimecard) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSTimecards.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSTimecard using the executor -func (o *FSTimecard) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSTimecards.Query( - sm.Where(FSTimecards.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSTimecardSlice is retrieved from the database -func (o FSTimecardSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSTimecards.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSTimecards.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSTimecards.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSTimecards.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSTimecardSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_timecard", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSTimecardSlice) copyMatchingRows(from ...*FSTimecard) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSTimecardSlice) 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 FSTimecards.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 *FSTimecard: - o.copyMatchingRows(retrieved) - case []*FSTimecard: - o.copyMatchingRows(retrieved...) - case FSTimecardSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSTimecard or a slice of FSTimecard - // then run the AfterUpdateHooks on the slice - _, err = FSTimecards.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSTimecardSlice) 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 FSTimecards.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 *FSTimecard: - o.copyMatchingRows(retrieved) - case []*FSTimecard: - o.copyMatchingRows(retrieved...) - case FSTimecardSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSTimecard or a slice of FSTimecard - // then run the AfterDeleteHooks on the slice - _, err = FSTimecards.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSTimecardSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSTimecardSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSTimecards.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSTimecardSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSTimecards.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSTimecardSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSTimecards.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 *FSTimecard) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSTimecardSlice) 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 attachFSTimecardOrganization0(ctx context.Context, exec bob.Executor, count int, fsTimecard0 *FSTimecard, organization1 *Organization) (*FSTimecard, error) { - setter := &FSTimecardSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsTimecard0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSTimecardOrganization0: %w", err) - } - - return fsTimecard0, nil -} - -func (fsTimecard0 *FSTimecard) 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 = attachFSTimecardOrganization0(ctx, exec, 1, fsTimecard0, organization1) - if err != nil { - return err - } - - fsTimecard0.R.Organization = organization1 - - organization1.R.FSTimecards = append(organization1.R.FSTimecards, fsTimecard0) - - return nil -} - -func (fsTimecard0 *FSTimecard) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSTimecardOrganization0(ctx, exec, 1, fsTimecard0, organization1) - if err != nil { - return err - } - - fsTimecard0.R.Organization = organization1 - - organization1.R.FSTimecards = append(organization1.R.FSTimecards, fsTimecard0) - - return nil -} - -type fsTimecardWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Activity psql.WhereNullMod[Q, string] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Enddatetime psql.WhereNullMod[Q, int64] - Equiptype psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fieldtech psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Lclocid psql.WhereNullMod[Q, string] - Linelocid psql.WhereNullMod[Q, string] - Locationname psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Pointlocid psql.WhereNullMod[Q, string] - Polygonlocid psql.WhereNullMod[Q, string] - Samplelocid psql.WhereNullMod[Q, string] - Srid psql.WhereNullMod[Q, string] - Startdatetime psql.WhereNullMod[Q, int64] - Traplocid psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - 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] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Rodentlocid psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsTimecardWhere[Q]) AliasedAs(alias string) fsTimecardWhere[Q] { - return buildFSTimecardWhere[Q](buildFSTimecardColumns(alias)) -} - -func buildFSTimecardWhere[Q psql.Filterable](cols fsTimecardColumns) fsTimecardWhere[Q] { - return fsTimecardWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Activity: psql.WhereNull[Q, string](cols.Activity), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), - Equiptype: psql.WhereNull[Q, string](cols.Equiptype), - Externalid: psql.WhereNull[Q, string](cols.Externalid), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), - 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), - Objectid: psql.Where[Q, int32](cols.Objectid), - Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), - Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), - Samplelocid: psql.WhereNull[Q, string](cols.Samplelocid), - Srid: psql.WhereNull[Q, string](cols.Srid), - Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), - Traplocid: psql.WhereNull[Q, string](cols.Traplocid), - Zone: psql.WhereNull[Q, string](cols.Zone), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Rodentlocid: psql.WhereNull[Q, string](cols.Rodentlocid), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSTimecard) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsTimecard cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSTimecards = FSTimecardSlice{o} - } - return nil - default: - return fmt.Errorf("fsTimecard has no relationship %q", name) - } -} - -type fsTimecardPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSTimecardPreloader() fsTimecardPreloader { - return fsTimecardPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSTimecards, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsTimecardThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSTimecardThenLoader[Q orm.Loadable]() fsTimecardThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsTimecardThenLoader[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 fsTimecard's Organization into the .R struct -func (o *FSTimecard) 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.FSTimecards = FSTimecardSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsTimecard's Organization into the .R struct -func (os FSTimecardSlice) 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.FSTimecards = append(rel.R.FSTimecards, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsTimecardJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsTimecardJoins[Q]) aliasedAs(alias string) fsTimecardJoins[Q] { - return buildFSTimecardJoins[Q](buildFSTimecardColumns(alias), j.typ) -} - -func buildFSTimecardJoins[Q dialect.Joinable](cols fsTimecardColumns, typ string) fsTimecardJoins[Q] { - return fsTimecardJoins[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/db/models/fs_trapdata.bob.go b/db/models/fs_trapdata.bob.go deleted file mode 100644 index e2783c28..00000000 --- a/db/models/fs_trapdata.bob.go +++ /dev/null @@ -1,1705 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSTrapdatum is an object representing the database table. -type FSTrapdatum struct { - OrganizationID int32 `db:"organization_id" ` - Avetemp null.Val[float64] `db:"avetemp" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Field null.Val[int64] `db:"field" ` - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid string `db:"globalid" ` - Idbytech null.Val[string] `db:"idbytech" ` - Locationname null.Val[string] `db:"locationname" ` - LocID null.Val[string] `db:"loc_id" ` - LR null.Val[int16] `db:"lr" ` - Objectid int32 `db:"objectid,pk" ` - Processed null.Val[int16] `db:"processed" ` - Raingauge null.Val[float64] `db:"raingauge" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Sitecond null.Val[string] `db:"sitecond" ` - Sortbytech null.Val[string] `db:"sortbytech" ` - Srid null.Val[string] `db:"srid" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Trapactivitytype null.Val[string] `db:"trapactivitytype" ` - Trapcondition null.Val[string] `db:"trapcondition" ` - Trapnights null.Val[int16] `db:"trapnights" ` - Traptype null.Val[string] `db:"traptype" ` - Voltage null.Val[float64] `db:"voltage" ` - Winddir null.Val[string] `db:"winddir" ` - Windspeed null.Val[float64] `db:"windspeed" ` - 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" ` - Lure null.Val[string] `db:"lure" ` - Vectorsurvtrapdataid null.Val[string] `db:"vectorsurvtrapdataid" ` - Vectorsurvtraplocationid null.Val[string] `db:"vectorsurvtraplocationid" ` - Updated time.Time `db:"updated" ` - - R fsTrapdatumR `db:"-" ` -} - -// FSTrapdatumSlice is an alias for a slice of pointers to FSTrapdatum. -// This should almost always be used instead of []*FSTrapdatum. -type FSTrapdatumSlice []*FSTrapdatum - -// FSTrapdata contains methods to work with the fs_trapdata table -var FSTrapdata = psql.NewTablex[*FSTrapdatum, FSTrapdatumSlice, *FSTrapdatumSetter]("", "fs_trapdata", buildFSTrapdatumColumns("fs_trapdata")) - -// FSTrapdataQuery is a query on the fs_trapdata table -type FSTrapdataQuery = *psql.ViewQuery[*FSTrapdatum, FSTrapdatumSlice] - -// fsTrapdatumR is where relationships are stored. -type fsTrapdatumR struct { - Organization *Organization // fs_trapdata.fs_trapdata_organization_id_fkey -} - -func buildFSTrapdatumColumns(alias string) fsTrapdatumColumns { - return fsTrapdatumColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "avetemp", "comments", "creationdate", "creator", "enddatetime", "editdate", "editor", "fieldtech", "field", "gatewaysync", "globalid", "idbytech", "locationname", "loc_id", "lr", "objectid", "processed", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sitecond", "sortbytech", "srid", "startdatetime", "trapactivitytype", "trapcondition", "trapnights", "traptype", "voltage", "winddir", "windspeed", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "lure", "vectorsurvtrapdataid", "vectorsurvtraplocationid", "updated", - ).WithParent("fs_trapdata"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Avetemp: psql.Quote(alias, "avetemp"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Enddatetime: psql.Quote(alias, "enddatetime"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fieldtech: psql.Quote(alias, "fieldtech"), - Field: psql.Quote(alias, "field"), - Gatewaysync: psql.Quote(alias, "gatewaysync"), - Globalid: psql.Quote(alias, "globalid"), - Idbytech: psql.Quote(alias, "idbytech"), - Locationname: psql.Quote(alias, "locationname"), - LocID: psql.Quote(alias, "loc_id"), - LR: psql.Quote(alias, "lr"), - Objectid: psql.Quote(alias, "objectid"), - Processed: psql.Quote(alias, "processed"), - Raingauge: psql.Quote(alias, "raingauge"), - Recordstatus: psql.Quote(alias, "recordstatus"), - Reviewed: psql.Quote(alias, "reviewed"), - Reviewedby: psql.Quote(alias, "reviewedby"), - Revieweddate: psql.Quote(alias, "revieweddate"), - Sitecond: psql.Quote(alias, "sitecond"), - Sortbytech: psql.Quote(alias, "sortbytech"), - Srid: psql.Quote(alias, "srid"), - Startdatetime: psql.Quote(alias, "startdatetime"), - Trapactivitytype: psql.Quote(alias, "trapactivitytype"), - Trapcondition: psql.Quote(alias, "trapcondition"), - Trapnights: psql.Quote(alias, "trapnights"), - Traptype: psql.Quote(alias, "traptype"), - Voltage: psql.Quote(alias, "voltage"), - Winddir: psql.Quote(alias, "winddir"), - Windspeed: psql.Quote(alias, "windspeed"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Lure: psql.Quote(alias, "lure"), - Vectorsurvtrapdataid: psql.Quote(alias, "vectorsurvtrapdataid"), - Vectorsurvtraplocationid: psql.Quote(alias, "vectorsurvtraplocationid"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsTrapdatumColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Avetemp psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Enddatetime psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fieldtech psql.Expression - Field psql.Expression - Gatewaysync psql.Expression - Globalid psql.Expression - Idbytech psql.Expression - Locationname psql.Expression - LocID psql.Expression - LR psql.Expression - Objectid psql.Expression - Processed psql.Expression - Raingauge psql.Expression - Recordstatus psql.Expression - Reviewed psql.Expression - Reviewedby psql.Expression - Revieweddate psql.Expression - Sitecond psql.Expression - Sortbytech psql.Expression - Srid psql.Expression - Startdatetime psql.Expression - Trapactivitytype psql.Expression - Trapcondition psql.Expression - Trapnights psql.Expression - Traptype psql.Expression - Voltage psql.Expression - Winddir psql.Expression - Windspeed psql.Expression - Zone psql.Expression - Zone2 psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Lure psql.Expression - Vectorsurvtrapdataid psql.Expression - Vectorsurvtraplocationid psql.Expression - Updated psql.Expression -} - -func (c fsTrapdatumColumns) Alias() string { - return c.tableAlias -} - -func (fsTrapdatumColumns) AliasedAs(alias string) fsTrapdatumColumns { - return buildFSTrapdatumColumns(alias) -} - -// FSTrapdatumSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSTrapdatumSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Field omitnull.Val[int64] `db:"field" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - 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" ` - LR omitnull.Val[int16] `db:"lr" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Processed omitnull.Val[int16] `db:"processed" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Sitecond omitnull.Val[string] `db:"sitecond" ` - Sortbytech omitnull.Val[string] `db:"sortbytech" ` - Srid omitnull.Val[string] `db:"srid" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Trapactivitytype omitnull.Val[string] `db:"trapactivitytype" ` - Trapcondition omitnull.Val[string] `db:"trapcondition" ` - Trapnights omitnull.Val[int16] `db:"trapnights" ` - Traptype omitnull.Val[string] `db:"traptype" ` - Voltage omitnull.Val[float64] `db:"voltage" ` - Winddir omitnull.Val[string] `db:"winddir" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - 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" ` - Lure omitnull.Val[string] `db:"lure" ` - Vectorsurvtrapdataid omitnull.Val[string] `db:"vectorsurvtrapdataid" ` - Vectorsurvtraplocationid omitnull.Val[string] `db:"vectorsurvtraplocationid" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSTrapdatumSetter) SetColumns() []string { - vals := make([]string, 0, 46) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Avetemp.IsUnset() { - vals = append(vals, "avetemp") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Enddatetime.IsUnset() { - vals = append(vals, "enddatetime") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fieldtech.IsUnset() { - vals = append(vals, "fieldtech") - } - if !s.Field.IsUnset() { - vals = append(vals, "field") - } - if !s.Gatewaysync.IsUnset() { - vals = append(vals, "gatewaysync") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Idbytech.IsUnset() { - vals = append(vals, "idbytech") - } - if !s.Locationname.IsUnset() { - vals = append(vals, "locationname") - } - if !s.LocID.IsUnset() { - vals = append(vals, "loc_id") - } - if !s.LR.IsUnset() { - vals = append(vals, "lr") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Processed.IsUnset() { - vals = append(vals, "processed") - } - if !s.Raingauge.IsUnset() { - vals = append(vals, "raingauge") - } - if !s.Recordstatus.IsUnset() { - vals = append(vals, "recordstatus") - } - if !s.Reviewed.IsUnset() { - vals = append(vals, "reviewed") - } - if !s.Reviewedby.IsUnset() { - vals = append(vals, "reviewedby") - } - if !s.Revieweddate.IsUnset() { - vals = append(vals, "revieweddate") - } - if !s.Sitecond.IsUnset() { - vals = append(vals, "sitecond") - } - if !s.Sortbytech.IsUnset() { - vals = append(vals, "sortbytech") - } - if !s.Srid.IsUnset() { - vals = append(vals, "srid") - } - if !s.Startdatetime.IsUnset() { - vals = append(vals, "startdatetime") - } - if !s.Trapactivitytype.IsUnset() { - vals = append(vals, "trapactivitytype") - } - if !s.Trapcondition.IsUnset() { - vals = append(vals, "trapcondition") - } - if !s.Trapnights.IsUnset() { - vals = append(vals, "trapnights") - } - if !s.Traptype.IsUnset() { - vals = append(vals, "traptype") - } - if !s.Voltage.IsUnset() { - vals = append(vals, "voltage") - } - if !s.Winddir.IsUnset() { - vals = append(vals, "winddir") - } - if !s.Windspeed.IsUnset() { - vals = append(vals, "windspeed") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Lure.IsUnset() { - vals = append(vals, "lure") - } - if !s.Vectorsurvtrapdataid.IsUnset() { - vals = append(vals, "vectorsurvtrapdataid") - } - if !s.Vectorsurvtraplocationid.IsUnset() { - vals = append(vals, "vectorsurvtraplocationid") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSTrapdatumSetter) Overwrite(t *FSTrapdatum) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Avetemp.IsUnset() { - t.Avetemp = s.Avetemp.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Enddatetime.IsUnset() { - t.Enddatetime = s.Enddatetime.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fieldtech.IsUnset() { - t.Fieldtech = s.Fieldtech.MustGetNull() - } - if !s.Field.IsUnset() { - t.Field = s.Field.MustGetNull() - } - if !s.Gatewaysync.IsUnset() { - t.Gatewaysync = s.Gatewaysync.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Idbytech.IsUnset() { - t.Idbytech = s.Idbytech.MustGetNull() - } - if !s.Locationname.IsUnset() { - t.Locationname = s.Locationname.MustGetNull() - } - if !s.LocID.IsUnset() { - t.LocID = s.LocID.MustGetNull() - } - if !s.LR.IsUnset() { - t.LR = s.LR.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Processed.IsUnset() { - t.Processed = s.Processed.MustGetNull() - } - if !s.Raingauge.IsUnset() { - t.Raingauge = s.Raingauge.MustGetNull() - } - if !s.Recordstatus.IsUnset() { - t.Recordstatus = s.Recordstatus.MustGetNull() - } - if !s.Reviewed.IsUnset() { - t.Reviewed = s.Reviewed.MustGetNull() - } - if !s.Reviewedby.IsUnset() { - t.Reviewedby = s.Reviewedby.MustGetNull() - } - if !s.Revieweddate.IsUnset() { - t.Revieweddate = s.Revieweddate.MustGetNull() - } - if !s.Sitecond.IsUnset() { - t.Sitecond = s.Sitecond.MustGetNull() - } - if !s.Sortbytech.IsUnset() { - t.Sortbytech = s.Sortbytech.MustGetNull() - } - if !s.Srid.IsUnset() { - t.Srid = s.Srid.MustGetNull() - } - if !s.Startdatetime.IsUnset() { - t.Startdatetime = s.Startdatetime.MustGetNull() - } - if !s.Trapactivitytype.IsUnset() { - t.Trapactivitytype = s.Trapactivitytype.MustGetNull() - } - if !s.Trapcondition.IsUnset() { - t.Trapcondition = s.Trapcondition.MustGetNull() - } - if !s.Trapnights.IsUnset() { - t.Trapnights = s.Trapnights.MustGetNull() - } - if !s.Traptype.IsUnset() { - t.Traptype = s.Traptype.MustGetNull() - } - if !s.Voltage.IsUnset() { - t.Voltage = s.Voltage.MustGetNull() - } - if !s.Winddir.IsUnset() { - t.Winddir = s.Winddir.MustGetNull() - } - if !s.Windspeed.IsUnset() { - t.Windspeed = s.Windspeed.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Lure.IsUnset() { - t.Lure = s.Lure.MustGetNull() - } - if !s.Vectorsurvtrapdataid.IsUnset() { - t.Vectorsurvtrapdataid = s.Vectorsurvtrapdataid.MustGetNull() - } - if !s.Vectorsurvtraplocationid.IsUnset() { - t.Vectorsurvtraplocationid = s.Vectorsurvtraplocationid.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSTrapdatumSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSTrapdata.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 46) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Avetemp.IsUnset() { - vals[1] = psql.Arg(s.Avetemp.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[2] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[3] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[4] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Enddatetime.IsUnset() { - vals[5] = psql.Arg(s.Enddatetime.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[6] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[7] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Fieldtech.IsUnset() { - vals[8] = psql.Arg(s.Fieldtech.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Field.IsUnset() { - vals[9] = psql.Arg(s.Field.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Gatewaysync.IsUnset() { - vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[11] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Idbytech.IsUnset() { - vals[12] = psql.Arg(s.Idbytech.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Locationname.IsUnset() { - vals[13] = psql.Arg(s.Locationname.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.LocID.IsUnset() { - vals[14] = psql.Arg(s.LocID.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.LR.IsUnset() { - vals[15] = psql.Arg(s.LR.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[16] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Processed.IsUnset() { - vals[17] = psql.Arg(s.Processed.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Raingauge.IsUnset() { - vals[18] = psql.Arg(s.Raingauge.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Recordstatus.IsUnset() { - vals[19] = psql.Arg(s.Recordstatus.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Reviewed.IsUnset() { - vals[20] = psql.Arg(s.Reviewed.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Reviewedby.IsUnset() { - vals[21] = psql.Arg(s.Reviewedby.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Revieweddate.IsUnset() { - vals[22] = psql.Arg(s.Revieweddate.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Sitecond.IsUnset() { - vals[23] = psql.Arg(s.Sitecond.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Sortbytech.IsUnset() { - vals[24] = psql.Arg(s.Sortbytech.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Srid.IsUnset() { - vals[25] = psql.Arg(s.Srid.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Startdatetime.IsUnset() { - vals[26] = psql.Arg(s.Startdatetime.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Trapactivitytype.IsUnset() { - vals[27] = psql.Arg(s.Trapactivitytype.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Trapcondition.IsUnset() { - vals[28] = psql.Arg(s.Trapcondition.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Trapnights.IsUnset() { - vals[29] = psql.Arg(s.Trapnights.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Traptype.IsUnset() { - vals[30] = psql.Arg(s.Traptype.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Voltage.IsUnset() { - vals[31] = psql.Arg(s.Voltage.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Winddir.IsUnset() { - vals[32] = psql.Arg(s.Winddir.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Windspeed.IsUnset() { - vals[33] = psql.Arg(s.Windspeed.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[34] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[35] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[36] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[37] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[38] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[39] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[40] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[41] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.Lure.IsUnset() { - vals[42] = psql.Arg(s.Lure.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.Vectorsurvtrapdataid.IsUnset() { - vals[43] = psql.Arg(s.Vectorsurvtrapdataid.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.Vectorsurvtraplocationid.IsUnset() { - vals[44] = psql.Arg(s.Vectorsurvtraplocationid.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[45] = psql.Arg(s.Updated.MustGet()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSTrapdatumSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSTrapdatumSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 46) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Avetemp.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "avetemp")...), - psql.Arg(s.Avetemp), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Enddatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "enddatetime")...), - psql.Arg(s.Enddatetime), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fieldtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldtech")...), - psql.Arg(s.Fieldtech), - }}) - } - - if !s.Field.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "field")...), - psql.Arg(s.Field), - }}) - } - - if !s.Gatewaysync.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "gatewaysync")...), - psql.Arg(s.Gatewaysync), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Idbytech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "idbytech")...), - psql.Arg(s.Idbytech), - }}) - } - - if !s.Locationname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationname")...), - psql.Arg(s.Locationname), - }}) - } - - if !s.LocID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "loc_id")...), - psql.Arg(s.LocID), - }}) - } - - if !s.LR.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lr")...), - psql.Arg(s.LR), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Processed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "processed")...), - psql.Arg(s.Processed), - }}) - } - - if !s.Raingauge.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "raingauge")...), - psql.Arg(s.Raingauge), - }}) - } - - if !s.Recordstatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "recordstatus")...), - psql.Arg(s.Recordstatus), - }}) - } - - if !s.Reviewed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewed")...), - psql.Arg(s.Reviewed), - }}) - } - - if !s.Reviewedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewedby")...), - psql.Arg(s.Reviewedby), - }}) - } - - if !s.Revieweddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "revieweddate")...), - psql.Arg(s.Revieweddate), - }}) - } - - if !s.Sitecond.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sitecond")...), - psql.Arg(s.Sitecond), - }}) - } - - if !s.Sortbytech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sortbytech")...), - psql.Arg(s.Sortbytech), - }}) - } - - if !s.Srid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "srid")...), - psql.Arg(s.Srid), - }}) - } - - if !s.Startdatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "startdatetime")...), - psql.Arg(s.Startdatetime), - }}) - } - - if !s.Trapactivitytype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "trapactivitytype")...), - psql.Arg(s.Trapactivitytype), - }}) - } - - if !s.Trapcondition.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "trapcondition")...), - psql.Arg(s.Trapcondition), - }}) - } - - if !s.Trapnights.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "trapnights")...), - psql.Arg(s.Trapnights), - }}) - } - - if !s.Traptype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "traptype")...), - psql.Arg(s.Traptype), - }}) - } - - if !s.Voltage.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "voltage")...), - psql.Arg(s.Voltage), - }}) - } - - if !s.Winddir.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "winddir")...), - psql.Arg(s.Winddir), - }}) - } - - if !s.Windspeed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "windspeed")...), - psql.Arg(s.Windspeed), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Lure.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lure")...), - psql.Arg(s.Lure), - }}) - } - - if !s.Vectorsurvtrapdataid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vectorsurvtrapdataid")...), - psql.Arg(s.Vectorsurvtrapdataid), - }}) - } - - if !s.Vectorsurvtraplocationid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vectorsurvtraplocationid")...), - psql.Arg(s.Vectorsurvtraplocationid), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSTrapdatum retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSTrapdatum(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSTrapdatum, error) { - if len(cols) == 0 { - return FSTrapdata.Query( - sm.Where(FSTrapdata.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSTrapdata.Query( - sm.Where(FSTrapdata.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSTrapdata.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSTrapdatumExists checks the presence of a single record by primary key -func FSTrapdatumExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSTrapdata.Query( - sm.Where(FSTrapdata.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSTrapdatum is retrieved from the database -func (o *FSTrapdatum) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSTrapdata.AfterSelectHooks.RunHooks(ctx, exec, FSTrapdatumSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSTrapdata.AfterInsertHooks.RunHooks(ctx, exec, FSTrapdatumSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSTrapdata.AfterUpdateHooks.RunHooks(ctx, exec, FSTrapdatumSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSTrapdata.AfterDeleteHooks.RunHooks(ctx, exec, FSTrapdatumSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSTrapdatum -func (o *FSTrapdatum) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSTrapdatum) pkEQ() dialect.Expression { - return psql.Quote("fs_trapdata", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSTrapdatum -func (o *FSTrapdatum) Update(ctx context.Context, exec bob.Executor, s *FSTrapdatumSetter) error { - v, err := FSTrapdata.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 FSTrapdatum record with an executor -func (o *FSTrapdatum) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSTrapdata.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSTrapdatum using the executor -func (o *FSTrapdatum) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSTrapdata.Query( - sm.Where(FSTrapdata.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSTrapdatumSlice is retrieved from the database -func (o FSTrapdatumSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSTrapdata.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSTrapdata.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSTrapdata.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSTrapdata.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSTrapdatumSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_trapdata", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSTrapdatumSlice) copyMatchingRows(from ...*FSTrapdatum) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSTrapdatumSlice) 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 FSTrapdata.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 *FSTrapdatum: - o.copyMatchingRows(retrieved) - case []*FSTrapdatum: - o.copyMatchingRows(retrieved...) - case FSTrapdatumSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSTrapdatum or a slice of FSTrapdatum - // then run the AfterUpdateHooks on the slice - _, err = FSTrapdata.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSTrapdatumSlice) 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 FSTrapdata.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 *FSTrapdatum: - o.copyMatchingRows(retrieved) - case []*FSTrapdatum: - o.copyMatchingRows(retrieved...) - case FSTrapdatumSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSTrapdatum or a slice of FSTrapdatum - // then run the AfterDeleteHooks on the slice - _, err = FSTrapdata.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSTrapdatumSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSTrapdatumSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSTrapdata.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSTrapdatumSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSTrapdata.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSTrapdatumSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSTrapdata.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 *FSTrapdatum) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSTrapdatumSlice) 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 attachFSTrapdatumOrganization0(ctx context.Context, exec bob.Executor, count int, fsTrapdatum0 *FSTrapdatum, organization1 *Organization) (*FSTrapdatum, error) { - setter := &FSTrapdatumSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsTrapdatum0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSTrapdatumOrganization0: %w", err) - } - - return fsTrapdatum0, nil -} - -func (fsTrapdatum0 *FSTrapdatum) 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 = attachFSTrapdatumOrganization0(ctx, exec, 1, fsTrapdatum0, organization1) - if err != nil { - return err - } - - fsTrapdatum0.R.Organization = organization1 - - organization1.R.FSTrapdata = append(organization1.R.FSTrapdata, fsTrapdatum0) - - return nil -} - -func (fsTrapdatum0 *FSTrapdatum) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSTrapdatumOrganization0(ctx, exec, 1, fsTrapdatum0, organization1) - if err != nil { - return err - } - - fsTrapdatum0.R.Organization = organization1 - - organization1.R.FSTrapdata = append(organization1.R.FSTrapdata, fsTrapdatum0) - - return nil -} - -type fsTrapdatumWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Avetemp psql.WhereNullMod[Q, float64] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Enddatetime psql.WhereNullMod[Q, int64] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fieldtech psql.WhereNullMod[Q, string] - Field psql.WhereNullMod[Q, int64] - Gatewaysync psql.WhereNullMod[Q, int16] - Globalid psql.WhereMod[Q, string] - Idbytech psql.WhereNullMod[Q, string] - Locationname psql.WhereNullMod[Q, string] - LocID psql.WhereNullMod[Q, string] - LR psql.WhereNullMod[Q, int16] - Objectid psql.WhereMod[Q, int32] - Processed psql.WhereNullMod[Q, int16] - Raingauge psql.WhereNullMod[Q, float64] - Recordstatus psql.WhereNullMod[Q, int16] - Reviewed psql.WhereNullMod[Q, int16] - Reviewedby psql.WhereNullMod[Q, string] - Revieweddate psql.WhereNullMod[Q, int64] - Sitecond psql.WhereNullMod[Q, string] - Sortbytech psql.WhereNullMod[Q, string] - Srid psql.WhereNullMod[Q, string] - Startdatetime psql.WhereNullMod[Q, int64] - Trapactivitytype psql.WhereNullMod[Q, string] - Trapcondition psql.WhereNullMod[Q, string] - Trapnights psql.WhereNullMod[Q, int16] - Traptype psql.WhereNullMod[Q, string] - Voltage psql.WhereNullMod[Q, float64] - Winddir psql.WhereNullMod[Q, string] - Windspeed psql.WhereNullMod[Q, float64] - Zone psql.WhereNullMod[Q, string] - 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] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Lure psql.WhereNullMod[Q, string] - Vectorsurvtrapdataid psql.WhereNullMod[Q, string] - Vectorsurvtraplocationid psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsTrapdatumWhere[Q]) AliasedAs(alias string) fsTrapdatumWhere[Q] { - return buildFSTrapdatumWhere[Q](buildFSTrapdatumColumns(alias)) -} - -func buildFSTrapdatumWhere[Q psql.Filterable](cols fsTrapdatumColumns) fsTrapdatumWhere[Q] { - return fsTrapdatumWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), - Field: psql.WhereNull[Q, int64](cols.Field), - Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), - 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), - LR: psql.WhereNull[Q, int16](cols.LR), - Objectid: psql.Where[Q, int32](cols.Objectid), - Processed: psql.WhereNull[Q, int16](cols.Processed), - Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), - Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), - Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), - Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), - Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), - Sitecond: psql.WhereNull[Q, string](cols.Sitecond), - Sortbytech: psql.WhereNull[Q, string](cols.Sortbytech), - Srid: psql.WhereNull[Q, string](cols.Srid), - Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), - Trapactivitytype: psql.WhereNull[Q, string](cols.Trapactivitytype), - Trapcondition: psql.WhereNull[Q, string](cols.Trapcondition), - Trapnights: psql.WhereNull[Q, int16](cols.Trapnights), - Traptype: psql.WhereNull[Q, string](cols.Traptype), - Voltage: psql.WhereNull[Q, float64](cols.Voltage), - Winddir: psql.WhereNull[Q, string](cols.Winddir), - Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), - Zone: psql.WhereNull[Q, string](cols.Zone), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Lure: psql.WhereNull[Q, string](cols.Lure), - Vectorsurvtrapdataid: psql.WhereNull[Q, string](cols.Vectorsurvtrapdataid), - Vectorsurvtraplocationid: psql.WhereNull[Q, string](cols.Vectorsurvtraplocationid), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSTrapdatum) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsTrapdatum cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSTrapdata = FSTrapdatumSlice{o} - } - return nil - default: - return fmt.Errorf("fsTrapdatum has no relationship %q", name) - } -} - -type fsTrapdatumPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSTrapdatumPreloader() fsTrapdatumPreloader { - return fsTrapdatumPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSTrapdata, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsTrapdatumThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSTrapdatumThenLoader[Q orm.Loadable]() fsTrapdatumThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsTrapdatumThenLoader[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 fsTrapdatum's Organization into the .R struct -func (o *FSTrapdatum) 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.FSTrapdata = FSTrapdatumSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsTrapdatum's Organization into the .R struct -func (os FSTrapdatumSlice) 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.FSTrapdata = append(rel.R.FSTrapdata, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsTrapdatumJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsTrapdatumJoins[Q]) aliasedAs(alias string) fsTrapdatumJoins[Q] { - return buildFSTrapdatumJoins[Q](buildFSTrapdatumColumns(alias), j.typ) -} - -func buildFSTrapdatumJoins[Q dialect.Joinable](cols fsTrapdatumColumns, typ string) fsTrapdatumJoins[Q] { - return fsTrapdatumJoins[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/db/models/fs_traplocation.bob.go b/db/models/fs_traplocation.bob.go deleted file mode 100644 index 0fb678f1..00000000 --- a/db/models/fs_traplocation.bob.go +++ /dev/null @@ -1,1430 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSTraplocation is an object representing the database table. -type FSTraplocation struct { - OrganizationID int32 `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid string `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Name null.Val[string] `db:"name" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Usetype null.Val[string] `db:"usetype" ` - 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" ` - Route null.Val[int64] `db:"route" ` - RouteOrder null.Val[int64] `db:"route_order" ` - SetDow null.Val[int64] `db:"set_dow" ` - Vectorsurvsiteid null.Val[string] `db:"vectorsurvsiteid" ` - H3R7 null.Val[string] `db:"h3r7" ` - H3R8 null.Val[string] `db:"h3r8" ` - Updated time.Time `db:"updated" ` - Geom null.Val[string] `db:"geom" ` - - R fsTraplocationR `db:"-" ` -} - -// FSTraplocationSlice is an alias for a slice of pointers to FSTraplocation. -// This should almost always be used instead of []*FSTraplocation. -type FSTraplocationSlice []*FSTraplocation - -// FSTraplocations contains methods to work with the fs_traplocation table -var FSTraplocations = psql.NewTablex[*FSTraplocation, FSTraplocationSlice, *FSTraplocationSetter]("", "fs_traplocation", buildFSTraplocationColumns("fs_traplocation")) - -// FSTraplocationsQuery is a query on the fs_traplocation table -type FSTraplocationsQuery = *psql.ViewQuery[*FSTraplocation, FSTraplocationSlice] - -// fsTraplocationR is where relationships are stored. -type fsTraplocationR struct { - Organization *Organization // fs_traplocation.fs_traplocation_organization_id_fkey -} - -func buildFSTraplocationColumns(alias string) fsTraplocationColumns { - return fsTraplocationColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "gatewaysync", "globalid", "habitat", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "usetype", "zone", "zone2", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "route", "route_order", "set_dow", "vectorsurvsiteid", "h3r7", "h3r8", "updated", "geom", - ).WithParent("fs_traplocation"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accessdesc: psql.Quote(alias, "accessdesc"), - Active: psql.Quote(alias, "active"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Description: psql.Quote(alias, "description"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Gatewaysync: psql.Quote(alias, "gatewaysync"), - Globalid: psql.Quote(alias, "globalid"), - Habitat: psql.Quote(alias, "habitat"), - Locationnumber: psql.Quote(alias, "locationnumber"), - Name: psql.Quote(alias, "name"), - Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), - Objectid: psql.Quote(alias, "objectid"), - Priority: psql.Quote(alias, "priority"), - Usetype: psql.Quote(alias, "usetype"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Route: psql.Quote(alias, "route"), - RouteOrder: psql.Quote(alias, "route_order"), - SetDow: psql.Quote(alias, "set_dow"), - Vectorsurvsiteid: psql.Quote(alias, "vectorsurvsiteid"), - H3R7: psql.Quote(alias, "h3r7"), - H3R8: psql.Quote(alias, "h3r8"), - Updated: psql.Quote(alias, "updated"), - Geom: psql.Quote(alias, "geom"), - } -} - -type fsTraplocationColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accessdesc psql.Expression - Active psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Description psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Gatewaysync psql.Expression - Globalid psql.Expression - Habitat psql.Expression - Locationnumber psql.Expression - Name psql.Expression - Nextactiondatescheduled psql.Expression - Objectid psql.Expression - Priority psql.Expression - Usetype psql.Expression - Zone psql.Expression - Zone2 psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Route psql.Expression - RouteOrder psql.Expression - SetDow psql.Expression - Vectorsurvsiteid psql.Expression - H3R7 psql.Expression - H3R8 psql.Expression - Updated psql.Expression - Geom psql.Expression -} - -func (c fsTraplocationColumns) Alias() string { - return c.tableAlias -} - -func (fsTraplocationColumns) AliasedAs(alias string) fsTraplocationColumns { - return buildFSTraplocationColumns(alias) -} - -// FSTraplocationSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSTraplocationSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omit.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Name omitnull.Val[string] `db:"name" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Usetype omitnull.Val[string] `db:"usetype" ` - 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" ` - Route omitnull.Val[int64] `db:"route" ` - RouteOrder omitnull.Val[int64] `db:"route_order" ` - SetDow omitnull.Val[int64] `db:"set_dow" ` - Vectorsurvsiteid omitnull.Val[string] `db:"vectorsurvsiteid" ` - H3R7 omitnull.Val[string] `db:"h3r7" ` - H3R8 omitnull.Val[string] `db:"h3r8" ` - Updated omit.Val[time.Time] `db:"updated" ` - Geom omitnull.Val[string] `db:"geom" ` -} - -func (s FSTraplocationSetter) SetColumns() []string { - vals := make([]string, 0, 35) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accessdesc.IsUnset() { - vals = append(vals, "accessdesc") - } - if !s.Active.IsUnset() { - vals = append(vals, "active") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Description.IsUnset() { - vals = append(vals, "description") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Gatewaysync.IsUnset() { - vals = append(vals, "gatewaysync") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Habitat.IsUnset() { - vals = append(vals, "habitat") - } - if !s.Locationnumber.IsUnset() { - vals = append(vals, "locationnumber") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if !s.Nextactiondatescheduled.IsUnset() { - vals = append(vals, "nextactiondatescheduled") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Usetype.IsUnset() { - vals = append(vals, "usetype") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Route.IsUnset() { - vals = append(vals, "route") - } - if !s.RouteOrder.IsUnset() { - vals = append(vals, "route_order") - } - if !s.SetDow.IsUnset() { - vals = append(vals, "set_dow") - } - if !s.Vectorsurvsiteid.IsUnset() { - vals = append(vals, "vectorsurvsiteid") - } - if !s.H3R7.IsUnset() { - vals = append(vals, "h3r7") - } - if !s.H3R8.IsUnset() { - vals = append(vals, "h3r8") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - if !s.Geom.IsUnset() { - vals = append(vals, "geom") - } - return vals -} - -func (s FSTraplocationSetter) Overwrite(t *FSTraplocation) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accessdesc.IsUnset() { - t.Accessdesc = s.Accessdesc.MustGetNull() - } - if !s.Active.IsUnset() { - t.Active = s.Active.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Description.IsUnset() { - t.Description = s.Description.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Gatewaysync.IsUnset() { - t.Gatewaysync = s.Gatewaysync.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Habitat.IsUnset() { - t.Habitat = s.Habitat.MustGetNull() - } - if !s.Locationnumber.IsUnset() { - t.Locationnumber = s.Locationnumber.MustGetNull() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if !s.Nextactiondatescheduled.IsUnset() { - t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Usetype.IsUnset() { - t.Usetype = s.Usetype.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Route.IsUnset() { - t.Route = s.Route.MustGetNull() - } - if !s.RouteOrder.IsUnset() { - t.RouteOrder = s.RouteOrder.MustGetNull() - } - if !s.SetDow.IsUnset() { - t.SetDow = s.SetDow.MustGetNull() - } - if !s.Vectorsurvsiteid.IsUnset() { - t.Vectorsurvsiteid = s.Vectorsurvsiteid.MustGetNull() - } - if !s.H3R7.IsUnset() { - t.H3R7 = s.H3R7.MustGetNull() - } - if !s.H3R8.IsUnset() { - t.H3R8 = s.H3R8.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } - if !s.Geom.IsUnset() { - t.Geom = s.Geom.MustGetNull() - } -} - -func (s *FSTraplocationSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSTraplocations.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 35) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accessdesc.IsUnset() { - vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Active.IsUnset() { - vals[2] = psql.Arg(s.Active.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[3] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[4] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[5] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Description.IsUnset() { - vals[6] = psql.Arg(s.Description.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[7] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[8] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[9] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Gatewaysync.IsUnset() { - vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[11] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Habitat.IsUnset() { - vals[12] = psql.Arg(s.Habitat.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Locationnumber.IsUnset() { - vals[13] = psql.Arg(s.Locationnumber.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[14] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Nextactiondatescheduled.IsUnset() { - vals[15] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[16] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[17] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Usetype.IsUnset() { - vals[18] = psql.Arg(s.Usetype.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[19] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[20] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[21] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[22] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[23] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[24] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[25] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[26] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Route.IsUnset() { - vals[27] = psql.Arg(s.Route.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.RouteOrder.IsUnset() { - vals[28] = psql.Arg(s.RouteOrder.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.SetDow.IsUnset() { - vals[29] = psql.Arg(s.SetDow.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Vectorsurvsiteid.IsUnset() { - vals[30] = psql.Arg(s.Vectorsurvsiteid.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.H3R7.IsUnset() { - vals[31] = psql.Arg(s.H3R7.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.H3R8.IsUnset() { - vals[32] = psql.Arg(s.H3R8.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[33] = psql.Arg(s.Updated.MustGet()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Geom.IsUnset() { - vals[34] = psql.Arg(s.Geom.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSTraplocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSTraplocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 35) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accessdesc.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accessdesc")...), - psql.Arg(s.Accessdesc), - }}) - } - - if !s.Active.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "active")...), - psql.Arg(s.Active), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Description.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "description")...), - psql.Arg(s.Description), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Gatewaysync.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "gatewaysync")...), - psql.Arg(s.Gatewaysync), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitat")...), - psql.Arg(s.Habitat), - }}) - } - - if !s.Locationnumber.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationnumber")...), - psql.Arg(s.Locationnumber), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if !s.Nextactiondatescheduled.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nextactiondatescheduled")...), - psql.Arg(s.Nextactiondatescheduled), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Usetype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "usetype")...), - psql.Arg(s.Usetype), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Route.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "route")...), - psql.Arg(s.Route), - }}) - } - - if !s.RouteOrder.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "route_order")...), - psql.Arg(s.RouteOrder), - }}) - } - - if !s.SetDow.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "set_dow")...), - psql.Arg(s.SetDow), - }}) - } - - if !s.Vectorsurvsiteid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vectorsurvsiteid")...), - psql.Arg(s.Vectorsurvsiteid), - }}) - } - - if !s.H3R7.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "h3r7")...), - psql.Arg(s.H3R7), - }}) - } - - if !s.H3R8.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "h3r8")...), - psql.Arg(s.H3R8), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - if !s.Geom.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geom")...), - psql.Arg(s.Geom), - }}) - } - - return exprs -} - -// FindFSTraplocation retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSTraplocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSTraplocation, error) { - if len(cols) == 0 { - return FSTraplocations.Query( - sm.Where(FSTraplocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSTraplocations.Query( - sm.Where(FSTraplocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSTraplocations.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSTraplocationExists checks the presence of a single record by primary key -func FSTraplocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSTraplocations.Query( - sm.Where(FSTraplocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSTraplocation is retrieved from the database -func (o *FSTraplocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSTraplocations.AfterSelectHooks.RunHooks(ctx, exec, FSTraplocationSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSTraplocations.AfterInsertHooks.RunHooks(ctx, exec, FSTraplocationSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSTraplocations.AfterUpdateHooks.RunHooks(ctx, exec, FSTraplocationSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSTraplocations.AfterDeleteHooks.RunHooks(ctx, exec, FSTraplocationSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSTraplocation -func (o *FSTraplocation) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSTraplocation) pkEQ() dialect.Expression { - return psql.Quote("fs_traplocation", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSTraplocation -func (o *FSTraplocation) Update(ctx context.Context, exec bob.Executor, s *FSTraplocationSetter) error { - v, err := FSTraplocations.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 FSTraplocation record with an executor -func (o *FSTraplocation) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSTraplocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSTraplocation using the executor -func (o *FSTraplocation) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSTraplocations.Query( - sm.Where(FSTraplocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSTraplocationSlice is retrieved from the database -func (o FSTraplocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSTraplocations.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSTraplocations.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSTraplocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSTraplocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSTraplocationSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_traplocation", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSTraplocationSlice) copyMatchingRows(from ...*FSTraplocation) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSTraplocationSlice) 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 FSTraplocations.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 *FSTraplocation: - o.copyMatchingRows(retrieved) - case []*FSTraplocation: - o.copyMatchingRows(retrieved...) - case FSTraplocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSTraplocation or a slice of FSTraplocation - // then run the AfterUpdateHooks on the slice - _, err = FSTraplocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSTraplocationSlice) 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 FSTraplocations.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 *FSTraplocation: - o.copyMatchingRows(retrieved) - case []*FSTraplocation: - o.copyMatchingRows(retrieved...) - case FSTraplocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSTraplocation or a slice of FSTraplocation - // then run the AfterDeleteHooks on the slice - _, err = FSTraplocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSTraplocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSTraplocationSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSTraplocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSTraplocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSTraplocations.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSTraplocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSTraplocations.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 *FSTraplocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSTraplocationSlice) 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 attachFSTraplocationOrganization0(ctx context.Context, exec bob.Executor, count int, fsTraplocation0 *FSTraplocation, organization1 *Organization) (*FSTraplocation, error) { - setter := &FSTraplocationSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsTraplocation0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSTraplocationOrganization0: %w", err) - } - - return fsTraplocation0, nil -} - -func (fsTraplocation0 *FSTraplocation) 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 = attachFSTraplocationOrganization0(ctx, exec, 1, fsTraplocation0, organization1) - if err != nil { - return err - } - - fsTraplocation0.R.Organization = organization1 - - organization1.R.FSTraplocations = append(organization1.R.FSTraplocations, fsTraplocation0) - - return nil -} - -func (fsTraplocation0 *FSTraplocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSTraplocationOrganization0(ctx, exec, 1, fsTraplocation0, organization1) - if err != nil { - return err - } - - fsTraplocation0.R.Organization = organization1 - - organization1.R.FSTraplocations = append(organization1.R.FSTraplocations, fsTraplocation0) - - return nil -} - -type fsTraplocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accessdesc psql.WhereNullMod[Q, string] - Active psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Description psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Gatewaysync psql.WhereNullMod[Q, int16] - Globalid psql.WhereMod[Q, string] - Habitat psql.WhereNullMod[Q, string] - Locationnumber psql.WhereNullMod[Q, int64] - Name psql.WhereNullMod[Q, string] - Nextactiondatescheduled psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Priority psql.WhereNullMod[Q, string] - Usetype psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - 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] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Route psql.WhereNullMod[Q, int64] - RouteOrder psql.WhereNullMod[Q, int64] - SetDow psql.WhereNullMod[Q, int64] - Vectorsurvsiteid psql.WhereNullMod[Q, string] - H3R7 psql.WhereNullMod[Q, string] - H3R8 psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] - Geom psql.WhereNullMod[Q, string] -} - -func (fsTraplocationWhere[Q]) AliasedAs(alias string) fsTraplocationWhere[Q] { - return buildFSTraplocationWhere[Q](buildFSTraplocationColumns(alias)) -} - -func buildFSTraplocationWhere[Q psql.Filterable](cols fsTraplocationColumns) fsTraplocationWhere[Q] { - return fsTraplocationWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), - Active: psql.WhereNull[Q, int16](cols.Active), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Description: psql.WhereNull[Q, string](cols.Description), - Externalid: psql.WhereNull[Q, string](cols.Externalid), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Gatewaysync: psql.WhereNull[Q, int16](cols.Gatewaysync), - 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), - Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), - Objectid: psql.Where[Q, int32](cols.Objectid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Usetype: psql.WhereNull[Q, string](cols.Usetype), - Zone: psql.WhereNull[Q, string](cols.Zone), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Route: psql.WhereNull[Q, int64](cols.Route), - RouteOrder: psql.WhereNull[Q, int64](cols.RouteOrder), - SetDow: psql.WhereNull[Q, int64](cols.SetDow), - Vectorsurvsiteid: psql.WhereNull[Q, string](cols.Vectorsurvsiteid), - H3R7: psql.WhereNull[Q, string](cols.H3R7), - H3R8: psql.WhereNull[Q, string](cols.H3R8), - Updated: psql.Where[Q, time.Time](cols.Updated), - Geom: psql.WhereNull[Q, string](cols.Geom), - } -} - -func (o *FSTraplocation) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsTraplocation cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSTraplocations = FSTraplocationSlice{o} - } - return nil - default: - return fmt.Errorf("fsTraplocation has no relationship %q", name) - } -} - -type fsTraplocationPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSTraplocationPreloader() fsTraplocationPreloader { - return fsTraplocationPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSTraplocations, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsTraplocationThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSTraplocationThenLoader[Q orm.Loadable]() fsTraplocationThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsTraplocationThenLoader[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 fsTraplocation's Organization into the .R struct -func (o *FSTraplocation) 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.FSTraplocations = FSTraplocationSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsTraplocation's Organization into the .R struct -func (os FSTraplocationSlice) 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.FSTraplocations = append(rel.R.FSTraplocations, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsTraplocationJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsTraplocationJoins[Q]) aliasedAs(alias string) fsTraplocationJoins[Q] { - return buildFSTraplocationJoins[Q](buildFSTraplocationColumns(alias), j.typ) -} - -func buildFSTraplocationJoins[Q dialect.Joinable](cols fsTraplocationColumns, typ string) fsTraplocationJoins[Q] { - return fsTraplocationJoins[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/db/models/fs_treatment.bob.go b/db/models/fs_treatment.bob.go deleted file mode 100644 index 5dbd0600..00000000 --- a/db/models/fs_treatment.bob.go +++ /dev/null @@ -1,2030 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSTreatment is an object representing the database table. -type FSTreatment struct { - OrganizationID int32 `db:"organization_id" ` - Activity null.Val[string] `db:"activity" ` - Areaunit null.Val[string] `db:"areaunit" ` - Avetemp null.Val[float64] `db:"avetemp" ` - Barrierrouteid null.Val[string] `db:"barrierrouteid" ` - Cbcount null.Val[int16] `db:"cbcount" ` - Comments null.Val[string] `db:"comments" ` - Containercount null.Val[int16] `db:"containercount" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Equiptype null.Val[string] `db:"equiptype" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Flowrate null.Val[float64] `db:"flowrate" ` - Globalid string `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - InspID null.Val[string] `db:"insp_id" ` - Invloc null.Val[string] `db:"invloc" ` - Linelocid null.Val[string] `db:"linelocid" ` - Locationname null.Val[string] `db:"locationname" ` - Method null.Val[string] `db:"method" ` - Objectid int32 `db:"objectid,pk" ` - Pointlocid null.Val[string] `db:"pointlocid" ` - Polygonlocid null.Val[string] `db:"polygonlocid" ` - Product null.Val[string] `db:"product" ` - Ptaid null.Val[string] `db:"ptaid" ` - Qty null.Val[float64] `db:"qty" ` - Qtyunit null.Val[string] `db:"qtyunit" ` - Raingauge null.Val[float64] `db:"raingauge" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Sdid null.Val[string] `db:"sdid" ` - Sitecond null.Val[string] `db:"sitecond" ` - Srid null.Val[string] `db:"srid" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Targetspecies null.Val[string] `db:"targetspecies" ` - Tirecount null.Val[int16] `db:"tirecount" ` - Treatacres null.Val[float64] `db:"treatacres" ` - Treatarea null.Val[float64] `db:"treatarea" ` - Treathectares null.Val[float64] `db:"treathectares" ` - Treatmenthours null.Val[float64] `db:"treatmenthours" ` - Treatmentlength null.Val[float64] `db:"treatmentlength" ` - Treatmentlengthunits null.Val[string] `db:"treatmentlengthunits" ` - Totalcostprodcut null.Val[float64] `db:"totalcostprodcut" ` - Ulvrouteid null.Val[string] `db:"ulvrouteid" ` - Warningoverride null.Val[int16] `db:"warningoverride" ` - Winddir null.Val[string] `db:"winddir" ` - Windspeed null.Val[float64] `db:"windspeed" ` - 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" ` - TempSitecond null.Val[string] `db:"temp_sitecond" ` - Updated time.Time `db:"updated" ` - Geom null.Val[string] `db:"geom" ` - - R fsTreatmentR `db:"-" ` -} - -// FSTreatmentSlice is an alias for a slice of pointers to FSTreatment. -// This should almost always be used instead of []*FSTreatment. -type FSTreatmentSlice []*FSTreatment - -// FSTreatments contains methods to work with the fs_treatment table -var FSTreatments = psql.NewTablex[*FSTreatment, FSTreatmentSlice, *FSTreatmentSetter]("", "fs_treatment", buildFSTreatmentColumns("fs_treatment")) - -// FSTreatmentsQuery is a query on the fs_treatment table -type FSTreatmentsQuery = *psql.ViewQuery[*FSTreatment, FSTreatmentSlice] - -// fsTreatmentR is where relationships are stored. -type fsTreatmentR struct { - Organization *Organization // fs_treatment.fs_treatment_organization_id_fkey -} - -func buildFSTreatmentColumns(alias string) fsTreatmentColumns { - return fsTreatmentColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "activity", "areaunit", "avetemp", "barrierrouteid", "cbcount", "comments", "containercount", "creationdate", "creator", "enddatetime", "equiptype", "editdate", "editor", "fieldtech", "flowrate", "globalid", "habitat", "insp_id", "invloc", "linelocid", "locationname", "method", "objectid", "pointlocid", "polygonlocid", "product", "ptaid", "qty", "qtyunit", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sdid", "sitecond", "srid", "startdatetime", "targetspecies", "tirecount", "treatacres", "treatarea", "treathectares", "treatmenthours", "treatmentlength", "treatmentlengthunits", "totalcostprodcut", "ulvrouteid", "warningoverride", "winddir", "windspeed", "zone", "zone2", "geometry_x", "geometry_y", "temp_sitecond", "updated", "geom", - ).WithParent("fs_treatment"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Activity: psql.Quote(alias, "activity"), - Areaunit: psql.Quote(alias, "areaunit"), - Avetemp: psql.Quote(alias, "avetemp"), - Barrierrouteid: psql.Quote(alias, "barrierrouteid"), - Cbcount: psql.Quote(alias, "cbcount"), - Comments: psql.Quote(alias, "comments"), - Containercount: psql.Quote(alias, "containercount"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Enddatetime: psql.Quote(alias, "enddatetime"), - Equiptype: psql.Quote(alias, "equiptype"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fieldtech: psql.Quote(alias, "fieldtech"), - Flowrate: psql.Quote(alias, "flowrate"), - Globalid: psql.Quote(alias, "globalid"), - Habitat: psql.Quote(alias, "habitat"), - InspID: psql.Quote(alias, "insp_id"), - Invloc: psql.Quote(alias, "invloc"), - Linelocid: psql.Quote(alias, "linelocid"), - Locationname: psql.Quote(alias, "locationname"), - Method: psql.Quote(alias, "method"), - Objectid: psql.Quote(alias, "objectid"), - Pointlocid: psql.Quote(alias, "pointlocid"), - Polygonlocid: psql.Quote(alias, "polygonlocid"), - Product: psql.Quote(alias, "product"), - Ptaid: psql.Quote(alias, "ptaid"), - Qty: psql.Quote(alias, "qty"), - Qtyunit: psql.Quote(alias, "qtyunit"), - Raingauge: psql.Quote(alias, "raingauge"), - Recordstatus: psql.Quote(alias, "recordstatus"), - Reviewed: psql.Quote(alias, "reviewed"), - Reviewedby: psql.Quote(alias, "reviewedby"), - Revieweddate: psql.Quote(alias, "revieweddate"), - Sdid: psql.Quote(alias, "sdid"), - Sitecond: psql.Quote(alias, "sitecond"), - Srid: psql.Quote(alias, "srid"), - Startdatetime: psql.Quote(alias, "startdatetime"), - Targetspecies: psql.Quote(alias, "targetspecies"), - Tirecount: psql.Quote(alias, "tirecount"), - Treatacres: psql.Quote(alias, "treatacres"), - Treatarea: psql.Quote(alias, "treatarea"), - Treathectares: psql.Quote(alias, "treathectares"), - Treatmenthours: psql.Quote(alias, "treatmenthours"), - Treatmentlength: psql.Quote(alias, "treatmentlength"), - Treatmentlengthunits: psql.Quote(alias, "treatmentlengthunits"), - Totalcostprodcut: psql.Quote(alias, "totalcostprodcut"), - Ulvrouteid: psql.Quote(alias, "ulvrouteid"), - Warningoverride: psql.Quote(alias, "warningoverride"), - Winddir: psql.Quote(alias, "winddir"), - Windspeed: psql.Quote(alias, "windspeed"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - TempSitecond: psql.Quote(alias, "temp_sitecond"), - Updated: psql.Quote(alias, "updated"), - Geom: psql.Quote(alias, "geom"), - } -} - -type fsTreatmentColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Activity psql.Expression - Areaunit psql.Expression - Avetemp psql.Expression - Barrierrouteid psql.Expression - Cbcount psql.Expression - Comments psql.Expression - Containercount psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Enddatetime psql.Expression - Equiptype psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fieldtech psql.Expression - Flowrate psql.Expression - Globalid psql.Expression - Habitat psql.Expression - InspID psql.Expression - Invloc psql.Expression - Linelocid psql.Expression - Locationname psql.Expression - Method psql.Expression - Objectid psql.Expression - Pointlocid psql.Expression - Polygonlocid psql.Expression - Product psql.Expression - Ptaid psql.Expression - Qty psql.Expression - Qtyunit psql.Expression - Raingauge psql.Expression - Recordstatus psql.Expression - Reviewed psql.Expression - Reviewedby psql.Expression - Revieweddate psql.Expression - Sdid psql.Expression - Sitecond psql.Expression - Srid psql.Expression - Startdatetime psql.Expression - Targetspecies psql.Expression - Tirecount psql.Expression - Treatacres psql.Expression - Treatarea psql.Expression - Treathectares psql.Expression - Treatmenthours psql.Expression - Treatmentlength psql.Expression - Treatmentlengthunits psql.Expression - Totalcostprodcut psql.Expression - Ulvrouteid psql.Expression - Warningoverride psql.Expression - Winddir psql.Expression - Windspeed psql.Expression - Zone psql.Expression - Zone2 psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - TempSitecond psql.Expression - Updated psql.Expression - Geom psql.Expression -} - -func (c fsTreatmentColumns) Alias() string { - return c.tableAlias -} - -func (fsTreatmentColumns) AliasedAs(alias string) fsTreatmentColumns { - return buildFSTreatmentColumns(alias) -} - -// FSTreatmentSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSTreatmentSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Activity omitnull.Val[string] `db:"activity" ` - Areaunit omitnull.Val[string] `db:"areaunit" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Barrierrouteid omitnull.Val[string] `db:"barrierrouteid" ` - Cbcount omitnull.Val[int16] `db:"cbcount" ` - Comments omitnull.Val[string] `db:"comments" ` - Containercount omitnull.Val[int16] `db:"containercount" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Equiptype omitnull.Val[string] `db:"equiptype" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Flowrate omitnull.Val[float64] `db:"flowrate" ` - 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" ` - Linelocid omitnull.Val[string] `db:"linelocid" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Method omitnull.Val[string] `db:"method" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Pointlocid omitnull.Val[string] `db:"pointlocid" ` - Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` - Product omitnull.Val[string] `db:"product" ` - Ptaid omitnull.Val[string] `db:"ptaid" ` - Qty omitnull.Val[float64] `db:"qty" ` - Qtyunit omitnull.Val[string] `db:"qtyunit" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Sdid omitnull.Val[string] `db:"sdid" ` - Sitecond omitnull.Val[string] `db:"sitecond" ` - Srid omitnull.Val[string] `db:"srid" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Targetspecies omitnull.Val[string] `db:"targetspecies" ` - Tirecount omitnull.Val[int16] `db:"tirecount" ` - Treatacres omitnull.Val[float64] `db:"treatacres" ` - Treatarea omitnull.Val[float64] `db:"treatarea" ` - Treathectares omitnull.Val[float64] `db:"treathectares" ` - Treatmenthours omitnull.Val[float64] `db:"treatmenthours" ` - Treatmentlength omitnull.Val[float64] `db:"treatmentlength" ` - Treatmentlengthunits omitnull.Val[string] `db:"treatmentlengthunits" ` - Totalcostprodcut omitnull.Val[float64] `db:"totalcostprodcut" ` - Ulvrouteid omitnull.Val[string] `db:"ulvrouteid" ` - Warningoverride omitnull.Val[int16] `db:"warningoverride" ` - Winddir omitnull.Val[string] `db:"winddir" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - 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" ` - TempSitecond omitnull.Val[string] `db:"temp_sitecond" ` - Updated omit.Val[time.Time] `db:"updated" ` - Geom omitnull.Val[string] `db:"geom" ` -} - -func (s FSTreatmentSetter) SetColumns() []string { - vals := make([]string, 0, 59) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Activity.IsUnset() { - vals = append(vals, "activity") - } - if !s.Areaunit.IsUnset() { - vals = append(vals, "areaunit") - } - if !s.Avetemp.IsUnset() { - vals = append(vals, "avetemp") - } - if !s.Barrierrouteid.IsUnset() { - vals = append(vals, "barrierrouteid") - } - if !s.Cbcount.IsUnset() { - vals = append(vals, "cbcount") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Containercount.IsUnset() { - vals = append(vals, "containercount") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Enddatetime.IsUnset() { - vals = append(vals, "enddatetime") - } - if !s.Equiptype.IsUnset() { - vals = append(vals, "equiptype") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fieldtech.IsUnset() { - vals = append(vals, "fieldtech") - } - if !s.Flowrate.IsUnset() { - vals = append(vals, "flowrate") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Habitat.IsUnset() { - vals = append(vals, "habitat") - } - if !s.InspID.IsUnset() { - vals = append(vals, "insp_id") - } - if !s.Invloc.IsUnset() { - vals = append(vals, "invloc") - } - if !s.Linelocid.IsUnset() { - vals = append(vals, "linelocid") - } - if !s.Locationname.IsUnset() { - vals = append(vals, "locationname") - } - if !s.Method.IsUnset() { - vals = append(vals, "method") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Pointlocid.IsUnset() { - vals = append(vals, "pointlocid") - } - if !s.Polygonlocid.IsUnset() { - vals = append(vals, "polygonlocid") - } - if !s.Product.IsUnset() { - vals = append(vals, "product") - } - if !s.Ptaid.IsUnset() { - vals = append(vals, "ptaid") - } - if !s.Qty.IsUnset() { - vals = append(vals, "qty") - } - if !s.Qtyunit.IsUnset() { - vals = append(vals, "qtyunit") - } - if !s.Raingauge.IsUnset() { - vals = append(vals, "raingauge") - } - if !s.Recordstatus.IsUnset() { - vals = append(vals, "recordstatus") - } - if !s.Reviewed.IsUnset() { - vals = append(vals, "reviewed") - } - if !s.Reviewedby.IsUnset() { - vals = append(vals, "reviewedby") - } - if !s.Revieweddate.IsUnset() { - vals = append(vals, "revieweddate") - } - if !s.Sdid.IsUnset() { - vals = append(vals, "sdid") - } - if !s.Sitecond.IsUnset() { - vals = append(vals, "sitecond") - } - if !s.Srid.IsUnset() { - vals = append(vals, "srid") - } - if !s.Startdatetime.IsUnset() { - vals = append(vals, "startdatetime") - } - if !s.Targetspecies.IsUnset() { - vals = append(vals, "targetspecies") - } - if !s.Tirecount.IsUnset() { - vals = append(vals, "tirecount") - } - if !s.Treatacres.IsUnset() { - vals = append(vals, "treatacres") - } - if !s.Treatarea.IsUnset() { - vals = append(vals, "treatarea") - } - if !s.Treathectares.IsUnset() { - vals = append(vals, "treathectares") - } - if !s.Treatmenthours.IsUnset() { - vals = append(vals, "treatmenthours") - } - if !s.Treatmentlength.IsUnset() { - vals = append(vals, "treatmentlength") - } - if !s.Treatmentlengthunits.IsUnset() { - vals = append(vals, "treatmentlengthunits") - } - if !s.Totalcostprodcut.IsUnset() { - vals = append(vals, "totalcostprodcut") - } - if !s.Ulvrouteid.IsUnset() { - vals = append(vals, "ulvrouteid") - } - if !s.Warningoverride.IsUnset() { - vals = append(vals, "warningoverride") - } - if !s.Winddir.IsUnset() { - vals = append(vals, "winddir") - } - if !s.Windspeed.IsUnset() { - vals = append(vals, "windspeed") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.TempSitecond.IsUnset() { - vals = append(vals, "temp_sitecond") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - if !s.Geom.IsUnset() { - vals = append(vals, "geom") - } - return vals -} - -func (s FSTreatmentSetter) Overwrite(t *FSTreatment) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Activity.IsUnset() { - t.Activity = s.Activity.MustGetNull() - } - if !s.Areaunit.IsUnset() { - t.Areaunit = s.Areaunit.MustGetNull() - } - if !s.Avetemp.IsUnset() { - t.Avetemp = s.Avetemp.MustGetNull() - } - if !s.Barrierrouteid.IsUnset() { - t.Barrierrouteid = s.Barrierrouteid.MustGetNull() - } - if !s.Cbcount.IsUnset() { - t.Cbcount = s.Cbcount.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Containercount.IsUnset() { - t.Containercount = s.Containercount.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Enddatetime.IsUnset() { - t.Enddatetime = s.Enddatetime.MustGetNull() - } - if !s.Equiptype.IsUnset() { - t.Equiptype = s.Equiptype.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fieldtech.IsUnset() { - t.Fieldtech = s.Fieldtech.MustGetNull() - } - if !s.Flowrate.IsUnset() { - t.Flowrate = s.Flowrate.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Habitat.IsUnset() { - t.Habitat = s.Habitat.MustGetNull() - } - if !s.InspID.IsUnset() { - t.InspID = s.InspID.MustGetNull() - } - if !s.Invloc.IsUnset() { - t.Invloc = s.Invloc.MustGetNull() - } - if !s.Linelocid.IsUnset() { - t.Linelocid = s.Linelocid.MustGetNull() - } - if !s.Locationname.IsUnset() { - t.Locationname = s.Locationname.MustGetNull() - } - if !s.Method.IsUnset() { - t.Method = s.Method.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Pointlocid.IsUnset() { - t.Pointlocid = s.Pointlocid.MustGetNull() - } - if !s.Polygonlocid.IsUnset() { - t.Polygonlocid = s.Polygonlocid.MustGetNull() - } - if !s.Product.IsUnset() { - t.Product = s.Product.MustGetNull() - } - if !s.Ptaid.IsUnset() { - t.Ptaid = s.Ptaid.MustGetNull() - } - if !s.Qty.IsUnset() { - t.Qty = s.Qty.MustGetNull() - } - if !s.Qtyunit.IsUnset() { - t.Qtyunit = s.Qtyunit.MustGetNull() - } - if !s.Raingauge.IsUnset() { - t.Raingauge = s.Raingauge.MustGetNull() - } - if !s.Recordstatus.IsUnset() { - t.Recordstatus = s.Recordstatus.MustGetNull() - } - if !s.Reviewed.IsUnset() { - t.Reviewed = s.Reviewed.MustGetNull() - } - if !s.Reviewedby.IsUnset() { - t.Reviewedby = s.Reviewedby.MustGetNull() - } - if !s.Revieweddate.IsUnset() { - t.Revieweddate = s.Revieweddate.MustGetNull() - } - if !s.Sdid.IsUnset() { - t.Sdid = s.Sdid.MustGetNull() - } - if !s.Sitecond.IsUnset() { - t.Sitecond = s.Sitecond.MustGetNull() - } - if !s.Srid.IsUnset() { - t.Srid = s.Srid.MustGetNull() - } - if !s.Startdatetime.IsUnset() { - t.Startdatetime = s.Startdatetime.MustGetNull() - } - if !s.Targetspecies.IsUnset() { - t.Targetspecies = s.Targetspecies.MustGetNull() - } - if !s.Tirecount.IsUnset() { - t.Tirecount = s.Tirecount.MustGetNull() - } - if !s.Treatacres.IsUnset() { - t.Treatacres = s.Treatacres.MustGetNull() - } - if !s.Treatarea.IsUnset() { - t.Treatarea = s.Treatarea.MustGetNull() - } - if !s.Treathectares.IsUnset() { - t.Treathectares = s.Treathectares.MustGetNull() - } - if !s.Treatmenthours.IsUnset() { - t.Treatmenthours = s.Treatmenthours.MustGetNull() - } - if !s.Treatmentlength.IsUnset() { - t.Treatmentlength = s.Treatmentlength.MustGetNull() - } - if !s.Treatmentlengthunits.IsUnset() { - t.Treatmentlengthunits = s.Treatmentlengthunits.MustGetNull() - } - if !s.Totalcostprodcut.IsUnset() { - t.Totalcostprodcut = s.Totalcostprodcut.MustGetNull() - } - if !s.Ulvrouteid.IsUnset() { - t.Ulvrouteid = s.Ulvrouteid.MustGetNull() - } - if !s.Warningoverride.IsUnset() { - t.Warningoverride = s.Warningoverride.MustGetNull() - } - if !s.Winddir.IsUnset() { - t.Winddir = s.Winddir.MustGetNull() - } - if !s.Windspeed.IsUnset() { - t.Windspeed = s.Windspeed.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.TempSitecond.IsUnset() { - t.TempSitecond = s.TempSitecond.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } - if !s.Geom.IsUnset() { - t.Geom = s.Geom.MustGetNull() - } -} - -func (s *FSTreatmentSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSTreatments.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 59) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Activity.IsUnset() { - vals[1] = psql.Arg(s.Activity.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Areaunit.IsUnset() { - vals[2] = psql.Arg(s.Areaunit.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Avetemp.IsUnset() { - vals[3] = psql.Arg(s.Avetemp.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Barrierrouteid.IsUnset() { - vals[4] = psql.Arg(s.Barrierrouteid.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Cbcount.IsUnset() { - vals[5] = psql.Arg(s.Cbcount.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[6] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Containercount.IsUnset() { - vals[7] = psql.Arg(s.Containercount.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[8] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[9] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Enddatetime.IsUnset() { - vals[10] = psql.Arg(s.Enddatetime.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Equiptype.IsUnset() { - vals[11] = psql.Arg(s.Equiptype.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[12] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[13] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Fieldtech.IsUnset() { - vals[14] = psql.Arg(s.Fieldtech.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Flowrate.IsUnset() { - vals[15] = psql.Arg(s.Flowrate.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[16] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Habitat.IsUnset() { - vals[17] = psql.Arg(s.Habitat.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.InspID.IsUnset() { - vals[18] = psql.Arg(s.InspID.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Invloc.IsUnset() { - vals[19] = psql.Arg(s.Invloc.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Linelocid.IsUnset() { - vals[20] = psql.Arg(s.Linelocid.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Locationname.IsUnset() { - vals[21] = psql.Arg(s.Locationname.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Method.IsUnset() { - vals[22] = psql.Arg(s.Method.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[23] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Pointlocid.IsUnset() { - vals[24] = psql.Arg(s.Pointlocid.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Polygonlocid.IsUnset() { - vals[25] = psql.Arg(s.Polygonlocid.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Product.IsUnset() { - vals[26] = psql.Arg(s.Product.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Ptaid.IsUnset() { - vals[27] = psql.Arg(s.Ptaid.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Qty.IsUnset() { - vals[28] = psql.Arg(s.Qty.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Qtyunit.IsUnset() { - vals[29] = psql.Arg(s.Qtyunit.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Raingauge.IsUnset() { - vals[30] = psql.Arg(s.Raingauge.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Recordstatus.IsUnset() { - vals[31] = psql.Arg(s.Recordstatus.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Reviewed.IsUnset() { - vals[32] = psql.Arg(s.Reviewed.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Reviewedby.IsUnset() { - vals[33] = psql.Arg(s.Reviewedby.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Revieweddate.IsUnset() { - vals[34] = psql.Arg(s.Revieweddate.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Sdid.IsUnset() { - vals[35] = psql.Arg(s.Sdid.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Sitecond.IsUnset() { - vals[36] = psql.Arg(s.Sitecond.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.Srid.IsUnset() { - vals[37] = psql.Arg(s.Srid.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.Startdatetime.IsUnset() { - vals[38] = psql.Arg(s.Startdatetime.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Targetspecies.IsUnset() { - vals[39] = psql.Arg(s.Targetspecies.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Tirecount.IsUnset() { - vals[40] = psql.Arg(s.Tirecount.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.Treatacres.IsUnset() { - vals[41] = psql.Arg(s.Treatacres.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.Treatarea.IsUnset() { - vals[42] = psql.Arg(s.Treatarea.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.Treathectares.IsUnset() { - vals[43] = psql.Arg(s.Treathectares.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.Treatmenthours.IsUnset() { - vals[44] = psql.Arg(s.Treatmenthours.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if !s.Treatmentlength.IsUnset() { - vals[45] = psql.Arg(s.Treatmentlength.MustGetNull()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if !s.Treatmentlengthunits.IsUnset() { - vals[46] = psql.Arg(s.Treatmentlengthunits.MustGetNull()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - if !s.Totalcostprodcut.IsUnset() { - vals[47] = psql.Arg(s.Totalcostprodcut.MustGetNull()) - } else { - vals[47] = psql.Raw("DEFAULT") - } - - if !s.Ulvrouteid.IsUnset() { - vals[48] = psql.Arg(s.Ulvrouteid.MustGetNull()) - } else { - vals[48] = psql.Raw("DEFAULT") - } - - if !s.Warningoverride.IsUnset() { - vals[49] = psql.Arg(s.Warningoverride.MustGetNull()) - } else { - vals[49] = psql.Raw("DEFAULT") - } - - if !s.Winddir.IsUnset() { - vals[50] = psql.Arg(s.Winddir.MustGetNull()) - } else { - vals[50] = psql.Raw("DEFAULT") - } - - if !s.Windspeed.IsUnset() { - vals[51] = psql.Arg(s.Windspeed.MustGetNull()) - } else { - vals[51] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[52] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[52] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[53] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[53] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[54] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[54] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[55] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[55] = psql.Raw("DEFAULT") - } - - if !s.TempSitecond.IsUnset() { - vals[56] = psql.Arg(s.TempSitecond.MustGetNull()) - } else { - vals[56] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[57] = psql.Arg(s.Updated.MustGet()) - } else { - vals[57] = psql.Raw("DEFAULT") - } - - if !s.Geom.IsUnset() { - vals[58] = psql.Arg(s.Geom.MustGetNull()) - } else { - vals[58] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSTreatmentSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSTreatmentSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 59) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Activity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "activity")...), - psql.Arg(s.Activity), - }}) - } - - if !s.Areaunit.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "areaunit")...), - psql.Arg(s.Areaunit), - }}) - } - - if !s.Avetemp.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "avetemp")...), - psql.Arg(s.Avetemp), - }}) - } - - if !s.Barrierrouteid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "barrierrouteid")...), - psql.Arg(s.Barrierrouteid), - }}) - } - - if !s.Cbcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "cbcount")...), - psql.Arg(s.Cbcount), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Containercount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "containercount")...), - psql.Arg(s.Containercount), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Enddatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "enddatetime")...), - psql.Arg(s.Enddatetime), - }}) - } - - if !s.Equiptype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "equiptype")...), - psql.Arg(s.Equiptype), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fieldtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldtech")...), - psql.Arg(s.Fieldtech), - }}) - } - - if !s.Flowrate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "flowrate")...), - psql.Arg(s.Flowrate), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitat")...), - psql.Arg(s.Habitat), - }}) - } - - if !s.InspID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "insp_id")...), - psql.Arg(s.InspID), - }}) - } - - if !s.Invloc.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "invloc")...), - psql.Arg(s.Invloc), - }}) - } - - if !s.Linelocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "linelocid")...), - psql.Arg(s.Linelocid), - }}) - } - - if !s.Locationname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationname")...), - psql.Arg(s.Locationname), - }}) - } - - if !s.Method.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "method")...), - psql.Arg(s.Method), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Pointlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pointlocid")...), - psql.Arg(s.Pointlocid), - }}) - } - - if !s.Polygonlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "polygonlocid")...), - psql.Arg(s.Polygonlocid), - }}) - } - - if !s.Product.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "product")...), - psql.Arg(s.Product), - }}) - } - - if !s.Ptaid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "ptaid")...), - psql.Arg(s.Ptaid), - }}) - } - - if !s.Qty.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "qty")...), - psql.Arg(s.Qty), - }}) - } - - if !s.Qtyunit.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "qtyunit")...), - psql.Arg(s.Qtyunit), - }}) - } - - if !s.Raingauge.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "raingauge")...), - psql.Arg(s.Raingauge), - }}) - } - - if !s.Recordstatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "recordstatus")...), - psql.Arg(s.Recordstatus), - }}) - } - - if !s.Reviewed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewed")...), - psql.Arg(s.Reviewed), - }}) - } - - if !s.Reviewedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewedby")...), - psql.Arg(s.Reviewedby), - }}) - } - - if !s.Revieweddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "revieweddate")...), - psql.Arg(s.Revieweddate), - }}) - } - - if !s.Sdid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sdid")...), - psql.Arg(s.Sdid), - }}) - } - - if !s.Sitecond.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sitecond")...), - psql.Arg(s.Sitecond), - }}) - } - - if !s.Srid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "srid")...), - psql.Arg(s.Srid), - }}) - } - - if !s.Startdatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "startdatetime")...), - psql.Arg(s.Startdatetime), - }}) - } - - if !s.Targetspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "targetspecies")...), - psql.Arg(s.Targetspecies), - }}) - } - - if !s.Tirecount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "tirecount")...), - psql.Arg(s.Tirecount), - }}) - } - - if !s.Treatacres.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treatacres")...), - psql.Arg(s.Treatacres), - }}) - } - - if !s.Treatarea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treatarea")...), - psql.Arg(s.Treatarea), - }}) - } - - if !s.Treathectares.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treathectares")...), - psql.Arg(s.Treathectares), - }}) - } - - if !s.Treatmenthours.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treatmenthours")...), - psql.Arg(s.Treatmenthours), - }}) - } - - if !s.Treatmentlength.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treatmentlength")...), - psql.Arg(s.Treatmentlength), - }}) - } - - if !s.Treatmentlengthunits.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treatmentlengthunits")...), - psql.Arg(s.Treatmentlengthunits), - }}) - } - - if !s.Totalcostprodcut.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "totalcostprodcut")...), - psql.Arg(s.Totalcostprodcut), - }}) - } - - if !s.Ulvrouteid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "ulvrouteid")...), - psql.Arg(s.Ulvrouteid), - }}) - } - - if !s.Warningoverride.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "warningoverride")...), - psql.Arg(s.Warningoverride), - }}) - } - - if !s.Winddir.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "winddir")...), - psql.Arg(s.Winddir), - }}) - } - - if !s.Windspeed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "windspeed")...), - psql.Arg(s.Windspeed), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.TempSitecond.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "temp_sitecond")...), - psql.Arg(s.TempSitecond), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - if !s.Geom.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geom")...), - psql.Arg(s.Geom), - }}) - } - - return exprs -} - -// FindFSTreatment retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSTreatment(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSTreatment, error) { - if len(cols) == 0 { - return FSTreatments.Query( - sm.Where(FSTreatments.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSTreatments.Query( - sm.Where(FSTreatments.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSTreatments.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSTreatmentExists checks the presence of a single record by primary key -func FSTreatmentExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSTreatments.Query( - sm.Where(FSTreatments.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSTreatment is retrieved from the database -func (o *FSTreatment) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSTreatments.AfterSelectHooks.RunHooks(ctx, exec, FSTreatmentSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSTreatments.AfterInsertHooks.RunHooks(ctx, exec, FSTreatmentSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSTreatments.AfterUpdateHooks.RunHooks(ctx, exec, FSTreatmentSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSTreatments.AfterDeleteHooks.RunHooks(ctx, exec, FSTreatmentSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSTreatment -func (o *FSTreatment) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSTreatment) pkEQ() dialect.Expression { - return psql.Quote("fs_treatment", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSTreatment -func (o *FSTreatment) Update(ctx context.Context, exec bob.Executor, s *FSTreatmentSetter) error { - v, err := FSTreatments.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 FSTreatment record with an executor -func (o *FSTreatment) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSTreatments.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSTreatment using the executor -func (o *FSTreatment) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSTreatments.Query( - sm.Where(FSTreatments.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSTreatmentSlice is retrieved from the database -func (o FSTreatmentSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSTreatments.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSTreatments.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSTreatments.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSTreatments.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSTreatmentSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_treatment", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSTreatmentSlice) copyMatchingRows(from ...*FSTreatment) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSTreatmentSlice) 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 FSTreatments.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 *FSTreatment: - o.copyMatchingRows(retrieved) - case []*FSTreatment: - o.copyMatchingRows(retrieved...) - case FSTreatmentSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSTreatment or a slice of FSTreatment - // then run the AfterUpdateHooks on the slice - _, err = FSTreatments.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSTreatmentSlice) 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 FSTreatments.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 *FSTreatment: - o.copyMatchingRows(retrieved) - case []*FSTreatment: - o.copyMatchingRows(retrieved...) - case FSTreatmentSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSTreatment or a slice of FSTreatment - // then run the AfterDeleteHooks on the slice - _, err = FSTreatments.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSTreatmentSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSTreatmentSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSTreatments.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSTreatmentSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSTreatments.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSTreatmentSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSTreatments.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 *FSTreatment) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSTreatmentSlice) 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 attachFSTreatmentOrganization0(ctx context.Context, exec bob.Executor, count int, fsTreatment0 *FSTreatment, organization1 *Organization) (*FSTreatment, error) { - setter := &FSTreatmentSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsTreatment0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSTreatmentOrganization0: %w", err) - } - - return fsTreatment0, nil -} - -func (fsTreatment0 *FSTreatment) 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 = attachFSTreatmentOrganization0(ctx, exec, 1, fsTreatment0, organization1) - if err != nil { - return err - } - - fsTreatment0.R.Organization = organization1 - - organization1.R.FSTreatments = append(organization1.R.FSTreatments, fsTreatment0) - - return nil -} - -func (fsTreatment0 *FSTreatment) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSTreatmentOrganization0(ctx, exec, 1, fsTreatment0, organization1) - if err != nil { - return err - } - - fsTreatment0.R.Organization = organization1 - - organization1.R.FSTreatments = append(organization1.R.FSTreatments, fsTreatment0) - - return nil -} - -type fsTreatmentWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Activity psql.WhereNullMod[Q, string] - Areaunit psql.WhereNullMod[Q, string] - Avetemp psql.WhereNullMod[Q, float64] - Barrierrouteid psql.WhereNullMod[Q, string] - Cbcount psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Containercount psql.WhereNullMod[Q, int16] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Enddatetime psql.WhereNullMod[Q, int64] - Equiptype psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fieldtech psql.WhereNullMod[Q, string] - Flowrate psql.WhereNullMod[Q, float64] - Globalid psql.WhereMod[Q, string] - Habitat psql.WhereNullMod[Q, string] - InspID psql.WhereNullMod[Q, string] - Invloc psql.WhereNullMod[Q, string] - Linelocid psql.WhereNullMod[Q, string] - Locationname psql.WhereNullMod[Q, string] - Method psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Pointlocid psql.WhereNullMod[Q, string] - Polygonlocid psql.WhereNullMod[Q, string] - Product psql.WhereNullMod[Q, string] - Ptaid psql.WhereNullMod[Q, string] - Qty psql.WhereNullMod[Q, float64] - Qtyunit psql.WhereNullMod[Q, string] - Raingauge psql.WhereNullMod[Q, float64] - Recordstatus psql.WhereNullMod[Q, int16] - Reviewed psql.WhereNullMod[Q, int16] - Reviewedby psql.WhereNullMod[Q, string] - Revieweddate psql.WhereNullMod[Q, int64] - Sdid psql.WhereNullMod[Q, string] - Sitecond psql.WhereNullMod[Q, string] - Srid psql.WhereNullMod[Q, string] - Startdatetime psql.WhereNullMod[Q, int64] - Targetspecies psql.WhereNullMod[Q, string] - Tirecount psql.WhereNullMod[Q, int16] - Treatacres psql.WhereNullMod[Q, float64] - Treatarea psql.WhereNullMod[Q, float64] - Treathectares psql.WhereNullMod[Q, float64] - Treatmenthours psql.WhereNullMod[Q, float64] - Treatmentlength psql.WhereNullMod[Q, float64] - Treatmentlengthunits psql.WhereNullMod[Q, string] - Totalcostprodcut psql.WhereNullMod[Q, float64] - Ulvrouteid psql.WhereNullMod[Q, string] - Warningoverride psql.WhereNullMod[Q, int16] - Winddir psql.WhereNullMod[Q, string] - Windspeed psql.WhereNullMod[Q, float64] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - TempSitecond psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] - Geom psql.WhereNullMod[Q, string] -} - -func (fsTreatmentWhere[Q]) AliasedAs(alias string) fsTreatmentWhere[Q] { - return buildFSTreatmentWhere[Q](buildFSTreatmentColumns(alias)) -} - -func buildFSTreatmentWhere[Q psql.Filterable](cols fsTreatmentColumns) fsTreatmentWhere[Q] { - return fsTreatmentWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Activity: psql.WhereNull[Q, string](cols.Activity), - Areaunit: psql.WhereNull[Q, string](cols.Areaunit), - Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), - Barrierrouteid: psql.WhereNull[Q, string](cols.Barrierrouteid), - Cbcount: psql.WhereNull[Q, int16](cols.Cbcount), - Comments: psql.WhereNull[Q, string](cols.Comments), - Containercount: psql.WhereNull[Q, int16](cols.Containercount), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), - Equiptype: psql.WhereNull[Q, string](cols.Equiptype), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech), - Flowrate: psql.WhereNull[Q, float64](cols.Flowrate), - 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), - Linelocid: psql.WhereNull[Q, string](cols.Linelocid), - Locationname: psql.WhereNull[Q, string](cols.Locationname), - Method: psql.WhereNull[Q, string](cols.Method), - Objectid: psql.Where[Q, int32](cols.Objectid), - Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), - Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), - Product: psql.WhereNull[Q, string](cols.Product), - Ptaid: psql.WhereNull[Q, string](cols.Ptaid), - Qty: psql.WhereNull[Q, float64](cols.Qty), - Qtyunit: psql.WhereNull[Q, string](cols.Qtyunit), - Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), - Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), - Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), - Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), - Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), - Sdid: psql.WhereNull[Q, string](cols.Sdid), - Sitecond: psql.WhereNull[Q, string](cols.Sitecond), - Srid: psql.WhereNull[Q, string](cols.Srid), - Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), - Targetspecies: psql.WhereNull[Q, string](cols.Targetspecies), - Tirecount: psql.WhereNull[Q, int16](cols.Tirecount), - Treatacres: psql.WhereNull[Q, float64](cols.Treatacres), - Treatarea: psql.WhereNull[Q, float64](cols.Treatarea), - Treathectares: psql.WhereNull[Q, float64](cols.Treathectares), - Treatmenthours: psql.WhereNull[Q, float64](cols.Treatmenthours), - Treatmentlength: psql.WhereNull[Q, float64](cols.Treatmentlength), - Treatmentlengthunits: psql.WhereNull[Q, string](cols.Treatmentlengthunits), - Totalcostprodcut: psql.WhereNull[Q, float64](cols.Totalcostprodcut), - Ulvrouteid: psql.WhereNull[Q, string](cols.Ulvrouteid), - Warningoverride: psql.WhereNull[Q, int16](cols.Warningoverride), - Winddir: psql.WhereNull[Q, string](cols.Winddir), - Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), - 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), - TempSitecond: psql.WhereNull[Q, string](cols.TempSitecond), - Updated: psql.Where[Q, time.Time](cols.Updated), - Geom: psql.WhereNull[Q, string](cols.Geom), - } -} - -func (o *FSTreatment) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsTreatment cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSTreatments = FSTreatmentSlice{o} - } - return nil - default: - return fmt.Errorf("fsTreatment has no relationship %q", name) - } -} - -type fsTreatmentPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSTreatmentPreloader() fsTreatmentPreloader { - return fsTreatmentPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSTreatments, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsTreatmentThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSTreatmentThenLoader[Q orm.Loadable]() fsTreatmentThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsTreatmentThenLoader[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 fsTreatment's Organization into the .R struct -func (o *FSTreatment) 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.FSTreatments = FSTreatmentSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsTreatment's Organization into the .R struct -func (os FSTreatmentSlice) 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.FSTreatments = append(rel.R.FSTreatments, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsTreatmentJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsTreatmentJoins[Q]) aliasedAs(alias string) fsTreatmentJoins[Q] { - return buildFSTreatmentJoins[Q](buildFSTreatmentColumns(alias), j.typ) -} - -func buildFSTreatmentJoins[Q dialect.Joinable](cols fsTreatmentColumns, typ string) fsTreatmentJoins[Q] { - return fsTreatmentJoins[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/db/models/fs_treatmentarea.bob.go b/db/models/fs_treatmentarea.bob.go deleted file mode 100644 index a5dd1fa7..00000000 --- a/db/models/fs_treatmentarea.bob.go +++ /dev/null @@ -1,1105 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSTreatmentarea is an object representing the database table. -type FSTreatmentarea struct { - OrganizationID int32 `db:"organization_id" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid string `db:"globalid" ` - Notified null.Val[int16] `db:"notified" ` - Objectid int32 `db:"objectid,pk" ` - SessionID null.Val[string] `db:"session_id" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - Treatdate null.Val[int64] `db:"treatdate" ` - TreatID null.Val[string] `db:"treat_id" ` - Type null.Val[string] `db:"type" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsTreatmentareaR `db:"-" ` -} - -// FSTreatmentareaSlice is an alias for a slice of pointers to FSTreatmentarea. -// This should almost always be used instead of []*FSTreatmentarea. -type FSTreatmentareaSlice []*FSTreatmentarea - -// FSTreatmentareas contains methods to work with the fs_treatmentarea table -var FSTreatmentareas = psql.NewTablex[*FSTreatmentarea, FSTreatmentareaSlice, *FSTreatmentareaSetter]("", "fs_treatmentarea", buildFSTreatmentareaColumns("fs_treatmentarea")) - -// FSTreatmentareasQuery is a query on the fs_treatmentarea table -type FSTreatmentareasQuery = *psql.ViewQuery[*FSTreatmentarea, FSTreatmentareaSlice] - -// fsTreatmentareaR is where relationships are stored. -type fsTreatmentareaR struct { - Organization *Organization // fs_treatmentarea.fs_treatmentarea_organization_id_fkey -} - -func buildFSTreatmentareaColumns(alias string) fsTreatmentareaColumns { - return fsTreatmentareaColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "comments", "creationdate", "creator", "editdate", "editor", "globalid", "notified", "objectid", "session_id", "shape__area", "shape__length", "treatdate", "treat_id", "type", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "updated", - ).WithParent("fs_treatmentarea"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Notified: psql.Quote(alias, "notified"), - Objectid: psql.Quote(alias, "objectid"), - SessionID: psql.Quote(alias, "session_id"), - ShapeArea: psql.Quote(alias, "shape__area"), - ShapeLength: psql.Quote(alias, "shape__length"), - Treatdate: psql.Quote(alias, "treatdate"), - TreatID: psql.Quote(alias, "treat_id"), - Type: psql.Quote(alias, "type"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsTreatmentareaColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Notified psql.Expression - Objectid psql.Expression - SessionID psql.Expression - ShapeArea psql.Expression - ShapeLength psql.Expression - Treatdate psql.Expression - TreatID psql.Expression - Type psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Updated psql.Expression -} - -func (c fsTreatmentareaColumns) Alias() string { - return c.tableAlias -} - -func (fsTreatmentareaColumns) AliasedAs(alias string) fsTreatmentareaColumns { - return buildFSTreatmentareaColumns(alias) -} - -// FSTreatmentareaSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSTreatmentareaSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - 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" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Treatdate omitnull.Val[int64] `db:"treatdate" ` - TreatID omitnull.Val[string] `db:"treat_id" ` - Type omitnull.Val[string] `db:"type" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSTreatmentareaSetter) SetColumns() []string { - vals := make([]string, 0, 22) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Notified.IsUnset() { - vals = append(vals, "notified") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.SessionID.IsUnset() { - vals = append(vals, "session_id") - } - if !s.ShapeArea.IsUnset() { - vals = append(vals, "shape__area") - } - if !s.ShapeLength.IsUnset() { - vals = append(vals, "shape__length") - } - if !s.Treatdate.IsUnset() { - vals = append(vals, "treatdate") - } - if !s.TreatID.IsUnset() { - vals = append(vals, "treat_id") - } - if !s.Type.IsUnset() { - vals = append(vals, "type") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSTreatmentareaSetter) Overwrite(t *FSTreatmentarea) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Notified.IsUnset() { - t.Notified = s.Notified.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.SessionID.IsUnset() { - t.SessionID = s.SessionID.MustGetNull() - } - if !s.ShapeArea.IsUnset() { - t.ShapeArea = s.ShapeArea.MustGetNull() - } - if !s.ShapeLength.IsUnset() { - t.ShapeLength = s.ShapeLength.MustGetNull() - } - if !s.Treatdate.IsUnset() { - t.Treatdate = s.Treatdate.MustGetNull() - } - if !s.TreatID.IsUnset() { - t.TreatID = s.TreatID.MustGetNull() - } - if !s.Type.IsUnset() { - t.Type = s.Type.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSTreatmentareaSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSTreatmentareas.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 22) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[1] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[2] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[3] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[4] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[5] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[6] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Notified.IsUnset() { - vals[7] = psql.Arg(s.Notified.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[8] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.SessionID.IsUnset() { - vals[9] = psql.Arg(s.SessionID.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.ShapeArea.IsUnset() { - vals[10] = psql.Arg(s.ShapeArea.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.ShapeLength.IsUnset() { - vals[11] = psql.Arg(s.ShapeLength.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Treatdate.IsUnset() { - vals[12] = psql.Arg(s.Treatdate.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.TreatID.IsUnset() { - vals[13] = psql.Arg(s.TreatID.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Type.IsUnset() { - vals[14] = psql.Arg(s.Type.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[15] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[16] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[17] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[18] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[19] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[20] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[21] = psql.Arg(s.Updated.MustGet()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSTreatmentareaSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSTreatmentareaSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 22) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Notified.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "notified")...), - psql.Arg(s.Notified), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.SessionID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "session_id")...), - psql.Arg(s.SessionID), - }}) - } - - if !s.ShapeArea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__area")...), - psql.Arg(s.ShapeArea), - }}) - } - - if !s.ShapeLength.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__length")...), - psql.Arg(s.ShapeLength), - }}) - } - - if !s.Treatdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treatdate")...), - psql.Arg(s.Treatdate), - }}) - } - - if !s.TreatID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treat_id")...), - psql.Arg(s.TreatID), - }}) - } - - if !s.Type.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "type")...), - psql.Arg(s.Type), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSTreatmentarea retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSTreatmentarea(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSTreatmentarea, error) { - if len(cols) == 0 { - return FSTreatmentareas.Query( - sm.Where(FSTreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSTreatmentareas.Query( - sm.Where(FSTreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSTreatmentareas.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSTreatmentareaExists checks the presence of a single record by primary key -func FSTreatmentareaExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSTreatmentareas.Query( - sm.Where(FSTreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSTreatmentarea is retrieved from the database -func (o *FSTreatmentarea) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSTreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, FSTreatmentareaSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSTreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, FSTreatmentareaSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSTreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, FSTreatmentareaSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSTreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, FSTreatmentareaSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSTreatmentarea -func (o *FSTreatmentarea) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSTreatmentarea) pkEQ() dialect.Expression { - return psql.Quote("fs_treatmentarea", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSTreatmentarea -func (o *FSTreatmentarea) Update(ctx context.Context, exec bob.Executor, s *FSTreatmentareaSetter) error { - v, err := FSTreatmentareas.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 FSTreatmentarea record with an executor -func (o *FSTreatmentarea) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSTreatmentareas.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSTreatmentarea using the executor -func (o *FSTreatmentarea) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSTreatmentareas.Query( - sm.Where(FSTreatmentareas.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSTreatmentareaSlice is retrieved from the database -func (o FSTreatmentareaSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSTreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSTreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSTreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSTreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSTreatmentareaSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_treatmentarea", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSTreatmentareaSlice) copyMatchingRows(from ...*FSTreatmentarea) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSTreatmentareaSlice) 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 FSTreatmentareas.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 *FSTreatmentarea: - o.copyMatchingRows(retrieved) - case []*FSTreatmentarea: - o.copyMatchingRows(retrieved...) - case FSTreatmentareaSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSTreatmentarea or a slice of FSTreatmentarea - // then run the AfterUpdateHooks on the slice - _, err = FSTreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSTreatmentareaSlice) 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 FSTreatmentareas.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 *FSTreatmentarea: - o.copyMatchingRows(retrieved) - case []*FSTreatmentarea: - o.copyMatchingRows(retrieved...) - case FSTreatmentareaSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSTreatmentarea or a slice of FSTreatmentarea - // then run the AfterDeleteHooks on the slice - _, err = FSTreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSTreatmentareaSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSTreatmentareaSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSTreatmentareas.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSTreatmentareaSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSTreatmentareas.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSTreatmentareaSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSTreatmentareas.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 *FSTreatmentarea) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSTreatmentareaSlice) 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 attachFSTreatmentareaOrganization0(ctx context.Context, exec bob.Executor, count int, fsTreatmentarea0 *FSTreatmentarea, organization1 *Organization) (*FSTreatmentarea, error) { - setter := &FSTreatmentareaSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsTreatmentarea0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSTreatmentareaOrganization0: %w", err) - } - - return fsTreatmentarea0, nil -} - -func (fsTreatmentarea0 *FSTreatmentarea) 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 = attachFSTreatmentareaOrganization0(ctx, exec, 1, fsTreatmentarea0, organization1) - if err != nil { - return err - } - - fsTreatmentarea0.R.Organization = organization1 - - organization1.R.FSTreatmentareas = append(organization1.R.FSTreatmentareas, fsTreatmentarea0) - - return nil -} - -func (fsTreatmentarea0 *FSTreatmentarea) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSTreatmentareaOrganization0(ctx, exec, 1, fsTreatmentarea0, organization1) - if err != nil { - return err - } - - fsTreatmentarea0.R.Organization = organization1 - - organization1.R.FSTreatmentareas = append(organization1.R.FSTreatmentareas, fsTreatmentarea0) - - return nil -} - -type fsTreatmentareaWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Notified psql.WhereNullMod[Q, int16] - Objectid psql.WhereMod[Q, int32] - SessionID psql.WhereNullMod[Q, string] - ShapeArea psql.WhereNullMod[Q, float64] - ShapeLength psql.WhereNullMod[Q, float64] - Treatdate psql.WhereNullMod[Q, int64] - TreatID psql.WhereNullMod[Q, string] - Type psql.WhereNullMod[Q, string] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsTreatmentareaWhere[Q]) AliasedAs(alias string) fsTreatmentareaWhere[Q] { - return buildFSTreatmentareaWhere[Q](buildFSTreatmentareaColumns(alias)) -} - -func buildFSTreatmentareaWhere[Q psql.Filterable](cols fsTreatmentareaColumns) fsTreatmentareaWhere[Q] { - return fsTreatmentareaWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - 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), - ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), - ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), - Treatdate: psql.WhereNull[Q, int64](cols.Treatdate), - TreatID: psql.WhereNull[Q, string](cols.TreatID), - Type: psql.WhereNull[Q, string](cols.Type), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSTreatmentarea) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsTreatmentarea cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSTreatmentareas = FSTreatmentareaSlice{o} - } - return nil - default: - return fmt.Errorf("fsTreatmentarea has no relationship %q", name) - } -} - -type fsTreatmentareaPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSTreatmentareaPreloader() fsTreatmentareaPreloader { - return fsTreatmentareaPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSTreatmentareas, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsTreatmentareaThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSTreatmentareaThenLoader[Q orm.Loadable]() fsTreatmentareaThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsTreatmentareaThenLoader[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 fsTreatmentarea's Organization into the .R struct -func (o *FSTreatmentarea) 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.FSTreatmentareas = FSTreatmentareaSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsTreatmentarea's Organization into the .R struct -func (os FSTreatmentareaSlice) 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.FSTreatmentareas = append(rel.R.FSTreatmentareas, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsTreatmentareaJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsTreatmentareaJoins[Q]) aliasedAs(alias string) fsTreatmentareaJoins[Q] { - return buildFSTreatmentareaJoins[Q](buildFSTreatmentareaColumns(alias), j.typ) -} - -func buildFSTreatmentareaJoins[Q dialect.Joinable](cols fsTreatmentareaColumns, typ string) fsTreatmentareaJoins[Q] { - return fsTreatmentareaJoins[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/db/models/fs_zones.bob.go b/db/models/fs_zones.bob.go deleted file mode 100644 index 287808a0..00000000 --- a/db/models/fs_zones.bob.go +++ /dev/null @@ -1,1005 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSZone is an object representing the database table. -type FSZone struct { - OrganizationID int32 `db:"organization_id" ` - Active null.Val[int64] `db:"active" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid string `db:"globalid" ` - Name null.Val[string] `db:"name" ` - Objectid int32 `db:"objectid,pk" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsZoneR `db:"-" ` -} - -// FSZoneSlice is an alias for a slice of pointers to FSZone. -// This should almost always be used instead of []*FSZone. -type FSZoneSlice []*FSZone - -// FSZones contains methods to work with the fs_zones table -var FSZones = psql.NewTablex[*FSZone, FSZoneSlice, *FSZoneSetter]("", "fs_zones", buildFSZoneColumns("fs_zones")) - -// FSZonesQuery is a query on the fs_zones table -type FSZonesQuery = *psql.ViewQuery[*FSZone, FSZoneSlice] - -// fsZoneR is where relationships are stored. -type fsZoneR struct { - Organization *Organization // fs_zones.fs_zones_organization_id_fkey -} - -func buildFSZoneColumns(alias string) fsZoneColumns { - return fsZoneColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "active", "creationdate", "creator", "editdate", "editor", "globalid", "name", "objectid", "shape__area", "shape__length", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "updated", - ).WithParent("fs_zones"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Active: psql.Quote(alias, "active"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Name: psql.Quote(alias, "name"), - Objectid: psql.Quote(alias, "objectid"), - ShapeArea: psql.Quote(alias, "shape__area"), - ShapeLength: psql.Quote(alias, "shape__length"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsZoneColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Active psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Name psql.Expression - Objectid psql.Expression - ShapeArea psql.Expression - ShapeLength psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Updated psql.Expression -} - -func (c fsZoneColumns) Alias() string { - return c.tableAlias -} - -func (fsZoneColumns) AliasedAs(alias string) fsZoneColumns { - return buildFSZoneColumns(alias) -} - -// FSZoneSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSZoneSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Active omitnull.Val[int64] `db:"active" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - 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" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSZoneSetter) SetColumns() []string { - vals := make([]string, 0, 18) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Active.IsUnset() { - vals = append(vals, "active") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.ShapeArea.IsUnset() { - vals = append(vals, "shape__area") - } - if !s.ShapeLength.IsUnset() { - vals = append(vals, "shape__length") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSZoneSetter) Overwrite(t *FSZone) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Active.IsUnset() { - t.Active = s.Active.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.ShapeArea.IsUnset() { - t.ShapeArea = s.ShapeArea.MustGetNull() - } - if !s.ShapeLength.IsUnset() { - t.ShapeLength = s.ShapeLength.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSZoneSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSZones.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 18) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Active.IsUnset() { - vals[1] = psql.Arg(s.Active.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[2] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[3] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[4] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[5] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[6] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[7] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[8] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.ShapeArea.IsUnset() { - vals[9] = psql.Arg(s.ShapeArea.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.ShapeLength.IsUnset() { - vals[10] = psql.Arg(s.ShapeLength.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[13] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[14] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[16] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[17] = psql.Arg(s.Updated.MustGet()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSZoneSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSZoneSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 18) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Active.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "active")...), - psql.Arg(s.Active), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.ShapeArea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__area")...), - psql.Arg(s.ShapeArea), - }}) - } - - if !s.ShapeLength.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__length")...), - psql.Arg(s.ShapeLength), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSZone retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSZone(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSZone, error) { - if len(cols) == 0 { - return FSZones.Query( - sm.Where(FSZones.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSZones.Query( - sm.Where(FSZones.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSZones.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSZoneExists checks the presence of a single record by primary key -func FSZoneExists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSZones.Query( - sm.Where(FSZones.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSZone is retrieved from the database -func (o *FSZone) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSZones.AfterSelectHooks.RunHooks(ctx, exec, FSZoneSlice{o}) - case bob.QueryTypeInsert: - ctx, err = FSZones.AfterInsertHooks.RunHooks(ctx, exec, FSZoneSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSZones.AfterUpdateHooks.RunHooks(ctx, exec, FSZoneSlice{o}) - case bob.QueryTypeDelete: - ctx, err = FSZones.AfterDeleteHooks.RunHooks(ctx, exec, FSZoneSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSZone -func (o *FSZone) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSZone) pkEQ() dialect.Expression { - return psql.Quote("fs_zones", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSZone -func (o *FSZone) Update(ctx context.Context, exec bob.Executor, s *FSZoneSetter) error { - v, err := FSZones.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 FSZone record with an executor -func (o *FSZone) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSZones.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSZone using the executor -func (o *FSZone) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSZones.Query( - sm.Where(FSZones.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSZoneSlice is retrieved from the database -func (o FSZoneSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSZones.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSZones.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSZones.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSZones.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSZoneSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_zones", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSZoneSlice) copyMatchingRows(from ...*FSZone) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSZoneSlice) 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 FSZones.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 *FSZone: - o.copyMatchingRows(retrieved) - case []*FSZone: - o.copyMatchingRows(retrieved...) - case FSZoneSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSZone or a slice of FSZone - // then run the AfterUpdateHooks on the slice - _, err = FSZones.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSZoneSlice) 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 FSZones.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 *FSZone: - o.copyMatchingRows(retrieved) - case []*FSZone: - o.copyMatchingRows(retrieved...) - case FSZoneSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSZone or a slice of FSZone - // then run the AfterDeleteHooks on the slice - _, err = FSZones.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSZoneSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSZoneSetter) error { - if len(o) == 0 { - return nil - } - - _, err := FSZones.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSZoneSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSZones.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSZoneSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSZones.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 *FSZone) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSZoneSlice) 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 attachFSZoneOrganization0(ctx context.Context, exec bob.Executor, count int, fsZone0 *FSZone, organization1 *Organization) (*FSZone, error) { - setter := &FSZoneSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsZone0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSZoneOrganization0: %w", err) - } - - return fsZone0, nil -} - -func (fsZone0 *FSZone) 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 = attachFSZoneOrganization0(ctx, exec, 1, fsZone0, organization1) - if err != nil { - return err - } - - fsZone0.R.Organization = organization1 - - organization1.R.FSZones = append(organization1.R.FSZones, fsZone0) - - return nil -} - -func (fsZone0 *FSZone) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSZoneOrganization0(ctx, exec, 1, fsZone0, organization1) - if err != nil { - return err - } - - fsZone0.R.Organization = organization1 - - organization1.R.FSZones = append(organization1.R.FSZones, fsZone0) - - return nil -} - -type fsZoneWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Active psql.WhereNullMod[Q, int64] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Name psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - ShapeArea psql.WhereNullMod[Q, float64] - ShapeLength psql.WhereNullMod[Q, float64] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsZoneWhere[Q]) AliasedAs(alias string) fsZoneWhere[Q] { - return buildFSZoneWhere[Q](buildFSZoneColumns(alias)) -} - -func buildFSZoneWhere[Q psql.Filterable](cols fsZoneColumns) fsZoneWhere[Q] { - return fsZoneWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Active: psql.WhereNull[Q, int64](cols.Active), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - 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), - ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSZone) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsZone cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSZones = FSZoneSlice{o} - } - return nil - default: - return fmt.Errorf("fsZone has no relationship %q", name) - } -} - -type fsZonePreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSZonePreloader() fsZonePreloader { - return fsZonePreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSZones, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsZoneThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSZoneThenLoader[Q orm.Loadable]() fsZoneThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsZoneThenLoader[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 fsZone's Organization into the .R struct -func (o *FSZone) 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.FSZones = FSZoneSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsZone's Organization into the .R struct -func (os FSZoneSlice) 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.FSZones = append(rel.R.FSZones, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsZoneJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsZoneJoins[Q]) aliasedAs(alias string) fsZoneJoins[Q] { - return buildFSZoneJoins[Q](buildFSZoneColumns(alias), j.typ) -} - -func buildFSZoneJoins[Q dialect.Joinable](cols fsZoneColumns, typ string) fsZoneJoins[Q] { - return fsZoneJoins[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/db/models/fs_zones2.bob.go b/db/models/fs_zones2.bob.go deleted file mode 100644 index 23f8aea1..00000000 --- a/db/models/fs_zones2.bob.go +++ /dev/null @@ -1,980 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// FSZones2 is an object representing the database table. -type FSZones2 struct { - OrganizationID int32 `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid string `db:"globalid" ` - Name null.Val[string] `db:"name" ` - Objectid int32 `db:"objectid,pk" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - 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" ` - Updated time.Time `db:"updated" ` - - R fsZones2R `db:"-" ` -} - -// FSZones2Slice is an alias for a slice of pointers to FSZones2. -// This should almost always be used instead of []*FSZones2. -type FSZones2Slice []*FSZones2 - -// FSZones2s contains methods to work with the fs_zones2 table -var FSZones2s = psql.NewTablex[*FSZones2, FSZones2Slice, *FSZones2Setter]("", "fs_zones2", buildFSZones2Columns("fs_zones2")) - -// FSZones2sQuery is a query on the fs_zones2 table -type FSZones2sQuery = *psql.ViewQuery[*FSZones2, FSZones2Slice] - -// fsZones2R is where relationships are stored. -type fsZones2R struct { - Organization *Organization // fs_zones2.fs_zones2_organization_id_fkey -} - -func buildFSZones2Columns(alias string) fsZones2Columns { - return fsZones2Columns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "name", "objectid", "shape__area", "shape__length", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "updated", - ).WithParent("fs_zones2"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Name: psql.Quote(alias, "name"), - Objectid: psql.Quote(alias, "objectid"), - ShapeArea: psql.Quote(alias, "shape__area"), - ShapeLength: psql.Quote(alias, "shape__length"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Updated: psql.Quote(alias, "updated"), - } -} - -type fsZones2Columns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Name psql.Expression - Objectid psql.Expression - ShapeArea psql.Expression - ShapeLength psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Updated psql.Expression -} - -func (c fsZones2Columns) Alias() string { - return c.tableAlias -} - -func (fsZones2Columns) AliasedAs(alias string) fsZones2Columns { - return buildFSZones2Columns(alias) -} - -// FSZones2Setter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type FSZones2Setter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - 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" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - 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" ` - Updated omit.Val[time.Time] `db:"updated" ` -} - -func (s FSZones2Setter) SetColumns() []string { - vals := make([]string, 0, 17) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if s.Globalid.IsValue() { - vals = append(vals, "globalid") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.ShapeArea.IsUnset() { - vals = append(vals, "shape__area") - } - if !s.ShapeLength.IsUnset() { - vals = append(vals, "shape__length") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Updated.IsValue() { - vals = append(vals, "updated") - } - return vals -} - -func (s FSZones2Setter) Overwrite(t *FSZones2) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if s.Globalid.IsValue() { - t.Globalid = s.Globalid.MustGet() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.ShapeArea.IsUnset() { - t.ShapeArea = s.ShapeArea.MustGetNull() - } - if !s.ShapeLength.IsUnset() { - t.ShapeLength = s.ShapeLength.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Updated.IsValue() { - t.Updated = s.Updated.MustGet() - } -} - -func (s *FSZones2Setter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return FSZones2s.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 17) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[1] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[2] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[3] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[4] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if s.Globalid.IsValue() { - vals[5] = psql.Arg(s.Globalid.MustGet()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[6] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[7] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.ShapeArea.IsUnset() { - vals[8] = psql.Arg(s.ShapeArea.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.ShapeLength.IsUnset() { - vals[9] = psql.Arg(s.ShapeLength.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[10] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[11] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[12] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[13] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[14] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[15] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if s.Updated.IsValue() { - vals[16] = psql.Arg(s.Updated.MustGet()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s FSZones2Setter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s FSZones2Setter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 17) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if s.Globalid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.ShapeArea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__area")...), - psql.Arg(s.ShapeArea), - }}) - } - - if !s.ShapeLength.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__length")...), - psql.Arg(s.ShapeLength), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Updated.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "updated")...), - psql.Arg(s.Updated), - }}) - } - - return exprs -} - -// FindFSZones2 retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindFSZones2(ctx context.Context, exec bob.Executor, ObjectidPK int32, cols ...string) (*FSZones2, error) { - if len(cols) == 0 { - return FSZones2s.Query( - sm.Where(FSZones2s.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).One(ctx, exec) - } - - return FSZones2s.Query( - sm.Where(FSZones2s.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Columns(FSZones2s.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// FSZones2Exists checks the presence of a single record by primary key -func FSZones2Exists(ctx context.Context, exec bob.Executor, ObjectidPK int32) (bool, error) { - return FSZones2s.Query( - sm.Where(FSZones2s.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after FSZones2 is retrieved from the database -func (o *FSZones2) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSZones2s.AfterSelectHooks.RunHooks(ctx, exec, FSZones2Slice{o}) - case bob.QueryTypeInsert: - ctx, err = FSZones2s.AfterInsertHooks.RunHooks(ctx, exec, FSZones2Slice{o}) - case bob.QueryTypeUpdate: - ctx, err = FSZones2s.AfterUpdateHooks.RunHooks(ctx, exec, FSZones2Slice{o}) - case bob.QueryTypeDelete: - ctx, err = FSZones2s.AfterDeleteHooks.RunHooks(ctx, exec, FSZones2Slice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the FSZones2 -func (o *FSZones2) primaryKeyVals() bob.Expression { - return psql.Arg(o.Objectid) -} - -func (o *FSZones2) pkEQ() dialect.Expression { - return psql.Quote("fs_zones2", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the FSZones2 -func (o *FSZones2) Update(ctx context.Context, exec bob.Executor, s *FSZones2Setter) error { - v, err := FSZones2s.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 FSZones2 record with an executor -func (o *FSZones2) Delete(ctx context.Context, exec bob.Executor) error { - _, err := FSZones2s.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the FSZones2 using the executor -func (o *FSZones2) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := FSZones2s.Query( - sm.Where(FSZones2s.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after FSZones2Slice is retrieved from the database -func (o FSZones2Slice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = FSZones2s.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = FSZones2s.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = FSZones2s.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = FSZones2s.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o FSZones2Slice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("fs_zones2", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 FSZones2Slice) copyMatchingRows(from ...*FSZones2) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o FSZones2Slice) 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 FSZones2s.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 *FSZones2: - o.copyMatchingRows(retrieved) - case []*FSZones2: - o.copyMatchingRows(retrieved...) - case FSZones2Slice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSZones2 or a slice of FSZones2 - // then run the AfterUpdateHooks on the slice - _, err = FSZones2s.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o FSZones2Slice) 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 FSZones2s.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 *FSZones2: - o.copyMatchingRows(retrieved) - case []*FSZones2: - o.copyMatchingRows(retrieved...) - case FSZones2Slice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a FSZones2 or a slice of FSZones2 - // then run the AfterDeleteHooks on the slice - _, err = FSZones2s.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o FSZones2Slice) UpdateAll(ctx context.Context, exec bob.Executor, vals FSZones2Setter) error { - if len(o) == 0 { - return nil - } - - _, err := FSZones2s.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o FSZones2Slice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := FSZones2s.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o FSZones2Slice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := FSZones2s.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 *FSZones2) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os FSZones2Slice) 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 attachFSZones2Organization0(ctx context.Context, exec bob.Executor, count int, fsZones20 *FSZones2, organization1 *Organization) (*FSZones2, error) { - setter := &FSZones2Setter{ - OrganizationID: omit.From(organization1.ID), - } - - err := fsZones20.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachFSZones2Organization0: %w", err) - } - - return fsZones20, nil -} - -func (fsZones20 *FSZones2) 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 = attachFSZones2Organization0(ctx, exec, 1, fsZones20, organization1) - if err != nil { - return err - } - - fsZones20.R.Organization = organization1 - - organization1.R.FSZones2s = append(organization1.R.FSZones2s, fsZones20) - - return nil -} - -func (fsZones20 *FSZones2) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachFSZones2Organization0(ctx, exec, 1, fsZones20, organization1) - if err != nil { - return err - } - - fsZones20.R.Organization = organization1 - - organization1.R.FSZones2s = append(organization1.R.FSZones2s, fsZones20) - - return nil -} - -type fsZones2Where[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereMod[Q, string] - Name psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - ShapeArea psql.WhereNullMod[Q, float64] - ShapeLength psql.WhereNullMod[Q, float64] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Updated psql.WhereMod[Q, time.Time] -} - -func (fsZones2Where[Q]) AliasedAs(alias string) fsZones2Where[Q] { - return buildFSZones2Where[Q](buildFSZones2Columns(alias)) -} - -func buildFSZones2Where[Q psql.Filterable](cols fsZones2Columns) fsZones2Where[Q] { - return fsZones2Where[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - 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), - ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Updated: psql.Where[Q, time.Time](cols.Updated), - } -} - -func (o *FSZones2) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("fsZones2 cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.FSZones2s = FSZones2Slice{o} - } - return nil - default: - return fmt.Errorf("fsZones2 has no relationship %q", name) - } -} - -type fsZones2Preloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildFSZones2Preloader() fsZones2Preloader { - return fsZones2Preloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: FSZones2s, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type fsZones2ThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFSZones2ThenLoader[Q orm.Loadable]() fsZones2ThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fsZones2ThenLoader[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 fsZones2's Organization into the .R struct -func (o *FSZones2) 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.FSZones2s = FSZones2Slice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the fsZones2's Organization into the .R struct -func (os FSZones2Slice) 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.FSZones2s = append(rel.R.FSZones2s, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type fsZones2Joins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fsZones2Joins[Q]) aliasedAs(alias string) fsZones2Joins[Q] { - return buildFSZones2Joins[Q](buildFSZones2Columns(alias), j.typ) -} - -func buildFSZones2Joins[Q dialect.Joinable](cols fsZones2Columns, typ string) fsZones2Joins[Q] { - return fsZones2Joins[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/db/models/geography_columns.bob.go b/db/models/geography_columns.bob.go index c0009226..c81d019b 100644 --- a/db/models/geography_columns.bob.go +++ b/db/models/geography_columns.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models diff --git a/db/models/geometry_columns.bob.go b/db/models/geometry_columns.bob.go index fde74e5f..68adfb2b 100644 --- a/db/models/geometry_columns.bob.go +++ b/db/models/geometry_columns.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models diff --git a/db/models/goose_db_version.bob.go b/db/models/goose_db_version.bob.go index 93afc44a..da2c4575 100644 --- a/db/models/goose_db_version.bob.go +++ b/db/models/goose_db_version.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models diff --git a/db/models/h3_aggregation.bob.go b/db/models/h3_aggregation.bob.go index 9ec7ed30..e2830ecc 100644 --- a/db/models/h3_aggregation.bob.go +++ b/db/models/h3_aggregation.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models diff --git a/db/models/history_containerrelate.bob.go b/db/models/history_containerrelate.bob.go deleted file mode 100644 index eb136bd9..00000000 --- a/db/models/history_containerrelate.bob.go +++ /dev/null @@ -1,1040 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryContainerrelate is an object representing the database table. -type HistoryContainerrelate struct { - OrganizationID int32 `db:"organization_id" ` - Containertype null.Val[string] `db:"containertype" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Inspsampleid null.Val[string] `db:"inspsampleid" ` - Mosquitoinspid null.Val[string] `db:"mosquitoinspid" ` - Objectid int32 `db:"objectid,pk" ` - Treatmentid null.Val[string] `db:"treatmentid" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historyContainerrelateR `db:"-" ` -} - -// HistoryContainerrelateSlice is an alias for a slice of pointers to HistoryContainerrelate. -// This should almost always be used instead of []*HistoryContainerrelate. -type HistoryContainerrelateSlice []*HistoryContainerrelate - -// HistoryContainerrelates contains methods to work with the history_containerrelate table -var HistoryContainerrelates = psql.NewTablex[*HistoryContainerrelate, HistoryContainerrelateSlice, *HistoryContainerrelateSetter]("", "history_containerrelate", buildHistoryContainerrelateColumns("history_containerrelate")) - -// HistoryContainerrelatesQuery is a query on the history_containerrelate table -type HistoryContainerrelatesQuery = *psql.ViewQuery[*HistoryContainerrelate, HistoryContainerrelateSlice] - -// historyContainerrelateR is where relationships are stored. -type historyContainerrelateR struct { - Organization *Organization // history_containerrelate.history_containerrelate_organization_id_fkey -} - -func buildHistoryContainerrelateColumns(alias string) historyContainerrelateColumns { - return historyContainerrelateColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "containertype", "creationdate", "creator", "editdate", "editor", "globalid", "inspsampleid", "mosquitoinspid", "objectid", "treatmentid", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", - ).WithParent("history_containerrelate"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Containertype: psql.Quote(alias, "containertype"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Inspsampleid: psql.Quote(alias, "inspsampleid"), - Mosquitoinspid: psql.Quote(alias, "mosquitoinspid"), - Objectid: psql.Quote(alias, "objectid"), - Treatmentid: psql.Quote(alias, "treatmentid"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Version: psql.Quote(alias, "version"), - } -} - -type historyContainerrelateColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Containertype psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Inspsampleid psql.Expression - Mosquitoinspid psql.Expression - Objectid psql.Expression - Treatmentid psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Version psql.Expression -} - -func (c historyContainerrelateColumns) Alias() string { - return c.tableAlias -} - -func (historyContainerrelateColumns) AliasedAs(alias string) historyContainerrelateColumns { - return buildHistoryContainerrelateColumns(alias) -} - -// HistoryContainerrelateSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryContainerrelateSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Containertype omitnull.Val[string] `db:"containertype" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Inspsampleid omitnull.Val[string] `db:"inspsampleid" ` - Mosquitoinspid omitnull.Val[string] `db:"mosquitoinspid" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Treatmentid omitnull.Val[string] `db:"treatmentid" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryContainerrelateSetter) SetColumns() []string { - vals := make([]string, 0, 19) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Containertype.IsUnset() { - vals = append(vals, "containertype") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Inspsampleid.IsUnset() { - vals = append(vals, "inspsampleid") - } - if !s.Mosquitoinspid.IsUnset() { - vals = append(vals, "mosquitoinspid") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Treatmentid.IsUnset() { - vals = append(vals, "treatmentid") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryContainerrelateSetter) Overwrite(t *HistoryContainerrelate) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Containertype.IsUnset() { - t.Containertype = s.Containertype.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Inspsampleid.IsUnset() { - t.Inspsampleid = s.Inspsampleid.MustGetNull() - } - if !s.Mosquitoinspid.IsUnset() { - t.Mosquitoinspid = s.Mosquitoinspid.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Treatmentid.IsUnset() { - t.Treatmentid = s.Treatmentid.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryContainerrelateSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryContainerrelates.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 19) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Containertype.IsUnset() { - vals[1] = psql.Arg(s.Containertype.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[2] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[3] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[4] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[5] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[6] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Inspsampleid.IsUnset() { - vals[7] = psql.Arg(s.Inspsampleid.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Mosquitoinspid.IsUnset() { - vals[8] = psql.Arg(s.Mosquitoinspid.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[9] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Treatmentid.IsUnset() { - vals[10] = psql.Arg(s.Treatmentid.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[11] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[12] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[13] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[14] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[15] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[16] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[17] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[18] = psql.Arg(s.Version.MustGet()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryContainerrelateSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryContainerrelateSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 19) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Containertype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "containertype")...), - psql.Arg(s.Containertype), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Inspsampleid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "inspsampleid")...), - psql.Arg(s.Inspsampleid), - }}) - } - - if !s.Mosquitoinspid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "mosquitoinspid")...), - psql.Arg(s.Mosquitoinspid), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Treatmentid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treatmentid")...), - psql.Arg(s.Treatmentid), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryContainerrelate retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryContainerrelate(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryContainerrelate, error) { - if len(cols) == 0 { - return HistoryContainerrelates.Query( - sm.Where(HistoryContainerrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryContainerrelates.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryContainerrelates.Query( - sm.Where(HistoryContainerrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryContainerrelates.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryContainerrelates.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryContainerrelateExists checks the presence of a single record by primary key -func HistoryContainerrelateExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryContainerrelates.Query( - sm.Where(HistoryContainerrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryContainerrelates.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryContainerrelate is retrieved from the database -func (o *HistoryContainerrelate) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryContainerrelates.AfterSelectHooks.RunHooks(ctx, exec, HistoryContainerrelateSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryContainerrelates.AfterInsertHooks.RunHooks(ctx, exec, HistoryContainerrelateSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryContainerrelates.AfterUpdateHooks.RunHooks(ctx, exec, HistoryContainerrelateSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryContainerrelates.AfterDeleteHooks.RunHooks(ctx, exec, HistoryContainerrelateSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryContainerrelate -func (o *HistoryContainerrelate) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryContainerrelate) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_containerrelate", "objectid"), psql.Quote("history_containerrelate", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryContainerrelate -func (o *HistoryContainerrelate) Update(ctx context.Context, exec bob.Executor, s *HistoryContainerrelateSetter) error { - v, err := HistoryContainerrelates.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 HistoryContainerrelate record with an executor -func (o *HistoryContainerrelate) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryContainerrelates.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryContainerrelate using the executor -func (o *HistoryContainerrelate) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryContainerrelates.Query( - sm.Where(HistoryContainerrelates.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryContainerrelates.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryContainerrelateSlice is retrieved from the database -func (o HistoryContainerrelateSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryContainerrelates.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryContainerrelates.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryContainerrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryContainerrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryContainerrelateSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_containerrelate", "objectid"), psql.Quote("history_containerrelate", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryContainerrelateSlice) copyMatchingRows(from ...*HistoryContainerrelate) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryContainerrelateSlice) 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 HistoryContainerrelates.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 *HistoryContainerrelate: - o.copyMatchingRows(retrieved) - case []*HistoryContainerrelate: - o.copyMatchingRows(retrieved...) - case HistoryContainerrelateSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryContainerrelate or a slice of HistoryContainerrelate - // then run the AfterUpdateHooks on the slice - _, err = HistoryContainerrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryContainerrelateSlice) 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 HistoryContainerrelates.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 *HistoryContainerrelate: - o.copyMatchingRows(retrieved) - case []*HistoryContainerrelate: - o.copyMatchingRows(retrieved...) - case HistoryContainerrelateSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryContainerrelate or a slice of HistoryContainerrelate - // then run the AfterDeleteHooks on the slice - _, err = HistoryContainerrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryContainerrelateSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryContainerrelateSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryContainerrelates.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryContainerrelateSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryContainerrelates.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryContainerrelateSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryContainerrelates.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 *HistoryContainerrelate) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryContainerrelateSlice) 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 attachHistoryContainerrelateOrganization0(ctx context.Context, exec bob.Executor, count int, historyContainerrelate0 *HistoryContainerrelate, organization1 *Organization) (*HistoryContainerrelate, error) { - setter := &HistoryContainerrelateSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyContainerrelate0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryContainerrelateOrganization0: %w", err) - } - - return historyContainerrelate0, nil -} - -func (historyContainerrelate0 *HistoryContainerrelate) 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 = attachHistoryContainerrelateOrganization0(ctx, exec, 1, historyContainerrelate0, organization1) - if err != nil { - return err - } - - historyContainerrelate0.R.Organization = organization1 - - organization1.R.HistoryContainerrelates = append(organization1.R.HistoryContainerrelates, historyContainerrelate0) - - return nil -} - -func (historyContainerrelate0 *HistoryContainerrelate) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryContainerrelateOrganization0(ctx, exec, 1, historyContainerrelate0, organization1) - if err != nil { - return err - } - - historyContainerrelate0.R.Organization = organization1 - - organization1.R.HistoryContainerrelates = append(organization1.R.HistoryContainerrelates, historyContainerrelate0) - - return nil -} - -type historyContainerrelateWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Containertype psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Inspsampleid psql.WhereNullMod[Q, string] - Mosquitoinspid psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Treatmentid psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyContainerrelateWhere[Q]) AliasedAs(alias string) historyContainerrelateWhere[Q] { - return buildHistoryContainerrelateWhere[Q](buildHistoryContainerrelateColumns(alias)) -} - -func buildHistoryContainerrelateWhere[Q psql.Filterable](cols historyContainerrelateColumns) historyContainerrelateWhere[Q] { - return historyContainerrelateWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Containertype: psql.WhereNull[Q, string](cols.Containertype), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - 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), - Inspsampleid: psql.WhereNull[Q, string](cols.Inspsampleid), - Mosquitoinspid: psql.WhereNull[Q, string](cols.Mosquitoinspid), - Objectid: psql.Where[Q, int32](cols.Objectid), - Treatmentid: psql.WhereNull[Q, string](cols.Treatmentid), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryContainerrelate) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyContainerrelate cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryContainerrelates = HistoryContainerrelateSlice{o} - } - return nil - default: - return fmt.Errorf("historyContainerrelate has no relationship %q", name) - } -} - -type historyContainerrelatePreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryContainerrelatePreloader() historyContainerrelatePreloader { - return historyContainerrelatePreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryContainerrelates, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyContainerrelateThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryContainerrelateThenLoader[Q orm.Loadable]() historyContainerrelateThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyContainerrelateThenLoader[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 historyContainerrelate's Organization into the .R struct -func (o *HistoryContainerrelate) 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.HistoryContainerrelates = HistoryContainerrelateSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyContainerrelate's Organization into the .R struct -func (os HistoryContainerrelateSlice) 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.HistoryContainerrelates = append(rel.R.HistoryContainerrelates, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyContainerrelateJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyContainerrelateJoins[Q]) aliasedAs(alias string) historyContainerrelateJoins[Q] { - return buildHistoryContainerrelateJoins[Q](buildHistoryContainerrelateColumns(alias), j.typ) -} - -func buildHistoryContainerrelateJoins[Q dialect.Joinable](cols historyContainerrelateColumns, typ string) historyContainerrelateJoins[Q] { - return historyContainerrelateJoins[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/db/models/history_fieldscoutinglog.bob.go b/db/models/history_fieldscoutinglog.bob.go deleted file mode 100644 index bc026f06..00000000 --- a/db/models/history_fieldscoutinglog.bob.go +++ /dev/null @@ -1,965 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryFieldscoutinglog is an object representing the database table. -type HistoryFieldscoutinglog struct { - OrganizationID int32 `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Objectid int32 `db:"objectid,pk" ` - Status null.Val[int16] `db:"status" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historyFieldscoutinglogR `db:"-" ` -} - -// HistoryFieldscoutinglogSlice is an alias for a slice of pointers to HistoryFieldscoutinglog. -// This should almost always be used instead of []*HistoryFieldscoutinglog. -type HistoryFieldscoutinglogSlice []*HistoryFieldscoutinglog - -// HistoryFieldscoutinglogs contains methods to work with the history_fieldscoutinglog table -var HistoryFieldscoutinglogs = psql.NewTablex[*HistoryFieldscoutinglog, HistoryFieldscoutinglogSlice, *HistoryFieldscoutinglogSetter]("", "history_fieldscoutinglog", buildHistoryFieldscoutinglogColumns("history_fieldscoutinglog")) - -// HistoryFieldscoutinglogsQuery is a query on the history_fieldscoutinglog table -type HistoryFieldscoutinglogsQuery = *psql.ViewQuery[*HistoryFieldscoutinglog, HistoryFieldscoutinglogSlice] - -// historyFieldscoutinglogR is where relationships are stored. -type historyFieldscoutinglogR struct { - Organization *Organization // history_fieldscoutinglog.history_fieldscoutinglog_organization_id_fkey -} - -func buildHistoryFieldscoutinglogColumns(alias string) historyFieldscoutinglogColumns { - return historyFieldscoutinglogColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "objectid", "status", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", - ).WithParent("history_fieldscoutinglog"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Objectid: psql.Quote(alias, "objectid"), - Status: psql.Quote(alias, "status"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Version: psql.Quote(alias, "version"), - } -} - -type historyFieldscoutinglogColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Objectid psql.Expression - Status psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Version psql.Expression -} - -func (c historyFieldscoutinglogColumns) Alias() string { - return c.tableAlias -} - -func (historyFieldscoutinglogColumns) AliasedAs(alias string) historyFieldscoutinglogColumns { - return buildHistoryFieldscoutinglogColumns(alias) -} - -// HistoryFieldscoutinglogSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryFieldscoutinglogSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Status omitnull.Val[int16] `db:"status" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryFieldscoutinglogSetter) SetColumns() []string { - vals := make([]string, 0, 16) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Status.IsUnset() { - vals = append(vals, "status") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryFieldscoutinglogSetter) Overwrite(t *HistoryFieldscoutinglog) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Status.IsUnset() { - t.Status = s.Status.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryFieldscoutinglogSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryFieldscoutinglogs.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 16) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[1] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[2] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[3] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[4] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[5] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[6] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Status.IsUnset() { - vals[7] = psql.Arg(s.Status.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[8] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[9] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[10] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[11] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[12] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[13] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[14] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[15] = psql.Arg(s.Version.MustGet()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryFieldscoutinglogSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryFieldscoutinglogSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 16) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Status.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "status")...), - psql.Arg(s.Status), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryFieldscoutinglog retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryFieldscoutinglog(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryFieldscoutinglog, error) { - if len(cols) == 0 { - return HistoryFieldscoutinglogs.Query( - sm.Where(HistoryFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryFieldscoutinglogs.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryFieldscoutinglogs.Query( - sm.Where(HistoryFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryFieldscoutinglogs.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryFieldscoutinglogs.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryFieldscoutinglogExists checks the presence of a single record by primary key -func HistoryFieldscoutinglogExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryFieldscoutinglogs.Query( - sm.Where(HistoryFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryFieldscoutinglogs.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryFieldscoutinglog is retrieved from the database -func (o *HistoryFieldscoutinglog) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryFieldscoutinglogs.AfterSelectHooks.RunHooks(ctx, exec, HistoryFieldscoutinglogSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryFieldscoutinglogs.AfterInsertHooks.RunHooks(ctx, exec, HistoryFieldscoutinglogSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryFieldscoutinglogs.AfterUpdateHooks.RunHooks(ctx, exec, HistoryFieldscoutinglogSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryFieldscoutinglogs.AfterDeleteHooks.RunHooks(ctx, exec, HistoryFieldscoutinglogSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryFieldscoutinglog -func (o *HistoryFieldscoutinglog) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryFieldscoutinglog) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_fieldscoutinglog", "objectid"), psql.Quote("history_fieldscoutinglog", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryFieldscoutinglog -func (o *HistoryFieldscoutinglog) Update(ctx context.Context, exec bob.Executor, s *HistoryFieldscoutinglogSetter) error { - v, err := HistoryFieldscoutinglogs.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 HistoryFieldscoutinglog record with an executor -func (o *HistoryFieldscoutinglog) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryFieldscoutinglogs.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryFieldscoutinglog using the executor -func (o *HistoryFieldscoutinglog) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryFieldscoutinglogs.Query( - sm.Where(HistoryFieldscoutinglogs.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryFieldscoutinglogs.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryFieldscoutinglogSlice is retrieved from the database -func (o HistoryFieldscoutinglogSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryFieldscoutinglogs.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryFieldscoutinglogs.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryFieldscoutinglogs.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryFieldscoutinglogs.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryFieldscoutinglogSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_fieldscoutinglog", "objectid"), psql.Quote("history_fieldscoutinglog", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryFieldscoutinglogSlice) copyMatchingRows(from ...*HistoryFieldscoutinglog) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryFieldscoutinglogSlice) 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 HistoryFieldscoutinglogs.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 *HistoryFieldscoutinglog: - o.copyMatchingRows(retrieved) - case []*HistoryFieldscoutinglog: - o.copyMatchingRows(retrieved...) - case HistoryFieldscoutinglogSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryFieldscoutinglog or a slice of HistoryFieldscoutinglog - // then run the AfterUpdateHooks on the slice - _, err = HistoryFieldscoutinglogs.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryFieldscoutinglogSlice) 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 HistoryFieldscoutinglogs.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 *HistoryFieldscoutinglog: - o.copyMatchingRows(retrieved) - case []*HistoryFieldscoutinglog: - o.copyMatchingRows(retrieved...) - case HistoryFieldscoutinglogSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryFieldscoutinglog or a slice of HistoryFieldscoutinglog - // then run the AfterDeleteHooks on the slice - _, err = HistoryFieldscoutinglogs.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryFieldscoutinglogSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryFieldscoutinglogSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryFieldscoutinglogs.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryFieldscoutinglogSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryFieldscoutinglogs.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryFieldscoutinglogSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryFieldscoutinglogs.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 *HistoryFieldscoutinglog) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryFieldscoutinglogSlice) 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 attachHistoryFieldscoutinglogOrganization0(ctx context.Context, exec bob.Executor, count int, historyFieldscoutinglog0 *HistoryFieldscoutinglog, organization1 *Organization) (*HistoryFieldscoutinglog, error) { - setter := &HistoryFieldscoutinglogSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyFieldscoutinglog0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryFieldscoutinglogOrganization0: %w", err) - } - - return historyFieldscoutinglog0, nil -} - -func (historyFieldscoutinglog0 *HistoryFieldscoutinglog) 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 = attachHistoryFieldscoutinglogOrganization0(ctx, exec, 1, historyFieldscoutinglog0, organization1) - if err != nil { - return err - } - - historyFieldscoutinglog0.R.Organization = organization1 - - organization1.R.HistoryFieldscoutinglogs = append(organization1.R.HistoryFieldscoutinglogs, historyFieldscoutinglog0) - - return nil -} - -func (historyFieldscoutinglog0 *HistoryFieldscoutinglog) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryFieldscoutinglogOrganization0(ctx, exec, 1, historyFieldscoutinglog0, organization1) - if err != nil { - return err - } - - historyFieldscoutinglog0.R.Organization = organization1 - - organization1.R.HistoryFieldscoutinglogs = append(organization1.R.HistoryFieldscoutinglogs, historyFieldscoutinglog0) - - return nil -} - -type historyFieldscoutinglogWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Status psql.WhereNullMod[Q, int16] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyFieldscoutinglogWhere[Q]) AliasedAs(alias string) historyFieldscoutinglogWhere[Q] { - return buildHistoryFieldscoutinglogWhere[Q](buildHistoryFieldscoutinglogColumns(alias)) -} - -func buildHistoryFieldscoutinglogWhere[Q psql.Filterable](cols historyFieldscoutinglogColumns) historyFieldscoutinglogWhere[Q] { - return historyFieldscoutinglogWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - 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), - Objectid: psql.Where[Q, int32](cols.Objectid), - Status: psql.WhereNull[Q, int16](cols.Status), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryFieldscoutinglog) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyFieldscoutinglog cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryFieldscoutinglogs = HistoryFieldscoutinglogSlice{o} - } - return nil - default: - return fmt.Errorf("historyFieldscoutinglog has no relationship %q", name) - } -} - -type historyFieldscoutinglogPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryFieldscoutinglogPreloader() historyFieldscoutinglogPreloader { - return historyFieldscoutinglogPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryFieldscoutinglogs, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyFieldscoutinglogThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryFieldscoutinglogThenLoader[Q orm.Loadable]() historyFieldscoutinglogThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyFieldscoutinglogThenLoader[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 historyFieldscoutinglog's Organization into the .R struct -func (o *HistoryFieldscoutinglog) 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.HistoryFieldscoutinglogs = HistoryFieldscoutinglogSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyFieldscoutinglog's Organization into the .R struct -func (os HistoryFieldscoutinglogSlice) 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.HistoryFieldscoutinglogs = append(rel.R.HistoryFieldscoutinglogs, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyFieldscoutinglogJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyFieldscoutinglogJoins[Q]) aliasedAs(alias string) historyFieldscoutinglogJoins[Q] { - return buildHistoryFieldscoutinglogJoins[Q](buildHistoryFieldscoutinglogColumns(alias), j.typ) -} - -func buildHistoryFieldscoutinglogJoins[Q dialect.Joinable](cols historyFieldscoutinglogColumns, typ string) historyFieldscoutinglogJoins[Q] { - return historyFieldscoutinglogJoins[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/db/models/history_habitatrelate.bob.go b/db/models/history_habitatrelate.bob.go deleted file mode 100644 index 7895dc87..00000000 --- a/db/models/history_habitatrelate.bob.go +++ /dev/null @@ -1,990 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryHabitatrelate is an object representing the database table. -type HistoryHabitatrelate struct { - OrganizationID int32 `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - 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" ` - Habitattype null.Val[string] `db:"habitattype" ` - Objectid int32 `db:"objectid,pk" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historyHabitatrelateR `db:"-" ` -} - -// HistoryHabitatrelateSlice is an alias for a slice of pointers to HistoryHabitatrelate. -// This should almost always be used instead of []*HistoryHabitatrelate. -type HistoryHabitatrelateSlice []*HistoryHabitatrelate - -// HistoryHabitatrelates contains methods to work with the history_habitatrelate table -var HistoryHabitatrelates = psql.NewTablex[*HistoryHabitatrelate, HistoryHabitatrelateSlice, *HistoryHabitatrelateSetter]("", "history_habitatrelate", buildHistoryHabitatrelateColumns("history_habitatrelate")) - -// HistoryHabitatrelatesQuery is a query on the history_habitatrelate table -type HistoryHabitatrelatesQuery = *psql.ViewQuery[*HistoryHabitatrelate, HistoryHabitatrelateSlice] - -// historyHabitatrelateR is where relationships are stored. -type historyHabitatrelateR struct { - Organization *Organization // history_habitatrelate.history_habitatrelate_organization_id_fkey -} - -func buildHistoryHabitatrelateColumns(alias string) historyHabitatrelateColumns { - return historyHabitatrelateColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "foreign_id", "globalid", "habitattype", "objectid", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", - ).WithParent("history_habitatrelate"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - ForeignID: psql.Quote(alias, "foreign_id"), - Globalid: psql.Quote(alias, "globalid"), - Habitattype: psql.Quote(alias, "habitattype"), - Objectid: psql.Quote(alias, "objectid"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Version: psql.Quote(alias, "version"), - } -} - -type historyHabitatrelateColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - ForeignID psql.Expression - Globalid psql.Expression - Habitattype psql.Expression - Objectid psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Version psql.Expression -} - -func (c historyHabitatrelateColumns) Alias() string { - return c.tableAlias -} - -func (historyHabitatrelateColumns) AliasedAs(alias string) historyHabitatrelateColumns { - return buildHistoryHabitatrelateColumns(alias) -} - -// HistoryHabitatrelateSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryHabitatrelateSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - 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" ` - Habitattype omitnull.Val[string] `db:"habitattype" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryHabitatrelateSetter) SetColumns() []string { - vals := make([]string, 0, 17) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.ForeignID.IsUnset() { - vals = append(vals, "foreign_id") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Habitattype.IsUnset() { - vals = append(vals, "habitattype") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryHabitatrelateSetter) Overwrite(t *HistoryHabitatrelate) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.ForeignID.IsUnset() { - t.ForeignID = s.ForeignID.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Habitattype.IsUnset() { - t.Habitattype = s.Habitattype.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryHabitatrelateSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryHabitatrelates.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 17) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[1] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[2] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[3] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[4] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.ForeignID.IsUnset() { - vals[5] = psql.Arg(s.ForeignID.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[6] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Habitattype.IsUnset() { - vals[7] = psql.Arg(s.Habitattype.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[8] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[9] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[10] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[11] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[12] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[13] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[14] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[15] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[16] = psql.Arg(s.Version.MustGet()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryHabitatrelateSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryHabitatrelateSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 17) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.ForeignID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "foreign_id")...), - psql.Arg(s.ForeignID), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitattype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitattype")...), - psql.Arg(s.Habitattype), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryHabitatrelate retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryHabitatrelate(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryHabitatrelate, error) { - if len(cols) == 0 { - return HistoryHabitatrelates.Query( - sm.Where(HistoryHabitatrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryHabitatrelates.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryHabitatrelates.Query( - sm.Where(HistoryHabitatrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryHabitatrelates.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryHabitatrelates.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryHabitatrelateExists checks the presence of a single record by primary key -func HistoryHabitatrelateExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryHabitatrelates.Query( - sm.Where(HistoryHabitatrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryHabitatrelates.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryHabitatrelate is retrieved from the database -func (o *HistoryHabitatrelate) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryHabitatrelates.AfterSelectHooks.RunHooks(ctx, exec, HistoryHabitatrelateSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryHabitatrelates.AfterInsertHooks.RunHooks(ctx, exec, HistoryHabitatrelateSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryHabitatrelates.AfterUpdateHooks.RunHooks(ctx, exec, HistoryHabitatrelateSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryHabitatrelates.AfterDeleteHooks.RunHooks(ctx, exec, HistoryHabitatrelateSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryHabitatrelate -func (o *HistoryHabitatrelate) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryHabitatrelate) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_habitatrelate", "objectid"), psql.Quote("history_habitatrelate", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryHabitatrelate -func (o *HistoryHabitatrelate) Update(ctx context.Context, exec bob.Executor, s *HistoryHabitatrelateSetter) error { - v, err := HistoryHabitatrelates.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 HistoryHabitatrelate record with an executor -func (o *HistoryHabitatrelate) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryHabitatrelates.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryHabitatrelate using the executor -func (o *HistoryHabitatrelate) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryHabitatrelates.Query( - sm.Where(HistoryHabitatrelates.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryHabitatrelates.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryHabitatrelateSlice is retrieved from the database -func (o HistoryHabitatrelateSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryHabitatrelates.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryHabitatrelates.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryHabitatrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryHabitatrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryHabitatrelateSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_habitatrelate", "objectid"), psql.Quote("history_habitatrelate", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryHabitatrelateSlice) copyMatchingRows(from ...*HistoryHabitatrelate) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryHabitatrelateSlice) 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 HistoryHabitatrelates.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 *HistoryHabitatrelate: - o.copyMatchingRows(retrieved) - case []*HistoryHabitatrelate: - o.copyMatchingRows(retrieved...) - case HistoryHabitatrelateSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryHabitatrelate or a slice of HistoryHabitatrelate - // then run the AfterUpdateHooks on the slice - _, err = HistoryHabitatrelates.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryHabitatrelateSlice) 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 HistoryHabitatrelates.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 *HistoryHabitatrelate: - o.copyMatchingRows(retrieved) - case []*HistoryHabitatrelate: - o.copyMatchingRows(retrieved...) - case HistoryHabitatrelateSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryHabitatrelate or a slice of HistoryHabitatrelate - // then run the AfterDeleteHooks on the slice - _, err = HistoryHabitatrelates.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryHabitatrelateSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryHabitatrelateSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryHabitatrelates.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryHabitatrelateSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryHabitatrelates.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryHabitatrelateSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryHabitatrelates.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 *HistoryHabitatrelate) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryHabitatrelateSlice) 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 attachHistoryHabitatrelateOrganization0(ctx context.Context, exec bob.Executor, count int, historyHabitatrelate0 *HistoryHabitatrelate, organization1 *Organization) (*HistoryHabitatrelate, error) { - setter := &HistoryHabitatrelateSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyHabitatrelate0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryHabitatrelateOrganization0: %w", err) - } - - return historyHabitatrelate0, nil -} - -func (historyHabitatrelate0 *HistoryHabitatrelate) 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 = attachHistoryHabitatrelateOrganization0(ctx, exec, 1, historyHabitatrelate0, organization1) - if err != nil { - return err - } - - historyHabitatrelate0.R.Organization = organization1 - - organization1.R.HistoryHabitatrelates = append(organization1.R.HistoryHabitatrelates, historyHabitatrelate0) - - return nil -} - -func (historyHabitatrelate0 *HistoryHabitatrelate) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryHabitatrelateOrganization0(ctx, exec, 1, historyHabitatrelate0, organization1) - if err != nil { - return err - } - - historyHabitatrelate0.R.Organization = organization1 - - organization1.R.HistoryHabitatrelates = append(organization1.R.HistoryHabitatrelates, historyHabitatrelate0) - - return nil -} - -type historyHabitatrelateWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - ForeignID psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Habitattype psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyHabitatrelateWhere[Q]) AliasedAs(alias string) historyHabitatrelateWhere[Q] { - return buildHistoryHabitatrelateWhere[Q](buildHistoryHabitatrelateColumns(alias)) -} - -func buildHistoryHabitatrelateWhere[Q psql.Filterable](cols historyHabitatrelateColumns) historyHabitatrelateWhere[Q] { - return historyHabitatrelateWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - 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), - Habitattype: psql.WhereNull[Q, string](cols.Habitattype), - Objectid: psql.Where[Q, int32](cols.Objectid), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryHabitatrelate) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyHabitatrelate cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryHabitatrelates = HistoryHabitatrelateSlice{o} - } - return nil - default: - return fmt.Errorf("historyHabitatrelate has no relationship %q", name) - } -} - -type historyHabitatrelatePreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryHabitatrelatePreloader() historyHabitatrelatePreloader { - return historyHabitatrelatePreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryHabitatrelates, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyHabitatrelateThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryHabitatrelateThenLoader[Q orm.Loadable]() historyHabitatrelateThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyHabitatrelateThenLoader[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 historyHabitatrelate's Organization into the .R struct -func (o *HistoryHabitatrelate) 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.HistoryHabitatrelates = HistoryHabitatrelateSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyHabitatrelate's Organization into the .R struct -func (os HistoryHabitatrelateSlice) 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.HistoryHabitatrelates = append(rel.R.HistoryHabitatrelates, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyHabitatrelateJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyHabitatrelateJoins[Q]) aliasedAs(alias string) historyHabitatrelateJoins[Q] { - return buildHistoryHabitatrelateJoins[Q](buildHistoryHabitatrelateColumns(alias), j.typ) -} - -func buildHistoryHabitatrelateJoins[Q dialect.Joinable](cols historyHabitatrelateColumns, typ string) historyHabitatrelateJoins[Q] { - return historyHabitatrelateJoins[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/db/models/history_inspectionsample.bob.go b/db/models/history_inspectionsample.bob.go deleted file mode 100644 index 3cf7b1f2..00000000 --- a/db/models/history_inspectionsample.bob.go +++ /dev/null @@ -1,1040 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryInspectionsample is an object representing the database table. -type HistoryInspectionsample struct { - OrganizationID int32 `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Idbytech null.Val[string] `db:"idbytech" ` - InspID null.Val[string] `db:"insp_id" ` - Objectid int32 `db:"objectid,pk" ` - Processed null.Val[int16] `db:"processed" ` - Sampleid null.Val[string] `db:"sampleid" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historyInspectionsampleR `db:"-" ` -} - -// HistoryInspectionsampleSlice is an alias for a slice of pointers to HistoryInspectionsample. -// This should almost always be used instead of []*HistoryInspectionsample. -type HistoryInspectionsampleSlice []*HistoryInspectionsample - -// HistoryInspectionsamples contains methods to work with the history_inspectionsample table -var HistoryInspectionsamples = psql.NewTablex[*HistoryInspectionsample, HistoryInspectionsampleSlice, *HistoryInspectionsampleSetter]("", "history_inspectionsample", buildHistoryInspectionsampleColumns("history_inspectionsample")) - -// HistoryInspectionsamplesQuery is a query on the history_inspectionsample table -type HistoryInspectionsamplesQuery = *psql.ViewQuery[*HistoryInspectionsample, HistoryInspectionsampleSlice] - -// historyInspectionsampleR is where relationships are stored. -type historyInspectionsampleR struct { - Organization *Organization // history_inspectionsample.history_inspectionsample_organization_id_fkey -} - -func buildHistoryInspectionsampleColumns(alias string) historyInspectionsampleColumns { - return historyInspectionsampleColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "idbytech", "insp_id", "objectid", "processed", "sampleid", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", - ).WithParent("history_inspectionsample"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Idbytech: psql.Quote(alias, "idbytech"), - InspID: psql.Quote(alias, "insp_id"), - Objectid: psql.Quote(alias, "objectid"), - Processed: psql.Quote(alias, "processed"), - Sampleid: psql.Quote(alias, "sampleid"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Version: psql.Quote(alias, "version"), - } -} - -type historyInspectionsampleColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Idbytech psql.Expression - InspID psql.Expression - Objectid psql.Expression - Processed psql.Expression - Sampleid psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Version psql.Expression -} - -func (c historyInspectionsampleColumns) Alias() string { - return c.tableAlias -} - -func (historyInspectionsampleColumns) AliasedAs(alias string) historyInspectionsampleColumns { - return buildHistoryInspectionsampleColumns(alias) -} - -// HistoryInspectionsampleSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryInspectionsampleSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Idbytech omitnull.Val[string] `db:"idbytech" ` - InspID omitnull.Val[string] `db:"insp_id" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Processed omitnull.Val[int16] `db:"processed" ` - Sampleid omitnull.Val[string] `db:"sampleid" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryInspectionsampleSetter) SetColumns() []string { - vals := make([]string, 0, 19) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Idbytech.IsUnset() { - vals = append(vals, "idbytech") - } - if !s.InspID.IsUnset() { - vals = append(vals, "insp_id") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Processed.IsUnset() { - vals = append(vals, "processed") - } - if !s.Sampleid.IsUnset() { - vals = append(vals, "sampleid") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryInspectionsampleSetter) Overwrite(t *HistoryInspectionsample) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Idbytech.IsUnset() { - t.Idbytech = s.Idbytech.MustGetNull() - } - if !s.InspID.IsUnset() { - t.InspID = s.InspID.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Processed.IsUnset() { - t.Processed = s.Processed.MustGetNull() - } - if !s.Sampleid.IsUnset() { - t.Sampleid = s.Sampleid.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryInspectionsampleSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryInspectionsamples.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 19) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[1] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[2] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[3] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[4] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[5] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Idbytech.IsUnset() { - vals[6] = psql.Arg(s.Idbytech.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.InspID.IsUnset() { - vals[7] = psql.Arg(s.InspID.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[8] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Processed.IsUnset() { - vals[9] = psql.Arg(s.Processed.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Sampleid.IsUnset() { - vals[10] = psql.Arg(s.Sampleid.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[11] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[12] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[13] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[14] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[15] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[16] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[17] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[18] = psql.Arg(s.Version.MustGet()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryInspectionsampleSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryInspectionsampleSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 19) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Idbytech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "idbytech")...), - psql.Arg(s.Idbytech), - }}) - } - - if !s.InspID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "insp_id")...), - psql.Arg(s.InspID), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Processed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "processed")...), - psql.Arg(s.Processed), - }}) - } - - if !s.Sampleid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sampleid")...), - psql.Arg(s.Sampleid), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryInspectionsample retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryInspectionsample(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryInspectionsample, error) { - if len(cols) == 0 { - return HistoryInspectionsamples.Query( - sm.Where(HistoryInspectionsamples.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryInspectionsamples.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryInspectionsamples.Query( - sm.Where(HistoryInspectionsamples.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryInspectionsamples.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryInspectionsamples.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryInspectionsampleExists checks the presence of a single record by primary key -func HistoryInspectionsampleExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryInspectionsamples.Query( - sm.Where(HistoryInspectionsamples.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryInspectionsamples.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryInspectionsample is retrieved from the database -func (o *HistoryInspectionsample) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryInspectionsamples.AfterSelectHooks.RunHooks(ctx, exec, HistoryInspectionsampleSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryInspectionsamples.AfterInsertHooks.RunHooks(ctx, exec, HistoryInspectionsampleSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryInspectionsamples.AfterUpdateHooks.RunHooks(ctx, exec, HistoryInspectionsampleSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryInspectionsamples.AfterDeleteHooks.RunHooks(ctx, exec, HistoryInspectionsampleSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryInspectionsample -func (o *HistoryInspectionsample) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryInspectionsample) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_inspectionsample", "objectid"), psql.Quote("history_inspectionsample", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryInspectionsample -func (o *HistoryInspectionsample) Update(ctx context.Context, exec bob.Executor, s *HistoryInspectionsampleSetter) error { - v, err := HistoryInspectionsamples.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 HistoryInspectionsample record with an executor -func (o *HistoryInspectionsample) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryInspectionsamples.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryInspectionsample using the executor -func (o *HistoryInspectionsample) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryInspectionsamples.Query( - sm.Where(HistoryInspectionsamples.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryInspectionsamples.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryInspectionsampleSlice is retrieved from the database -func (o HistoryInspectionsampleSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryInspectionsamples.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryInspectionsamples.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryInspectionsamples.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryInspectionsamples.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryInspectionsampleSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_inspectionsample", "objectid"), psql.Quote("history_inspectionsample", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryInspectionsampleSlice) copyMatchingRows(from ...*HistoryInspectionsample) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryInspectionsampleSlice) 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 HistoryInspectionsamples.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 *HistoryInspectionsample: - o.copyMatchingRows(retrieved) - case []*HistoryInspectionsample: - o.copyMatchingRows(retrieved...) - case HistoryInspectionsampleSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryInspectionsample or a slice of HistoryInspectionsample - // then run the AfterUpdateHooks on the slice - _, err = HistoryInspectionsamples.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryInspectionsampleSlice) 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 HistoryInspectionsamples.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 *HistoryInspectionsample: - o.copyMatchingRows(retrieved) - case []*HistoryInspectionsample: - o.copyMatchingRows(retrieved...) - case HistoryInspectionsampleSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryInspectionsample or a slice of HistoryInspectionsample - // then run the AfterDeleteHooks on the slice - _, err = HistoryInspectionsamples.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryInspectionsampleSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryInspectionsampleSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryInspectionsamples.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryInspectionsampleSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryInspectionsamples.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryInspectionsampleSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryInspectionsamples.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 *HistoryInspectionsample) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryInspectionsampleSlice) 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 attachHistoryInspectionsampleOrganization0(ctx context.Context, exec bob.Executor, count int, historyInspectionsample0 *HistoryInspectionsample, organization1 *Organization) (*HistoryInspectionsample, error) { - setter := &HistoryInspectionsampleSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyInspectionsample0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryInspectionsampleOrganization0: %w", err) - } - - return historyInspectionsample0, nil -} - -func (historyInspectionsample0 *HistoryInspectionsample) 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 = attachHistoryInspectionsampleOrganization0(ctx, exec, 1, historyInspectionsample0, organization1) - if err != nil { - return err - } - - historyInspectionsample0.R.Organization = organization1 - - organization1.R.HistoryInspectionsamples = append(organization1.R.HistoryInspectionsamples, historyInspectionsample0) - - return nil -} - -func (historyInspectionsample0 *HistoryInspectionsample) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryInspectionsampleOrganization0(ctx, exec, 1, historyInspectionsample0, organization1) - if err != nil { - return err - } - - historyInspectionsample0.R.Organization = organization1 - - organization1.R.HistoryInspectionsamples = append(organization1.R.HistoryInspectionsamples, historyInspectionsample0) - - return nil -} - -type historyInspectionsampleWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Idbytech psql.WhereNullMod[Q, string] - InspID psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Processed psql.WhereNullMod[Q, int16] - Sampleid psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyInspectionsampleWhere[Q]) AliasedAs(alias string) historyInspectionsampleWhere[Q] { - return buildHistoryInspectionsampleWhere[Q](buildHistoryInspectionsampleColumns(alias)) -} - -func buildHistoryInspectionsampleWhere[Q psql.Filterable](cols historyInspectionsampleColumns) historyInspectionsampleWhere[Q] { - return historyInspectionsampleWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - 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), - Idbytech: psql.WhereNull[Q, string](cols.Idbytech), - InspID: psql.WhereNull[Q, string](cols.InspID), - Objectid: psql.Where[Q, int32](cols.Objectid), - Processed: psql.WhereNull[Q, int16](cols.Processed), - Sampleid: psql.WhereNull[Q, string](cols.Sampleid), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryInspectionsample) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyInspectionsample cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryInspectionsamples = HistoryInspectionsampleSlice{o} - } - return nil - default: - return fmt.Errorf("historyInspectionsample has no relationship %q", name) - } -} - -type historyInspectionsamplePreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryInspectionsamplePreloader() historyInspectionsamplePreloader { - return historyInspectionsamplePreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryInspectionsamples, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyInspectionsampleThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryInspectionsampleThenLoader[Q orm.Loadable]() historyInspectionsampleThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyInspectionsampleThenLoader[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 historyInspectionsample's Organization into the .R struct -func (o *HistoryInspectionsample) 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.HistoryInspectionsamples = HistoryInspectionsampleSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyInspectionsample's Organization into the .R struct -func (os HistoryInspectionsampleSlice) 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.HistoryInspectionsamples = append(rel.R.HistoryInspectionsamples, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyInspectionsampleJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyInspectionsampleJoins[Q]) aliasedAs(alias string) historyInspectionsampleJoins[Q] { - return buildHistoryInspectionsampleJoins[Q](buildHistoryInspectionsampleColumns(alias), j.typ) -} - -func buildHistoryInspectionsampleJoins[Q dialect.Joinable](cols historyInspectionsampleColumns, typ string) historyInspectionsampleJoins[Q] { - return historyInspectionsampleJoins[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/db/models/history_inspectionsampledetail.bob.go b/db/models/history_inspectionsampledetail.bob.go deleted file mode 100644 index bf648d50..00000000 --- a/db/models/history_inspectionsampledetail.bob.go +++ /dev/null @@ -1,1315 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryInspectionsampledetail is an object representing the database table. -type HistoryInspectionsampledetail struct { - OrganizationID int32 `db:"organization_id" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fadultact null.Val[string] `db:"fadultact" ` - Fdomstage null.Val[string] `db:"fdomstage" ` - Feggcount null.Val[int16] `db:"feggcount" ` - Fieldspecies null.Val[string] `db:"fieldspecies" ` - Flarvcount null.Val[int16] `db:"flarvcount" ` - Flstages null.Val[string] `db:"flstages" ` - Fpupcount null.Val[int16] `db:"fpupcount" ` - Globalid null.Val[string] `db:"globalid" ` - InspsampleID null.Val[string] `db:"inspsample_id" ` - Labspecies null.Val[string] `db:"labspecies" ` - Ldomstage null.Val[string] `db:"ldomstage" ` - Leggcount null.Val[int16] `db:"leggcount" ` - Llarvcount null.Val[int16] `db:"llarvcount" ` - Lpupcount null.Val[int16] `db:"lpupcount" ` - Objectid int32 `db:"objectid,pk" ` - Processed null.Val[int16] `db:"processed" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historyInspectionsampledetailR `db:"-" ` -} - -// HistoryInspectionsampledetailSlice is an alias for a slice of pointers to HistoryInspectionsampledetail. -// This should almost always be used instead of []*HistoryInspectionsampledetail. -type HistoryInspectionsampledetailSlice []*HistoryInspectionsampledetail - -// HistoryInspectionsampledetails contains methods to work with the history_inspectionsampledetail table -var HistoryInspectionsampledetails = psql.NewTablex[*HistoryInspectionsampledetail, HistoryInspectionsampledetailSlice, *HistoryInspectionsampledetailSetter]("", "history_inspectionsampledetail", buildHistoryInspectionsampledetailColumns("history_inspectionsampledetail")) - -// HistoryInspectionsampledetailsQuery is a query on the history_inspectionsampledetail table -type HistoryInspectionsampledetailsQuery = *psql.ViewQuery[*HistoryInspectionsampledetail, HistoryInspectionsampledetailSlice] - -// historyInspectionsampledetailR is where relationships are stored. -type historyInspectionsampledetailR struct { - Organization *Organization // history_inspectionsampledetail.history_inspectionsampledetail_organization_id_fkey -} - -func buildHistoryInspectionsampledetailColumns(alias string) historyInspectionsampledetailColumns { - return historyInspectionsampledetailColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "comments", "creationdate", "creator", "editdate", "editor", "fadultact", "fdomstage", "feggcount", "fieldspecies", "flarvcount", "flstages", "fpupcount", "globalid", "inspsample_id", "labspecies", "ldomstage", "leggcount", "llarvcount", "lpupcount", "objectid", "processed", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", - ).WithParent("history_inspectionsampledetail"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fadultact: psql.Quote(alias, "fadultact"), - Fdomstage: psql.Quote(alias, "fdomstage"), - Feggcount: psql.Quote(alias, "feggcount"), - Fieldspecies: psql.Quote(alias, "fieldspecies"), - Flarvcount: psql.Quote(alias, "flarvcount"), - Flstages: psql.Quote(alias, "flstages"), - Fpupcount: psql.Quote(alias, "fpupcount"), - Globalid: psql.Quote(alias, "globalid"), - InspsampleID: psql.Quote(alias, "inspsample_id"), - Labspecies: psql.Quote(alias, "labspecies"), - Ldomstage: psql.Quote(alias, "ldomstage"), - Leggcount: psql.Quote(alias, "leggcount"), - Llarvcount: psql.Quote(alias, "llarvcount"), - Lpupcount: psql.Quote(alias, "lpupcount"), - Objectid: psql.Quote(alias, "objectid"), - Processed: psql.Quote(alias, "processed"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Version: psql.Quote(alias, "version"), - } -} - -type historyInspectionsampledetailColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fadultact psql.Expression - Fdomstage psql.Expression - Feggcount psql.Expression - Fieldspecies psql.Expression - Flarvcount psql.Expression - Flstages psql.Expression - Fpupcount psql.Expression - Globalid psql.Expression - InspsampleID psql.Expression - Labspecies psql.Expression - Ldomstage psql.Expression - Leggcount psql.Expression - Llarvcount psql.Expression - Lpupcount psql.Expression - Objectid psql.Expression - Processed psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Version psql.Expression -} - -func (c historyInspectionsampledetailColumns) Alias() string { - return c.tableAlias -} - -func (historyInspectionsampledetailColumns) AliasedAs(alias string) historyInspectionsampledetailColumns { - return buildHistoryInspectionsampledetailColumns(alias) -} - -// HistoryInspectionsampledetailSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryInspectionsampledetailSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fadultact omitnull.Val[string] `db:"fadultact" ` - Fdomstage omitnull.Val[string] `db:"fdomstage" ` - Feggcount omitnull.Val[int16] `db:"feggcount" ` - Fieldspecies omitnull.Val[string] `db:"fieldspecies" ` - Flarvcount omitnull.Val[int16] `db:"flarvcount" ` - Flstages omitnull.Val[string] `db:"flstages" ` - Fpupcount omitnull.Val[int16] `db:"fpupcount" ` - Globalid omitnull.Val[string] `db:"globalid" ` - InspsampleID omitnull.Val[string] `db:"inspsample_id" ` - Labspecies omitnull.Val[string] `db:"labspecies" ` - Ldomstage omitnull.Val[string] `db:"ldomstage" ` - Leggcount omitnull.Val[int16] `db:"leggcount" ` - Llarvcount omitnull.Val[int16] `db:"llarvcount" ` - Lpupcount omitnull.Val[int16] `db:"lpupcount" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Processed omitnull.Val[int16] `db:"processed" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryInspectionsampledetailSetter) SetColumns() []string { - vals := make([]string, 0, 30) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fadultact.IsUnset() { - vals = append(vals, "fadultact") - } - if !s.Fdomstage.IsUnset() { - vals = append(vals, "fdomstage") - } - if !s.Feggcount.IsUnset() { - vals = append(vals, "feggcount") - } - if !s.Fieldspecies.IsUnset() { - vals = append(vals, "fieldspecies") - } - if !s.Flarvcount.IsUnset() { - vals = append(vals, "flarvcount") - } - if !s.Flstages.IsUnset() { - vals = append(vals, "flstages") - } - if !s.Fpupcount.IsUnset() { - vals = append(vals, "fpupcount") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.InspsampleID.IsUnset() { - vals = append(vals, "inspsample_id") - } - if !s.Labspecies.IsUnset() { - vals = append(vals, "labspecies") - } - if !s.Ldomstage.IsUnset() { - vals = append(vals, "ldomstage") - } - if !s.Leggcount.IsUnset() { - vals = append(vals, "leggcount") - } - if !s.Llarvcount.IsUnset() { - vals = append(vals, "llarvcount") - } - if !s.Lpupcount.IsUnset() { - vals = append(vals, "lpupcount") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Processed.IsUnset() { - vals = append(vals, "processed") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryInspectionsampledetailSetter) Overwrite(t *HistoryInspectionsampledetail) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fadultact.IsUnset() { - t.Fadultact = s.Fadultact.MustGetNull() - } - if !s.Fdomstage.IsUnset() { - t.Fdomstage = s.Fdomstage.MustGetNull() - } - if !s.Feggcount.IsUnset() { - t.Feggcount = s.Feggcount.MustGetNull() - } - if !s.Fieldspecies.IsUnset() { - t.Fieldspecies = s.Fieldspecies.MustGetNull() - } - if !s.Flarvcount.IsUnset() { - t.Flarvcount = s.Flarvcount.MustGetNull() - } - if !s.Flstages.IsUnset() { - t.Flstages = s.Flstages.MustGetNull() - } - if !s.Fpupcount.IsUnset() { - t.Fpupcount = s.Fpupcount.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.InspsampleID.IsUnset() { - t.InspsampleID = s.InspsampleID.MustGetNull() - } - if !s.Labspecies.IsUnset() { - t.Labspecies = s.Labspecies.MustGetNull() - } - if !s.Ldomstage.IsUnset() { - t.Ldomstage = s.Ldomstage.MustGetNull() - } - if !s.Leggcount.IsUnset() { - t.Leggcount = s.Leggcount.MustGetNull() - } - if !s.Llarvcount.IsUnset() { - t.Llarvcount = s.Llarvcount.MustGetNull() - } - if !s.Lpupcount.IsUnset() { - t.Lpupcount = s.Lpupcount.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Processed.IsUnset() { - t.Processed = s.Processed.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryInspectionsampledetailSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryInspectionsampledetails.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 30) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[1] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[2] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[3] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[4] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[5] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Fadultact.IsUnset() { - vals[6] = psql.Arg(s.Fadultact.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Fdomstage.IsUnset() { - vals[7] = psql.Arg(s.Fdomstage.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Feggcount.IsUnset() { - vals[8] = psql.Arg(s.Feggcount.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Fieldspecies.IsUnset() { - vals[9] = psql.Arg(s.Fieldspecies.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Flarvcount.IsUnset() { - vals[10] = psql.Arg(s.Flarvcount.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Flstages.IsUnset() { - vals[11] = psql.Arg(s.Flstages.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Fpupcount.IsUnset() { - vals[12] = psql.Arg(s.Fpupcount.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[13] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.InspsampleID.IsUnset() { - vals[14] = psql.Arg(s.InspsampleID.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Labspecies.IsUnset() { - vals[15] = psql.Arg(s.Labspecies.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Ldomstage.IsUnset() { - vals[16] = psql.Arg(s.Ldomstage.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Leggcount.IsUnset() { - vals[17] = psql.Arg(s.Leggcount.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Llarvcount.IsUnset() { - vals[18] = psql.Arg(s.Llarvcount.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Lpupcount.IsUnset() { - vals[19] = psql.Arg(s.Lpupcount.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[20] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Processed.IsUnset() { - vals[21] = psql.Arg(s.Processed.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[22] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[23] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[24] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[25] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[26] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[27] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[28] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[29] = psql.Arg(s.Version.MustGet()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryInspectionsampledetailSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryInspectionsampledetailSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 30) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fadultact.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fadultact")...), - psql.Arg(s.Fadultact), - }}) - } - - if !s.Fdomstage.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fdomstage")...), - psql.Arg(s.Fdomstage), - }}) - } - - if !s.Feggcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "feggcount")...), - psql.Arg(s.Feggcount), - }}) - } - - if !s.Fieldspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldspecies")...), - psql.Arg(s.Fieldspecies), - }}) - } - - if !s.Flarvcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "flarvcount")...), - psql.Arg(s.Flarvcount), - }}) - } - - if !s.Flstages.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "flstages")...), - psql.Arg(s.Flstages), - }}) - } - - if !s.Fpupcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fpupcount")...), - psql.Arg(s.Fpupcount), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.InspsampleID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "inspsample_id")...), - psql.Arg(s.InspsampleID), - }}) - } - - if !s.Labspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "labspecies")...), - psql.Arg(s.Labspecies), - }}) - } - - if !s.Ldomstage.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "ldomstage")...), - psql.Arg(s.Ldomstage), - }}) - } - - if !s.Leggcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "leggcount")...), - psql.Arg(s.Leggcount), - }}) - } - - if !s.Llarvcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "llarvcount")...), - psql.Arg(s.Llarvcount), - }}) - } - - if !s.Lpupcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lpupcount")...), - psql.Arg(s.Lpupcount), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Processed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "processed")...), - psql.Arg(s.Processed), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryInspectionsampledetail retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryInspectionsampledetail(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryInspectionsampledetail, error) { - if len(cols) == 0 { - return HistoryInspectionsampledetails.Query( - sm.Where(HistoryInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryInspectionsampledetails.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryInspectionsampledetails.Query( - sm.Where(HistoryInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryInspectionsampledetails.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryInspectionsampledetails.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryInspectionsampledetailExists checks the presence of a single record by primary key -func HistoryInspectionsampledetailExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryInspectionsampledetails.Query( - sm.Where(HistoryInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryInspectionsampledetails.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryInspectionsampledetail is retrieved from the database -func (o *HistoryInspectionsampledetail) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryInspectionsampledetails.AfterSelectHooks.RunHooks(ctx, exec, HistoryInspectionsampledetailSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryInspectionsampledetails.AfterInsertHooks.RunHooks(ctx, exec, HistoryInspectionsampledetailSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryInspectionsampledetails.AfterUpdateHooks.RunHooks(ctx, exec, HistoryInspectionsampledetailSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryInspectionsampledetails.AfterDeleteHooks.RunHooks(ctx, exec, HistoryInspectionsampledetailSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryInspectionsampledetail -func (o *HistoryInspectionsampledetail) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryInspectionsampledetail) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_inspectionsampledetail", "objectid"), psql.Quote("history_inspectionsampledetail", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryInspectionsampledetail -func (o *HistoryInspectionsampledetail) Update(ctx context.Context, exec bob.Executor, s *HistoryInspectionsampledetailSetter) error { - v, err := HistoryInspectionsampledetails.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 HistoryInspectionsampledetail record with an executor -func (o *HistoryInspectionsampledetail) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryInspectionsampledetails.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryInspectionsampledetail using the executor -func (o *HistoryInspectionsampledetail) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryInspectionsampledetails.Query( - sm.Where(HistoryInspectionsampledetails.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryInspectionsampledetails.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryInspectionsampledetailSlice is retrieved from the database -func (o HistoryInspectionsampledetailSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryInspectionsampledetails.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryInspectionsampledetails.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryInspectionsampledetails.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryInspectionsampledetails.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryInspectionsampledetailSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_inspectionsampledetail", "objectid"), psql.Quote("history_inspectionsampledetail", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryInspectionsampledetailSlice) copyMatchingRows(from ...*HistoryInspectionsampledetail) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryInspectionsampledetailSlice) 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 HistoryInspectionsampledetails.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 *HistoryInspectionsampledetail: - o.copyMatchingRows(retrieved) - case []*HistoryInspectionsampledetail: - o.copyMatchingRows(retrieved...) - case HistoryInspectionsampledetailSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryInspectionsampledetail or a slice of HistoryInspectionsampledetail - // then run the AfterUpdateHooks on the slice - _, err = HistoryInspectionsampledetails.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryInspectionsampledetailSlice) 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 HistoryInspectionsampledetails.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 *HistoryInspectionsampledetail: - o.copyMatchingRows(retrieved) - case []*HistoryInspectionsampledetail: - o.copyMatchingRows(retrieved...) - case HistoryInspectionsampledetailSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryInspectionsampledetail or a slice of HistoryInspectionsampledetail - // then run the AfterDeleteHooks on the slice - _, err = HistoryInspectionsampledetails.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryInspectionsampledetailSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryInspectionsampledetailSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryInspectionsampledetails.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryInspectionsampledetailSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryInspectionsampledetails.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryInspectionsampledetailSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryInspectionsampledetails.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 *HistoryInspectionsampledetail) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryInspectionsampledetailSlice) 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 attachHistoryInspectionsampledetailOrganization0(ctx context.Context, exec bob.Executor, count int, historyInspectionsampledetail0 *HistoryInspectionsampledetail, organization1 *Organization) (*HistoryInspectionsampledetail, error) { - setter := &HistoryInspectionsampledetailSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyInspectionsampledetail0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryInspectionsampledetailOrganization0: %w", err) - } - - return historyInspectionsampledetail0, nil -} - -func (historyInspectionsampledetail0 *HistoryInspectionsampledetail) 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 = attachHistoryInspectionsampledetailOrganization0(ctx, exec, 1, historyInspectionsampledetail0, organization1) - if err != nil { - return err - } - - historyInspectionsampledetail0.R.Organization = organization1 - - organization1.R.HistoryInspectionsampledetails = append(organization1.R.HistoryInspectionsampledetails, historyInspectionsampledetail0) - - return nil -} - -func (historyInspectionsampledetail0 *HistoryInspectionsampledetail) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryInspectionsampledetailOrganization0(ctx, exec, 1, historyInspectionsampledetail0, organization1) - if err != nil { - return err - } - - historyInspectionsampledetail0.R.Organization = organization1 - - organization1.R.HistoryInspectionsampledetails = append(organization1.R.HistoryInspectionsampledetails, historyInspectionsampledetail0) - - return nil -} - -type historyInspectionsampledetailWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fadultact psql.WhereNullMod[Q, string] - Fdomstage psql.WhereNullMod[Q, string] - Feggcount psql.WhereNullMod[Q, int16] - Fieldspecies psql.WhereNullMod[Q, string] - Flarvcount psql.WhereNullMod[Q, int16] - Flstages psql.WhereNullMod[Q, string] - Fpupcount psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] - InspsampleID psql.WhereNullMod[Q, string] - Labspecies psql.WhereNullMod[Q, string] - Ldomstage psql.WhereNullMod[Q, string] - Leggcount psql.WhereNullMod[Q, int16] - Llarvcount psql.WhereNullMod[Q, int16] - Lpupcount psql.WhereNullMod[Q, int16] - Objectid psql.WhereMod[Q, int32] - Processed psql.WhereNullMod[Q, int16] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyInspectionsampledetailWhere[Q]) AliasedAs(alias string) historyInspectionsampledetailWhere[Q] { - return buildHistoryInspectionsampledetailWhere[Q](buildHistoryInspectionsampledetailColumns(alias)) -} - -func buildHistoryInspectionsampledetailWhere[Q psql.Filterable](cols historyInspectionsampledetailColumns) historyInspectionsampledetailWhere[Q] { - return historyInspectionsampledetailWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - Fadultact: psql.WhereNull[Q, string](cols.Fadultact), - Fdomstage: psql.WhereNull[Q, string](cols.Fdomstage), - Feggcount: psql.WhereNull[Q, int16](cols.Feggcount), - Fieldspecies: psql.WhereNull[Q, string](cols.Fieldspecies), - 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), - InspsampleID: psql.WhereNull[Q, string](cols.InspsampleID), - Labspecies: psql.WhereNull[Q, string](cols.Labspecies), - Ldomstage: psql.WhereNull[Q, string](cols.Ldomstage), - Leggcount: psql.WhereNull[Q, int16](cols.Leggcount), - Llarvcount: psql.WhereNull[Q, int16](cols.Llarvcount), - Lpupcount: psql.WhereNull[Q, int16](cols.Lpupcount), - Objectid: psql.Where[Q, int32](cols.Objectid), - Processed: psql.WhereNull[Q, int16](cols.Processed), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryInspectionsampledetail) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyInspectionsampledetail cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryInspectionsampledetails = HistoryInspectionsampledetailSlice{o} - } - return nil - default: - return fmt.Errorf("historyInspectionsampledetail has no relationship %q", name) - } -} - -type historyInspectionsampledetailPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryInspectionsampledetailPreloader() historyInspectionsampledetailPreloader { - return historyInspectionsampledetailPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryInspectionsampledetails, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyInspectionsampledetailThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryInspectionsampledetailThenLoader[Q orm.Loadable]() historyInspectionsampledetailThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyInspectionsampledetailThenLoader[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 historyInspectionsampledetail's Organization into the .R struct -func (o *HistoryInspectionsampledetail) 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.HistoryInspectionsampledetails = HistoryInspectionsampledetailSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyInspectionsampledetail's Organization into the .R struct -func (os HistoryInspectionsampledetailSlice) 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.HistoryInspectionsampledetails = append(rel.R.HistoryInspectionsampledetails, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyInspectionsampledetailJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyInspectionsampledetailJoins[Q]) aliasedAs(alias string) historyInspectionsampledetailJoins[Q] { - return buildHistoryInspectionsampledetailJoins[Q](buildHistoryInspectionsampledetailColumns(alias), j.typ) -} - -func buildHistoryInspectionsampledetailJoins[Q dialect.Joinable](cols historyInspectionsampledetailColumns, typ string) historyInspectionsampledetailJoins[Q] { - return historyInspectionsampledetailJoins[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/db/models/history_linelocation.bob.go b/db/models/history_linelocation.bob.go deleted file mode 100644 index b8badb43..00000000 --- a/db/models/history_linelocation.bob.go +++ /dev/null @@ -1,1890 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryLinelocation is an object representing the database table. -type HistoryLinelocation struct { - OrganizationID int32 `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Acres null.Val[float64] `db:"acres" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Hectares null.Val[float64] `db:"hectares" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Larvinspectinterval null.Val[int16] `db:"larvinspectinterval" ` - Lastinspectactiontaken null.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectactivity null.Val[string] `db:"lastinspectactivity" ` - Lastinspectavglarvae null.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae null.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectbreeding null.Val[string] `db:"lastinspectbreeding" ` - Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate null.Val[int64] `db:"lastinspectdate" ` - Lastinspectfieldspecies null.Val[string] `db:"lastinspectfieldspecies" ` - Lastinspectlstages null.Val[string] `db:"lastinspectlstages" ` - Lasttreatactivity null.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate null.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct null.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty null.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit null.Val[string] `db:"lasttreatqtyunit" ` - LengthFT null.Val[float64] `db:"length_ft" ` - LengthMeters null.Val[float64] `db:"length_meters" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Name null.Val[string] `db:"name" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Symbology null.Val[string] `db:"symbology" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - Usetype null.Val[string] `db:"usetype" ` - Waterorigin null.Val[string] `db:"waterorigin" ` - WidthFT null.Val[float64] `db:"width_ft" ` - WidthMeters null.Val[float64] `db:"width_meters" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historyLinelocationR `db:"-" ` -} - -// HistoryLinelocationSlice is an alias for a slice of pointers to HistoryLinelocation. -// This should almost always be used instead of []*HistoryLinelocation. -type HistoryLinelocationSlice []*HistoryLinelocation - -// HistoryLinelocations contains methods to work with the history_linelocation table -var HistoryLinelocations = psql.NewTablex[*HistoryLinelocation, HistoryLinelocationSlice, *HistoryLinelocationSetter]("", "history_linelocation", buildHistoryLinelocationColumns("history_linelocation")) - -// HistoryLinelocationsQuery is a query on the history_linelocation table -type HistoryLinelocationsQuery = *psql.ViewQuery[*HistoryLinelocation, HistoryLinelocationSlice] - -// historyLinelocationR is where relationships are stored. -type historyLinelocationR struct { - Organization *Organization // history_linelocation.history_linelocation_organization_id_fkey -} - -func buildHistoryLinelocationColumns(alias string) historyLinelocationColumns { - return historyLinelocationColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "acres", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "globalid", "habitat", "hectares", "jurisdiction", "larvinspectinterval", "lastinspectactiontaken", "lastinspectactivity", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectbreeding", "lastinspectconditions", "lastinspectdate", "lastinspectfieldspecies", "lastinspectlstages", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "length_ft", "length_meters", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "symbology", "shape__length", "usetype", "waterorigin", "width_ft", "width_meters", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", - ).WithParent("history_linelocation"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accessdesc: psql.Quote(alias, "accessdesc"), - Acres: psql.Quote(alias, "acres"), - Active: psql.Quote(alias, "active"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Description: psql.Quote(alias, "description"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Habitat: psql.Quote(alias, "habitat"), - Hectares: psql.Quote(alias, "hectares"), - Jurisdiction: psql.Quote(alias, "jurisdiction"), - Larvinspectinterval: psql.Quote(alias, "larvinspectinterval"), - Lastinspectactiontaken: psql.Quote(alias, "lastinspectactiontaken"), - Lastinspectactivity: psql.Quote(alias, "lastinspectactivity"), - Lastinspectavglarvae: psql.Quote(alias, "lastinspectavglarvae"), - Lastinspectavgpupae: psql.Quote(alias, "lastinspectavgpupae"), - Lastinspectbreeding: psql.Quote(alias, "lastinspectbreeding"), - Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), - Lastinspectdate: psql.Quote(alias, "lastinspectdate"), - Lastinspectfieldspecies: psql.Quote(alias, "lastinspectfieldspecies"), - Lastinspectlstages: psql.Quote(alias, "lastinspectlstages"), - Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), - Lasttreatdate: psql.Quote(alias, "lasttreatdate"), - Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), - Lasttreatqty: psql.Quote(alias, "lasttreatqty"), - Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), - LengthFT: psql.Quote(alias, "length_ft"), - LengthMeters: psql.Quote(alias, "length_meters"), - Locationnumber: psql.Quote(alias, "locationnumber"), - Name: psql.Quote(alias, "name"), - Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), - Objectid: psql.Quote(alias, "objectid"), - Priority: psql.Quote(alias, "priority"), - Symbology: psql.Quote(alias, "symbology"), - ShapeLength: psql.Quote(alias, "shape__length"), - Usetype: psql.Quote(alias, "usetype"), - Waterorigin: psql.Quote(alias, "waterorigin"), - WidthFT: psql.Quote(alias, "width_ft"), - WidthMeters: psql.Quote(alias, "width_meters"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Version: psql.Quote(alias, "version"), - } -} - -type historyLinelocationColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accessdesc psql.Expression - Acres psql.Expression - Active psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Description psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Habitat psql.Expression - Hectares psql.Expression - Jurisdiction psql.Expression - Larvinspectinterval psql.Expression - Lastinspectactiontaken psql.Expression - Lastinspectactivity psql.Expression - Lastinspectavglarvae psql.Expression - Lastinspectavgpupae psql.Expression - Lastinspectbreeding psql.Expression - Lastinspectconditions psql.Expression - Lastinspectdate psql.Expression - Lastinspectfieldspecies psql.Expression - Lastinspectlstages psql.Expression - Lasttreatactivity psql.Expression - Lasttreatdate psql.Expression - Lasttreatproduct psql.Expression - Lasttreatqty psql.Expression - Lasttreatqtyunit psql.Expression - LengthFT psql.Expression - LengthMeters psql.Expression - Locationnumber psql.Expression - Name psql.Expression - Nextactiondatescheduled psql.Expression - Objectid psql.Expression - Priority psql.Expression - Symbology psql.Expression - ShapeLength psql.Expression - Usetype psql.Expression - Waterorigin psql.Expression - WidthFT psql.Expression - WidthMeters psql.Expression - Zone psql.Expression - Zone2 psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Version psql.Expression -} - -func (c historyLinelocationColumns) Alias() string { - return c.tableAlias -} - -func (historyLinelocationColumns) AliasedAs(alias string) historyLinelocationColumns { - return buildHistoryLinelocationColumns(alias) -} - -// HistoryLinelocationSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryLinelocationSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Acres omitnull.Val[float64] `db:"acres" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Hectares omitnull.Val[float64] `db:"hectares" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Larvinspectinterval omitnull.Val[int16] `db:"larvinspectinterval" ` - Lastinspectactiontaken omitnull.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectactivity omitnull.Val[string] `db:"lastinspectactivity" ` - Lastinspectavglarvae omitnull.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae omitnull.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectbreeding omitnull.Val[string] `db:"lastinspectbreeding" ` - Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate omitnull.Val[int64] `db:"lastinspectdate" ` - Lastinspectfieldspecies omitnull.Val[string] `db:"lastinspectfieldspecies" ` - Lastinspectlstages omitnull.Val[string] `db:"lastinspectlstages" ` - Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate omitnull.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` - LengthFT omitnull.Val[float64] `db:"length_ft" ` - LengthMeters omitnull.Val[float64] `db:"length_meters" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Name omitnull.Val[string] `db:"name" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Symbology omitnull.Val[string] `db:"symbology" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Usetype omitnull.Val[string] `db:"usetype" ` - Waterorigin omitnull.Val[string] `db:"waterorigin" ` - WidthFT omitnull.Val[float64] `db:"width_ft" ` - WidthMeters omitnull.Val[float64] `db:"width_meters" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryLinelocationSetter) SetColumns() []string { - vals := make([]string, 0, 53) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accessdesc.IsUnset() { - vals = append(vals, "accessdesc") - } - if !s.Acres.IsUnset() { - vals = append(vals, "acres") - } - if !s.Active.IsUnset() { - vals = append(vals, "active") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Description.IsUnset() { - vals = append(vals, "description") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Habitat.IsUnset() { - vals = append(vals, "habitat") - } - if !s.Hectares.IsUnset() { - vals = append(vals, "hectares") - } - if !s.Jurisdiction.IsUnset() { - vals = append(vals, "jurisdiction") - } - if !s.Larvinspectinterval.IsUnset() { - vals = append(vals, "larvinspectinterval") - } - if !s.Lastinspectactiontaken.IsUnset() { - vals = append(vals, "lastinspectactiontaken") - } - if !s.Lastinspectactivity.IsUnset() { - vals = append(vals, "lastinspectactivity") - } - if !s.Lastinspectavglarvae.IsUnset() { - vals = append(vals, "lastinspectavglarvae") - } - if !s.Lastinspectavgpupae.IsUnset() { - vals = append(vals, "lastinspectavgpupae") - } - if !s.Lastinspectbreeding.IsUnset() { - vals = append(vals, "lastinspectbreeding") - } - if !s.Lastinspectconditions.IsUnset() { - vals = append(vals, "lastinspectconditions") - } - if !s.Lastinspectdate.IsUnset() { - vals = append(vals, "lastinspectdate") - } - if !s.Lastinspectfieldspecies.IsUnset() { - vals = append(vals, "lastinspectfieldspecies") - } - if !s.Lastinspectlstages.IsUnset() { - vals = append(vals, "lastinspectlstages") - } - if !s.Lasttreatactivity.IsUnset() { - vals = append(vals, "lasttreatactivity") - } - if !s.Lasttreatdate.IsUnset() { - vals = append(vals, "lasttreatdate") - } - if !s.Lasttreatproduct.IsUnset() { - vals = append(vals, "lasttreatproduct") - } - if !s.Lasttreatqty.IsUnset() { - vals = append(vals, "lasttreatqty") - } - if !s.Lasttreatqtyunit.IsUnset() { - vals = append(vals, "lasttreatqtyunit") - } - if !s.LengthFT.IsUnset() { - vals = append(vals, "length_ft") - } - if !s.LengthMeters.IsUnset() { - vals = append(vals, "length_meters") - } - if !s.Locationnumber.IsUnset() { - vals = append(vals, "locationnumber") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if !s.Nextactiondatescheduled.IsUnset() { - vals = append(vals, "nextactiondatescheduled") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Symbology.IsUnset() { - vals = append(vals, "symbology") - } - if !s.ShapeLength.IsUnset() { - vals = append(vals, "shape__length") - } - if !s.Usetype.IsUnset() { - vals = append(vals, "usetype") - } - if !s.Waterorigin.IsUnset() { - vals = append(vals, "waterorigin") - } - if !s.WidthFT.IsUnset() { - vals = append(vals, "width_ft") - } - if !s.WidthMeters.IsUnset() { - vals = append(vals, "width_meters") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryLinelocationSetter) Overwrite(t *HistoryLinelocation) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accessdesc.IsUnset() { - t.Accessdesc = s.Accessdesc.MustGetNull() - } - if !s.Acres.IsUnset() { - t.Acres = s.Acres.MustGetNull() - } - if !s.Active.IsUnset() { - t.Active = s.Active.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Description.IsUnset() { - t.Description = s.Description.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Habitat.IsUnset() { - t.Habitat = s.Habitat.MustGetNull() - } - if !s.Hectares.IsUnset() { - t.Hectares = s.Hectares.MustGetNull() - } - if !s.Jurisdiction.IsUnset() { - t.Jurisdiction = s.Jurisdiction.MustGetNull() - } - if !s.Larvinspectinterval.IsUnset() { - t.Larvinspectinterval = s.Larvinspectinterval.MustGetNull() - } - if !s.Lastinspectactiontaken.IsUnset() { - t.Lastinspectactiontaken = s.Lastinspectactiontaken.MustGetNull() - } - if !s.Lastinspectactivity.IsUnset() { - t.Lastinspectactivity = s.Lastinspectactivity.MustGetNull() - } - if !s.Lastinspectavglarvae.IsUnset() { - t.Lastinspectavglarvae = s.Lastinspectavglarvae.MustGetNull() - } - if !s.Lastinspectavgpupae.IsUnset() { - t.Lastinspectavgpupae = s.Lastinspectavgpupae.MustGetNull() - } - if !s.Lastinspectbreeding.IsUnset() { - t.Lastinspectbreeding = s.Lastinspectbreeding.MustGetNull() - } - if !s.Lastinspectconditions.IsUnset() { - t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() - } - if !s.Lastinspectdate.IsUnset() { - t.Lastinspectdate = s.Lastinspectdate.MustGetNull() - } - if !s.Lastinspectfieldspecies.IsUnset() { - t.Lastinspectfieldspecies = s.Lastinspectfieldspecies.MustGetNull() - } - if !s.Lastinspectlstages.IsUnset() { - t.Lastinspectlstages = s.Lastinspectlstages.MustGetNull() - } - if !s.Lasttreatactivity.IsUnset() { - t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() - } - if !s.Lasttreatdate.IsUnset() { - t.Lasttreatdate = s.Lasttreatdate.MustGetNull() - } - if !s.Lasttreatproduct.IsUnset() { - t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() - } - if !s.Lasttreatqty.IsUnset() { - t.Lasttreatqty = s.Lasttreatqty.MustGetNull() - } - if !s.Lasttreatqtyunit.IsUnset() { - t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() - } - if !s.LengthFT.IsUnset() { - t.LengthFT = s.LengthFT.MustGetNull() - } - if !s.LengthMeters.IsUnset() { - t.LengthMeters = s.LengthMeters.MustGetNull() - } - if !s.Locationnumber.IsUnset() { - t.Locationnumber = s.Locationnumber.MustGetNull() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if !s.Nextactiondatescheduled.IsUnset() { - t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Symbology.IsUnset() { - t.Symbology = s.Symbology.MustGetNull() - } - if !s.ShapeLength.IsUnset() { - t.ShapeLength = s.ShapeLength.MustGetNull() - } - if !s.Usetype.IsUnset() { - t.Usetype = s.Usetype.MustGetNull() - } - if !s.Waterorigin.IsUnset() { - t.Waterorigin = s.Waterorigin.MustGetNull() - } - if !s.WidthFT.IsUnset() { - t.WidthFT = s.WidthFT.MustGetNull() - } - if !s.WidthMeters.IsUnset() { - t.WidthMeters = s.WidthMeters.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryLinelocationSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryLinelocations.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 53) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accessdesc.IsUnset() { - vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Acres.IsUnset() { - vals[2] = psql.Arg(s.Acres.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Active.IsUnset() { - vals[3] = psql.Arg(s.Active.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[4] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[5] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[6] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Description.IsUnset() { - vals[7] = psql.Arg(s.Description.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[8] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[9] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[10] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[11] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Habitat.IsUnset() { - vals[12] = psql.Arg(s.Habitat.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Hectares.IsUnset() { - vals[13] = psql.Arg(s.Hectares.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Jurisdiction.IsUnset() { - vals[14] = psql.Arg(s.Jurisdiction.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Larvinspectinterval.IsUnset() { - vals[15] = psql.Arg(s.Larvinspectinterval.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectactiontaken.IsUnset() { - vals[16] = psql.Arg(s.Lastinspectactiontaken.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectactivity.IsUnset() { - vals[17] = psql.Arg(s.Lastinspectactivity.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectavglarvae.IsUnset() { - vals[18] = psql.Arg(s.Lastinspectavglarvae.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectavgpupae.IsUnset() { - vals[19] = psql.Arg(s.Lastinspectavgpupae.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectbreeding.IsUnset() { - vals[20] = psql.Arg(s.Lastinspectbreeding.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectconditions.IsUnset() { - vals[21] = psql.Arg(s.Lastinspectconditions.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectdate.IsUnset() { - vals[22] = psql.Arg(s.Lastinspectdate.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectfieldspecies.IsUnset() { - vals[23] = psql.Arg(s.Lastinspectfieldspecies.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectlstages.IsUnset() { - vals[24] = psql.Arg(s.Lastinspectlstages.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatactivity.IsUnset() { - vals[25] = psql.Arg(s.Lasttreatactivity.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatdate.IsUnset() { - vals[26] = psql.Arg(s.Lasttreatdate.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatproduct.IsUnset() { - vals[27] = psql.Arg(s.Lasttreatproduct.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqty.IsUnset() { - vals[28] = psql.Arg(s.Lasttreatqty.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqtyunit.IsUnset() { - vals[29] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.LengthFT.IsUnset() { - vals[30] = psql.Arg(s.LengthFT.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.LengthMeters.IsUnset() { - vals[31] = psql.Arg(s.LengthMeters.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Locationnumber.IsUnset() { - vals[32] = psql.Arg(s.Locationnumber.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[33] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Nextactiondatescheduled.IsUnset() { - vals[34] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[35] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[36] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.Symbology.IsUnset() { - vals[37] = psql.Arg(s.Symbology.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.ShapeLength.IsUnset() { - vals[38] = psql.Arg(s.ShapeLength.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Usetype.IsUnset() { - vals[39] = psql.Arg(s.Usetype.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Waterorigin.IsUnset() { - vals[40] = psql.Arg(s.Waterorigin.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.WidthFT.IsUnset() { - vals[41] = psql.Arg(s.WidthFT.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.WidthMeters.IsUnset() { - vals[42] = psql.Arg(s.WidthMeters.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[43] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[44] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[45] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[46] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[47] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[47] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[48] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[48] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[49] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[49] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[50] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[50] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[51] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[51] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[52] = psql.Arg(s.Version.MustGet()) - } else { - vals[52] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryLinelocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryLinelocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 53) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accessdesc.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accessdesc")...), - psql.Arg(s.Accessdesc), - }}) - } - - if !s.Acres.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "acres")...), - psql.Arg(s.Acres), - }}) - } - - if !s.Active.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "active")...), - psql.Arg(s.Active), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Description.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "description")...), - psql.Arg(s.Description), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitat")...), - psql.Arg(s.Habitat), - }}) - } - - if !s.Hectares.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "hectares")...), - psql.Arg(s.Hectares), - }}) - } - - if !s.Jurisdiction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "jurisdiction")...), - psql.Arg(s.Jurisdiction), - }}) - } - - if !s.Larvinspectinterval.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvinspectinterval")...), - psql.Arg(s.Larvinspectinterval), - }}) - } - - if !s.Lastinspectactiontaken.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectactiontaken")...), - psql.Arg(s.Lastinspectactiontaken), - }}) - } - - if !s.Lastinspectactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectactivity")...), - psql.Arg(s.Lastinspectactivity), - }}) - } - - if !s.Lastinspectavglarvae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectavglarvae")...), - psql.Arg(s.Lastinspectavglarvae), - }}) - } - - if !s.Lastinspectavgpupae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectavgpupae")...), - psql.Arg(s.Lastinspectavgpupae), - }}) - } - - if !s.Lastinspectbreeding.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectbreeding")...), - psql.Arg(s.Lastinspectbreeding), - }}) - } - - if !s.Lastinspectconditions.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectconditions")...), - psql.Arg(s.Lastinspectconditions), - }}) - } - - if !s.Lastinspectdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectdate")...), - psql.Arg(s.Lastinspectdate), - }}) - } - - if !s.Lastinspectfieldspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectfieldspecies")...), - psql.Arg(s.Lastinspectfieldspecies), - }}) - } - - if !s.Lastinspectlstages.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectlstages")...), - psql.Arg(s.Lastinspectlstages), - }}) - } - - if !s.Lasttreatactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatactivity")...), - psql.Arg(s.Lasttreatactivity), - }}) - } - - if !s.Lasttreatdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatdate")...), - psql.Arg(s.Lasttreatdate), - }}) - } - - if !s.Lasttreatproduct.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatproduct")...), - psql.Arg(s.Lasttreatproduct), - }}) - } - - if !s.Lasttreatqty.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqty")...), - psql.Arg(s.Lasttreatqty), - }}) - } - - if !s.Lasttreatqtyunit.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqtyunit")...), - psql.Arg(s.Lasttreatqtyunit), - }}) - } - - if !s.LengthFT.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "length_ft")...), - psql.Arg(s.LengthFT), - }}) - } - - if !s.LengthMeters.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "length_meters")...), - psql.Arg(s.LengthMeters), - }}) - } - - if !s.Locationnumber.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationnumber")...), - psql.Arg(s.Locationnumber), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if !s.Nextactiondatescheduled.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nextactiondatescheduled")...), - psql.Arg(s.Nextactiondatescheduled), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Symbology.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "symbology")...), - psql.Arg(s.Symbology), - }}) - } - - if !s.ShapeLength.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__length")...), - psql.Arg(s.ShapeLength), - }}) - } - - if !s.Usetype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "usetype")...), - psql.Arg(s.Usetype), - }}) - } - - if !s.Waterorigin.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "waterorigin")...), - psql.Arg(s.Waterorigin), - }}) - } - - if !s.WidthFT.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "width_ft")...), - psql.Arg(s.WidthFT), - }}) - } - - if !s.WidthMeters.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "width_meters")...), - psql.Arg(s.WidthMeters), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryLinelocation retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryLinelocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryLinelocation, error) { - if len(cols) == 0 { - return HistoryLinelocations.Query( - sm.Where(HistoryLinelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryLinelocations.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryLinelocations.Query( - sm.Where(HistoryLinelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryLinelocations.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryLinelocations.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryLinelocationExists checks the presence of a single record by primary key -func HistoryLinelocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryLinelocations.Query( - sm.Where(HistoryLinelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryLinelocations.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryLinelocation is retrieved from the database -func (o *HistoryLinelocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryLinelocations.AfterSelectHooks.RunHooks(ctx, exec, HistoryLinelocationSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryLinelocations.AfterInsertHooks.RunHooks(ctx, exec, HistoryLinelocationSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryLinelocations.AfterUpdateHooks.RunHooks(ctx, exec, HistoryLinelocationSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryLinelocations.AfterDeleteHooks.RunHooks(ctx, exec, HistoryLinelocationSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryLinelocation -func (o *HistoryLinelocation) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryLinelocation) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_linelocation", "objectid"), psql.Quote("history_linelocation", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryLinelocation -func (o *HistoryLinelocation) Update(ctx context.Context, exec bob.Executor, s *HistoryLinelocationSetter) error { - v, err := HistoryLinelocations.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 HistoryLinelocation record with an executor -func (o *HistoryLinelocation) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryLinelocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryLinelocation using the executor -func (o *HistoryLinelocation) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryLinelocations.Query( - sm.Where(HistoryLinelocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryLinelocations.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryLinelocationSlice is retrieved from the database -func (o HistoryLinelocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryLinelocations.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryLinelocations.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryLinelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryLinelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryLinelocationSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_linelocation", "objectid"), psql.Quote("history_linelocation", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryLinelocationSlice) copyMatchingRows(from ...*HistoryLinelocation) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryLinelocationSlice) 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 HistoryLinelocations.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 *HistoryLinelocation: - o.copyMatchingRows(retrieved) - case []*HistoryLinelocation: - o.copyMatchingRows(retrieved...) - case HistoryLinelocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryLinelocation or a slice of HistoryLinelocation - // then run the AfterUpdateHooks on the slice - _, err = HistoryLinelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryLinelocationSlice) 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 HistoryLinelocations.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 *HistoryLinelocation: - o.copyMatchingRows(retrieved) - case []*HistoryLinelocation: - o.copyMatchingRows(retrieved...) - case HistoryLinelocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryLinelocation or a slice of HistoryLinelocation - // then run the AfterDeleteHooks on the slice - _, err = HistoryLinelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryLinelocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryLinelocationSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryLinelocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryLinelocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryLinelocations.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryLinelocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryLinelocations.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 *HistoryLinelocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryLinelocationSlice) 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 attachHistoryLinelocationOrganization0(ctx context.Context, exec bob.Executor, count int, historyLinelocation0 *HistoryLinelocation, organization1 *Organization) (*HistoryLinelocation, error) { - setter := &HistoryLinelocationSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyLinelocation0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryLinelocationOrganization0: %w", err) - } - - return historyLinelocation0, nil -} - -func (historyLinelocation0 *HistoryLinelocation) 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 = attachHistoryLinelocationOrganization0(ctx, exec, 1, historyLinelocation0, organization1) - if err != nil { - return err - } - - historyLinelocation0.R.Organization = organization1 - - organization1.R.HistoryLinelocations = append(organization1.R.HistoryLinelocations, historyLinelocation0) - - return nil -} - -func (historyLinelocation0 *HistoryLinelocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryLinelocationOrganization0(ctx, exec, 1, historyLinelocation0, organization1) - if err != nil { - return err - } - - historyLinelocation0.R.Organization = organization1 - - organization1.R.HistoryLinelocations = append(organization1.R.HistoryLinelocations, historyLinelocation0) - - return nil -} - -type historyLinelocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accessdesc psql.WhereNullMod[Q, string] - Acres psql.WhereNullMod[Q, float64] - Active psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Description psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Habitat psql.WhereNullMod[Q, string] - Hectares psql.WhereNullMod[Q, float64] - Jurisdiction psql.WhereNullMod[Q, string] - Larvinspectinterval psql.WhereNullMod[Q, int16] - Lastinspectactiontaken psql.WhereNullMod[Q, string] - Lastinspectactivity psql.WhereNullMod[Q, string] - Lastinspectavglarvae psql.WhereNullMod[Q, float64] - Lastinspectavgpupae psql.WhereNullMod[Q, float64] - Lastinspectbreeding psql.WhereNullMod[Q, string] - Lastinspectconditions psql.WhereNullMod[Q, string] - Lastinspectdate psql.WhereNullMod[Q, int64] - Lastinspectfieldspecies psql.WhereNullMod[Q, string] - Lastinspectlstages psql.WhereNullMod[Q, string] - Lasttreatactivity psql.WhereNullMod[Q, string] - Lasttreatdate psql.WhereNullMod[Q, int64] - Lasttreatproduct psql.WhereNullMod[Q, string] - Lasttreatqty psql.WhereNullMod[Q, float64] - Lasttreatqtyunit psql.WhereNullMod[Q, string] - LengthFT psql.WhereNullMod[Q, float64] - LengthMeters psql.WhereNullMod[Q, float64] - Locationnumber psql.WhereNullMod[Q, int64] - Name psql.WhereNullMod[Q, string] - Nextactiondatescheduled psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Priority psql.WhereNullMod[Q, string] - Symbology psql.WhereNullMod[Q, string] - ShapeLength psql.WhereNullMod[Q, float64] - Usetype psql.WhereNullMod[Q, string] - Waterorigin psql.WhereNullMod[Q, string] - WidthFT psql.WhereNullMod[Q, float64] - WidthMeters psql.WhereNullMod[Q, float64] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyLinelocationWhere[Q]) AliasedAs(alias string) historyLinelocationWhere[Q] { - return buildHistoryLinelocationWhere[Q](buildHistoryLinelocationColumns(alias)) -} - -func buildHistoryLinelocationWhere[Q psql.Filterable](cols historyLinelocationColumns) historyLinelocationWhere[Q] { - return historyLinelocationWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), - Acres: psql.WhereNull[Q, float64](cols.Acres), - Active: psql.WhereNull[Q, int16](cols.Active), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Description: psql.WhereNull[Q, string](cols.Description), - 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), - Habitat: psql.WhereNull[Q, string](cols.Habitat), - Hectares: psql.WhereNull[Q, float64](cols.Hectares), - Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), - Larvinspectinterval: psql.WhereNull[Q, int16](cols.Larvinspectinterval), - Lastinspectactiontaken: psql.WhereNull[Q, string](cols.Lastinspectactiontaken), - Lastinspectactivity: psql.WhereNull[Q, string](cols.Lastinspectactivity), - Lastinspectavglarvae: psql.WhereNull[Q, float64](cols.Lastinspectavglarvae), - Lastinspectavgpupae: psql.WhereNull[Q, float64](cols.Lastinspectavgpupae), - Lastinspectbreeding: psql.WhereNull[Q, string](cols.Lastinspectbreeding), - Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), - Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), - Lastinspectfieldspecies: psql.WhereNull[Q, string](cols.Lastinspectfieldspecies), - Lastinspectlstages: psql.WhereNull[Q, string](cols.Lastinspectlstages), - Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), - Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), - Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), - Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), - Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), - LengthFT: psql.WhereNull[Q, float64](cols.LengthFT), - LengthMeters: psql.WhereNull[Q, float64](cols.LengthMeters), - Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), - Name: psql.WhereNull[Q, string](cols.Name), - Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), - Objectid: psql.Where[Q, int32](cols.Objectid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Symbology: psql.WhereNull[Q, string](cols.Symbology), - ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), - Usetype: psql.WhereNull[Q, string](cols.Usetype), - Waterorigin: psql.WhereNull[Q, string](cols.Waterorigin), - WidthFT: psql.WhereNull[Q, float64](cols.WidthFT), - WidthMeters: psql.WhereNull[Q, float64](cols.WidthMeters), - Zone: psql.WhereNull[Q, string](cols.Zone), - Zone2: psql.WhereNull[Q, string](cols.Zone2), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryLinelocation) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyLinelocation cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryLinelocations = HistoryLinelocationSlice{o} - } - return nil - default: - return fmt.Errorf("historyLinelocation has no relationship %q", name) - } -} - -type historyLinelocationPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryLinelocationPreloader() historyLinelocationPreloader { - return historyLinelocationPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryLinelocations, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyLinelocationThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryLinelocationThenLoader[Q orm.Loadable]() historyLinelocationThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyLinelocationThenLoader[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 historyLinelocation's Organization into the .R struct -func (o *HistoryLinelocation) 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.HistoryLinelocations = HistoryLinelocationSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyLinelocation's Organization into the .R struct -func (os HistoryLinelocationSlice) 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.HistoryLinelocations = append(rel.R.HistoryLinelocations, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyLinelocationJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyLinelocationJoins[Q]) aliasedAs(alias string) historyLinelocationJoins[Q] { - return buildHistoryLinelocationJoins[Q](buildHistoryLinelocationColumns(alias), j.typ) -} - -func buildHistoryLinelocationJoins[Q dialect.Joinable](cols historyLinelocationColumns, typ string) historyLinelocationJoins[Q] { - return historyLinelocationJoins[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/db/models/history_locationtracking.bob.go b/db/models/history_locationtracking.bob.go deleted file mode 100644 index 5422e79a..00000000 --- a/db/models/history_locationtracking.bob.go +++ /dev/null @@ -1,990 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryLocationtracking is an object representing the database table. -type HistoryLocationtracking struct { - OrganizationID int32 `db:"organization_id" ` - Accuracy null.Val[float64] `db:"accuracy" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Globalid null.Val[string] `db:"globalid" ` - Objectid int32 `db:"objectid,pk" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historyLocationtrackingR `db:"-" ` -} - -// HistoryLocationtrackingSlice is an alias for a slice of pointers to HistoryLocationtracking. -// This should almost always be used instead of []*HistoryLocationtracking. -type HistoryLocationtrackingSlice []*HistoryLocationtracking - -// HistoryLocationtrackings contains methods to work with the history_locationtracking table -var HistoryLocationtrackings = psql.NewTablex[*HistoryLocationtracking, HistoryLocationtrackingSlice, *HistoryLocationtrackingSetter]("", "history_locationtracking", buildHistoryLocationtrackingColumns("history_locationtracking")) - -// HistoryLocationtrackingsQuery is a query on the history_locationtracking table -type HistoryLocationtrackingsQuery = *psql.ViewQuery[*HistoryLocationtracking, HistoryLocationtrackingSlice] - -// historyLocationtrackingR is where relationships are stored. -type historyLocationtrackingR struct { - Organization *Organization // history_locationtracking.history_locationtracking_organization_id_fkey -} - -func buildHistoryLocationtrackingColumns(alias string) historyLocationtrackingColumns { - return historyLocationtrackingColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accuracy", "creationdate", "creator", "editdate", "editor", "fieldtech", "globalid", "objectid", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", - ).WithParent("history_locationtracking"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accuracy: psql.Quote(alias, "accuracy"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fieldtech: psql.Quote(alias, "fieldtech"), - Globalid: psql.Quote(alias, "globalid"), - Objectid: psql.Quote(alias, "objectid"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Version: psql.Quote(alias, "version"), - } -} - -type historyLocationtrackingColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accuracy psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fieldtech psql.Expression - Globalid psql.Expression - Objectid psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Version psql.Expression -} - -func (c historyLocationtrackingColumns) Alias() string { - return c.tableAlias -} - -func (historyLocationtrackingColumns) AliasedAs(alias string) historyLocationtrackingColumns { - return buildHistoryLocationtrackingColumns(alias) -} - -// HistoryLocationtrackingSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryLocationtrackingSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Accuracy omitnull.Val[float64] `db:"accuracy" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryLocationtrackingSetter) SetColumns() []string { - vals := make([]string, 0, 17) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accuracy.IsUnset() { - vals = append(vals, "accuracy") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fieldtech.IsUnset() { - vals = append(vals, "fieldtech") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryLocationtrackingSetter) Overwrite(t *HistoryLocationtracking) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accuracy.IsUnset() { - t.Accuracy = s.Accuracy.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fieldtech.IsUnset() { - t.Fieldtech = s.Fieldtech.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryLocationtrackingSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryLocationtrackings.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 17) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accuracy.IsUnset() { - vals[1] = psql.Arg(s.Accuracy.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[2] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[3] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[4] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[5] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Fieldtech.IsUnset() { - vals[6] = psql.Arg(s.Fieldtech.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[7] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[8] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[9] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[10] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[11] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[12] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[13] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[14] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[15] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[16] = psql.Arg(s.Version.MustGet()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryLocationtrackingSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryLocationtrackingSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 17) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accuracy.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accuracy")...), - psql.Arg(s.Accuracy), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fieldtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldtech")...), - psql.Arg(s.Fieldtech), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryLocationtracking retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryLocationtracking(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryLocationtracking, error) { - if len(cols) == 0 { - return HistoryLocationtrackings.Query( - sm.Where(HistoryLocationtrackings.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryLocationtrackings.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryLocationtrackings.Query( - sm.Where(HistoryLocationtrackings.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryLocationtrackings.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryLocationtrackings.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryLocationtrackingExists checks the presence of a single record by primary key -func HistoryLocationtrackingExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryLocationtrackings.Query( - sm.Where(HistoryLocationtrackings.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryLocationtrackings.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryLocationtracking is retrieved from the database -func (o *HistoryLocationtracking) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryLocationtrackings.AfterSelectHooks.RunHooks(ctx, exec, HistoryLocationtrackingSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryLocationtrackings.AfterInsertHooks.RunHooks(ctx, exec, HistoryLocationtrackingSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryLocationtrackings.AfterUpdateHooks.RunHooks(ctx, exec, HistoryLocationtrackingSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryLocationtrackings.AfterDeleteHooks.RunHooks(ctx, exec, HistoryLocationtrackingSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryLocationtracking -func (o *HistoryLocationtracking) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryLocationtracking) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_locationtracking", "objectid"), psql.Quote("history_locationtracking", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryLocationtracking -func (o *HistoryLocationtracking) Update(ctx context.Context, exec bob.Executor, s *HistoryLocationtrackingSetter) error { - v, err := HistoryLocationtrackings.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 HistoryLocationtracking record with an executor -func (o *HistoryLocationtracking) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryLocationtrackings.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryLocationtracking using the executor -func (o *HistoryLocationtracking) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryLocationtrackings.Query( - sm.Where(HistoryLocationtrackings.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryLocationtrackings.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryLocationtrackingSlice is retrieved from the database -func (o HistoryLocationtrackingSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryLocationtrackings.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryLocationtrackings.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryLocationtrackings.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryLocationtrackings.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryLocationtrackingSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_locationtracking", "objectid"), psql.Quote("history_locationtracking", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryLocationtrackingSlice) copyMatchingRows(from ...*HistoryLocationtracking) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryLocationtrackingSlice) 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 HistoryLocationtrackings.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 *HistoryLocationtracking: - o.copyMatchingRows(retrieved) - case []*HistoryLocationtracking: - o.copyMatchingRows(retrieved...) - case HistoryLocationtrackingSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryLocationtracking or a slice of HistoryLocationtracking - // then run the AfterUpdateHooks on the slice - _, err = HistoryLocationtrackings.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryLocationtrackingSlice) 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 HistoryLocationtrackings.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 *HistoryLocationtracking: - o.copyMatchingRows(retrieved) - case []*HistoryLocationtracking: - o.copyMatchingRows(retrieved...) - case HistoryLocationtrackingSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryLocationtracking or a slice of HistoryLocationtracking - // then run the AfterDeleteHooks on the slice - _, err = HistoryLocationtrackings.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryLocationtrackingSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryLocationtrackingSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryLocationtrackings.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryLocationtrackingSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryLocationtrackings.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryLocationtrackingSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryLocationtrackings.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 *HistoryLocationtracking) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryLocationtrackingSlice) 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 attachHistoryLocationtrackingOrganization0(ctx context.Context, exec bob.Executor, count int, historyLocationtracking0 *HistoryLocationtracking, organization1 *Organization) (*HistoryLocationtracking, error) { - setter := &HistoryLocationtrackingSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyLocationtracking0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryLocationtrackingOrganization0: %w", err) - } - - return historyLocationtracking0, nil -} - -func (historyLocationtracking0 *HistoryLocationtracking) 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 = attachHistoryLocationtrackingOrganization0(ctx, exec, 1, historyLocationtracking0, organization1) - if err != nil { - return err - } - - historyLocationtracking0.R.Organization = organization1 - - organization1.R.HistoryLocationtrackings = append(organization1.R.HistoryLocationtrackings, historyLocationtracking0) - - return nil -} - -func (historyLocationtracking0 *HistoryLocationtracking) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryLocationtrackingOrganization0(ctx, exec, 1, historyLocationtracking0, organization1) - if err != nil { - return err - } - - historyLocationtracking0.R.Organization = organization1 - - organization1.R.HistoryLocationtrackings = append(organization1.R.HistoryLocationtrackings, historyLocationtracking0) - - return nil -} - -type historyLocationtrackingWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accuracy psql.WhereNullMod[Q, float64] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fieldtech psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyLocationtrackingWhere[Q]) AliasedAs(alias string) historyLocationtrackingWhere[Q] { - return buildHistoryLocationtrackingWhere[Q](buildHistoryLocationtrackingColumns(alias)) -} - -func buildHistoryLocationtrackingWhere[Q psql.Filterable](cols historyLocationtrackingColumns) historyLocationtrackingWhere[Q] { - return historyLocationtrackingWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accuracy: psql.WhereNull[Q, float64](cols.Accuracy), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - 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), - Objectid: psql.Where[Q, int32](cols.Objectid), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryLocationtracking) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyLocationtracking cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryLocationtrackings = HistoryLocationtrackingSlice{o} - } - return nil - default: - return fmt.Errorf("historyLocationtracking has no relationship %q", name) - } -} - -type historyLocationtrackingPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryLocationtrackingPreloader() historyLocationtrackingPreloader { - return historyLocationtrackingPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryLocationtrackings, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyLocationtrackingThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryLocationtrackingThenLoader[Q orm.Loadable]() historyLocationtrackingThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyLocationtrackingThenLoader[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 historyLocationtracking's Organization into the .R struct -func (o *HistoryLocationtracking) 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.HistoryLocationtrackings = HistoryLocationtrackingSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyLocationtracking's Organization into the .R struct -func (os HistoryLocationtrackingSlice) 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.HistoryLocationtrackings = append(rel.R.HistoryLocationtrackings, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyLocationtrackingJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyLocationtrackingJoins[Q]) aliasedAs(alias string) historyLocationtrackingJoins[Q] { - return buildHistoryLocationtrackingJoins[Q](buildHistoryLocationtrackingColumns(alias), j.typ) -} - -func buildHistoryLocationtrackingJoins[Q dialect.Joinable](cols historyLocationtrackingColumns, typ string) historyLocationtrackingJoins[Q] { - return historyLocationtrackingJoins[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/db/models/history_mosquitoinspection.bob.go b/db/models/history_mosquitoinspection.bob.go deleted file mode 100644 index ba8c4b0f..00000000 --- a/db/models/history_mosquitoinspection.bob.go +++ /dev/null @@ -1,2115 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryMosquitoinspection is an object representing the database table. -type HistoryMosquitoinspection struct { - OrganizationID int32 `db:"organization_id" ` - Actiontaken null.Val[string] `db:"actiontaken" ` - Activity null.Val[string] `db:"activity" ` - Adultact null.Val[string] `db:"adultact" ` - Avetemp null.Val[float64] `db:"avetemp" ` - Avglarvae null.Val[float64] `db:"avglarvae" ` - Avgpupae null.Val[float64] `db:"avgpupae" ` - Breeding null.Val[string] `db:"breeding" ` - Cbcount null.Val[int16] `db:"cbcount" ` - Comments null.Val[string] `db:"comments" ` - Containercount null.Val[int16] `db:"containercount" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Domstage null.Val[string] `db:"domstage" ` - Eggs null.Val[int16] `db:"eggs" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldspecies null.Val[string] `db:"fieldspecies" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Globalid null.Val[string] `db:"globalid" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Larvaepresent null.Val[int16] `db:"larvaepresent" ` - Linelocid null.Val[string] `db:"linelocid" ` - Locationname null.Val[string] `db:"locationname" ` - Lstages null.Val[string] `db:"lstages" ` - Numdips null.Val[int16] `db:"numdips" ` - Objectid int32 `db:"objectid,pk" ` - Personalcontact null.Val[int16] `db:"personalcontact" ` - Pointlocid null.Val[string] `db:"pointlocid" ` - Polygonlocid null.Val[string] `db:"polygonlocid" ` - Posdips null.Val[int16] `db:"posdips" ` - Positivecontainercount null.Val[int16] `db:"positivecontainercount" ` - Pupaepresent null.Val[int16] `db:"pupaepresent" ` - Raingauge null.Val[float64] `db:"raingauge" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Sdid null.Val[string] `db:"sdid" ` - Sitecond null.Val[string] `db:"sitecond" ` - Srid null.Val[string] `db:"srid" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Tirecount null.Val[int16] `db:"tirecount" ` - Totlarvae null.Val[int16] `db:"totlarvae" ` - Totpupae null.Val[int16] `db:"totpupae" ` - Visualmonitoring null.Val[int16] `db:"visualmonitoring" ` - Vmcomments null.Val[string] `db:"vmcomments" ` - Winddir null.Val[string] `db:"winddir" ` - Windspeed null.Val[float64] `db:"windspeed" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Adminaction null.Val[string] `db:"adminaction" ` - Ptaid null.Val[string] `db:"ptaid" ` - Version int32 `db:"version,pk" ` - - R historyMosquitoinspectionR `db:"-" ` -} - -// HistoryMosquitoinspectionSlice is an alias for a slice of pointers to HistoryMosquitoinspection. -// This should almost always be used instead of []*HistoryMosquitoinspection. -type HistoryMosquitoinspectionSlice []*HistoryMosquitoinspection - -// HistoryMosquitoinspections contains methods to work with the history_mosquitoinspection table -var HistoryMosquitoinspections = psql.NewTablex[*HistoryMosquitoinspection, HistoryMosquitoinspectionSlice, *HistoryMosquitoinspectionSetter]("", "history_mosquitoinspection", buildHistoryMosquitoinspectionColumns("history_mosquitoinspection")) - -// HistoryMosquitoinspectionsQuery is a query on the history_mosquitoinspection table -type HistoryMosquitoinspectionsQuery = *psql.ViewQuery[*HistoryMosquitoinspection, HistoryMosquitoinspectionSlice] - -// historyMosquitoinspectionR is where relationships are stored. -type historyMosquitoinspectionR struct { - Organization *Organization // history_mosquitoinspection.history_mosquitoinspection_organization_id_fkey -} - -func buildHistoryMosquitoinspectionColumns(alias string) historyMosquitoinspectionColumns { - return historyMosquitoinspectionColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "actiontaken", "activity", "adultact", "avetemp", "avglarvae", "avgpupae", "breeding", "cbcount", "comments", "containercount", "creationdate", "creator", "domstage", "eggs", "enddatetime", "editdate", "editor", "fieldspecies", "fieldtech", "globalid", "jurisdiction", "larvaepresent", "linelocid", "locationname", "lstages", "numdips", "objectid", "personalcontact", "pointlocid", "polygonlocid", "posdips", "positivecontainercount", "pupaepresent", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sdid", "sitecond", "srid", "startdatetime", "tirecount", "totlarvae", "totpupae", "visualmonitoring", "vmcomments", "winddir", "windspeed", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "adminaction", "ptaid", "version", - ).WithParent("history_mosquitoinspection"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Actiontaken: psql.Quote(alias, "actiontaken"), - Activity: psql.Quote(alias, "activity"), - Adultact: psql.Quote(alias, "adultact"), - Avetemp: psql.Quote(alias, "avetemp"), - Avglarvae: psql.Quote(alias, "avglarvae"), - Avgpupae: psql.Quote(alias, "avgpupae"), - Breeding: psql.Quote(alias, "breeding"), - Cbcount: psql.Quote(alias, "cbcount"), - Comments: psql.Quote(alias, "comments"), - Containercount: psql.Quote(alias, "containercount"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Domstage: psql.Quote(alias, "domstage"), - Eggs: psql.Quote(alias, "eggs"), - Enddatetime: psql.Quote(alias, "enddatetime"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fieldspecies: psql.Quote(alias, "fieldspecies"), - Fieldtech: psql.Quote(alias, "fieldtech"), - Globalid: psql.Quote(alias, "globalid"), - Jurisdiction: psql.Quote(alias, "jurisdiction"), - Larvaepresent: psql.Quote(alias, "larvaepresent"), - Linelocid: psql.Quote(alias, "linelocid"), - Locationname: psql.Quote(alias, "locationname"), - Lstages: psql.Quote(alias, "lstages"), - Numdips: psql.Quote(alias, "numdips"), - Objectid: psql.Quote(alias, "objectid"), - Personalcontact: psql.Quote(alias, "personalcontact"), - Pointlocid: psql.Quote(alias, "pointlocid"), - Polygonlocid: psql.Quote(alias, "polygonlocid"), - Posdips: psql.Quote(alias, "posdips"), - Positivecontainercount: psql.Quote(alias, "positivecontainercount"), - Pupaepresent: psql.Quote(alias, "pupaepresent"), - Raingauge: psql.Quote(alias, "raingauge"), - Recordstatus: psql.Quote(alias, "recordstatus"), - Reviewed: psql.Quote(alias, "reviewed"), - Reviewedby: psql.Quote(alias, "reviewedby"), - Revieweddate: psql.Quote(alias, "revieweddate"), - Sdid: psql.Quote(alias, "sdid"), - Sitecond: psql.Quote(alias, "sitecond"), - Srid: psql.Quote(alias, "srid"), - Startdatetime: psql.Quote(alias, "startdatetime"), - Tirecount: psql.Quote(alias, "tirecount"), - Totlarvae: psql.Quote(alias, "totlarvae"), - Totpupae: psql.Quote(alias, "totpupae"), - Visualmonitoring: psql.Quote(alias, "visualmonitoring"), - Vmcomments: psql.Quote(alias, "vmcomments"), - Winddir: psql.Quote(alias, "winddir"), - Windspeed: psql.Quote(alias, "windspeed"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Adminaction: psql.Quote(alias, "adminaction"), - Ptaid: psql.Quote(alias, "ptaid"), - Version: psql.Quote(alias, "version"), - } -} - -type historyMosquitoinspectionColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Actiontaken psql.Expression - Activity psql.Expression - Adultact psql.Expression - Avetemp psql.Expression - Avglarvae psql.Expression - Avgpupae psql.Expression - Breeding psql.Expression - Cbcount psql.Expression - Comments psql.Expression - Containercount psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Domstage psql.Expression - Eggs psql.Expression - Enddatetime psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fieldspecies psql.Expression - Fieldtech psql.Expression - Globalid psql.Expression - Jurisdiction psql.Expression - Larvaepresent psql.Expression - Linelocid psql.Expression - Locationname psql.Expression - Lstages psql.Expression - Numdips psql.Expression - Objectid psql.Expression - Personalcontact psql.Expression - Pointlocid psql.Expression - Polygonlocid psql.Expression - Posdips psql.Expression - Positivecontainercount psql.Expression - Pupaepresent psql.Expression - Raingauge psql.Expression - Recordstatus psql.Expression - Reviewed psql.Expression - Reviewedby psql.Expression - Revieweddate psql.Expression - Sdid psql.Expression - Sitecond psql.Expression - Srid psql.Expression - Startdatetime psql.Expression - Tirecount psql.Expression - Totlarvae psql.Expression - Totpupae psql.Expression - Visualmonitoring psql.Expression - Vmcomments psql.Expression - Winddir psql.Expression - Windspeed psql.Expression - Zone psql.Expression - Zone2 psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Adminaction psql.Expression - Ptaid psql.Expression - Version psql.Expression -} - -func (c historyMosquitoinspectionColumns) Alias() string { - return c.tableAlias -} - -func (historyMosquitoinspectionColumns) AliasedAs(alias string) historyMosquitoinspectionColumns { - return buildHistoryMosquitoinspectionColumns(alias) -} - -// HistoryMosquitoinspectionSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryMosquitoinspectionSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Actiontaken omitnull.Val[string] `db:"actiontaken" ` - Activity omitnull.Val[string] `db:"activity" ` - Adultact omitnull.Val[string] `db:"adultact" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Avglarvae omitnull.Val[float64] `db:"avglarvae" ` - Avgpupae omitnull.Val[float64] `db:"avgpupae" ` - Breeding omitnull.Val[string] `db:"breeding" ` - Cbcount omitnull.Val[int16] `db:"cbcount" ` - Comments omitnull.Val[string] `db:"comments" ` - Containercount omitnull.Val[int16] `db:"containercount" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Domstage omitnull.Val[string] `db:"domstage" ` - Eggs omitnull.Val[int16] `db:"eggs" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldspecies omitnull.Val[string] `db:"fieldspecies" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Larvaepresent omitnull.Val[int16] `db:"larvaepresent" ` - Linelocid omitnull.Val[string] `db:"linelocid" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Lstages omitnull.Val[string] `db:"lstages" ` - Numdips omitnull.Val[int16] `db:"numdips" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Personalcontact omitnull.Val[int16] `db:"personalcontact" ` - Pointlocid omitnull.Val[string] `db:"pointlocid" ` - Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` - Posdips omitnull.Val[int16] `db:"posdips" ` - Positivecontainercount omitnull.Val[int16] `db:"positivecontainercount" ` - Pupaepresent omitnull.Val[int16] `db:"pupaepresent" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Sdid omitnull.Val[string] `db:"sdid" ` - Sitecond omitnull.Val[string] `db:"sitecond" ` - Srid omitnull.Val[string] `db:"srid" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Tirecount omitnull.Val[int16] `db:"tirecount" ` - Totlarvae omitnull.Val[int16] `db:"totlarvae" ` - Totpupae omitnull.Val[int16] `db:"totpupae" ` - Visualmonitoring omitnull.Val[int16] `db:"visualmonitoring" ` - Vmcomments omitnull.Val[string] `db:"vmcomments" ` - Winddir omitnull.Val[string] `db:"winddir" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Adminaction omitnull.Val[string] `db:"adminaction" ` - Ptaid omitnull.Val[string] `db:"ptaid" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryMosquitoinspectionSetter) SetColumns() []string { - vals := make([]string, 0, 62) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Actiontaken.IsUnset() { - vals = append(vals, "actiontaken") - } - if !s.Activity.IsUnset() { - vals = append(vals, "activity") - } - if !s.Adultact.IsUnset() { - vals = append(vals, "adultact") - } - if !s.Avetemp.IsUnset() { - vals = append(vals, "avetemp") - } - if !s.Avglarvae.IsUnset() { - vals = append(vals, "avglarvae") - } - if !s.Avgpupae.IsUnset() { - vals = append(vals, "avgpupae") - } - if !s.Breeding.IsUnset() { - vals = append(vals, "breeding") - } - if !s.Cbcount.IsUnset() { - vals = append(vals, "cbcount") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Containercount.IsUnset() { - vals = append(vals, "containercount") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Domstage.IsUnset() { - vals = append(vals, "domstage") - } - if !s.Eggs.IsUnset() { - vals = append(vals, "eggs") - } - if !s.Enddatetime.IsUnset() { - vals = append(vals, "enddatetime") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fieldspecies.IsUnset() { - vals = append(vals, "fieldspecies") - } - if !s.Fieldtech.IsUnset() { - vals = append(vals, "fieldtech") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Jurisdiction.IsUnset() { - vals = append(vals, "jurisdiction") - } - if !s.Larvaepresent.IsUnset() { - vals = append(vals, "larvaepresent") - } - if !s.Linelocid.IsUnset() { - vals = append(vals, "linelocid") - } - if !s.Locationname.IsUnset() { - vals = append(vals, "locationname") - } - if !s.Lstages.IsUnset() { - vals = append(vals, "lstages") - } - if !s.Numdips.IsUnset() { - vals = append(vals, "numdips") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Personalcontact.IsUnset() { - vals = append(vals, "personalcontact") - } - if !s.Pointlocid.IsUnset() { - vals = append(vals, "pointlocid") - } - if !s.Polygonlocid.IsUnset() { - vals = append(vals, "polygonlocid") - } - if !s.Posdips.IsUnset() { - vals = append(vals, "posdips") - } - if !s.Positivecontainercount.IsUnset() { - vals = append(vals, "positivecontainercount") - } - if !s.Pupaepresent.IsUnset() { - vals = append(vals, "pupaepresent") - } - if !s.Raingauge.IsUnset() { - vals = append(vals, "raingauge") - } - if !s.Recordstatus.IsUnset() { - vals = append(vals, "recordstatus") - } - if !s.Reviewed.IsUnset() { - vals = append(vals, "reviewed") - } - if !s.Reviewedby.IsUnset() { - vals = append(vals, "reviewedby") - } - if !s.Revieweddate.IsUnset() { - vals = append(vals, "revieweddate") - } - if !s.Sdid.IsUnset() { - vals = append(vals, "sdid") - } - if !s.Sitecond.IsUnset() { - vals = append(vals, "sitecond") - } - if !s.Srid.IsUnset() { - vals = append(vals, "srid") - } - if !s.Startdatetime.IsUnset() { - vals = append(vals, "startdatetime") - } - if !s.Tirecount.IsUnset() { - vals = append(vals, "tirecount") - } - if !s.Totlarvae.IsUnset() { - vals = append(vals, "totlarvae") - } - if !s.Totpupae.IsUnset() { - vals = append(vals, "totpupae") - } - if !s.Visualmonitoring.IsUnset() { - vals = append(vals, "visualmonitoring") - } - if !s.Vmcomments.IsUnset() { - vals = append(vals, "vmcomments") - } - if !s.Winddir.IsUnset() { - vals = append(vals, "winddir") - } - if !s.Windspeed.IsUnset() { - vals = append(vals, "windspeed") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Adminaction.IsUnset() { - vals = append(vals, "adminaction") - } - if !s.Ptaid.IsUnset() { - vals = append(vals, "ptaid") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryMosquitoinspectionSetter) Overwrite(t *HistoryMosquitoinspection) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Actiontaken.IsUnset() { - t.Actiontaken = s.Actiontaken.MustGetNull() - } - if !s.Activity.IsUnset() { - t.Activity = s.Activity.MustGetNull() - } - if !s.Adultact.IsUnset() { - t.Adultact = s.Adultact.MustGetNull() - } - if !s.Avetemp.IsUnset() { - t.Avetemp = s.Avetemp.MustGetNull() - } - if !s.Avglarvae.IsUnset() { - t.Avglarvae = s.Avglarvae.MustGetNull() - } - if !s.Avgpupae.IsUnset() { - t.Avgpupae = s.Avgpupae.MustGetNull() - } - if !s.Breeding.IsUnset() { - t.Breeding = s.Breeding.MustGetNull() - } - if !s.Cbcount.IsUnset() { - t.Cbcount = s.Cbcount.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Containercount.IsUnset() { - t.Containercount = s.Containercount.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Domstage.IsUnset() { - t.Domstage = s.Domstage.MustGetNull() - } - if !s.Eggs.IsUnset() { - t.Eggs = s.Eggs.MustGetNull() - } - if !s.Enddatetime.IsUnset() { - t.Enddatetime = s.Enddatetime.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fieldspecies.IsUnset() { - t.Fieldspecies = s.Fieldspecies.MustGetNull() - } - if !s.Fieldtech.IsUnset() { - t.Fieldtech = s.Fieldtech.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Jurisdiction.IsUnset() { - t.Jurisdiction = s.Jurisdiction.MustGetNull() - } - if !s.Larvaepresent.IsUnset() { - t.Larvaepresent = s.Larvaepresent.MustGetNull() - } - if !s.Linelocid.IsUnset() { - t.Linelocid = s.Linelocid.MustGetNull() - } - if !s.Locationname.IsUnset() { - t.Locationname = s.Locationname.MustGetNull() - } - if !s.Lstages.IsUnset() { - t.Lstages = s.Lstages.MustGetNull() - } - if !s.Numdips.IsUnset() { - t.Numdips = s.Numdips.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Personalcontact.IsUnset() { - t.Personalcontact = s.Personalcontact.MustGetNull() - } - if !s.Pointlocid.IsUnset() { - t.Pointlocid = s.Pointlocid.MustGetNull() - } - if !s.Polygonlocid.IsUnset() { - t.Polygonlocid = s.Polygonlocid.MustGetNull() - } - if !s.Posdips.IsUnset() { - t.Posdips = s.Posdips.MustGetNull() - } - if !s.Positivecontainercount.IsUnset() { - t.Positivecontainercount = s.Positivecontainercount.MustGetNull() - } - if !s.Pupaepresent.IsUnset() { - t.Pupaepresent = s.Pupaepresent.MustGetNull() - } - if !s.Raingauge.IsUnset() { - t.Raingauge = s.Raingauge.MustGetNull() - } - if !s.Recordstatus.IsUnset() { - t.Recordstatus = s.Recordstatus.MustGetNull() - } - if !s.Reviewed.IsUnset() { - t.Reviewed = s.Reviewed.MustGetNull() - } - if !s.Reviewedby.IsUnset() { - t.Reviewedby = s.Reviewedby.MustGetNull() - } - if !s.Revieweddate.IsUnset() { - t.Revieweddate = s.Revieweddate.MustGetNull() - } - if !s.Sdid.IsUnset() { - t.Sdid = s.Sdid.MustGetNull() - } - if !s.Sitecond.IsUnset() { - t.Sitecond = s.Sitecond.MustGetNull() - } - if !s.Srid.IsUnset() { - t.Srid = s.Srid.MustGetNull() - } - if !s.Startdatetime.IsUnset() { - t.Startdatetime = s.Startdatetime.MustGetNull() - } - if !s.Tirecount.IsUnset() { - t.Tirecount = s.Tirecount.MustGetNull() - } - if !s.Totlarvae.IsUnset() { - t.Totlarvae = s.Totlarvae.MustGetNull() - } - if !s.Totpupae.IsUnset() { - t.Totpupae = s.Totpupae.MustGetNull() - } - if !s.Visualmonitoring.IsUnset() { - t.Visualmonitoring = s.Visualmonitoring.MustGetNull() - } - if !s.Vmcomments.IsUnset() { - t.Vmcomments = s.Vmcomments.MustGetNull() - } - if !s.Winddir.IsUnset() { - t.Winddir = s.Winddir.MustGetNull() - } - if !s.Windspeed.IsUnset() { - t.Windspeed = s.Windspeed.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Adminaction.IsUnset() { - t.Adminaction = s.Adminaction.MustGetNull() - } - if !s.Ptaid.IsUnset() { - t.Ptaid = s.Ptaid.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryMosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryMosquitoinspections.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 62) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Actiontaken.IsUnset() { - vals[1] = psql.Arg(s.Actiontaken.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Activity.IsUnset() { - vals[2] = psql.Arg(s.Activity.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Adultact.IsUnset() { - vals[3] = psql.Arg(s.Adultact.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Avetemp.IsUnset() { - vals[4] = psql.Arg(s.Avetemp.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Avglarvae.IsUnset() { - vals[5] = psql.Arg(s.Avglarvae.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Avgpupae.IsUnset() { - vals[6] = psql.Arg(s.Avgpupae.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Breeding.IsUnset() { - vals[7] = psql.Arg(s.Breeding.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Cbcount.IsUnset() { - vals[8] = psql.Arg(s.Cbcount.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[9] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Containercount.IsUnset() { - vals[10] = psql.Arg(s.Containercount.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[11] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[12] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Domstage.IsUnset() { - vals[13] = psql.Arg(s.Domstage.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Eggs.IsUnset() { - vals[14] = psql.Arg(s.Eggs.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Enddatetime.IsUnset() { - vals[15] = psql.Arg(s.Enddatetime.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[16] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[17] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Fieldspecies.IsUnset() { - vals[18] = psql.Arg(s.Fieldspecies.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Fieldtech.IsUnset() { - vals[19] = psql.Arg(s.Fieldtech.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[20] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Jurisdiction.IsUnset() { - vals[21] = psql.Arg(s.Jurisdiction.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Larvaepresent.IsUnset() { - vals[22] = psql.Arg(s.Larvaepresent.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Linelocid.IsUnset() { - vals[23] = psql.Arg(s.Linelocid.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Locationname.IsUnset() { - vals[24] = psql.Arg(s.Locationname.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Lstages.IsUnset() { - vals[25] = psql.Arg(s.Lstages.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Numdips.IsUnset() { - vals[26] = psql.Arg(s.Numdips.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[27] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Personalcontact.IsUnset() { - vals[28] = psql.Arg(s.Personalcontact.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Pointlocid.IsUnset() { - vals[29] = psql.Arg(s.Pointlocid.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Polygonlocid.IsUnset() { - vals[30] = psql.Arg(s.Polygonlocid.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Posdips.IsUnset() { - vals[31] = psql.Arg(s.Posdips.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Positivecontainercount.IsUnset() { - vals[32] = psql.Arg(s.Positivecontainercount.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Pupaepresent.IsUnset() { - vals[33] = psql.Arg(s.Pupaepresent.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Raingauge.IsUnset() { - vals[34] = psql.Arg(s.Raingauge.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Recordstatus.IsUnset() { - vals[35] = psql.Arg(s.Recordstatus.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Reviewed.IsUnset() { - vals[36] = psql.Arg(s.Reviewed.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.Reviewedby.IsUnset() { - vals[37] = psql.Arg(s.Reviewedby.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.Revieweddate.IsUnset() { - vals[38] = psql.Arg(s.Revieweddate.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Sdid.IsUnset() { - vals[39] = psql.Arg(s.Sdid.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Sitecond.IsUnset() { - vals[40] = psql.Arg(s.Sitecond.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.Srid.IsUnset() { - vals[41] = psql.Arg(s.Srid.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.Startdatetime.IsUnset() { - vals[42] = psql.Arg(s.Startdatetime.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.Tirecount.IsUnset() { - vals[43] = psql.Arg(s.Tirecount.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.Totlarvae.IsUnset() { - vals[44] = psql.Arg(s.Totlarvae.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if !s.Totpupae.IsUnset() { - vals[45] = psql.Arg(s.Totpupae.MustGetNull()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if !s.Visualmonitoring.IsUnset() { - vals[46] = psql.Arg(s.Visualmonitoring.MustGetNull()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - if !s.Vmcomments.IsUnset() { - vals[47] = psql.Arg(s.Vmcomments.MustGetNull()) - } else { - vals[47] = psql.Raw("DEFAULT") - } - - if !s.Winddir.IsUnset() { - vals[48] = psql.Arg(s.Winddir.MustGetNull()) - } else { - vals[48] = psql.Raw("DEFAULT") - } - - if !s.Windspeed.IsUnset() { - vals[49] = psql.Arg(s.Windspeed.MustGetNull()) - } else { - vals[49] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[50] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[50] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[51] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[51] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[52] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[52] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[53] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[53] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[54] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[54] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[55] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[55] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[56] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[56] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[57] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[57] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[58] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[58] = psql.Raw("DEFAULT") - } - - if !s.Adminaction.IsUnset() { - vals[59] = psql.Arg(s.Adminaction.MustGetNull()) - } else { - vals[59] = psql.Raw("DEFAULT") - } - - if !s.Ptaid.IsUnset() { - vals[60] = psql.Arg(s.Ptaid.MustGetNull()) - } else { - vals[60] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[61] = psql.Arg(s.Version.MustGet()) - } else { - vals[61] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryMosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryMosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 62) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Actiontaken.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "actiontaken")...), - psql.Arg(s.Actiontaken), - }}) - } - - if !s.Activity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "activity")...), - psql.Arg(s.Activity), - }}) - } - - if !s.Adultact.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "adultact")...), - psql.Arg(s.Adultact), - }}) - } - - if !s.Avetemp.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "avetemp")...), - psql.Arg(s.Avetemp), - }}) - } - - if !s.Avglarvae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "avglarvae")...), - psql.Arg(s.Avglarvae), - }}) - } - - if !s.Avgpupae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "avgpupae")...), - psql.Arg(s.Avgpupae), - }}) - } - - if !s.Breeding.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "breeding")...), - psql.Arg(s.Breeding), - }}) - } - - if !s.Cbcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "cbcount")...), - psql.Arg(s.Cbcount), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Containercount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "containercount")...), - psql.Arg(s.Containercount), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Domstage.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "domstage")...), - psql.Arg(s.Domstage), - }}) - } - - if !s.Eggs.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "eggs")...), - psql.Arg(s.Eggs), - }}) - } - - if !s.Enddatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "enddatetime")...), - psql.Arg(s.Enddatetime), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fieldspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldspecies")...), - psql.Arg(s.Fieldspecies), - }}) - } - - if !s.Fieldtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldtech")...), - psql.Arg(s.Fieldtech), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Jurisdiction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "jurisdiction")...), - psql.Arg(s.Jurisdiction), - }}) - } - - if !s.Larvaepresent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvaepresent")...), - psql.Arg(s.Larvaepresent), - }}) - } - - if !s.Linelocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "linelocid")...), - psql.Arg(s.Linelocid), - }}) - } - - if !s.Locationname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationname")...), - psql.Arg(s.Locationname), - }}) - } - - if !s.Lstages.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lstages")...), - psql.Arg(s.Lstages), - }}) - } - - if !s.Numdips.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "numdips")...), - psql.Arg(s.Numdips), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Personalcontact.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "personalcontact")...), - psql.Arg(s.Personalcontact), - }}) - } - - if !s.Pointlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pointlocid")...), - psql.Arg(s.Pointlocid), - }}) - } - - if !s.Polygonlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "polygonlocid")...), - psql.Arg(s.Polygonlocid), - }}) - } - - if !s.Posdips.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "posdips")...), - psql.Arg(s.Posdips), - }}) - } - - if !s.Positivecontainercount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "positivecontainercount")...), - psql.Arg(s.Positivecontainercount), - }}) - } - - if !s.Pupaepresent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pupaepresent")...), - psql.Arg(s.Pupaepresent), - }}) - } - - if !s.Raingauge.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "raingauge")...), - psql.Arg(s.Raingauge), - }}) - } - - if !s.Recordstatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "recordstatus")...), - psql.Arg(s.Recordstatus), - }}) - } - - if !s.Reviewed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewed")...), - psql.Arg(s.Reviewed), - }}) - } - - if !s.Reviewedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewedby")...), - psql.Arg(s.Reviewedby), - }}) - } - - if !s.Revieweddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "revieweddate")...), - psql.Arg(s.Revieweddate), - }}) - } - - if !s.Sdid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sdid")...), - psql.Arg(s.Sdid), - }}) - } - - if !s.Sitecond.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sitecond")...), - psql.Arg(s.Sitecond), - }}) - } - - if !s.Srid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "srid")...), - psql.Arg(s.Srid), - }}) - } - - if !s.Startdatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "startdatetime")...), - psql.Arg(s.Startdatetime), - }}) - } - - if !s.Tirecount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "tirecount")...), - psql.Arg(s.Tirecount), - }}) - } - - if !s.Totlarvae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "totlarvae")...), - psql.Arg(s.Totlarvae), - }}) - } - - if !s.Totpupae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "totpupae")...), - psql.Arg(s.Totpupae), - }}) - } - - if !s.Visualmonitoring.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "visualmonitoring")...), - psql.Arg(s.Visualmonitoring), - }}) - } - - if !s.Vmcomments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vmcomments")...), - psql.Arg(s.Vmcomments), - }}) - } - - if !s.Winddir.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "winddir")...), - psql.Arg(s.Winddir), - }}) - } - - if !s.Windspeed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "windspeed")...), - psql.Arg(s.Windspeed), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Adminaction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "adminaction")...), - psql.Arg(s.Adminaction), - }}) - } - - if !s.Ptaid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "ptaid")...), - psql.Arg(s.Ptaid), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryMosquitoinspection retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryMosquitoinspection(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryMosquitoinspection, error) { - if len(cols) == 0 { - return HistoryMosquitoinspections.Query( - sm.Where(HistoryMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryMosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryMosquitoinspections.Query( - sm.Where(HistoryMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryMosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryMosquitoinspections.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryMosquitoinspectionExists checks the presence of a single record by primary key -func HistoryMosquitoinspectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryMosquitoinspections.Query( - sm.Where(HistoryMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryMosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryMosquitoinspection is retrieved from the database -func (o *HistoryMosquitoinspection) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryMosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, HistoryMosquitoinspectionSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryMosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, HistoryMosquitoinspectionSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryMosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, HistoryMosquitoinspectionSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryMosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, HistoryMosquitoinspectionSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryMosquitoinspection -func (o *HistoryMosquitoinspection) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryMosquitoinspection) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_mosquitoinspection", "objectid"), psql.Quote("history_mosquitoinspection", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryMosquitoinspection -func (o *HistoryMosquitoinspection) Update(ctx context.Context, exec bob.Executor, s *HistoryMosquitoinspectionSetter) error { - v, err := HistoryMosquitoinspections.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 HistoryMosquitoinspection record with an executor -func (o *HistoryMosquitoinspection) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryMosquitoinspections.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryMosquitoinspection using the executor -func (o *HistoryMosquitoinspection) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryMosquitoinspections.Query( - sm.Where(HistoryMosquitoinspections.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryMosquitoinspections.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryMosquitoinspectionSlice is retrieved from the database -func (o HistoryMosquitoinspectionSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryMosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryMosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryMosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryMosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryMosquitoinspectionSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_mosquitoinspection", "objectid"), psql.Quote("history_mosquitoinspection", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryMosquitoinspectionSlice) copyMatchingRows(from ...*HistoryMosquitoinspection) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryMosquitoinspectionSlice) 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 HistoryMosquitoinspections.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 *HistoryMosquitoinspection: - o.copyMatchingRows(retrieved) - case []*HistoryMosquitoinspection: - o.copyMatchingRows(retrieved...) - case HistoryMosquitoinspectionSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryMosquitoinspection or a slice of HistoryMosquitoinspection - // then run the AfterUpdateHooks on the slice - _, err = HistoryMosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryMosquitoinspectionSlice) 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 HistoryMosquitoinspections.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 *HistoryMosquitoinspection: - o.copyMatchingRows(retrieved) - case []*HistoryMosquitoinspection: - o.copyMatchingRows(retrieved...) - case HistoryMosquitoinspectionSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryMosquitoinspection or a slice of HistoryMosquitoinspection - // then run the AfterDeleteHooks on the slice - _, err = HistoryMosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryMosquitoinspectionSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryMosquitoinspectionSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryMosquitoinspections.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryMosquitoinspectionSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryMosquitoinspections.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryMosquitoinspectionSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryMosquitoinspections.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 *HistoryMosquitoinspection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryMosquitoinspectionSlice) 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 attachHistoryMosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, historyMosquitoinspection0 *HistoryMosquitoinspection, organization1 *Organization) (*HistoryMosquitoinspection, error) { - setter := &HistoryMosquitoinspectionSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyMosquitoinspection0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryMosquitoinspectionOrganization0: %w", err) - } - - return historyMosquitoinspection0, nil -} - -func (historyMosquitoinspection0 *HistoryMosquitoinspection) 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 = attachHistoryMosquitoinspectionOrganization0(ctx, exec, 1, historyMosquitoinspection0, organization1) - if err != nil { - return err - } - - historyMosquitoinspection0.R.Organization = organization1 - - organization1.R.HistoryMosquitoinspections = append(organization1.R.HistoryMosquitoinspections, historyMosquitoinspection0) - - return nil -} - -func (historyMosquitoinspection0 *HistoryMosquitoinspection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryMosquitoinspectionOrganization0(ctx, exec, 1, historyMosquitoinspection0, organization1) - if err != nil { - return err - } - - historyMosquitoinspection0.R.Organization = organization1 - - organization1.R.HistoryMosquitoinspections = append(organization1.R.HistoryMosquitoinspections, historyMosquitoinspection0) - - return nil -} - -type historyMosquitoinspectionWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Actiontaken psql.WhereNullMod[Q, string] - Activity psql.WhereNullMod[Q, string] - Adultact psql.WhereNullMod[Q, string] - Avetemp psql.WhereNullMod[Q, float64] - Avglarvae psql.WhereNullMod[Q, float64] - Avgpupae psql.WhereNullMod[Q, float64] - Breeding psql.WhereNullMod[Q, string] - Cbcount psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Containercount psql.WhereNullMod[Q, int16] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Domstage psql.WhereNullMod[Q, string] - Eggs psql.WhereNullMod[Q, int16] - Enddatetime psql.WhereNullMod[Q, int64] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fieldspecies psql.WhereNullMod[Q, string] - Fieldtech psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Jurisdiction psql.WhereNullMod[Q, string] - Larvaepresent psql.WhereNullMod[Q, int16] - Linelocid psql.WhereNullMod[Q, string] - Locationname psql.WhereNullMod[Q, string] - Lstages psql.WhereNullMod[Q, string] - Numdips psql.WhereNullMod[Q, int16] - Objectid psql.WhereMod[Q, int32] - Personalcontact psql.WhereNullMod[Q, int16] - Pointlocid psql.WhereNullMod[Q, string] - Polygonlocid psql.WhereNullMod[Q, string] - Posdips psql.WhereNullMod[Q, int16] - Positivecontainercount psql.WhereNullMod[Q, int16] - Pupaepresent psql.WhereNullMod[Q, int16] - Raingauge psql.WhereNullMod[Q, float64] - Recordstatus psql.WhereNullMod[Q, int16] - Reviewed psql.WhereNullMod[Q, int16] - Reviewedby psql.WhereNullMod[Q, string] - Revieweddate psql.WhereNullMod[Q, int64] - Sdid psql.WhereNullMod[Q, string] - Sitecond psql.WhereNullMod[Q, string] - Srid psql.WhereNullMod[Q, string] - Startdatetime psql.WhereNullMod[Q, int64] - Tirecount psql.WhereNullMod[Q, int16] - Totlarvae psql.WhereNullMod[Q, int16] - Totpupae psql.WhereNullMod[Q, int16] - Visualmonitoring psql.WhereNullMod[Q, int16] - Vmcomments psql.WhereNullMod[Q, string] - Winddir psql.WhereNullMod[Q, string] - Windspeed psql.WhereNullMod[Q, float64] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Adminaction psql.WhereNullMod[Q, string] - Ptaid psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyMosquitoinspectionWhere[Q]) AliasedAs(alias string) historyMosquitoinspectionWhere[Q] { - return buildHistoryMosquitoinspectionWhere[Q](buildHistoryMosquitoinspectionColumns(alias)) -} - -func buildHistoryMosquitoinspectionWhere[Q psql.Filterable](cols historyMosquitoinspectionColumns) historyMosquitoinspectionWhere[Q] { - return historyMosquitoinspectionWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Actiontaken: psql.WhereNull[Q, string](cols.Actiontaken), - Activity: psql.WhereNull[Q, string](cols.Activity), - Adultact: psql.WhereNull[Q, string](cols.Adultact), - Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), - Avglarvae: psql.WhereNull[Q, float64](cols.Avglarvae), - Avgpupae: psql.WhereNull[Q, float64](cols.Avgpupae), - Breeding: psql.WhereNull[Q, string](cols.Breeding), - Cbcount: psql.WhereNull[Q, int16](cols.Cbcount), - Comments: psql.WhereNull[Q, string](cols.Comments), - Containercount: psql.WhereNull[Q, int16](cols.Containercount), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Domstage: psql.WhereNull[Q, string](cols.Domstage), - Eggs: psql.WhereNull[Q, int16](cols.Eggs), - Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - 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), - Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), - Larvaepresent: psql.WhereNull[Q, int16](cols.Larvaepresent), - Linelocid: psql.WhereNull[Q, string](cols.Linelocid), - Locationname: psql.WhereNull[Q, string](cols.Locationname), - Lstages: psql.WhereNull[Q, string](cols.Lstages), - Numdips: psql.WhereNull[Q, int16](cols.Numdips), - Objectid: psql.Where[Q, int32](cols.Objectid), - Personalcontact: psql.WhereNull[Q, int16](cols.Personalcontact), - Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), - Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), - Posdips: psql.WhereNull[Q, int16](cols.Posdips), - Positivecontainercount: psql.WhereNull[Q, int16](cols.Positivecontainercount), - Pupaepresent: psql.WhereNull[Q, int16](cols.Pupaepresent), - Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), - Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), - Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), - Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), - Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), - Sdid: psql.WhereNull[Q, string](cols.Sdid), - Sitecond: psql.WhereNull[Q, string](cols.Sitecond), - Srid: psql.WhereNull[Q, string](cols.Srid), - Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), - Tirecount: psql.WhereNull[Q, int16](cols.Tirecount), - Totlarvae: psql.WhereNull[Q, int16](cols.Totlarvae), - Totpupae: psql.WhereNull[Q, int16](cols.Totpupae), - Visualmonitoring: psql.WhereNull[Q, int16](cols.Visualmonitoring), - Vmcomments: psql.WhereNull[Q, string](cols.Vmcomments), - Winddir: psql.WhereNull[Q, string](cols.Winddir), - Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), - Zone: psql.WhereNull[Q, string](cols.Zone), - Zone2: psql.WhereNull[Q, string](cols.Zone2), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Adminaction: psql.WhereNull[Q, string](cols.Adminaction), - Ptaid: psql.WhereNull[Q, string](cols.Ptaid), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryMosquitoinspection) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyMosquitoinspection cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryMosquitoinspections = HistoryMosquitoinspectionSlice{o} - } - return nil - default: - return fmt.Errorf("historyMosquitoinspection has no relationship %q", name) - } -} - -type historyMosquitoinspectionPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryMosquitoinspectionPreloader() historyMosquitoinspectionPreloader { - return historyMosquitoinspectionPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryMosquitoinspections, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyMosquitoinspectionThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryMosquitoinspectionThenLoader[Q orm.Loadable]() historyMosquitoinspectionThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyMosquitoinspectionThenLoader[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 historyMosquitoinspection's Organization into the .R struct -func (o *HistoryMosquitoinspection) 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.HistoryMosquitoinspections = HistoryMosquitoinspectionSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyMosquitoinspection's Organization into the .R struct -func (os HistoryMosquitoinspectionSlice) 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.HistoryMosquitoinspections = append(rel.R.HistoryMosquitoinspections, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyMosquitoinspectionJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyMosquitoinspectionJoins[Q]) aliasedAs(alias string) historyMosquitoinspectionJoins[Q] { - return buildHistoryMosquitoinspectionJoins[Q](buildHistoryMosquitoinspectionColumns(alias), j.typ) -} - -func buildHistoryMosquitoinspectionJoins[Q dialect.Joinable](cols historyMosquitoinspectionColumns, typ string) historyMosquitoinspectionJoins[Q] { - return historyMosquitoinspectionJoins[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/db/models/history_pointlocation.bob.go b/db/models/history_pointlocation.bob.go deleted file mode 100644 index 95c9a2ae..00000000 --- a/db/models/history_pointlocation.bob.go +++ /dev/null @@ -1,1790 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryPointlocation is an object representing the database table. -type HistoryPointlocation struct { - OrganizationID int32 `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Created null.Val[time.Time] `db:"created" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Larvinspectinterval null.Val[int16] `db:"larvinspectinterval" ` - Lastinspectactiontaken null.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectactivity null.Val[string] `db:"lastinspectactivity" ` - Lastinspectavglarvae null.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae null.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectbreeding null.Val[string] `db:"lastinspectbreeding" ` - Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate null.Val[int64] `db:"lastinspectdate" ` - Lastinspectfieldspecies null.Val[string] `db:"lastinspectfieldspecies" ` - Lastinspectlstages null.Val[string] `db:"lastinspectlstages" ` - Lasttreatactivity null.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate null.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct null.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty null.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit null.Val[string] `db:"lasttreatqtyunit" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Name null.Val[string] `db:"name" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Stype null.Val[string] `db:"stype" ` - Symbology null.Val[string] `db:"symbology" ` - Usetype null.Val[string] `db:"usetype" ` - Waterorigin null.Val[string] `db:"waterorigin" ` - X null.Val[float64] `db:"x" ` - 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" ` - Assignedtech null.Val[string] `db:"assignedtech" ` - DeactivateReason null.Val[string] `db:"deactivate_reason" ` - Scalarpriority null.Val[int64] `db:"scalarpriority" ` - Sourcestatus null.Val[string] `db:"sourcestatus" ` - Version int32 `db:"version,pk" ` - - R historyPointlocationR `db:"-" ` -} - -// HistoryPointlocationSlice is an alias for a slice of pointers to HistoryPointlocation. -// This should almost always be used instead of []*HistoryPointlocation. -type HistoryPointlocationSlice []*HistoryPointlocation - -// HistoryPointlocations contains methods to work with the history_pointlocation table -var HistoryPointlocations = psql.NewTablex[*HistoryPointlocation, HistoryPointlocationSlice, *HistoryPointlocationSetter]("", "history_pointlocation", buildHistoryPointlocationColumns("history_pointlocation")) - -// HistoryPointlocationsQuery is a query on the history_pointlocation table -type HistoryPointlocationsQuery = *psql.ViewQuery[*HistoryPointlocation, HistoryPointlocationSlice] - -// historyPointlocationR is where relationships are stored. -type historyPointlocationR struct { - Organization *Organization // history_pointlocation.history_pointlocation_organization_id_fkey -} - -func buildHistoryPointlocationColumns(alias string) historyPointlocationColumns { - return historyPointlocationColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "active", "comments", "created", "creationdate", "creator", "description", "externalid", "editdate", "editor", "globalid", "habitat", "jurisdiction", "larvinspectinterval", "lastinspectactiontaken", "lastinspectactivity", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectbreeding", "lastinspectconditions", "lastinspectdate", "lastinspectfieldspecies", "lastinspectlstages", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "stype", "symbology", "usetype", "waterorigin", "x", "y", "zone", "zone2", "geometry_x", "geometry_y", "assignedtech", "deactivate_reason", "scalarpriority", "sourcestatus", "version", - ).WithParent("history_pointlocation"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accessdesc: psql.Quote(alias, "accessdesc"), - Active: psql.Quote(alias, "active"), - Comments: psql.Quote(alias, "comments"), - Created: psql.Quote(alias, "created"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Description: psql.Quote(alias, "description"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Habitat: psql.Quote(alias, "habitat"), - Jurisdiction: psql.Quote(alias, "jurisdiction"), - Larvinspectinterval: psql.Quote(alias, "larvinspectinterval"), - Lastinspectactiontaken: psql.Quote(alias, "lastinspectactiontaken"), - Lastinspectactivity: psql.Quote(alias, "lastinspectactivity"), - Lastinspectavglarvae: psql.Quote(alias, "lastinspectavglarvae"), - Lastinspectavgpupae: psql.Quote(alias, "lastinspectavgpupae"), - Lastinspectbreeding: psql.Quote(alias, "lastinspectbreeding"), - Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), - Lastinspectdate: psql.Quote(alias, "lastinspectdate"), - Lastinspectfieldspecies: psql.Quote(alias, "lastinspectfieldspecies"), - Lastinspectlstages: psql.Quote(alias, "lastinspectlstages"), - Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), - Lasttreatdate: psql.Quote(alias, "lasttreatdate"), - Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), - Lasttreatqty: psql.Quote(alias, "lasttreatqty"), - Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), - Locationnumber: psql.Quote(alias, "locationnumber"), - Name: psql.Quote(alias, "name"), - Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), - Objectid: psql.Quote(alias, "objectid"), - Priority: psql.Quote(alias, "priority"), - Stype: psql.Quote(alias, "stype"), - Symbology: psql.Quote(alias, "symbology"), - Usetype: psql.Quote(alias, "usetype"), - Waterorigin: psql.Quote(alias, "waterorigin"), - X: psql.Quote(alias, "x"), - Y: psql.Quote(alias, "y"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - Assignedtech: psql.Quote(alias, "assignedtech"), - DeactivateReason: psql.Quote(alias, "deactivate_reason"), - Scalarpriority: psql.Quote(alias, "scalarpriority"), - Sourcestatus: psql.Quote(alias, "sourcestatus"), - Version: psql.Quote(alias, "version"), - } -} - -type historyPointlocationColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accessdesc psql.Expression - Active psql.Expression - Comments psql.Expression - Created psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Description psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Habitat psql.Expression - Jurisdiction psql.Expression - Larvinspectinterval psql.Expression - Lastinspectactiontaken psql.Expression - Lastinspectactivity psql.Expression - Lastinspectavglarvae psql.Expression - Lastinspectavgpupae psql.Expression - Lastinspectbreeding psql.Expression - Lastinspectconditions psql.Expression - Lastinspectdate psql.Expression - Lastinspectfieldspecies psql.Expression - Lastinspectlstages psql.Expression - Lasttreatactivity psql.Expression - Lasttreatdate psql.Expression - Lasttreatproduct psql.Expression - Lasttreatqty psql.Expression - Lasttreatqtyunit psql.Expression - Locationnumber psql.Expression - Name psql.Expression - Nextactiondatescheduled psql.Expression - Objectid psql.Expression - Priority psql.Expression - Stype psql.Expression - Symbology psql.Expression - Usetype psql.Expression - Waterorigin psql.Expression - X psql.Expression - Y psql.Expression - Zone psql.Expression - Zone2 psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - Assignedtech psql.Expression - DeactivateReason psql.Expression - Scalarpriority psql.Expression - Sourcestatus psql.Expression - Version psql.Expression -} - -func (c historyPointlocationColumns) Alias() string { - return c.tableAlias -} - -func (historyPointlocationColumns) AliasedAs(alias string) historyPointlocationColumns { - return buildHistoryPointlocationColumns(alias) -} - -// HistoryPointlocationSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryPointlocationSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Created omitnull.Val[time.Time] `db:"created" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Larvinspectinterval omitnull.Val[int16] `db:"larvinspectinterval" ` - Lastinspectactiontaken omitnull.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectactivity omitnull.Val[string] `db:"lastinspectactivity" ` - Lastinspectavglarvae omitnull.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae omitnull.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectbreeding omitnull.Val[string] `db:"lastinspectbreeding" ` - Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate omitnull.Val[int64] `db:"lastinspectdate" ` - Lastinspectfieldspecies omitnull.Val[string] `db:"lastinspectfieldspecies" ` - Lastinspectlstages omitnull.Val[string] `db:"lastinspectlstages" ` - Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate omitnull.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Name omitnull.Val[string] `db:"name" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Stype omitnull.Val[string] `db:"stype" ` - Symbology omitnull.Val[string] `db:"symbology" ` - Usetype omitnull.Val[string] `db:"usetype" ` - Waterorigin omitnull.Val[string] `db:"waterorigin" ` - X omitnull.Val[float64] `db:"x" ` - 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" ` - Assignedtech omitnull.Val[string] `db:"assignedtech" ` - DeactivateReason omitnull.Val[string] `db:"deactivate_reason" ` - Scalarpriority omitnull.Val[int64] `db:"scalarpriority" ` - Sourcestatus omitnull.Val[string] `db:"sourcestatus" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryPointlocationSetter) SetColumns() []string { - vals := make([]string, 0, 49) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accessdesc.IsUnset() { - vals = append(vals, "accessdesc") - } - if !s.Active.IsUnset() { - vals = append(vals, "active") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Description.IsUnset() { - vals = append(vals, "description") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Habitat.IsUnset() { - vals = append(vals, "habitat") - } - if !s.Jurisdiction.IsUnset() { - vals = append(vals, "jurisdiction") - } - if !s.Larvinspectinterval.IsUnset() { - vals = append(vals, "larvinspectinterval") - } - if !s.Lastinspectactiontaken.IsUnset() { - vals = append(vals, "lastinspectactiontaken") - } - if !s.Lastinspectactivity.IsUnset() { - vals = append(vals, "lastinspectactivity") - } - if !s.Lastinspectavglarvae.IsUnset() { - vals = append(vals, "lastinspectavglarvae") - } - if !s.Lastinspectavgpupae.IsUnset() { - vals = append(vals, "lastinspectavgpupae") - } - if !s.Lastinspectbreeding.IsUnset() { - vals = append(vals, "lastinspectbreeding") - } - if !s.Lastinspectconditions.IsUnset() { - vals = append(vals, "lastinspectconditions") - } - if !s.Lastinspectdate.IsUnset() { - vals = append(vals, "lastinspectdate") - } - if !s.Lastinspectfieldspecies.IsUnset() { - vals = append(vals, "lastinspectfieldspecies") - } - if !s.Lastinspectlstages.IsUnset() { - vals = append(vals, "lastinspectlstages") - } - if !s.Lasttreatactivity.IsUnset() { - vals = append(vals, "lasttreatactivity") - } - if !s.Lasttreatdate.IsUnset() { - vals = append(vals, "lasttreatdate") - } - if !s.Lasttreatproduct.IsUnset() { - vals = append(vals, "lasttreatproduct") - } - if !s.Lasttreatqty.IsUnset() { - vals = append(vals, "lasttreatqty") - } - if !s.Lasttreatqtyunit.IsUnset() { - vals = append(vals, "lasttreatqtyunit") - } - if !s.Locationnumber.IsUnset() { - vals = append(vals, "locationnumber") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if !s.Nextactiondatescheduled.IsUnset() { - vals = append(vals, "nextactiondatescheduled") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Stype.IsUnset() { - vals = append(vals, "stype") - } - if !s.Symbology.IsUnset() { - vals = append(vals, "symbology") - } - if !s.Usetype.IsUnset() { - vals = append(vals, "usetype") - } - if !s.Waterorigin.IsUnset() { - vals = append(vals, "waterorigin") - } - if !s.X.IsUnset() { - vals = append(vals, "x") - } - if !s.Y.IsUnset() { - vals = append(vals, "y") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.Assignedtech.IsUnset() { - vals = append(vals, "assignedtech") - } - if !s.DeactivateReason.IsUnset() { - vals = append(vals, "deactivate_reason") - } - if !s.Scalarpriority.IsUnset() { - vals = append(vals, "scalarpriority") - } - if !s.Sourcestatus.IsUnset() { - vals = append(vals, "sourcestatus") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryPointlocationSetter) Overwrite(t *HistoryPointlocation) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accessdesc.IsUnset() { - t.Accessdesc = s.Accessdesc.MustGetNull() - } - if !s.Active.IsUnset() { - t.Active = s.Active.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Description.IsUnset() { - t.Description = s.Description.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Habitat.IsUnset() { - t.Habitat = s.Habitat.MustGetNull() - } - if !s.Jurisdiction.IsUnset() { - t.Jurisdiction = s.Jurisdiction.MustGetNull() - } - if !s.Larvinspectinterval.IsUnset() { - t.Larvinspectinterval = s.Larvinspectinterval.MustGetNull() - } - if !s.Lastinspectactiontaken.IsUnset() { - t.Lastinspectactiontaken = s.Lastinspectactiontaken.MustGetNull() - } - if !s.Lastinspectactivity.IsUnset() { - t.Lastinspectactivity = s.Lastinspectactivity.MustGetNull() - } - if !s.Lastinspectavglarvae.IsUnset() { - t.Lastinspectavglarvae = s.Lastinspectavglarvae.MustGetNull() - } - if !s.Lastinspectavgpupae.IsUnset() { - t.Lastinspectavgpupae = s.Lastinspectavgpupae.MustGetNull() - } - if !s.Lastinspectbreeding.IsUnset() { - t.Lastinspectbreeding = s.Lastinspectbreeding.MustGetNull() - } - if !s.Lastinspectconditions.IsUnset() { - t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() - } - if !s.Lastinspectdate.IsUnset() { - t.Lastinspectdate = s.Lastinspectdate.MustGetNull() - } - if !s.Lastinspectfieldspecies.IsUnset() { - t.Lastinspectfieldspecies = s.Lastinspectfieldspecies.MustGetNull() - } - if !s.Lastinspectlstages.IsUnset() { - t.Lastinspectlstages = s.Lastinspectlstages.MustGetNull() - } - if !s.Lasttreatactivity.IsUnset() { - t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() - } - if !s.Lasttreatdate.IsUnset() { - t.Lasttreatdate = s.Lasttreatdate.MustGetNull() - } - if !s.Lasttreatproduct.IsUnset() { - t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() - } - if !s.Lasttreatqty.IsUnset() { - t.Lasttreatqty = s.Lasttreatqty.MustGetNull() - } - if !s.Lasttreatqtyunit.IsUnset() { - t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() - } - if !s.Locationnumber.IsUnset() { - t.Locationnumber = s.Locationnumber.MustGetNull() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if !s.Nextactiondatescheduled.IsUnset() { - t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Stype.IsUnset() { - t.Stype = s.Stype.MustGetNull() - } - if !s.Symbology.IsUnset() { - t.Symbology = s.Symbology.MustGetNull() - } - if !s.Usetype.IsUnset() { - t.Usetype = s.Usetype.MustGetNull() - } - if !s.Waterorigin.IsUnset() { - t.Waterorigin = s.Waterorigin.MustGetNull() - } - if !s.X.IsUnset() { - t.X = s.X.MustGetNull() - } - if !s.Y.IsUnset() { - t.Y = s.Y.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.Assignedtech.IsUnset() { - t.Assignedtech = s.Assignedtech.MustGetNull() - } - if !s.DeactivateReason.IsUnset() { - t.DeactivateReason = s.DeactivateReason.MustGetNull() - } - if !s.Scalarpriority.IsUnset() { - t.Scalarpriority = s.Scalarpriority.MustGetNull() - } - if !s.Sourcestatus.IsUnset() { - t.Sourcestatus = s.Sourcestatus.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryPointlocationSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryPointlocations.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 49) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accessdesc.IsUnset() { - vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Active.IsUnset() { - vals[2] = psql.Arg(s.Active.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[3] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[4] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[5] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[6] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Description.IsUnset() { - vals[7] = psql.Arg(s.Description.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[8] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[9] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[10] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[11] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Habitat.IsUnset() { - vals[12] = psql.Arg(s.Habitat.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Jurisdiction.IsUnset() { - vals[13] = psql.Arg(s.Jurisdiction.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Larvinspectinterval.IsUnset() { - vals[14] = psql.Arg(s.Larvinspectinterval.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectactiontaken.IsUnset() { - vals[15] = psql.Arg(s.Lastinspectactiontaken.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectactivity.IsUnset() { - vals[16] = psql.Arg(s.Lastinspectactivity.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectavglarvae.IsUnset() { - vals[17] = psql.Arg(s.Lastinspectavglarvae.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectavgpupae.IsUnset() { - vals[18] = psql.Arg(s.Lastinspectavgpupae.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectbreeding.IsUnset() { - vals[19] = psql.Arg(s.Lastinspectbreeding.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectconditions.IsUnset() { - vals[20] = psql.Arg(s.Lastinspectconditions.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectdate.IsUnset() { - vals[21] = psql.Arg(s.Lastinspectdate.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectfieldspecies.IsUnset() { - vals[22] = psql.Arg(s.Lastinspectfieldspecies.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectlstages.IsUnset() { - vals[23] = psql.Arg(s.Lastinspectlstages.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatactivity.IsUnset() { - vals[24] = psql.Arg(s.Lasttreatactivity.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatdate.IsUnset() { - vals[25] = psql.Arg(s.Lasttreatdate.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatproduct.IsUnset() { - vals[26] = psql.Arg(s.Lasttreatproduct.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqty.IsUnset() { - vals[27] = psql.Arg(s.Lasttreatqty.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqtyunit.IsUnset() { - vals[28] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Locationnumber.IsUnset() { - vals[29] = psql.Arg(s.Locationnumber.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[30] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Nextactiondatescheduled.IsUnset() { - vals[31] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[32] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[33] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Stype.IsUnset() { - vals[34] = psql.Arg(s.Stype.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Symbology.IsUnset() { - vals[35] = psql.Arg(s.Symbology.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Usetype.IsUnset() { - vals[36] = psql.Arg(s.Usetype.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.Waterorigin.IsUnset() { - vals[37] = psql.Arg(s.Waterorigin.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.X.IsUnset() { - vals[38] = psql.Arg(s.X.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Y.IsUnset() { - vals[39] = psql.Arg(s.Y.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[40] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[41] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[42] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[43] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.Assignedtech.IsUnset() { - vals[44] = psql.Arg(s.Assignedtech.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if !s.DeactivateReason.IsUnset() { - vals[45] = psql.Arg(s.DeactivateReason.MustGetNull()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if !s.Scalarpriority.IsUnset() { - vals[46] = psql.Arg(s.Scalarpriority.MustGetNull()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - if !s.Sourcestatus.IsUnset() { - vals[47] = psql.Arg(s.Sourcestatus.MustGetNull()) - } else { - vals[47] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[48] = psql.Arg(s.Version.MustGet()) - } else { - vals[48] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryPointlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryPointlocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 49) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accessdesc.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accessdesc")...), - psql.Arg(s.Accessdesc), - }}) - } - - if !s.Active.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "active")...), - psql.Arg(s.Active), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Description.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "description")...), - psql.Arg(s.Description), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitat")...), - psql.Arg(s.Habitat), - }}) - } - - if !s.Jurisdiction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "jurisdiction")...), - psql.Arg(s.Jurisdiction), - }}) - } - - if !s.Larvinspectinterval.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvinspectinterval")...), - psql.Arg(s.Larvinspectinterval), - }}) - } - - if !s.Lastinspectactiontaken.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectactiontaken")...), - psql.Arg(s.Lastinspectactiontaken), - }}) - } - - if !s.Lastinspectactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectactivity")...), - psql.Arg(s.Lastinspectactivity), - }}) - } - - if !s.Lastinspectavglarvae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectavglarvae")...), - psql.Arg(s.Lastinspectavglarvae), - }}) - } - - if !s.Lastinspectavgpupae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectavgpupae")...), - psql.Arg(s.Lastinspectavgpupae), - }}) - } - - if !s.Lastinspectbreeding.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectbreeding")...), - psql.Arg(s.Lastinspectbreeding), - }}) - } - - if !s.Lastinspectconditions.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectconditions")...), - psql.Arg(s.Lastinspectconditions), - }}) - } - - if !s.Lastinspectdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectdate")...), - psql.Arg(s.Lastinspectdate), - }}) - } - - if !s.Lastinspectfieldspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectfieldspecies")...), - psql.Arg(s.Lastinspectfieldspecies), - }}) - } - - if !s.Lastinspectlstages.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectlstages")...), - psql.Arg(s.Lastinspectlstages), - }}) - } - - if !s.Lasttreatactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatactivity")...), - psql.Arg(s.Lasttreatactivity), - }}) - } - - if !s.Lasttreatdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatdate")...), - psql.Arg(s.Lasttreatdate), - }}) - } - - if !s.Lasttreatproduct.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatproduct")...), - psql.Arg(s.Lasttreatproduct), - }}) - } - - if !s.Lasttreatqty.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqty")...), - psql.Arg(s.Lasttreatqty), - }}) - } - - if !s.Lasttreatqtyunit.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqtyunit")...), - psql.Arg(s.Lasttreatqtyunit), - }}) - } - - if !s.Locationnumber.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationnumber")...), - psql.Arg(s.Locationnumber), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if !s.Nextactiondatescheduled.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nextactiondatescheduled")...), - psql.Arg(s.Nextactiondatescheduled), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Stype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "stype")...), - psql.Arg(s.Stype), - }}) - } - - if !s.Symbology.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "symbology")...), - psql.Arg(s.Symbology), - }}) - } - - if !s.Usetype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "usetype")...), - psql.Arg(s.Usetype), - }}) - } - - if !s.Waterorigin.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "waterorigin")...), - psql.Arg(s.Waterorigin), - }}) - } - - if !s.X.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "x")...), - psql.Arg(s.X), - }}) - } - - if !s.Y.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "y")...), - psql.Arg(s.Y), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.Assignedtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "assignedtech")...), - psql.Arg(s.Assignedtech), - }}) - } - - if !s.DeactivateReason.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "deactivate_reason")...), - psql.Arg(s.DeactivateReason), - }}) - } - - if !s.Scalarpriority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "scalarpriority")...), - psql.Arg(s.Scalarpriority), - }}) - } - - if !s.Sourcestatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sourcestatus")...), - psql.Arg(s.Sourcestatus), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryPointlocation retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryPointlocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryPointlocation, error) { - if len(cols) == 0 { - return HistoryPointlocations.Query( - sm.Where(HistoryPointlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryPointlocations.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryPointlocations.Query( - sm.Where(HistoryPointlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryPointlocations.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryPointlocations.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryPointlocationExists checks the presence of a single record by primary key -func HistoryPointlocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryPointlocations.Query( - sm.Where(HistoryPointlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryPointlocations.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryPointlocation is retrieved from the database -func (o *HistoryPointlocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryPointlocations.AfterSelectHooks.RunHooks(ctx, exec, HistoryPointlocationSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryPointlocations.AfterInsertHooks.RunHooks(ctx, exec, HistoryPointlocationSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryPointlocations.AfterUpdateHooks.RunHooks(ctx, exec, HistoryPointlocationSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryPointlocations.AfterDeleteHooks.RunHooks(ctx, exec, HistoryPointlocationSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryPointlocation -func (o *HistoryPointlocation) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryPointlocation) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_pointlocation", "objectid"), psql.Quote("history_pointlocation", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryPointlocation -func (o *HistoryPointlocation) Update(ctx context.Context, exec bob.Executor, s *HistoryPointlocationSetter) error { - v, err := HistoryPointlocations.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 HistoryPointlocation record with an executor -func (o *HistoryPointlocation) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryPointlocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryPointlocation using the executor -func (o *HistoryPointlocation) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryPointlocations.Query( - sm.Where(HistoryPointlocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryPointlocations.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryPointlocationSlice is retrieved from the database -func (o HistoryPointlocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryPointlocations.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryPointlocations.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryPointlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryPointlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryPointlocationSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_pointlocation", "objectid"), psql.Quote("history_pointlocation", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryPointlocationSlice) copyMatchingRows(from ...*HistoryPointlocation) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryPointlocationSlice) 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 HistoryPointlocations.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 *HistoryPointlocation: - o.copyMatchingRows(retrieved) - case []*HistoryPointlocation: - o.copyMatchingRows(retrieved...) - case HistoryPointlocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryPointlocation or a slice of HistoryPointlocation - // then run the AfterUpdateHooks on the slice - _, err = HistoryPointlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryPointlocationSlice) 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 HistoryPointlocations.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 *HistoryPointlocation: - o.copyMatchingRows(retrieved) - case []*HistoryPointlocation: - o.copyMatchingRows(retrieved...) - case HistoryPointlocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryPointlocation or a slice of HistoryPointlocation - // then run the AfterDeleteHooks on the slice - _, err = HistoryPointlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryPointlocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryPointlocationSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryPointlocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryPointlocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryPointlocations.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryPointlocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryPointlocations.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 *HistoryPointlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryPointlocationSlice) 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 attachHistoryPointlocationOrganization0(ctx context.Context, exec bob.Executor, count int, historyPointlocation0 *HistoryPointlocation, organization1 *Organization) (*HistoryPointlocation, error) { - setter := &HistoryPointlocationSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyPointlocation0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryPointlocationOrganization0: %w", err) - } - - return historyPointlocation0, nil -} - -func (historyPointlocation0 *HistoryPointlocation) 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 = attachHistoryPointlocationOrganization0(ctx, exec, 1, historyPointlocation0, organization1) - if err != nil { - return err - } - - historyPointlocation0.R.Organization = organization1 - - organization1.R.HistoryPointlocations = append(organization1.R.HistoryPointlocations, historyPointlocation0) - - return nil -} - -func (historyPointlocation0 *HistoryPointlocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryPointlocationOrganization0(ctx, exec, 1, historyPointlocation0, organization1) - if err != nil { - return err - } - - historyPointlocation0.R.Organization = organization1 - - organization1.R.HistoryPointlocations = append(organization1.R.HistoryPointlocations, historyPointlocation0) - - return nil -} - -type historyPointlocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accessdesc psql.WhereNullMod[Q, string] - Active psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Description psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Habitat psql.WhereNullMod[Q, string] - Jurisdiction psql.WhereNullMod[Q, string] - Larvinspectinterval psql.WhereNullMod[Q, int16] - Lastinspectactiontaken psql.WhereNullMod[Q, string] - Lastinspectactivity psql.WhereNullMod[Q, string] - Lastinspectavglarvae psql.WhereNullMod[Q, float64] - Lastinspectavgpupae psql.WhereNullMod[Q, float64] - Lastinspectbreeding psql.WhereNullMod[Q, string] - Lastinspectconditions psql.WhereNullMod[Q, string] - Lastinspectdate psql.WhereNullMod[Q, int64] - Lastinspectfieldspecies psql.WhereNullMod[Q, string] - Lastinspectlstages psql.WhereNullMod[Q, string] - Lasttreatactivity psql.WhereNullMod[Q, string] - Lasttreatdate psql.WhereNullMod[Q, int64] - Lasttreatproduct psql.WhereNullMod[Q, string] - Lasttreatqty psql.WhereNullMod[Q, float64] - Lasttreatqtyunit psql.WhereNullMod[Q, string] - Locationnumber psql.WhereNullMod[Q, int64] - Name psql.WhereNullMod[Q, string] - Nextactiondatescheduled psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Priority psql.WhereNullMod[Q, string] - Stype psql.WhereNullMod[Q, string] - Symbology psql.WhereNullMod[Q, string] - Usetype psql.WhereNullMod[Q, string] - Waterorigin psql.WhereNullMod[Q, string] - X psql.WhereNullMod[Q, float64] - 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] - Assignedtech psql.WhereNullMod[Q, string] - DeactivateReason psql.WhereNullMod[Q, string] - Scalarpriority psql.WhereNullMod[Q, int64] - Sourcestatus psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyPointlocationWhere[Q]) AliasedAs(alias string) historyPointlocationWhere[Q] { - return buildHistoryPointlocationWhere[Q](buildHistoryPointlocationColumns(alias)) -} - -func buildHistoryPointlocationWhere[Q psql.Filterable](cols historyPointlocationColumns) historyPointlocationWhere[Q] { - return historyPointlocationWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), - Active: psql.WhereNull[Q, int16](cols.Active), - Comments: psql.WhereNull[Q, string](cols.Comments), - Created: psql.WhereNull[Q, time.Time](cols.Created), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Description: psql.WhereNull[Q, string](cols.Description), - 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), - Habitat: psql.WhereNull[Q, string](cols.Habitat), - Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), - Larvinspectinterval: psql.WhereNull[Q, int16](cols.Larvinspectinterval), - Lastinspectactiontaken: psql.WhereNull[Q, string](cols.Lastinspectactiontaken), - Lastinspectactivity: psql.WhereNull[Q, string](cols.Lastinspectactivity), - Lastinspectavglarvae: psql.WhereNull[Q, float64](cols.Lastinspectavglarvae), - Lastinspectavgpupae: psql.WhereNull[Q, float64](cols.Lastinspectavgpupae), - Lastinspectbreeding: psql.WhereNull[Q, string](cols.Lastinspectbreeding), - Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), - Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), - Lastinspectfieldspecies: psql.WhereNull[Q, string](cols.Lastinspectfieldspecies), - Lastinspectlstages: psql.WhereNull[Q, string](cols.Lastinspectlstages), - Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), - Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), - Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), - Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), - Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), - Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), - Name: psql.WhereNull[Q, string](cols.Name), - Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), - Objectid: psql.Where[Q, int32](cols.Objectid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Stype: psql.WhereNull[Q, string](cols.Stype), - Symbology: psql.WhereNull[Q, string](cols.Symbology), - Usetype: psql.WhereNull[Q, string](cols.Usetype), - Waterorigin: psql.WhereNull[Q, string](cols.Waterorigin), - X: psql.WhereNull[Q, float64](cols.X), - 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), - Assignedtech: psql.WhereNull[Q, string](cols.Assignedtech), - DeactivateReason: psql.WhereNull[Q, string](cols.DeactivateReason), - Scalarpriority: psql.WhereNull[Q, int64](cols.Scalarpriority), - Sourcestatus: psql.WhereNull[Q, string](cols.Sourcestatus), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryPointlocation) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyPointlocation cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryPointlocations = HistoryPointlocationSlice{o} - } - return nil - default: - return fmt.Errorf("historyPointlocation has no relationship %q", name) - } -} - -type historyPointlocationPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryPointlocationPreloader() historyPointlocationPreloader { - return historyPointlocationPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryPointlocations, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyPointlocationThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryPointlocationThenLoader[Q orm.Loadable]() historyPointlocationThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyPointlocationThenLoader[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 historyPointlocation's Organization into the .R struct -func (o *HistoryPointlocation) 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.HistoryPointlocations = HistoryPointlocationSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyPointlocation's Organization into the .R struct -func (os HistoryPointlocationSlice) 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.HistoryPointlocations = append(rel.R.HistoryPointlocations, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyPointlocationJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyPointlocationJoins[Q]) aliasedAs(alias string) historyPointlocationJoins[Q] { - return buildHistoryPointlocationJoins[Q](buildHistoryPointlocationColumns(alias), j.typ) -} - -func buildHistoryPointlocationJoins[Q dialect.Joinable](cols historyPointlocationColumns, typ string) historyPointlocationJoins[Q] { - return historyPointlocationJoins[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/db/models/history_polygonlocation.bob.go b/db/models/history_polygonlocation.bob.go deleted file mode 100644 index e9dcdc82..00000000 --- a/db/models/history_polygonlocation.bob.go +++ /dev/null @@ -1,1740 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryPolygonlocation is an object representing the database table. -type HistoryPolygonlocation struct { - OrganizationID int32 `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Acres null.Val[float64] `db:"acres" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Filter null.Val[string] `db:"filter" ` - Globalid null.Val[string] `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Hectares null.Val[float64] `db:"hectares" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Larvinspectinterval null.Val[int16] `db:"larvinspectinterval" ` - Lastinspectactiontaken null.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectactivity null.Val[string] `db:"lastinspectactivity" ` - Lastinspectavglarvae null.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae null.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectbreeding null.Val[string] `db:"lastinspectbreeding" ` - Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate null.Val[int64] `db:"lastinspectdate" ` - Lastinspectfieldspecies null.Val[string] `db:"lastinspectfieldspecies" ` - Lastinspectlstages null.Val[string] `db:"lastinspectlstages" ` - Lasttreatactivity null.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate null.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct null.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty null.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit null.Val[string] `db:"lasttreatqtyunit" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Name null.Val[string] `db:"name" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Symbology null.Val[string] `db:"symbology" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - Usetype null.Val[string] `db:"usetype" ` - Waterorigin null.Val[string] `db:"waterorigin" ` - 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" ` - Version int32 `db:"version,pk" ` - Created null.Val[time.Time] `db:"created" ` - - R historyPolygonlocationR `db:"-" ` -} - -// HistoryPolygonlocationSlice is an alias for a slice of pointers to HistoryPolygonlocation. -// This should almost always be used instead of []*HistoryPolygonlocation. -type HistoryPolygonlocationSlice []*HistoryPolygonlocation - -// HistoryPolygonlocations contains methods to work with the history_polygonlocation table -var HistoryPolygonlocations = psql.NewTablex[*HistoryPolygonlocation, HistoryPolygonlocationSlice, *HistoryPolygonlocationSetter]("", "history_polygonlocation", buildHistoryPolygonlocationColumns("history_polygonlocation")) - -// HistoryPolygonlocationsQuery is a query on the history_polygonlocation table -type HistoryPolygonlocationsQuery = *psql.ViewQuery[*HistoryPolygonlocation, HistoryPolygonlocationSlice] - -// historyPolygonlocationR is where relationships are stored. -type historyPolygonlocationR struct { - Organization *Organization // history_polygonlocation.history_polygonlocation_organization_id_fkey -} - -func buildHistoryPolygonlocationColumns(alias string) historyPolygonlocationColumns { - return historyPolygonlocationColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "acres", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "filter", "globalid", "habitat", "hectares", "jurisdiction", "larvinspectinterval", "lastinspectactiontaken", "lastinspectactivity", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectbreeding", "lastinspectconditions", "lastinspectdate", "lastinspectfieldspecies", "lastinspectlstages", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "symbology", "shape__area", "shape__length", "usetype", "waterorigin", "zone", "zone2", "geometry_x", "geometry_y", "version", "created", - ).WithParent("history_polygonlocation"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accessdesc: psql.Quote(alias, "accessdesc"), - Acres: psql.Quote(alias, "acres"), - Active: psql.Quote(alias, "active"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Description: psql.Quote(alias, "description"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Filter: psql.Quote(alias, "filter"), - Globalid: psql.Quote(alias, "globalid"), - Habitat: psql.Quote(alias, "habitat"), - Hectares: psql.Quote(alias, "hectares"), - Jurisdiction: psql.Quote(alias, "jurisdiction"), - Larvinspectinterval: psql.Quote(alias, "larvinspectinterval"), - Lastinspectactiontaken: psql.Quote(alias, "lastinspectactiontaken"), - Lastinspectactivity: psql.Quote(alias, "lastinspectactivity"), - Lastinspectavglarvae: psql.Quote(alias, "lastinspectavglarvae"), - Lastinspectavgpupae: psql.Quote(alias, "lastinspectavgpupae"), - Lastinspectbreeding: psql.Quote(alias, "lastinspectbreeding"), - Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), - Lastinspectdate: psql.Quote(alias, "lastinspectdate"), - Lastinspectfieldspecies: psql.Quote(alias, "lastinspectfieldspecies"), - Lastinspectlstages: psql.Quote(alias, "lastinspectlstages"), - Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), - Lasttreatdate: psql.Quote(alias, "lasttreatdate"), - Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), - Lasttreatqty: psql.Quote(alias, "lasttreatqty"), - Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), - Locationnumber: psql.Quote(alias, "locationnumber"), - Name: psql.Quote(alias, "name"), - Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), - Objectid: psql.Quote(alias, "objectid"), - Priority: psql.Quote(alias, "priority"), - Symbology: psql.Quote(alias, "symbology"), - ShapeArea: psql.Quote(alias, "shape__area"), - ShapeLength: psql.Quote(alias, "shape__length"), - Usetype: psql.Quote(alias, "usetype"), - Waterorigin: psql.Quote(alias, "waterorigin"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - Version: psql.Quote(alias, "version"), - Created: psql.Quote(alias, "created"), - } -} - -type historyPolygonlocationColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accessdesc psql.Expression - Acres psql.Expression - Active psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Description psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Filter psql.Expression - Globalid psql.Expression - Habitat psql.Expression - Hectares psql.Expression - Jurisdiction psql.Expression - Larvinspectinterval psql.Expression - Lastinspectactiontaken psql.Expression - Lastinspectactivity psql.Expression - Lastinspectavglarvae psql.Expression - Lastinspectavgpupae psql.Expression - Lastinspectbreeding psql.Expression - Lastinspectconditions psql.Expression - Lastinspectdate psql.Expression - Lastinspectfieldspecies psql.Expression - Lastinspectlstages psql.Expression - Lasttreatactivity psql.Expression - Lasttreatdate psql.Expression - Lasttreatproduct psql.Expression - Lasttreatqty psql.Expression - Lasttreatqtyunit psql.Expression - Locationnumber psql.Expression - Name psql.Expression - Nextactiondatescheduled psql.Expression - Objectid psql.Expression - Priority psql.Expression - Symbology psql.Expression - ShapeArea psql.Expression - ShapeLength psql.Expression - Usetype psql.Expression - Waterorigin psql.Expression - Zone psql.Expression - Zone2 psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - Version psql.Expression - Created psql.Expression -} - -func (c historyPolygonlocationColumns) Alias() string { - return c.tableAlias -} - -func (historyPolygonlocationColumns) AliasedAs(alias string) historyPolygonlocationColumns { - return buildHistoryPolygonlocationColumns(alias) -} - -// HistoryPolygonlocationSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryPolygonlocationSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Acres omitnull.Val[float64] `db:"acres" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Filter omitnull.Val[string] `db:"filter" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Hectares omitnull.Val[float64] `db:"hectares" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Larvinspectinterval omitnull.Val[int16] `db:"larvinspectinterval" ` - Lastinspectactiontaken omitnull.Val[string] `db:"lastinspectactiontaken" ` - Lastinspectactivity omitnull.Val[string] `db:"lastinspectactivity" ` - Lastinspectavglarvae omitnull.Val[float64] `db:"lastinspectavglarvae" ` - Lastinspectavgpupae omitnull.Val[float64] `db:"lastinspectavgpupae" ` - Lastinspectbreeding omitnull.Val[string] `db:"lastinspectbreeding" ` - Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate omitnull.Val[int64] `db:"lastinspectdate" ` - Lastinspectfieldspecies omitnull.Val[string] `db:"lastinspectfieldspecies" ` - Lastinspectlstages omitnull.Val[string] `db:"lastinspectlstages" ` - Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate omitnull.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Name omitnull.Val[string] `db:"name" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Symbology omitnull.Val[string] `db:"symbology" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Usetype omitnull.Val[string] `db:"usetype" ` - Waterorigin omitnull.Val[string] `db:"waterorigin" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` - Created omitnull.Val[time.Time] `db:"created" ` -} - -func (s HistoryPolygonlocationSetter) SetColumns() []string { - vals := make([]string, 0, 47) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accessdesc.IsUnset() { - vals = append(vals, "accessdesc") - } - if !s.Acres.IsUnset() { - vals = append(vals, "acres") - } - if !s.Active.IsUnset() { - vals = append(vals, "active") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Description.IsUnset() { - vals = append(vals, "description") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Filter.IsUnset() { - vals = append(vals, "filter") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Habitat.IsUnset() { - vals = append(vals, "habitat") - } - if !s.Hectares.IsUnset() { - vals = append(vals, "hectares") - } - if !s.Jurisdiction.IsUnset() { - vals = append(vals, "jurisdiction") - } - if !s.Larvinspectinterval.IsUnset() { - vals = append(vals, "larvinspectinterval") - } - if !s.Lastinspectactiontaken.IsUnset() { - vals = append(vals, "lastinspectactiontaken") - } - if !s.Lastinspectactivity.IsUnset() { - vals = append(vals, "lastinspectactivity") - } - if !s.Lastinspectavglarvae.IsUnset() { - vals = append(vals, "lastinspectavglarvae") - } - if !s.Lastinspectavgpupae.IsUnset() { - vals = append(vals, "lastinspectavgpupae") - } - if !s.Lastinspectbreeding.IsUnset() { - vals = append(vals, "lastinspectbreeding") - } - if !s.Lastinspectconditions.IsUnset() { - vals = append(vals, "lastinspectconditions") - } - if !s.Lastinspectdate.IsUnset() { - vals = append(vals, "lastinspectdate") - } - if !s.Lastinspectfieldspecies.IsUnset() { - vals = append(vals, "lastinspectfieldspecies") - } - if !s.Lastinspectlstages.IsUnset() { - vals = append(vals, "lastinspectlstages") - } - if !s.Lasttreatactivity.IsUnset() { - vals = append(vals, "lasttreatactivity") - } - if !s.Lasttreatdate.IsUnset() { - vals = append(vals, "lasttreatdate") - } - if !s.Lasttreatproduct.IsUnset() { - vals = append(vals, "lasttreatproduct") - } - if !s.Lasttreatqty.IsUnset() { - vals = append(vals, "lasttreatqty") - } - if !s.Lasttreatqtyunit.IsUnset() { - vals = append(vals, "lasttreatqtyunit") - } - if !s.Locationnumber.IsUnset() { - vals = append(vals, "locationnumber") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if !s.Nextactiondatescheduled.IsUnset() { - vals = append(vals, "nextactiondatescheduled") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Symbology.IsUnset() { - vals = append(vals, "symbology") - } - if !s.ShapeArea.IsUnset() { - vals = append(vals, "shape__area") - } - if !s.ShapeLength.IsUnset() { - vals = append(vals, "shape__length") - } - if !s.Usetype.IsUnset() { - vals = append(vals, "usetype") - } - if !s.Waterorigin.IsUnset() { - vals = append(vals, "waterorigin") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - return vals -} - -func (s HistoryPolygonlocationSetter) Overwrite(t *HistoryPolygonlocation) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accessdesc.IsUnset() { - t.Accessdesc = s.Accessdesc.MustGetNull() - } - if !s.Acres.IsUnset() { - t.Acres = s.Acres.MustGetNull() - } - if !s.Active.IsUnset() { - t.Active = s.Active.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Description.IsUnset() { - t.Description = s.Description.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Filter.IsUnset() { - t.Filter = s.Filter.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Habitat.IsUnset() { - t.Habitat = s.Habitat.MustGetNull() - } - if !s.Hectares.IsUnset() { - t.Hectares = s.Hectares.MustGetNull() - } - if !s.Jurisdiction.IsUnset() { - t.Jurisdiction = s.Jurisdiction.MustGetNull() - } - if !s.Larvinspectinterval.IsUnset() { - t.Larvinspectinterval = s.Larvinspectinterval.MustGetNull() - } - if !s.Lastinspectactiontaken.IsUnset() { - t.Lastinspectactiontaken = s.Lastinspectactiontaken.MustGetNull() - } - if !s.Lastinspectactivity.IsUnset() { - t.Lastinspectactivity = s.Lastinspectactivity.MustGetNull() - } - if !s.Lastinspectavglarvae.IsUnset() { - t.Lastinspectavglarvae = s.Lastinspectavglarvae.MustGetNull() - } - if !s.Lastinspectavgpupae.IsUnset() { - t.Lastinspectavgpupae = s.Lastinspectavgpupae.MustGetNull() - } - if !s.Lastinspectbreeding.IsUnset() { - t.Lastinspectbreeding = s.Lastinspectbreeding.MustGetNull() - } - if !s.Lastinspectconditions.IsUnset() { - t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() - } - if !s.Lastinspectdate.IsUnset() { - t.Lastinspectdate = s.Lastinspectdate.MustGetNull() - } - if !s.Lastinspectfieldspecies.IsUnset() { - t.Lastinspectfieldspecies = s.Lastinspectfieldspecies.MustGetNull() - } - if !s.Lastinspectlstages.IsUnset() { - t.Lastinspectlstages = s.Lastinspectlstages.MustGetNull() - } - if !s.Lasttreatactivity.IsUnset() { - t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() - } - if !s.Lasttreatdate.IsUnset() { - t.Lasttreatdate = s.Lasttreatdate.MustGetNull() - } - if !s.Lasttreatproduct.IsUnset() { - t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() - } - if !s.Lasttreatqty.IsUnset() { - t.Lasttreatqty = s.Lasttreatqty.MustGetNull() - } - if !s.Lasttreatqtyunit.IsUnset() { - t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() - } - if !s.Locationnumber.IsUnset() { - t.Locationnumber = s.Locationnumber.MustGetNull() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if !s.Nextactiondatescheduled.IsUnset() { - t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Symbology.IsUnset() { - t.Symbology = s.Symbology.MustGetNull() - } - if !s.ShapeArea.IsUnset() { - t.ShapeArea = s.ShapeArea.MustGetNull() - } - if !s.ShapeLength.IsUnset() { - t.ShapeLength = s.ShapeLength.MustGetNull() - } - if !s.Usetype.IsUnset() { - t.Usetype = s.Usetype.MustGetNull() - } - if !s.Waterorigin.IsUnset() { - t.Waterorigin = s.Waterorigin.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } -} - -func (s *HistoryPolygonlocationSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryPolygonlocations.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 47) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accessdesc.IsUnset() { - vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Acres.IsUnset() { - vals[2] = psql.Arg(s.Acres.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Active.IsUnset() { - vals[3] = psql.Arg(s.Active.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[4] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[5] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[6] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Description.IsUnset() { - vals[7] = psql.Arg(s.Description.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[8] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[9] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[10] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Filter.IsUnset() { - vals[11] = psql.Arg(s.Filter.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[12] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Habitat.IsUnset() { - vals[13] = psql.Arg(s.Habitat.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Hectares.IsUnset() { - vals[14] = psql.Arg(s.Hectares.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Jurisdiction.IsUnset() { - vals[15] = psql.Arg(s.Jurisdiction.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Larvinspectinterval.IsUnset() { - vals[16] = psql.Arg(s.Larvinspectinterval.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectactiontaken.IsUnset() { - vals[17] = psql.Arg(s.Lastinspectactiontaken.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectactivity.IsUnset() { - vals[18] = psql.Arg(s.Lastinspectactivity.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectavglarvae.IsUnset() { - vals[19] = psql.Arg(s.Lastinspectavglarvae.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectavgpupae.IsUnset() { - vals[20] = psql.Arg(s.Lastinspectavgpupae.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectbreeding.IsUnset() { - vals[21] = psql.Arg(s.Lastinspectbreeding.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectconditions.IsUnset() { - vals[22] = psql.Arg(s.Lastinspectconditions.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectdate.IsUnset() { - vals[23] = psql.Arg(s.Lastinspectdate.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectfieldspecies.IsUnset() { - vals[24] = psql.Arg(s.Lastinspectfieldspecies.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectlstages.IsUnset() { - vals[25] = psql.Arg(s.Lastinspectlstages.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatactivity.IsUnset() { - vals[26] = psql.Arg(s.Lasttreatactivity.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatdate.IsUnset() { - vals[27] = psql.Arg(s.Lasttreatdate.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatproduct.IsUnset() { - vals[28] = psql.Arg(s.Lasttreatproduct.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqty.IsUnset() { - vals[29] = psql.Arg(s.Lasttreatqty.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqtyunit.IsUnset() { - vals[30] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Locationnumber.IsUnset() { - vals[31] = psql.Arg(s.Locationnumber.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[32] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Nextactiondatescheduled.IsUnset() { - vals[33] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[34] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[35] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Symbology.IsUnset() { - vals[36] = psql.Arg(s.Symbology.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.ShapeArea.IsUnset() { - vals[37] = psql.Arg(s.ShapeArea.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.ShapeLength.IsUnset() { - vals[38] = psql.Arg(s.ShapeLength.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Usetype.IsUnset() { - vals[39] = psql.Arg(s.Usetype.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Waterorigin.IsUnset() { - vals[40] = psql.Arg(s.Waterorigin.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[41] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[42] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[43] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[44] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[45] = psql.Arg(s.Version.MustGet()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[46] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryPolygonlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryPolygonlocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 47) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accessdesc.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accessdesc")...), - psql.Arg(s.Accessdesc), - }}) - } - - if !s.Acres.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "acres")...), - psql.Arg(s.Acres), - }}) - } - - if !s.Active.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "active")...), - psql.Arg(s.Active), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Description.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "description")...), - psql.Arg(s.Description), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Filter.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "filter")...), - psql.Arg(s.Filter), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitat")...), - psql.Arg(s.Habitat), - }}) - } - - if !s.Hectares.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "hectares")...), - psql.Arg(s.Hectares), - }}) - } - - if !s.Jurisdiction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "jurisdiction")...), - psql.Arg(s.Jurisdiction), - }}) - } - - if !s.Larvinspectinterval.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvinspectinterval")...), - psql.Arg(s.Larvinspectinterval), - }}) - } - - if !s.Lastinspectactiontaken.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectactiontaken")...), - psql.Arg(s.Lastinspectactiontaken), - }}) - } - - if !s.Lastinspectactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectactivity")...), - psql.Arg(s.Lastinspectactivity), - }}) - } - - if !s.Lastinspectavglarvae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectavglarvae")...), - psql.Arg(s.Lastinspectavglarvae), - }}) - } - - if !s.Lastinspectavgpupae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectavgpupae")...), - psql.Arg(s.Lastinspectavgpupae), - }}) - } - - if !s.Lastinspectbreeding.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectbreeding")...), - psql.Arg(s.Lastinspectbreeding), - }}) - } - - if !s.Lastinspectconditions.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectconditions")...), - psql.Arg(s.Lastinspectconditions), - }}) - } - - if !s.Lastinspectdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectdate")...), - psql.Arg(s.Lastinspectdate), - }}) - } - - if !s.Lastinspectfieldspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectfieldspecies")...), - psql.Arg(s.Lastinspectfieldspecies), - }}) - } - - if !s.Lastinspectlstages.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectlstages")...), - psql.Arg(s.Lastinspectlstages), - }}) - } - - if !s.Lasttreatactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatactivity")...), - psql.Arg(s.Lasttreatactivity), - }}) - } - - if !s.Lasttreatdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatdate")...), - psql.Arg(s.Lasttreatdate), - }}) - } - - if !s.Lasttreatproduct.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatproduct")...), - psql.Arg(s.Lasttreatproduct), - }}) - } - - if !s.Lasttreatqty.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqty")...), - psql.Arg(s.Lasttreatqty), - }}) - } - - if !s.Lasttreatqtyunit.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqtyunit")...), - psql.Arg(s.Lasttreatqtyunit), - }}) - } - - if !s.Locationnumber.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationnumber")...), - psql.Arg(s.Locationnumber), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if !s.Nextactiondatescheduled.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nextactiondatescheduled")...), - psql.Arg(s.Nextactiondatescheduled), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Symbology.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "symbology")...), - psql.Arg(s.Symbology), - }}) - } - - if !s.ShapeArea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__area")...), - psql.Arg(s.ShapeArea), - }}) - } - - if !s.ShapeLength.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__length")...), - psql.Arg(s.ShapeLength), - }}) - } - - if !s.Usetype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "usetype")...), - psql.Arg(s.Usetype), - }}) - } - - if !s.Waterorigin.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "waterorigin")...), - psql.Arg(s.Waterorigin), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - return exprs -} - -// FindHistoryPolygonlocation retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryPolygonlocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryPolygonlocation, error) { - if len(cols) == 0 { - return HistoryPolygonlocations.Query( - sm.Where(HistoryPolygonlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryPolygonlocations.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryPolygonlocations.Query( - sm.Where(HistoryPolygonlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryPolygonlocations.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryPolygonlocations.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryPolygonlocationExists checks the presence of a single record by primary key -func HistoryPolygonlocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryPolygonlocations.Query( - sm.Where(HistoryPolygonlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryPolygonlocations.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryPolygonlocation is retrieved from the database -func (o *HistoryPolygonlocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryPolygonlocations.AfterSelectHooks.RunHooks(ctx, exec, HistoryPolygonlocationSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryPolygonlocations.AfterInsertHooks.RunHooks(ctx, exec, HistoryPolygonlocationSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryPolygonlocations.AfterUpdateHooks.RunHooks(ctx, exec, HistoryPolygonlocationSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryPolygonlocations.AfterDeleteHooks.RunHooks(ctx, exec, HistoryPolygonlocationSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryPolygonlocation -func (o *HistoryPolygonlocation) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryPolygonlocation) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_polygonlocation", "objectid"), psql.Quote("history_polygonlocation", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryPolygonlocation -func (o *HistoryPolygonlocation) Update(ctx context.Context, exec bob.Executor, s *HistoryPolygonlocationSetter) error { - v, err := HistoryPolygonlocations.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 HistoryPolygonlocation record with an executor -func (o *HistoryPolygonlocation) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryPolygonlocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryPolygonlocation using the executor -func (o *HistoryPolygonlocation) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryPolygonlocations.Query( - sm.Where(HistoryPolygonlocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryPolygonlocations.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryPolygonlocationSlice is retrieved from the database -func (o HistoryPolygonlocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryPolygonlocations.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryPolygonlocations.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryPolygonlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryPolygonlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryPolygonlocationSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_polygonlocation", "objectid"), psql.Quote("history_polygonlocation", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryPolygonlocationSlice) copyMatchingRows(from ...*HistoryPolygonlocation) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryPolygonlocationSlice) 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 HistoryPolygonlocations.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 *HistoryPolygonlocation: - o.copyMatchingRows(retrieved) - case []*HistoryPolygonlocation: - o.copyMatchingRows(retrieved...) - case HistoryPolygonlocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryPolygonlocation or a slice of HistoryPolygonlocation - // then run the AfterUpdateHooks on the slice - _, err = HistoryPolygonlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryPolygonlocationSlice) 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 HistoryPolygonlocations.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 *HistoryPolygonlocation: - o.copyMatchingRows(retrieved) - case []*HistoryPolygonlocation: - o.copyMatchingRows(retrieved...) - case HistoryPolygonlocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryPolygonlocation or a slice of HistoryPolygonlocation - // then run the AfterDeleteHooks on the slice - _, err = HistoryPolygonlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryPolygonlocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryPolygonlocationSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryPolygonlocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryPolygonlocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryPolygonlocations.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryPolygonlocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryPolygonlocations.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 *HistoryPolygonlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryPolygonlocationSlice) 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 attachHistoryPolygonlocationOrganization0(ctx context.Context, exec bob.Executor, count int, historyPolygonlocation0 *HistoryPolygonlocation, organization1 *Organization) (*HistoryPolygonlocation, error) { - setter := &HistoryPolygonlocationSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyPolygonlocation0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryPolygonlocationOrganization0: %w", err) - } - - return historyPolygonlocation0, nil -} - -func (historyPolygonlocation0 *HistoryPolygonlocation) 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 = attachHistoryPolygonlocationOrganization0(ctx, exec, 1, historyPolygonlocation0, organization1) - if err != nil { - return err - } - - historyPolygonlocation0.R.Organization = organization1 - - organization1.R.HistoryPolygonlocations = append(organization1.R.HistoryPolygonlocations, historyPolygonlocation0) - - return nil -} - -func (historyPolygonlocation0 *HistoryPolygonlocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryPolygonlocationOrganization0(ctx, exec, 1, historyPolygonlocation0, organization1) - if err != nil { - return err - } - - historyPolygonlocation0.R.Organization = organization1 - - organization1.R.HistoryPolygonlocations = append(organization1.R.HistoryPolygonlocations, historyPolygonlocation0) - - return nil -} - -type historyPolygonlocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accessdesc psql.WhereNullMod[Q, string] - Acres psql.WhereNullMod[Q, float64] - Active psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Description psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Filter psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Habitat psql.WhereNullMod[Q, string] - Hectares psql.WhereNullMod[Q, float64] - Jurisdiction psql.WhereNullMod[Q, string] - Larvinspectinterval psql.WhereNullMod[Q, int16] - Lastinspectactiontaken psql.WhereNullMod[Q, string] - Lastinspectactivity psql.WhereNullMod[Q, string] - Lastinspectavglarvae psql.WhereNullMod[Q, float64] - Lastinspectavgpupae psql.WhereNullMod[Q, float64] - Lastinspectbreeding psql.WhereNullMod[Q, string] - Lastinspectconditions psql.WhereNullMod[Q, string] - Lastinspectdate psql.WhereNullMod[Q, int64] - Lastinspectfieldspecies psql.WhereNullMod[Q, string] - Lastinspectlstages psql.WhereNullMod[Q, string] - Lasttreatactivity psql.WhereNullMod[Q, string] - Lasttreatdate psql.WhereNullMod[Q, int64] - Lasttreatproduct psql.WhereNullMod[Q, string] - Lasttreatqty psql.WhereNullMod[Q, float64] - Lasttreatqtyunit psql.WhereNullMod[Q, string] - Locationnumber psql.WhereNullMod[Q, int64] - Name psql.WhereNullMod[Q, string] - Nextactiondatescheduled psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Priority psql.WhereNullMod[Q, string] - Symbology psql.WhereNullMod[Q, string] - ShapeArea psql.WhereNullMod[Q, float64] - ShapeLength psql.WhereNullMod[Q, float64] - Usetype psql.WhereNullMod[Q, string] - Waterorigin psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - Version psql.WhereMod[Q, int32] - Created psql.WhereNullMod[Q, time.Time] -} - -func (historyPolygonlocationWhere[Q]) AliasedAs(alias string) historyPolygonlocationWhere[Q] { - return buildHistoryPolygonlocationWhere[Q](buildHistoryPolygonlocationColumns(alias)) -} - -func buildHistoryPolygonlocationWhere[Q psql.Filterable](cols historyPolygonlocationColumns) historyPolygonlocationWhere[Q] { - return historyPolygonlocationWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), - Acres: psql.WhereNull[Q, float64](cols.Acres), - Active: psql.WhereNull[Q, int16](cols.Active), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Description: psql.WhereNull[Q, string](cols.Description), - Externalid: psql.WhereNull[Q, string](cols.Externalid), - 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), - Habitat: psql.WhereNull[Q, string](cols.Habitat), - Hectares: psql.WhereNull[Q, float64](cols.Hectares), - Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), - Larvinspectinterval: psql.WhereNull[Q, int16](cols.Larvinspectinterval), - Lastinspectactiontaken: psql.WhereNull[Q, string](cols.Lastinspectactiontaken), - Lastinspectactivity: psql.WhereNull[Q, string](cols.Lastinspectactivity), - Lastinspectavglarvae: psql.WhereNull[Q, float64](cols.Lastinspectavglarvae), - Lastinspectavgpupae: psql.WhereNull[Q, float64](cols.Lastinspectavgpupae), - Lastinspectbreeding: psql.WhereNull[Q, string](cols.Lastinspectbreeding), - Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), - Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), - Lastinspectfieldspecies: psql.WhereNull[Q, string](cols.Lastinspectfieldspecies), - Lastinspectlstages: psql.WhereNull[Q, string](cols.Lastinspectlstages), - Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), - Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), - Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), - Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), - Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), - Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), - Name: psql.WhereNull[Q, string](cols.Name), - Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), - Objectid: psql.Where[Q, int32](cols.Objectid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Symbology: psql.WhereNull[Q, string](cols.Symbology), - ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), - ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), - Usetype: psql.WhereNull[Q, string](cols.Usetype), - Waterorigin: psql.WhereNull[Q, string](cols.Waterorigin), - 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), - Version: psql.Where[Q, int32](cols.Version), - Created: psql.WhereNull[Q, time.Time](cols.Created), - } -} - -func (o *HistoryPolygonlocation) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyPolygonlocation cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryPolygonlocations = HistoryPolygonlocationSlice{o} - } - return nil - default: - return fmt.Errorf("historyPolygonlocation has no relationship %q", name) - } -} - -type historyPolygonlocationPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryPolygonlocationPreloader() historyPolygonlocationPreloader { - return historyPolygonlocationPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryPolygonlocations, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyPolygonlocationThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryPolygonlocationThenLoader[Q orm.Loadable]() historyPolygonlocationThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyPolygonlocationThenLoader[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 historyPolygonlocation's Organization into the .R struct -func (o *HistoryPolygonlocation) 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.HistoryPolygonlocations = HistoryPolygonlocationSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyPolygonlocation's Organization into the .R struct -func (os HistoryPolygonlocationSlice) 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.HistoryPolygonlocations = append(rel.R.HistoryPolygonlocations, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyPolygonlocationJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyPolygonlocationJoins[Q]) aliasedAs(alias string) historyPolygonlocationJoins[Q] { - return buildHistoryPolygonlocationJoins[Q](buildHistoryPolygonlocationColumns(alias), j.typ) -} - -func buildHistoryPolygonlocationJoins[Q dialect.Joinable](cols historyPolygonlocationColumns, typ string) historyPolygonlocationJoins[Q] { - return historyPolygonlocationJoins[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/db/models/history_pool.bob.go b/db/models/history_pool.bob.go deleted file mode 100644 index 1505f086..00000000 --- a/db/models/history_pool.bob.go +++ /dev/null @@ -1,1390 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryPool is an object representing the database table. -type HistoryPool struct { - OrganizationID int32 `db:"organization_id" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Datesent null.Val[int64] `db:"datesent" ` - Datetested null.Val[int64] `db:"datetested" ` - Diseasepos null.Val[string] `db:"diseasepos" ` - Diseasetested null.Val[string] `db:"diseasetested" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid null.Val[string] `db:"globalid" ` - Lab null.Val[string] `db:"lab" ` - LabID null.Val[string] `db:"lab_id" ` - Objectid int32 `db:"objectid,pk" ` - Poolyear null.Val[int16] `db:"poolyear" ` - Processed null.Val[int16] `db:"processed" ` - Sampleid null.Val[string] `db:"sampleid" ` - Survtech null.Val[string] `db:"survtech" ` - Testmethod null.Val[string] `db:"testmethod" ` - Testtech null.Val[string] `db:"testtech" ` - TrapdataID null.Val[string] `db:"trapdata_id" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Vectorsurvcollectionid null.Val[string] `db:"vectorsurvcollectionid" ` - Vectorsurvpoolid null.Val[string] `db:"vectorsurvpoolid" ` - Vectorsurvtrapdataid null.Val[string] `db:"vectorsurvtrapdataid" ` - Version int32 `db:"version,pk" ` - - R historyPoolR `db:"-" ` -} - -// HistoryPoolSlice is an alias for a slice of pointers to HistoryPool. -// This should almost always be used instead of []*HistoryPool. -type HistoryPoolSlice []*HistoryPool - -// HistoryPools contains methods to work with the history_pool table -var HistoryPools = psql.NewTablex[*HistoryPool, HistoryPoolSlice, *HistoryPoolSetter]("", "history_pool", buildHistoryPoolColumns("history_pool")) - -// HistoryPoolsQuery is a query on the history_pool table -type HistoryPoolsQuery = *psql.ViewQuery[*HistoryPool, HistoryPoolSlice] - -// historyPoolR is where relationships are stored. -type historyPoolR struct { - Organization *Organization // history_pool.history_pool_organization_id_fkey -} - -func buildHistoryPoolColumns(alias string) historyPoolColumns { - return historyPoolColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "comments", "creationdate", "creator", "datesent", "datetested", "diseasepos", "diseasetested", "editdate", "editor", "gatewaysync", "globalid", "lab", "lab_id", "objectid", "poolyear", "processed", "sampleid", "survtech", "testmethod", "testtech", "trapdata_id", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "vectorsurvcollectionid", "vectorsurvpoolid", "vectorsurvtrapdataid", "version", - ).WithParent("history_pool"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Datesent: psql.Quote(alias, "datesent"), - Datetested: psql.Quote(alias, "datetested"), - Diseasepos: psql.Quote(alias, "diseasepos"), - Diseasetested: psql.Quote(alias, "diseasetested"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Gatewaysync: psql.Quote(alias, "gatewaysync"), - Globalid: psql.Quote(alias, "globalid"), - Lab: psql.Quote(alias, "lab"), - LabID: psql.Quote(alias, "lab_id"), - Objectid: psql.Quote(alias, "objectid"), - Poolyear: psql.Quote(alias, "poolyear"), - Processed: psql.Quote(alias, "processed"), - Sampleid: psql.Quote(alias, "sampleid"), - Survtech: psql.Quote(alias, "survtech"), - Testmethod: psql.Quote(alias, "testmethod"), - Testtech: psql.Quote(alias, "testtech"), - TrapdataID: psql.Quote(alias, "trapdata_id"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Vectorsurvcollectionid: psql.Quote(alias, "vectorsurvcollectionid"), - Vectorsurvpoolid: psql.Quote(alias, "vectorsurvpoolid"), - Vectorsurvtrapdataid: psql.Quote(alias, "vectorsurvtrapdataid"), - Version: psql.Quote(alias, "version"), - } -} - -type historyPoolColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Datesent psql.Expression - Datetested psql.Expression - Diseasepos psql.Expression - Diseasetested psql.Expression - Editdate psql.Expression - Editor psql.Expression - Gatewaysync psql.Expression - Globalid psql.Expression - Lab psql.Expression - LabID psql.Expression - Objectid psql.Expression - Poolyear psql.Expression - Processed psql.Expression - Sampleid psql.Expression - Survtech psql.Expression - Testmethod psql.Expression - Testtech psql.Expression - TrapdataID psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Vectorsurvcollectionid psql.Expression - Vectorsurvpoolid psql.Expression - Vectorsurvtrapdataid psql.Expression - Version psql.Expression -} - -func (c historyPoolColumns) Alias() string { - return c.tableAlias -} - -func (historyPoolColumns) AliasedAs(alias string) historyPoolColumns { - return buildHistoryPoolColumns(alias) -} - -// HistoryPoolSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryPoolSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Datesent omitnull.Val[int64] `db:"datesent" ` - Datetested omitnull.Val[int64] `db:"datetested" ` - Diseasepos omitnull.Val[string] `db:"diseasepos" ` - Diseasetested omitnull.Val[string] `db:"diseasetested" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Lab omitnull.Val[string] `db:"lab" ` - LabID omitnull.Val[string] `db:"lab_id" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Poolyear omitnull.Val[int16] `db:"poolyear" ` - Processed omitnull.Val[int16] `db:"processed" ` - Sampleid omitnull.Val[string] `db:"sampleid" ` - Survtech omitnull.Val[string] `db:"survtech" ` - Testmethod omitnull.Val[string] `db:"testmethod" ` - Testtech omitnull.Val[string] `db:"testtech" ` - TrapdataID omitnull.Val[string] `db:"trapdata_id" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Vectorsurvcollectionid omitnull.Val[string] `db:"vectorsurvcollectionid" ` - Vectorsurvpoolid omitnull.Val[string] `db:"vectorsurvpoolid" ` - Vectorsurvtrapdataid omitnull.Val[string] `db:"vectorsurvtrapdataid" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryPoolSetter) SetColumns() []string { - vals := make([]string, 0, 33) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Datesent.IsUnset() { - vals = append(vals, "datesent") - } - if !s.Datetested.IsUnset() { - vals = append(vals, "datetested") - } - if !s.Diseasepos.IsUnset() { - vals = append(vals, "diseasepos") - } - if !s.Diseasetested.IsUnset() { - vals = append(vals, "diseasetested") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Gatewaysync.IsUnset() { - vals = append(vals, "gatewaysync") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Lab.IsUnset() { - vals = append(vals, "lab") - } - if !s.LabID.IsUnset() { - vals = append(vals, "lab_id") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Poolyear.IsUnset() { - vals = append(vals, "poolyear") - } - if !s.Processed.IsUnset() { - vals = append(vals, "processed") - } - if !s.Sampleid.IsUnset() { - vals = append(vals, "sampleid") - } - if !s.Survtech.IsUnset() { - vals = append(vals, "survtech") - } - if !s.Testmethod.IsUnset() { - vals = append(vals, "testmethod") - } - if !s.Testtech.IsUnset() { - vals = append(vals, "testtech") - } - if !s.TrapdataID.IsUnset() { - vals = append(vals, "trapdata_id") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Vectorsurvcollectionid.IsUnset() { - vals = append(vals, "vectorsurvcollectionid") - } - if !s.Vectorsurvpoolid.IsUnset() { - vals = append(vals, "vectorsurvpoolid") - } - if !s.Vectorsurvtrapdataid.IsUnset() { - vals = append(vals, "vectorsurvtrapdataid") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryPoolSetter) Overwrite(t *HistoryPool) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Datesent.IsUnset() { - t.Datesent = s.Datesent.MustGetNull() - } - if !s.Datetested.IsUnset() { - t.Datetested = s.Datetested.MustGetNull() - } - if !s.Diseasepos.IsUnset() { - t.Diseasepos = s.Diseasepos.MustGetNull() - } - if !s.Diseasetested.IsUnset() { - t.Diseasetested = s.Diseasetested.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Gatewaysync.IsUnset() { - t.Gatewaysync = s.Gatewaysync.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Lab.IsUnset() { - t.Lab = s.Lab.MustGetNull() - } - if !s.LabID.IsUnset() { - t.LabID = s.LabID.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Poolyear.IsUnset() { - t.Poolyear = s.Poolyear.MustGetNull() - } - if !s.Processed.IsUnset() { - t.Processed = s.Processed.MustGetNull() - } - if !s.Sampleid.IsUnset() { - t.Sampleid = s.Sampleid.MustGetNull() - } - if !s.Survtech.IsUnset() { - t.Survtech = s.Survtech.MustGetNull() - } - if !s.Testmethod.IsUnset() { - t.Testmethod = s.Testmethod.MustGetNull() - } - if !s.Testtech.IsUnset() { - t.Testtech = s.Testtech.MustGetNull() - } - if !s.TrapdataID.IsUnset() { - t.TrapdataID = s.TrapdataID.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Vectorsurvcollectionid.IsUnset() { - t.Vectorsurvcollectionid = s.Vectorsurvcollectionid.MustGetNull() - } - if !s.Vectorsurvpoolid.IsUnset() { - t.Vectorsurvpoolid = s.Vectorsurvpoolid.MustGetNull() - } - if !s.Vectorsurvtrapdataid.IsUnset() { - t.Vectorsurvtrapdataid = s.Vectorsurvtrapdataid.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryPoolSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryPools.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 33) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[1] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[2] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[3] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Datesent.IsUnset() { - vals[4] = psql.Arg(s.Datesent.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Datetested.IsUnset() { - vals[5] = psql.Arg(s.Datetested.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Diseasepos.IsUnset() { - vals[6] = psql.Arg(s.Diseasepos.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Diseasetested.IsUnset() { - vals[7] = psql.Arg(s.Diseasetested.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[8] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[9] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Gatewaysync.IsUnset() { - vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[11] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Lab.IsUnset() { - vals[12] = psql.Arg(s.Lab.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.LabID.IsUnset() { - vals[13] = psql.Arg(s.LabID.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[14] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Poolyear.IsUnset() { - vals[15] = psql.Arg(s.Poolyear.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Processed.IsUnset() { - vals[16] = psql.Arg(s.Processed.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Sampleid.IsUnset() { - vals[17] = psql.Arg(s.Sampleid.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Survtech.IsUnset() { - vals[18] = psql.Arg(s.Survtech.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Testmethod.IsUnset() { - vals[19] = psql.Arg(s.Testmethod.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Testtech.IsUnset() { - vals[20] = psql.Arg(s.Testtech.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.TrapdataID.IsUnset() { - vals[21] = psql.Arg(s.TrapdataID.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[22] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[23] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[24] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[25] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[26] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[27] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[28] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Vectorsurvcollectionid.IsUnset() { - vals[29] = psql.Arg(s.Vectorsurvcollectionid.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Vectorsurvpoolid.IsUnset() { - vals[30] = psql.Arg(s.Vectorsurvpoolid.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Vectorsurvtrapdataid.IsUnset() { - vals[31] = psql.Arg(s.Vectorsurvtrapdataid.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[32] = psql.Arg(s.Version.MustGet()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryPoolSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryPoolSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 33) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Datesent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "datesent")...), - psql.Arg(s.Datesent), - }}) - } - - if !s.Datetested.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "datetested")...), - psql.Arg(s.Datetested), - }}) - } - - if !s.Diseasepos.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "diseasepos")...), - psql.Arg(s.Diseasepos), - }}) - } - - if !s.Diseasetested.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "diseasetested")...), - psql.Arg(s.Diseasetested), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Gatewaysync.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "gatewaysync")...), - psql.Arg(s.Gatewaysync), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Lab.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lab")...), - psql.Arg(s.Lab), - }}) - } - - if !s.LabID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lab_id")...), - psql.Arg(s.LabID), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Poolyear.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "poolyear")...), - psql.Arg(s.Poolyear), - }}) - } - - if !s.Processed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "processed")...), - psql.Arg(s.Processed), - }}) - } - - if !s.Sampleid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sampleid")...), - psql.Arg(s.Sampleid), - }}) - } - - if !s.Survtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "survtech")...), - psql.Arg(s.Survtech), - }}) - } - - if !s.Testmethod.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "testmethod")...), - psql.Arg(s.Testmethod), - }}) - } - - if !s.Testtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "testtech")...), - psql.Arg(s.Testtech), - }}) - } - - if !s.TrapdataID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "trapdata_id")...), - psql.Arg(s.TrapdataID), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Vectorsurvcollectionid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vectorsurvcollectionid")...), - psql.Arg(s.Vectorsurvcollectionid), - }}) - } - - if !s.Vectorsurvpoolid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vectorsurvpoolid")...), - psql.Arg(s.Vectorsurvpoolid), - }}) - } - - if !s.Vectorsurvtrapdataid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vectorsurvtrapdataid")...), - psql.Arg(s.Vectorsurvtrapdataid), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryPool retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryPool(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryPool, error) { - if len(cols) == 0 { - return HistoryPools.Query( - sm.Where(HistoryPools.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryPools.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryPools.Query( - sm.Where(HistoryPools.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryPools.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryPools.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryPoolExists checks the presence of a single record by primary key -func HistoryPoolExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryPools.Query( - sm.Where(HistoryPools.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryPools.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryPool is retrieved from the database -func (o *HistoryPool) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryPools.AfterSelectHooks.RunHooks(ctx, exec, HistoryPoolSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryPools.AfterInsertHooks.RunHooks(ctx, exec, HistoryPoolSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryPools.AfterUpdateHooks.RunHooks(ctx, exec, HistoryPoolSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryPools.AfterDeleteHooks.RunHooks(ctx, exec, HistoryPoolSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryPool -func (o *HistoryPool) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryPool) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_pool", "objectid"), psql.Quote("history_pool", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryPool -func (o *HistoryPool) Update(ctx context.Context, exec bob.Executor, s *HistoryPoolSetter) error { - v, err := HistoryPools.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 HistoryPool record with an executor -func (o *HistoryPool) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryPools.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryPool using the executor -func (o *HistoryPool) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryPools.Query( - sm.Where(HistoryPools.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryPools.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryPoolSlice is retrieved from the database -func (o HistoryPoolSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryPools.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryPools.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryPools.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryPools.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryPoolSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_pool", "objectid"), psql.Quote("history_pool", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryPoolSlice) copyMatchingRows(from ...*HistoryPool) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryPoolSlice) 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 HistoryPools.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 *HistoryPool: - o.copyMatchingRows(retrieved) - case []*HistoryPool: - o.copyMatchingRows(retrieved...) - case HistoryPoolSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryPool or a slice of HistoryPool - // then run the AfterUpdateHooks on the slice - _, err = HistoryPools.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryPoolSlice) 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 HistoryPools.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 *HistoryPool: - o.copyMatchingRows(retrieved) - case []*HistoryPool: - o.copyMatchingRows(retrieved...) - case HistoryPoolSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryPool or a slice of HistoryPool - // then run the AfterDeleteHooks on the slice - _, err = HistoryPools.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryPoolSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryPoolSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryPools.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryPoolSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryPools.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryPoolSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryPools.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 *HistoryPool) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryPoolSlice) 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 attachHistoryPoolOrganization0(ctx context.Context, exec bob.Executor, count int, historyPool0 *HistoryPool, organization1 *Organization) (*HistoryPool, error) { - setter := &HistoryPoolSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyPool0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryPoolOrganization0: %w", err) - } - - return historyPool0, nil -} - -func (historyPool0 *HistoryPool) 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 = attachHistoryPoolOrganization0(ctx, exec, 1, historyPool0, organization1) - if err != nil { - return err - } - - historyPool0.R.Organization = organization1 - - organization1.R.HistoryPools = append(organization1.R.HistoryPools, historyPool0) - - return nil -} - -func (historyPool0 *HistoryPool) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryPoolOrganization0(ctx, exec, 1, historyPool0, organization1) - if err != nil { - return err - } - - historyPool0.R.Organization = organization1 - - organization1.R.HistoryPools = append(organization1.R.HistoryPools, historyPool0) - - return nil -} - -type historyPoolWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Datesent psql.WhereNullMod[Q, int64] - Datetested psql.WhereNullMod[Q, int64] - Diseasepos psql.WhereNullMod[Q, string] - Diseasetested psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Gatewaysync psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] - Lab psql.WhereNullMod[Q, string] - LabID psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Poolyear psql.WhereNullMod[Q, int16] - Processed psql.WhereNullMod[Q, int16] - Sampleid psql.WhereNullMod[Q, string] - Survtech psql.WhereNullMod[Q, string] - Testmethod psql.WhereNullMod[Q, string] - Testtech psql.WhereNullMod[Q, string] - TrapdataID psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Vectorsurvcollectionid psql.WhereNullMod[Q, string] - Vectorsurvpoolid psql.WhereNullMod[Q, string] - Vectorsurvtrapdataid psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyPoolWhere[Q]) AliasedAs(alias string) historyPoolWhere[Q] { - return buildHistoryPoolWhere[Q](buildHistoryPoolColumns(alias)) -} - -func buildHistoryPoolWhere[Q psql.Filterable](cols historyPoolColumns) historyPoolWhere[Q] { - return historyPoolWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Datesent: psql.WhereNull[Q, int64](cols.Datesent), - Datetested: psql.WhereNull[Q, int64](cols.Datetested), - Diseasepos: psql.WhereNull[Q, string](cols.Diseasepos), - Diseasetested: psql.WhereNull[Q, string](cols.Diseasetested), - 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), - Lab: psql.WhereNull[Q, string](cols.Lab), - LabID: psql.WhereNull[Q, string](cols.LabID), - Objectid: psql.Where[Q, int32](cols.Objectid), - Poolyear: psql.WhereNull[Q, int16](cols.Poolyear), - Processed: psql.WhereNull[Q, int16](cols.Processed), - Sampleid: psql.WhereNull[Q, string](cols.Sampleid), - Survtech: psql.WhereNull[Q, string](cols.Survtech), - Testmethod: psql.WhereNull[Q, string](cols.Testmethod), - Testtech: psql.WhereNull[Q, string](cols.Testtech), - TrapdataID: psql.WhereNull[Q, string](cols.TrapdataID), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Vectorsurvcollectionid: psql.WhereNull[Q, string](cols.Vectorsurvcollectionid), - Vectorsurvpoolid: psql.WhereNull[Q, string](cols.Vectorsurvpoolid), - Vectorsurvtrapdataid: psql.WhereNull[Q, string](cols.Vectorsurvtrapdataid), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryPool) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyPool cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryPools = HistoryPoolSlice{o} - } - return nil - default: - return fmt.Errorf("historyPool has no relationship %q", name) - } -} - -type historyPoolPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryPoolPreloader() historyPoolPreloader { - return historyPoolPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryPools, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyPoolThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryPoolThenLoader[Q orm.Loadable]() historyPoolThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyPoolThenLoader[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 historyPool's Organization into the .R struct -func (o *HistoryPool) 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.HistoryPools = HistoryPoolSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyPool's Organization into the .R struct -func (os HistoryPoolSlice) 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.HistoryPools = append(rel.R.HistoryPools, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyPoolJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyPoolJoins[Q]) aliasedAs(alias string) historyPoolJoins[Q] { - return buildHistoryPoolJoins[Q](buildHistoryPoolColumns(alias), j.typ) -} - -func buildHistoryPoolJoins[Q dialect.Joinable](cols historyPoolColumns, typ string) historyPoolJoins[Q] { - return historyPoolJoins[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/db/models/history_pooldetail.bob.go b/db/models/history_pooldetail.bob.go deleted file mode 100644 index e3666f95..00000000 --- a/db/models/history_pooldetail.bob.go +++ /dev/null @@ -1,1040 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryPooldetail is an object representing the database table. -type HistoryPooldetail struct { - OrganizationID int32 `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Females null.Val[int16] `db:"females" ` - Globalid null.Val[string] `db:"globalid" ` - Objectid int32 `db:"objectid,pk" ` - PoolID null.Val[string] `db:"pool_id" ` - Species null.Val[string] `db:"species" ` - TrapdataID null.Val[string] `db:"trapdata_id" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historyPooldetailR `db:"-" ` -} - -// HistoryPooldetailSlice is an alias for a slice of pointers to HistoryPooldetail. -// This should almost always be used instead of []*HistoryPooldetail. -type HistoryPooldetailSlice []*HistoryPooldetail - -// HistoryPooldetails contains methods to work with the history_pooldetail table -var HistoryPooldetails = psql.NewTablex[*HistoryPooldetail, HistoryPooldetailSlice, *HistoryPooldetailSetter]("", "history_pooldetail", buildHistoryPooldetailColumns("history_pooldetail")) - -// HistoryPooldetailsQuery is a query on the history_pooldetail table -type HistoryPooldetailsQuery = *psql.ViewQuery[*HistoryPooldetail, HistoryPooldetailSlice] - -// historyPooldetailR is where relationships are stored. -type historyPooldetailR struct { - Organization *Organization // history_pooldetail.history_pooldetail_organization_id_fkey -} - -func buildHistoryPooldetailColumns(alias string) historyPooldetailColumns { - return historyPooldetailColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "females", "globalid", "objectid", "pool_id", "species", "trapdata_id", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", - ).WithParent("history_pooldetail"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Females: psql.Quote(alias, "females"), - Globalid: psql.Quote(alias, "globalid"), - Objectid: psql.Quote(alias, "objectid"), - PoolID: psql.Quote(alias, "pool_id"), - Species: psql.Quote(alias, "species"), - TrapdataID: psql.Quote(alias, "trapdata_id"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Version: psql.Quote(alias, "version"), - } -} - -type historyPooldetailColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Females psql.Expression - Globalid psql.Expression - Objectid psql.Expression - PoolID psql.Expression - Species psql.Expression - TrapdataID psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Version psql.Expression -} - -func (c historyPooldetailColumns) Alias() string { - return c.tableAlias -} - -func (historyPooldetailColumns) AliasedAs(alias string) historyPooldetailColumns { - return buildHistoryPooldetailColumns(alias) -} - -// HistoryPooldetailSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryPooldetailSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Females omitnull.Val[int16] `db:"females" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - PoolID omitnull.Val[string] `db:"pool_id" ` - Species omitnull.Val[string] `db:"species" ` - TrapdataID omitnull.Val[string] `db:"trapdata_id" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryPooldetailSetter) SetColumns() []string { - vals := make([]string, 0, 19) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Females.IsUnset() { - vals = append(vals, "females") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.PoolID.IsUnset() { - vals = append(vals, "pool_id") - } - if !s.Species.IsUnset() { - vals = append(vals, "species") - } - if !s.TrapdataID.IsUnset() { - vals = append(vals, "trapdata_id") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryPooldetailSetter) Overwrite(t *HistoryPooldetail) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Females.IsUnset() { - t.Females = s.Females.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.PoolID.IsUnset() { - t.PoolID = s.PoolID.MustGetNull() - } - if !s.Species.IsUnset() { - t.Species = s.Species.MustGetNull() - } - if !s.TrapdataID.IsUnset() { - t.TrapdataID = s.TrapdataID.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryPooldetailSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryPooldetails.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 19) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[1] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[2] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[3] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[4] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Females.IsUnset() { - vals[5] = psql.Arg(s.Females.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[6] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[7] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.PoolID.IsUnset() { - vals[8] = psql.Arg(s.PoolID.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Species.IsUnset() { - vals[9] = psql.Arg(s.Species.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.TrapdataID.IsUnset() { - vals[10] = psql.Arg(s.TrapdataID.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[11] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[12] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[13] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[14] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[15] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[16] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[17] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[18] = psql.Arg(s.Version.MustGet()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryPooldetailSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryPooldetailSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 19) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Females.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "females")...), - psql.Arg(s.Females), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.PoolID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pool_id")...), - psql.Arg(s.PoolID), - }}) - } - - if !s.Species.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "species")...), - psql.Arg(s.Species), - }}) - } - - if !s.TrapdataID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "trapdata_id")...), - psql.Arg(s.TrapdataID), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryPooldetail retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryPooldetail(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryPooldetail, error) { - if len(cols) == 0 { - return HistoryPooldetails.Query( - sm.Where(HistoryPooldetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryPooldetails.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryPooldetails.Query( - sm.Where(HistoryPooldetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryPooldetails.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryPooldetails.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryPooldetailExists checks the presence of a single record by primary key -func HistoryPooldetailExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryPooldetails.Query( - sm.Where(HistoryPooldetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryPooldetails.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryPooldetail is retrieved from the database -func (o *HistoryPooldetail) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryPooldetails.AfterSelectHooks.RunHooks(ctx, exec, HistoryPooldetailSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryPooldetails.AfterInsertHooks.RunHooks(ctx, exec, HistoryPooldetailSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryPooldetails.AfterUpdateHooks.RunHooks(ctx, exec, HistoryPooldetailSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryPooldetails.AfterDeleteHooks.RunHooks(ctx, exec, HistoryPooldetailSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryPooldetail -func (o *HistoryPooldetail) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryPooldetail) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_pooldetail", "objectid"), psql.Quote("history_pooldetail", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryPooldetail -func (o *HistoryPooldetail) Update(ctx context.Context, exec bob.Executor, s *HistoryPooldetailSetter) error { - v, err := HistoryPooldetails.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 HistoryPooldetail record with an executor -func (o *HistoryPooldetail) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryPooldetails.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryPooldetail using the executor -func (o *HistoryPooldetail) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryPooldetails.Query( - sm.Where(HistoryPooldetails.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryPooldetails.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryPooldetailSlice is retrieved from the database -func (o HistoryPooldetailSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryPooldetails.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryPooldetails.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryPooldetails.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryPooldetails.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryPooldetailSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_pooldetail", "objectid"), psql.Quote("history_pooldetail", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryPooldetailSlice) copyMatchingRows(from ...*HistoryPooldetail) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryPooldetailSlice) 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 HistoryPooldetails.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 *HistoryPooldetail: - o.copyMatchingRows(retrieved) - case []*HistoryPooldetail: - o.copyMatchingRows(retrieved...) - case HistoryPooldetailSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryPooldetail or a slice of HistoryPooldetail - // then run the AfterUpdateHooks on the slice - _, err = HistoryPooldetails.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryPooldetailSlice) 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 HistoryPooldetails.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 *HistoryPooldetail: - o.copyMatchingRows(retrieved) - case []*HistoryPooldetail: - o.copyMatchingRows(retrieved...) - case HistoryPooldetailSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryPooldetail or a slice of HistoryPooldetail - // then run the AfterDeleteHooks on the slice - _, err = HistoryPooldetails.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryPooldetailSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryPooldetailSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryPooldetails.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryPooldetailSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryPooldetails.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryPooldetailSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryPooldetails.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 *HistoryPooldetail) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryPooldetailSlice) 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 attachHistoryPooldetailOrganization0(ctx context.Context, exec bob.Executor, count int, historyPooldetail0 *HistoryPooldetail, organization1 *Organization) (*HistoryPooldetail, error) { - setter := &HistoryPooldetailSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyPooldetail0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryPooldetailOrganization0: %w", err) - } - - return historyPooldetail0, nil -} - -func (historyPooldetail0 *HistoryPooldetail) 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 = attachHistoryPooldetailOrganization0(ctx, exec, 1, historyPooldetail0, organization1) - if err != nil { - return err - } - - historyPooldetail0.R.Organization = organization1 - - organization1.R.HistoryPooldetails = append(organization1.R.HistoryPooldetails, historyPooldetail0) - - return nil -} - -func (historyPooldetail0 *HistoryPooldetail) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryPooldetailOrganization0(ctx, exec, 1, historyPooldetail0, organization1) - if err != nil { - return err - } - - historyPooldetail0.R.Organization = organization1 - - organization1.R.HistoryPooldetails = append(organization1.R.HistoryPooldetails, historyPooldetail0) - - return nil -} - -type historyPooldetailWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Females psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - PoolID psql.WhereNullMod[Q, string] - Species psql.WhereNullMod[Q, string] - TrapdataID psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyPooldetailWhere[Q]) AliasedAs(alias string) historyPooldetailWhere[Q] { - return buildHistoryPooldetailWhere[Q](buildHistoryPooldetailColumns(alias)) -} - -func buildHistoryPooldetailWhere[Q psql.Filterable](cols historyPooldetailColumns) historyPooldetailWhere[Q] { - return historyPooldetailWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - 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), - Objectid: psql.Where[Q, int32](cols.Objectid), - PoolID: psql.WhereNull[Q, string](cols.PoolID), - Species: psql.WhereNull[Q, string](cols.Species), - TrapdataID: psql.WhereNull[Q, string](cols.TrapdataID), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryPooldetail) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyPooldetail cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryPooldetails = HistoryPooldetailSlice{o} - } - return nil - default: - return fmt.Errorf("historyPooldetail has no relationship %q", name) - } -} - -type historyPooldetailPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryPooldetailPreloader() historyPooldetailPreloader { - return historyPooldetailPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryPooldetails, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyPooldetailThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryPooldetailThenLoader[Q orm.Loadable]() historyPooldetailThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyPooldetailThenLoader[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 historyPooldetail's Organization into the .R struct -func (o *HistoryPooldetail) 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.HistoryPooldetails = HistoryPooldetailSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyPooldetail's Organization into the .R struct -func (os HistoryPooldetailSlice) 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.HistoryPooldetails = append(rel.R.HistoryPooldetails, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyPooldetailJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyPooldetailJoins[Q]) aliasedAs(alias string) historyPooldetailJoins[Q] { - return buildHistoryPooldetailJoins[Q](buildHistoryPooldetailColumns(alias), j.typ) -} - -func buildHistoryPooldetailJoins[Q dialect.Joinable](cols historyPooldetailColumns, typ string) historyPooldetailJoins[Q] { - return historyPooldetailJoins[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/db/models/history_proposedtreatmentarea.bob.go b/db/models/history_proposedtreatmentarea.bob.go deleted file mode 100644 index c0ea8aed..00000000 --- a/db/models/history_proposedtreatmentarea.bob.go +++ /dev/null @@ -1,1515 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryProposedtreatmentarea is an object representing the database table. -type HistoryProposedtreatmentarea struct { - OrganizationID int32 `db:"organization_id" ` - Acres null.Val[float64] `db:"acres" ` - Comments null.Val[string] `db:"comments" ` - Completed null.Val[int16] `db:"completed" ` - Completedby null.Val[string] `db:"completedby" ` - Completeddate null.Val[int64] `db:"completeddate" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Duedate null.Val[int64] `db:"duedate" ` - Exported null.Val[int16] `db:"exported" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Hectares null.Val[float64] `db:"hectares" ` - Issprayroute null.Val[int16] `db:"issprayroute" ` - Lasttreatactivity null.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate null.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct null.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty null.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit null.Val[string] `db:"lasttreatqtyunit" ` - Method null.Val[string] `db:"method" ` - Name null.Val[string] `db:"name" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - Targetapprate null.Val[float64] `db:"targetapprate" ` - Targetproduct null.Val[string] `db:"targetproduct" ` - Targetspecies null.Val[string] `db:"targetspecies" ` - 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" ` - Version int32 `db:"version,pk" ` - Created null.Val[time.Time] `db:"created" ` - - R historyProposedtreatmentareaR `db:"-" ` -} - -// HistoryProposedtreatmentareaSlice is an alias for a slice of pointers to HistoryProposedtreatmentarea. -// This should almost always be used instead of []*HistoryProposedtreatmentarea. -type HistoryProposedtreatmentareaSlice []*HistoryProposedtreatmentarea - -// HistoryProposedtreatmentareas contains methods to work with the history_proposedtreatmentarea table -var HistoryProposedtreatmentareas = psql.NewTablex[*HistoryProposedtreatmentarea, HistoryProposedtreatmentareaSlice, *HistoryProposedtreatmentareaSetter]("", "history_proposedtreatmentarea", buildHistoryProposedtreatmentareaColumns("history_proposedtreatmentarea")) - -// HistoryProposedtreatmentareasQuery is a query on the history_proposedtreatmentarea table -type HistoryProposedtreatmentareasQuery = *psql.ViewQuery[*HistoryProposedtreatmentarea, HistoryProposedtreatmentareaSlice] - -// historyProposedtreatmentareaR is where relationships are stored. -type historyProposedtreatmentareaR struct { - Organization *Organization // history_proposedtreatmentarea.history_proposedtreatmentarea_organization_id_fkey -} - -func buildHistoryProposedtreatmentareaColumns(alias string) historyProposedtreatmentareaColumns { - return historyProposedtreatmentareaColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "acres", "comments", "completed", "completedby", "completeddate", "creationdate", "creator", "duedate", "exported", "editdate", "editor", "globalid", "hectares", "issprayroute", "lasttreatactivity", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "method", "name", "objectid", "priority", "reviewed", "reviewedby", "revieweddate", "shape__area", "shape__length", "targetapprate", "targetproduct", "targetspecies", "zone", "zone2", "geometry_x", "geometry_y", "version", "created", - ).WithParent("history_proposedtreatmentarea"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Acres: psql.Quote(alias, "acres"), - Comments: psql.Quote(alias, "comments"), - Completed: psql.Quote(alias, "completed"), - Completedby: psql.Quote(alias, "completedby"), - Completeddate: psql.Quote(alias, "completeddate"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Duedate: psql.Quote(alias, "duedate"), - Exported: psql.Quote(alias, "exported"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Hectares: psql.Quote(alias, "hectares"), - Issprayroute: psql.Quote(alias, "issprayroute"), - Lasttreatactivity: psql.Quote(alias, "lasttreatactivity"), - Lasttreatdate: psql.Quote(alias, "lasttreatdate"), - Lasttreatproduct: psql.Quote(alias, "lasttreatproduct"), - Lasttreatqty: psql.Quote(alias, "lasttreatqty"), - Lasttreatqtyunit: psql.Quote(alias, "lasttreatqtyunit"), - Method: psql.Quote(alias, "method"), - Name: psql.Quote(alias, "name"), - Objectid: psql.Quote(alias, "objectid"), - Priority: psql.Quote(alias, "priority"), - Reviewed: psql.Quote(alias, "reviewed"), - Reviewedby: psql.Quote(alias, "reviewedby"), - Revieweddate: psql.Quote(alias, "revieweddate"), - ShapeArea: psql.Quote(alias, "shape__area"), - ShapeLength: psql.Quote(alias, "shape__length"), - Targetapprate: psql.Quote(alias, "targetapprate"), - Targetproduct: psql.Quote(alias, "targetproduct"), - Targetspecies: psql.Quote(alias, "targetspecies"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - Version: psql.Quote(alias, "version"), - Created: psql.Quote(alias, "created"), - } -} - -type historyProposedtreatmentareaColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Acres psql.Expression - Comments psql.Expression - Completed psql.Expression - Completedby psql.Expression - Completeddate psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Duedate psql.Expression - Exported psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Hectares psql.Expression - Issprayroute psql.Expression - Lasttreatactivity psql.Expression - Lasttreatdate psql.Expression - Lasttreatproduct psql.Expression - Lasttreatqty psql.Expression - Lasttreatqtyunit psql.Expression - Method psql.Expression - Name psql.Expression - Objectid psql.Expression - Priority psql.Expression - Reviewed psql.Expression - Reviewedby psql.Expression - Revieweddate psql.Expression - ShapeArea psql.Expression - ShapeLength psql.Expression - Targetapprate psql.Expression - Targetproduct psql.Expression - Targetspecies psql.Expression - Zone psql.Expression - Zone2 psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - Version psql.Expression - Created psql.Expression -} - -func (c historyProposedtreatmentareaColumns) Alias() string { - return c.tableAlias -} - -func (historyProposedtreatmentareaColumns) AliasedAs(alias string) historyProposedtreatmentareaColumns { - return buildHistoryProposedtreatmentareaColumns(alias) -} - -// HistoryProposedtreatmentareaSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryProposedtreatmentareaSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Acres omitnull.Val[float64] `db:"acres" ` - Comments omitnull.Val[string] `db:"comments" ` - Completed omitnull.Val[int16] `db:"completed" ` - Completedby omitnull.Val[string] `db:"completedby" ` - Completeddate omitnull.Val[int64] `db:"completeddate" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Duedate omitnull.Val[int64] `db:"duedate" ` - Exported omitnull.Val[int16] `db:"exported" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Hectares omitnull.Val[float64] `db:"hectares" ` - Issprayroute omitnull.Val[int16] `db:"issprayroute" ` - Lasttreatactivity omitnull.Val[string] `db:"lasttreatactivity" ` - Lasttreatdate omitnull.Val[int64] `db:"lasttreatdate" ` - Lasttreatproduct omitnull.Val[string] `db:"lasttreatproduct" ` - Lasttreatqty omitnull.Val[float64] `db:"lasttreatqty" ` - Lasttreatqtyunit omitnull.Val[string] `db:"lasttreatqtyunit" ` - Method omitnull.Val[string] `db:"method" ` - Name omitnull.Val[string] `db:"name" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Targetapprate omitnull.Val[float64] `db:"targetapprate" ` - Targetproduct omitnull.Val[string] `db:"targetproduct" ` - Targetspecies omitnull.Val[string] `db:"targetspecies" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` - Created omitnull.Val[time.Time] `db:"created" ` -} - -func (s HistoryProposedtreatmentareaSetter) SetColumns() []string { - vals := make([]string, 0, 38) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Acres.IsUnset() { - vals = append(vals, "acres") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Completed.IsUnset() { - vals = append(vals, "completed") - } - if !s.Completedby.IsUnset() { - vals = append(vals, "completedby") - } - if !s.Completeddate.IsUnset() { - vals = append(vals, "completeddate") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Duedate.IsUnset() { - vals = append(vals, "duedate") - } - if !s.Exported.IsUnset() { - vals = append(vals, "exported") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Hectares.IsUnset() { - vals = append(vals, "hectares") - } - if !s.Issprayroute.IsUnset() { - vals = append(vals, "issprayroute") - } - if !s.Lasttreatactivity.IsUnset() { - vals = append(vals, "lasttreatactivity") - } - if !s.Lasttreatdate.IsUnset() { - vals = append(vals, "lasttreatdate") - } - if !s.Lasttreatproduct.IsUnset() { - vals = append(vals, "lasttreatproduct") - } - if !s.Lasttreatqty.IsUnset() { - vals = append(vals, "lasttreatqty") - } - if !s.Lasttreatqtyunit.IsUnset() { - vals = append(vals, "lasttreatqtyunit") - } - if !s.Method.IsUnset() { - vals = append(vals, "method") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Reviewed.IsUnset() { - vals = append(vals, "reviewed") - } - if !s.Reviewedby.IsUnset() { - vals = append(vals, "reviewedby") - } - if !s.Revieweddate.IsUnset() { - vals = append(vals, "revieweddate") - } - if !s.ShapeArea.IsUnset() { - vals = append(vals, "shape__area") - } - if !s.ShapeLength.IsUnset() { - vals = append(vals, "shape__length") - } - if !s.Targetapprate.IsUnset() { - vals = append(vals, "targetapprate") - } - if !s.Targetproduct.IsUnset() { - vals = append(vals, "targetproduct") - } - if !s.Targetspecies.IsUnset() { - vals = append(vals, "targetspecies") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - return vals -} - -func (s HistoryProposedtreatmentareaSetter) Overwrite(t *HistoryProposedtreatmentarea) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Acres.IsUnset() { - t.Acres = s.Acres.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Completed.IsUnset() { - t.Completed = s.Completed.MustGetNull() - } - if !s.Completedby.IsUnset() { - t.Completedby = s.Completedby.MustGetNull() - } - if !s.Completeddate.IsUnset() { - t.Completeddate = s.Completeddate.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Duedate.IsUnset() { - t.Duedate = s.Duedate.MustGetNull() - } - if !s.Exported.IsUnset() { - t.Exported = s.Exported.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Hectares.IsUnset() { - t.Hectares = s.Hectares.MustGetNull() - } - if !s.Issprayroute.IsUnset() { - t.Issprayroute = s.Issprayroute.MustGetNull() - } - if !s.Lasttreatactivity.IsUnset() { - t.Lasttreatactivity = s.Lasttreatactivity.MustGetNull() - } - if !s.Lasttreatdate.IsUnset() { - t.Lasttreatdate = s.Lasttreatdate.MustGetNull() - } - if !s.Lasttreatproduct.IsUnset() { - t.Lasttreatproduct = s.Lasttreatproduct.MustGetNull() - } - if !s.Lasttreatqty.IsUnset() { - t.Lasttreatqty = s.Lasttreatqty.MustGetNull() - } - if !s.Lasttreatqtyunit.IsUnset() { - t.Lasttreatqtyunit = s.Lasttreatqtyunit.MustGetNull() - } - if !s.Method.IsUnset() { - t.Method = s.Method.MustGetNull() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Reviewed.IsUnset() { - t.Reviewed = s.Reviewed.MustGetNull() - } - if !s.Reviewedby.IsUnset() { - t.Reviewedby = s.Reviewedby.MustGetNull() - } - if !s.Revieweddate.IsUnset() { - t.Revieweddate = s.Revieweddate.MustGetNull() - } - if !s.ShapeArea.IsUnset() { - t.ShapeArea = s.ShapeArea.MustGetNull() - } - if !s.ShapeLength.IsUnset() { - t.ShapeLength = s.ShapeLength.MustGetNull() - } - if !s.Targetapprate.IsUnset() { - t.Targetapprate = s.Targetapprate.MustGetNull() - } - if !s.Targetproduct.IsUnset() { - t.Targetproduct = s.Targetproduct.MustGetNull() - } - if !s.Targetspecies.IsUnset() { - t.Targetspecies = s.Targetspecies.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } -} - -func (s *HistoryProposedtreatmentareaSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryProposedtreatmentareas.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 38) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Acres.IsUnset() { - vals[1] = psql.Arg(s.Acres.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[2] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Completed.IsUnset() { - vals[3] = psql.Arg(s.Completed.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Completedby.IsUnset() { - vals[4] = psql.Arg(s.Completedby.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Completeddate.IsUnset() { - vals[5] = psql.Arg(s.Completeddate.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[6] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[7] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Duedate.IsUnset() { - vals[8] = psql.Arg(s.Duedate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Exported.IsUnset() { - vals[9] = psql.Arg(s.Exported.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[10] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[11] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[12] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Hectares.IsUnset() { - vals[13] = psql.Arg(s.Hectares.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Issprayroute.IsUnset() { - vals[14] = psql.Arg(s.Issprayroute.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatactivity.IsUnset() { - vals[15] = psql.Arg(s.Lasttreatactivity.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatdate.IsUnset() { - vals[16] = psql.Arg(s.Lasttreatdate.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatproduct.IsUnset() { - vals[17] = psql.Arg(s.Lasttreatproduct.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqty.IsUnset() { - vals[18] = psql.Arg(s.Lasttreatqty.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatqtyunit.IsUnset() { - vals[19] = psql.Arg(s.Lasttreatqtyunit.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Method.IsUnset() { - vals[20] = psql.Arg(s.Method.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[21] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[22] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[23] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Reviewed.IsUnset() { - vals[24] = psql.Arg(s.Reviewed.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Reviewedby.IsUnset() { - vals[25] = psql.Arg(s.Reviewedby.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Revieweddate.IsUnset() { - vals[26] = psql.Arg(s.Revieweddate.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.ShapeArea.IsUnset() { - vals[27] = psql.Arg(s.ShapeArea.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.ShapeLength.IsUnset() { - vals[28] = psql.Arg(s.ShapeLength.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Targetapprate.IsUnset() { - vals[29] = psql.Arg(s.Targetapprate.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Targetproduct.IsUnset() { - vals[30] = psql.Arg(s.Targetproduct.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Targetspecies.IsUnset() { - vals[31] = psql.Arg(s.Targetspecies.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[32] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[33] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[34] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[35] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[36] = psql.Arg(s.Version.MustGet()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[37] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryProposedtreatmentareaSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryProposedtreatmentareaSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 38) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Acres.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "acres")...), - psql.Arg(s.Acres), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Completed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "completed")...), - psql.Arg(s.Completed), - }}) - } - - if !s.Completedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "completedby")...), - psql.Arg(s.Completedby), - }}) - } - - if !s.Completeddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "completeddate")...), - psql.Arg(s.Completeddate), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Duedate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "duedate")...), - psql.Arg(s.Duedate), - }}) - } - - if !s.Exported.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "exported")...), - psql.Arg(s.Exported), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Hectares.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "hectares")...), - psql.Arg(s.Hectares), - }}) - } - - if !s.Issprayroute.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "issprayroute")...), - psql.Arg(s.Issprayroute), - }}) - } - - if !s.Lasttreatactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatactivity")...), - psql.Arg(s.Lasttreatactivity), - }}) - } - - if !s.Lasttreatdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatdate")...), - psql.Arg(s.Lasttreatdate), - }}) - } - - if !s.Lasttreatproduct.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatproduct")...), - psql.Arg(s.Lasttreatproduct), - }}) - } - - if !s.Lasttreatqty.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqty")...), - psql.Arg(s.Lasttreatqty), - }}) - } - - if !s.Lasttreatqtyunit.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatqtyunit")...), - psql.Arg(s.Lasttreatqtyunit), - }}) - } - - if !s.Method.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "method")...), - psql.Arg(s.Method), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Reviewed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewed")...), - psql.Arg(s.Reviewed), - }}) - } - - if !s.Reviewedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewedby")...), - psql.Arg(s.Reviewedby), - }}) - } - - if !s.Revieweddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "revieweddate")...), - psql.Arg(s.Revieweddate), - }}) - } - - if !s.ShapeArea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__area")...), - psql.Arg(s.ShapeArea), - }}) - } - - if !s.ShapeLength.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__length")...), - psql.Arg(s.ShapeLength), - }}) - } - - if !s.Targetapprate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "targetapprate")...), - psql.Arg(s.Targetapprate), - }}) - } - - if !s.Targetproduct.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "targetproduct")...), - psql.Arg(s.Targetproduct), - }}) - } - - if !s.Targetspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "targetspecies")...), - psql.Arg(s.Targetspecies), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - return exprs -} - -// FindHistoryProposedtreatmentarea retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryProposedtreatmentarea(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryProposedtreatmentarea, error) { - if len(cols) == 0 { - return HistoryProposedtreatmentareas.Query( - sm.Where(HistoryProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryProposedtreatmentareas.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryProposedtreatmentareas.Query( - sm.Where(HistoryProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryProposedtreatmentareas.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryProposedtreatmentareas.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryProposedtreatmentareaExists checks the presence of a single record by primary key -func HistoryProposedtreatmentareaExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryProposedtreatmentareas.Query( - sm.Where(HistoryProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryProposedtreatmentareas.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryProposedtreatmentarea is retrieved from the database -func (o *HistoryProposedtreatmentarea) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryProposedtreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, HistoryProposedtreatmentareaSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryProposedtreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, HistoryProposedtreatmentareaSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryProposedtreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, HistoryProposedtreatmentareaSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryProposedtreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, HistoryProposedtreatmentareaSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryProposedtreatmentarea -func (o *HistoryProposedtreatmentarea) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryProposedtreatmentarea) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_proposedtreatmentarea", "objectid"), psql.Quote("history_proposedtreatmentarea", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryProposedtreatmentarea -func (o *HistoryProposedtreatmentarea) Update(ctx context.Context, exec bob.Executor, s *HistoryProposedtreatmentareaSetter) error { - v, err := HistoryProposedtreatmentareas.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 HistoryProposedtreatmentarea record with an executor -func (o *HistoryProposedtreatmentarea) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryProposedtreatmentareas.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryProposedtreatmentarea using the executor -func (o *HistoryProposedtreatmentarea) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryProposedtreatmentareas.Query( - sm.Where(HistoryProposedtreatmentareas.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryProposedtreatmentareas.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryProposedtreatmentareaSlice is retrieved from the database -func (o HistoryProposedtreatmentareaSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryProposedtreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryProposedtreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryProposedtreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryProposedtreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryProposedtreatmentareaSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_proposedtreatmentarea", "objectid"), psql.Quote("history_proposedtreatmentarea", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryProposedtreatmentareaSlice) copyMatchingRows(from ...*HistoryProposedtreatmentarea) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryProposedtreatmentareaSlice) 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 HistoryProposedtreatmentareas.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 *HistoryProposedtreatmentarea: - o.copyMatchingRows(retrieved) - case []*HistoryProposedtreatmentarea: - o.copyMatchingRows(retrieved...) - case HistoryProposedtreatmentareaSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryProposedtreatmentarea or a slice of HistoryProposedtreatmentarea - // then run the AfterUpdateHooks on the slice - _, err = HistoryProposedtreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryProposedtreatmentareaSlice) 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 HistoryProposedtreatmentareas.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 *HistoryProposedtreatmentarea: - o.copyMatchingRows(retrieved) - case []*HistoryProposedtreatmentarea: - o.copyMatchingRows(retrieved...) - case HistoryProposedtreatmentareaSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryProposedtreatmentarea or a slice of HistoryProposedtreatmentarea - // then run the AfterDeleteHooks on the slice - _, err = HistoryProposedtreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryProposedtreatmentareaSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryProposedtreatmentareaSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryProposedtreatmentareas.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryProposedtreatmentareaSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryProposedtreatmentareas.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryProposedtreatmentareaSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryProposedtreatmentareas.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 *HistoryProposedtreatmentarea) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryProposedtreatmentareaSlice) 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 attachHistoryProposedtreatmentareaOrganization0(ctx context.Context, exec bob.Executor, count int, historyProposedtreatmentarea0 *HistoryProposedtreatmentarea, organization1 *Organization) (*HistoryProposedtreatmentarea, error) { - setter := &HistoryProposedtreatmentareaSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyProposedtreatmentarea0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryProposedtreatmentareaOrganization0: %w", err) - } - - return historyProposedtreatmentarea0, nil -} - -func (historyProposedtreatmentarea0 *HistoryProposedtreatmentarea) 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 = attachHistoryProposedtreatmentareaOrganization0(ctx, exec, 1, historyProposedtreatmentarea0, organization1) - if err != nil { - return err - } - - historyProposedtreatmentarea0.R.Organization = organization1 - - organization1.R.HistoryProposedtreatmentareas = append(organization1.R.HistoryProposedtreatmentareas, historyProposedtreatmentarea0) - - return nil -} - -func (historyProposedtreatmentarea0 *HistoryProposedtreatmentarea) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryProposedtreatmentareaOrganization0(ctx, exec, 1, historyProposedtreatmentarea0, organization1) - if err != nil { - return err - } - - historyProposedtreatmentarea0.R.Organization = organization1 - - organization1.R.HistoryProposedtreatmentareas = append(organization1.R.HistoryProposedtreatmentareas, historyProposedtreatmentarea0) - - return nil -} - -type historyProposedtreatmentareaWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Acres psql.WhereNullMod[Q, float64] - Comments psql.WhereNullMod[Q, string] - Completed psql.WhereNullMod[Q, int16] - Completedby psql.WhereNullMod[Q, string] - Completeddate psql.WhereNullMod[Q, int64] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Duedate psql.WhereNullMod[Q, int64] - Exported psql.WhereNullMod[Q, int16] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Hectares psql.WhereNullMod[Q, float64] - Issprayroute psql.WhereNullMod[Q, int16] - Lasttreatactivity psql.WhereNullMod[Q, string] - Lasttreatdate psql.WhereNullMod[Q, int64] - Lasttreatproduct psql.WhereNullMod[Q, string] - Lasttreatqty psql.WhereNullMod[Q, float64] - Lasttreatqtyunit psql.WhereNullMod[Q, string] - Method psql.WhereNullMod[Q, string] - Name psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Priority psql.WhereNullMod[Q, string] - Reviewed psql.WhereNullMod[Q, int16] - Reviewedby psql.WhereNullMod[Q, string] - Revieweddate psql.WhereNullMod[Q, int64] - ShapeArea psql.WhereNullMod[Q, float64] - ShapeLength psql.WhereNullMod[Q, float64] - Targetapprate psql.WhereNullMod[Q, float64] - Targetproduct psql.WhereNullMod[Q, string] - Targetspecies psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - Version psql.WhereMod[Q, int32] - Created psql.WhereNullMod[Q, time.Time] -} - -func (historyProposedtreatmentareaWhere[Q]) AliasedAs(alias string) historyProposedtreatmentareaWhere[Q] { - return buildHistoryProposedtreatmentareaWhere[Q](buildHistoryProposedtreatmentareaColumns(alias)) -} - -func buildHistoryProposedtreatmentareaWhere[Q psql.Filterable](cols historyProposedtreatmentareaColumns) historyProposedtreatmentareaWhere[Q] { - return historyProposedtreatmentareaWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Acres: psql.WhereNull[Q, float64](cols.Acres), - Comments: psql.WhereNull[Q, string](cols.Comments), - Completed: psql.WhereNull[Q, int16](cols.Completed), - Completedby: psql.WhereNull[Q, string](cols.Completedby), - Completeddate: psql.WhereNull[Q, int64](cols.Completeddate), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Duedate: psql.WhereNull[Q, int64](cols.Duedate), - 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), - Hectares: psql.WhereNull[Q, float64](cols.Hectares), - Issprayroute: psql.WhereNull[Q, int16](cols.Issprayroute), - Lasttreatactivity: psql.WhereNull[Q, string](cols.Lasttreatactivity), - Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), - Lasttreatproduct: psql.WhereNull[Q, string](cols.Lasttreatproduct), - Lasttreatqty: psql.WhereNull[Q, float64](cols.Lasttreatqty), - Lasttreatqtyunit: psql.WhereNull[Q, string](cols.Lasttreatqtyunit), - Method: psql.WhereNull[Q, string](cols.Method), - Name: psql.WhereNull[Q, string](cols.Name), - Objectid: psql.Where[Q, int32](cols.Objectid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), - Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), - Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), - ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), - ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), - Targetapprate: psql.WhereNull[Q, float64](cols.Targetapprate), - Targetproduct: psql.WhereNull[Q, string](cols.Targetproduct), - Targetspecies: psql.WhereNull[Q, string](cols.Targetspecies), - 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), - Version: psql.Where[Q, int32](cols.Version), - Created: psql.WhereNull[Q, time.Time](cols.Created), - } -} - -func (o *HistoryProposedtreatmentarea) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyProposedtreatmentarea cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryProposedtreatmentareas = HistoryProposedtreatmentareaSlice{o} - } - return nil - default: - return fmt.Errorf("historyProposedtreatmentarea has no relationship %q", name) - } -} - -type historyProposedtreatmentareaPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryProposedtreatmentareaPreloader() historyProposedtreatmentareaPreloader { - return historyProposedtreatmentareaPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryProposedtreatmentareas, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyProposedtreatmentareaThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryProposedtreatmentareaThenLoader[Q orm.Loadable]() historyProposedtreatmentareaThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyProposedtreatmentareaThenLoader[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 historyProposedtreatmentarea's Organization into the .R struct -func (o *HistoryProposedtreatmentarea) 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.HistoryProposedtreatmentareas = HistoryProposedtreatmentareaSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyProposedtreatmentarea's Organization into the .R struct -func (os HistoryProposedtreatmentareaSlice) 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.HistoryProposedtreatmentareas = append(rel.R.HistoryProposedtreatmentareas, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyProposedtreatmentareaJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyProposedtreatmentareaJoins[Q]) aliasedAs(alias string) historyProposedtreatmentareaJoins[Q] { - return buildHistoryProposedtreatmentareaJoins[Q](buildHistoryProposedtreatmentareaColumns(alias), j.typ) -} - -func buildHistoryProposedtreatmentareaJoins[Q dialect.Joinable](cols historyProposedtreatmentareaColumns, typ string) historyProposedtreatmentareaJoins[Q] { - return historyProposedtreatmentareaJoins[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/db/models/history_qamosquitoinspection.bob.go b/db/models/history_qamosquitoinspection.bob.go deleted file mode 100644 index 255fe4f4..00000000 --- a/db/models/history_qamosquitoinspection.bob.go +++ /dev/null @@ -1,2240 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryQamosquitoinspection is an object representing the database table. -type HistoryQamosquitoinspection struct { - OrganizationID int32 `db:"organization_id" ` - Acresbreeding null.Val[float64] `db:"acresbreeding" ` - Actiontaken null.Val[string] `db:"actiontaken" ` - Adultactivity null.Val[int16] `db:"adultactivity" ` - Aquaticorganisms null.Val[string] `db:"aquaticorganisms" ` - Avetemp null.Val[float64] `db:"avetemp" ` - Breedingpotential null.Val[string] `db:"breedingpotential" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Fish null.Val[int16] `db:"fish" ` - Globalid null.Val[string] `db:"globalid" ` - Habvalue1 null.Val[int16] `db:"habvalue1" ` - Habvalue1percent null.Val[int16] `db:"habvalue1percent" ` - Habvalue2 null.Val[int16] `db:"habvalue2" ` - Habvalue2percent null.Val[int16] `db:"habvalue2percent" ` - Larvaeinsidetreatedarea null.Val[int16] `db:"larvaeinsidetreatedarea" ` - Larvaeoutsidetreatedarea null.Val[int16] `db:"larvaeoutsidetreatedarea" ` - Larvaepresent null.Val[int16] `db:"larvaepresent" ` - Larvaereason null.Val[string] `db:"larvaereason" ` - Linelocid null.Val[string] `db:"linelocid" ` - Locationname null.Val[string] `db:"locationname" ` - LR null.Val[int16] `db:"lr" ` - Mosquitohabitat null.Val[string] `db:"mosquitohabitat" ` - Movingwater null.Val[int16] `db:"movingwater" ` - Negdips null.Val[int16] `db:"negdips" ` - Nowaterever null.Val[int16] `db:"nowaterever" ` - Objectid int32 `db:"objectid,pk" ` - Pointlocid null.Val[string] `db:"pointlocid" ` - Polygonlocid null.Val[string] `db:"polygonlocid" ` - Posdips null.Val[int16] `db:"posdips" ` - Potential null.Val[int16] `db:"potential" ` - Raingauge null.Val[float64] `db:"raingauge" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Sitetype null.Val[string] `db:"sitetype" ` - Soilconditions null.Val[string] `db:"soilconditions" ` - Sourcereduction null.Val[string] `db:"sourcereduction" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Totalacres null.Val[float64] `db:"totalacres" ` - Vegetation null.Val[string] `db:"vegetation" ` - Waterconditions null.Val[string] `db:"waterconditions" ` - Waterduration null.Val[string] `db:"waterduration" ` - Watermovement1 null.Val[string] `db:"watermovement1" ` - Watermovement1percent null.Val[int16] `db:"watermovement1percent" ` - Watermovement2 null.Val[string] `db:"watermovement2" ` - Watermovement2percent null.Val[int16] `db:"watermovement2percent" ` - Waterpresent null.Val[int16] `db:"waterpresent" ` - Watersource null.Val[string] `db:"watersource" ` - Winddir null.Val[string] `db:"winddir" ` - Windspeed null.Val[float64] `db:"windspeed" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historyQamosquitoinspectionR `db:"-" ` -} - -// HistoryQamosquitoinspectionSlice is an alias for a slice of pointers to HistoryQamosquitoinspection. -// This should almost always be used instead of []*HistoryQamosquitoinspection. -type HistoryQamosquitoinspectionSlice []*HistoryQamosquitoinspection - -// HistoryQamosquitoinspections contains methods to work with the history_qamosquitoinspection table -var HistoryQamosquitoinspections = psql.NewTablex[*HistoryQamosquitoinspection, HistoryQamosquitoinspectionSlice, *HistoryQamosquitoinspectionSetter]("", "history_qamosquitoinspection", buildHistoryQamosquitoinspectionColumns("history_qamosquitoinspection")) - -// HistoryQamosquitoinspectionsQuery is a query on the history_qamosquitoinspection table -type HistoryQamosquitoinspectionsQuery = *psql.ViewQuery[*HistoryQamosquitoinspection, HistoryQamosquitoinspectionSlice] - -// historyQamosquitoinspectionR is where relationships are stored. -type historyQamosquitoinspectionR struct { - Organization *Organization // history_qamosquitoinspection.history_qamosquitoinspection_organization_id_fkey -} - -func buildHistoryQamosquitoinspectionColumns(alias string) historyQamosquitoinspectionColumns { - return historyQamosquitoinspectionColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "acresbreeding", "actiontaken", "adultactivity", "aquaticorganisms", "avetemp", "breedingpotential", "comments", "creationdate", "creator", "enddatetime", "editdate", "editor", "fieldtech", "fish", "globalid", "habvalue1", "habvalue1percent", "habvalue2", "habvalue2percent", "larvaeinsidetreatedarea", "larvaeoutsidetreatedarea", "larvaepresent", "larvaereason", "linelocid", "locationname", "lr", "mosquitohabitat", "movingwater", "negdips", "nowaterever", "objectid", "pointlocid", "polygonlocid", "posdips", "potential", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sitetype", "soilconditions", "sourcereduction", "startdatetime", "totalacres", "vegetation", "waterconditions", "waterduration", "watermovement1", "watermovement1percent", "watermovement2", "watermovement2percent", "waterpresent", "watersource", "winddir", "windspeed", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", - ).WithParent("history_qamosquitoinspection"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Acresbreeding: psql.Quote(alias, "acresbreeding"), - Actiontaken: psql.Quote(alias, "actiontaken"), - Adultactivity: psql.Quote(alias, "adultactivity"), - Aquaticorganisms: psql.Quote(alias, "aquaticorganisms"), - Avetemp: psql.Quote(alias, "avetemp"), - Breedingpotential: psql.Quote(alias, "breedingpotential"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Enddatetime: psql.Quote(alias, "enddatetime"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fieldtech: psql.Quote(alias, "fieldtech"), - Fish: psql.Quote(alias, "fish"), - Globalid: psql.Quote(alias, "globalid"), - Habvalue1: psql.Quote(alias, "habvalue1"), - Habvalue1percent: psql.Quote(alias, "habvalue1percent"), - Habvalue2: psql.Quote(alias, "habvalue2"), - Habvalue2percent: psql.Quote(alias, "habvalue2percent"), - Larvaeinsidetreatedarea: psql.Quote(alias, "larvaeinsidetreatedarea"), - Larvaeoutsidetreatedarea: psql.Quote(alias, "larvaeoutsidetreatedarea"), - Larvaepresent: psql.Quote(alias, "larvaepresent"), - Larvaereason: psql.Quote(alias, "larvaereason"), - Linelocid: psql.Quote(alias, "linelocid"), - Locationname: psql.Quote(alias, "locationname"), - LR: psql.Quote(alias, "lr"), - Mosquitohabitat: psql.Quote(alias, "mosquitohabitat"), - Movingwater: psql.Quote(alias, "movingwater"), - Negdips: psql.Quote(alias, "negdips"), - Nowaterever: psql.Quote(alias, "nowaterever"), - Objectid: psql.Quote(alias, "objectid"), - Pointlocid: psql.Quote(alias, "pointlocid"), - Polygonlocid: psql.Quote(alias, "polygonlocid"), - Posdips: psql.Quote(alias, "posdips"), - Potential: psql.Quote(alias, "potential"), - Raingauge: psql.Quote(alias, "raingauge"), - Recordstatus: psql.Quote(alias, "recordstatus"), - Reviewed: psql.Quote(alias, "reviewed"), - Reviewedby: psql.Quote(alias, "reviewedby"), - Revieweddate: psql.Quote(alias, "revieweddate"), - Sitetype: psql.Quote(alias, "sitetype"), - Soilconditions: psql.Quote(alias, "soilconditions"), - Sourcereduction: psql.Quote(alias, "sourcereduction"), - Startdatetime: psql.Quote(alias, "startdatetime"), - Totalacres: psql.Quote(alias, "totalacres"), - Vegetation: psql.Quote(alias, "vegetation"), - Waterconditions: psql.Quote(alias, "waterconditions"), - Waterduration: psql.Quote(alias, "waterduration"), - Watermovement1: psql.Quote(alias, "watermovement1"), - Watermovement1percent: psql.Quote(alias, "watermovement1percent"), - Watermovement2: psql.Quote(alias, "watermovement2"), - Watermovement2percent: psql.Quote(alias, "watermovement2percent"), - Waterpresent: psql.Quote(alias, "waterpresent"), - Watersource: psql.Quote(alias, "watersource"), - Winddir: psql.Quote(alias, "winddir"), - Windspeed: psql.Quote(alias, "windspeed"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Version: psql.Quote(alias, "version"), - } -} - -type historyQamosquitoinspectionColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Acresbreeding psql.Expression - Actiontaken psql.Expression - Adultactivity psql.Expression - Aquaticorganisms psql.Expression - Avetemp psql.Expression - Breedingpotential psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Enddatetime psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fieldtech psql.Expression - Fish psql.Expression - Globalid psql.Expression - Habvalue1 psql.Expression - Habvalue1percent psql.Expression - Habvalue2 psql.Expression - Habvalue2percent psql.Expression - Larvaeinsidetreatedarea psql.Expression - Larvaeoutsidetreatedarea psql.Expression - Larvaepresent psql.Expression - Larvaereason psql.Expression - Linelocid psql.Expression - Locationname psql.Expression - LR psql.Expression - Mosquitohabitat psql.Expression - Movingwater psql.Expression - Negdips psql.Expression - Nowaterever psql.Expression - Objectid psql.Expression - Pointlocid psql.Expression - Polygonlocid psql.Expression - Posdips psql.Expression - Potential psql.Expression - Raingauge psql.Expression - Recordstatus psql.Expression - Reviewed psql.Expression - Reviewedby psql.Expression - Revieweddate psql.Expression - Sitetype psql.Expression - Soilconditions psql.Expression - Sourcereduction psql.Expression - Startdatetime psql.Expression - Totalacres psql.Expression - Vegetation psql.Expression - Waterconditions psql.Expression - Waterduration psql.Expression - Watermovement1 psql.Expression - Watermovement1percent psql.Expression - Watermovement2 psql.Expression - Watermovement2percent psql.Expression - Waterpresent psql.Expression - Watersource psql.Expression - Winddir psql.Expression - Windspeed psql.Expression - Zone psql.Expression - Zone2 psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Version psql.Expression -} - -func (c historyQamosquitoinspectionColumns) Alias() string { - return c.tableAlias -} - -func (historyQamosquitoinspectionColumns) AliasedAs(alias string) historyQamosquitoinspectionColumns { - return buildHistoryQamosquitoinspectionColumns(alias) -} - -// HistoryQamosquitoinspectionSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryQamosquitoinspectionSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Acresbreeding omitnull.Val[float64] `db:"acresbreeding" ` - Actiontaken omitnull.Val[string] `db:"actiontaken" ` - Adultactivity omitnull.Val[int16] `db:"adultactivity" ` - Aquaticorganisms omitnull.Val[string] `db:"aquaticorganisms" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Breedingpotential omitnull.Val[string] `db:"breedingpotential" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Fish omitnull.Val[int16] `db:"fish" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Habvalue1 omitnull.Val[int16] `db:"habvalue1" ` - Habvalue1percent omitnull.Val[int16] `db:"habvalue1percent" ` - Habvalue2 omitnull.Val[int16] `db:"habvalue2" ` - Habvalue2percent omitnull.Val[int16] `db:"habvalue2percent" ` - Larvaeinsidetreatedarea omitnull.Val[int16] `db:"larvaeinsidetreatedarea" ` - Larvaeoutsidetreatedarea omitnull.Val[int16] `db:"larvaeoutsidetreatedarea" ` - Larvaepresent omitnull.Val[int16] `db:"larvaepresent" ` - Larvaereason omitnull.Val[string] `db:"larvaereason" ` - Linelocid omitnull.Val[string] `db:"linelocid" ` - Locationname omitnull.Val[string] `db:"locationname" ` - LR omitnull.Val[int16] `db:"lr" ` - Mosquitohabitat omitnull.Val[string] `db:"mosquitohabitat" ` - Movingwater omitnull.Val[int16] `db:"movingwater" ` - Negdips omitnull.Val[int16] `db:"negdips" ` - Nowaterever omitnull.Val[int16] `db:"nowaterever" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Pointlocid omitnull.Val[string] `db:"pointlocid" ` - Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` - Posdips omitnull.Val[int16] `db:"posdips" ` - Potential omitnull.Val[int16] `db:"potential" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Sitetype omitnull.Val[string] `db:"sitetype" ` - Soilconditions omitnull.Val[string] `db:"soilconditions" ` - Sourcereduction omitnull.Val[string] `db:"sourcereduction" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Totalacres omitnull.Val[float64] `db:"totalacres" ` - Vegetation omitnull.Val[string] `db:"vegetation" ` - Waterconditions omitnull.Val[string] `db:"waterconditions" ` - Waterduration omitnull.Val[string] `db:"waterduration" ` - Watermovement1 omitnull.Val[string] `db:"watermovement1" ` - Watermovement1percent omitnull.Val[int16] `db:"watermovement1percent" ` - Watermovement2 omitnull.Val[string] `db:"watermovement2" ` - Watermovement2percent omitnull.Val[int16] `db:"watermovement2percent" ` - Waterpresent omitnull.Val[int16] `db:"waterpresent" ` - Watersource omitnull.Val[string] `db:"watersource" ` - Winddir omitnull.Val[string] `db:"winddir" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryQamosquitoinspectionSetter) SetColumns() []string { - vals := make([]string, 0, 67) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Acresbreeding.IsUnset() { - vals = append(vals, "acresbreeding") - } - if !s.Actiontaken.IsUnset() { - vals = append(vals, "actiontaken") - } - if !s.Adultactivity.IsUnset() { - vals = append(vals, "adultactivity") - } - if !s.Aquaticorganisms.IsUnset() { - vals = append(vals, "aquaticorganisms") - } - if !s.Avetemp.IsUnset() { - vals = append(vals, "avetemp") - } - if !s.Breedingpotential.IsUnset() { - vals = append(vals, "breedingpotential") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Enddatetime.IsUnset() { - vals = append(vals, "enddatetime") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fieldtech.IsUnset() { - vals = append(vals, "fieldtech") - } - if !s.Fish.IsUnset() { - vals = append(vals, "fish") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Habvalue1.IsUnset() { - vals = append(vals, "habvalue1") - } - if !s.Habvalue1percent.IsUnset() { - vals = append(vals, "habvalue1percent") - } - if !s.Habvalue2.IsUnset() { - vals = append(vals, "habvalue2") - } - if !s.Habvalue2percent.IsUnset() { - vals = append(vals, "habvalue2percent") - } - if !s.Larvaeinsidetreatedarea.IsUnset() { - vals = append(vals, "larvaeinsidetreatedarea") - } - if !s.Larvaeoutsidetreatedarea.IsUnset() { - vals = append(vals, "larvaeoutsidetreatedarea") - } - if !s.Larvaepresent.IsUnset() { - vals = append(vals, "larvaepresent") - } - if !s.Larvaereason.IsUnset() { - vals = append(vals, "larvaereason") - } - if !s.Linelocid.IsUnset() { - vals = append(vals, "linelocid") - } - if !s.Locationname.IsUnset() { - vals = append(vals, "locationname") - } - if !s.LR.IsUnset() { - vals = append(vals, "lr") - } - if !s.Mosquitohabitat.IsUnset() { - vals = append(vals, "mosquitohabitat") - } - if !s.Movingwater.IsUnset() { - vals = append(vals, "movingwater") - } - if !s.Negdips.IsUnset() { - vals = append(vals, "negdips") - } - if !s.Nowaterever.IsUnset() { - vals = append(vals, "nowaterever") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Pointlocid.IsUnset() { - vals = append(vals, "pointlocid") - } - if !s.Polygonlocid.IsUnset() { - vals = append(vals, "polygonlocid") - } - if !s.Posdips.IsUnset() { - vals = append(vals, "posdips") - } - if !s.Potential.IsUnset() { - vals = append(vals, "potential") - } - if !s.Raingauge.IsUnset() { - vals = append(vals, "raingauge") - } - if !s.Recordstatus.IsUnset() { - vals = append(vals, "recordstatus") - } - if !s.Reviewed.IsUnset() { - vals = append(vals, "reviewed") - } - if !s.Reviewedby.IsUnset() { - vals = append(vals, "reviewedby") - } - if !s.Revieweddate.IsUnset() { - vals = append(vals, "revieweddate") - } - if !s.Sitetype.IsUnset() { - vals = append(vals, "sitetype") - } - if !s.Soilconditions.IsUnset() { - vals = append(vals, "soilconditions") - } - if !s.Sourcereduction.IsUnset() { - vals = append(vals, "sourcereduction") - } - if !s.Startdatetime.IsUnset() { - vals = append(vals, "startdatetime") - } - if !s.Totalacres.IsUnset() { - vals = append(vals, "totalacres") - } - if !s.Vegetation.IsUnset() { - vals = append(vals, "vegetation") - } - if !s.Waterconditions.IsUnset() { - vals = append(vals, "waterconditions") - } - if !s.Waterduration.IsUnset() { - vals = append(vals, "waterduration") - } - if !s.Watermovement1.IsUnset() { - vals = append(vals, "watermovement1") - } - if !s.Watermovement1percent.IsUnset() { - vals = append(vals, "watermovement1percent") - } - if !s.Watermovement2.IsUnset() { - vals = append(vals, "watermovement2") - } - if !s.Watermovement2percent.IsUnset() { - vals = append(vals, "watermovement2percent") - } - if !s.Waterpresent.IsUnset() { - vals = append(vals, "waterpresent") - } - if !s.Watersource.IsUnset() { - vals = append(vals, "watersource") - } - if !s.Winddir.IsUnset() { - vals = append(vals, "winddir") - } - if !s.Windspeed.IsUnset() { - vals = append(vals, "windspeed") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryQamosquitoinspectionSetter) Overwrite(t *HistoryQamosquitoinspection) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Acresbreeding.IsUnset() { - t.Acresbreeding = s.Acresbreeding.MustGetNull() - } - if !s.Actiontaken.IsUnset() { - t.Actiontaken = s.Actiontaken.MustGetNull() - } - if !s.Adultactivity.IsUnset() { - t.Adultactivity = s.Adultactivity.MustGetNull() - } - if !s.Aquaticorganisms.IsUnset() { - t.Aquaticorganisms = s.Aquaticorganisms.MustGetNull() - } - if !s.Avetemp.IsUnset() { - t.Avetemp = s.Avetemp.MustGetNull() - } - if !s.Breedingpotential.IsUnset() { - t.Breedingpotential = s.Breedingpotential.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Enddatetime.IsUnset() { - t.Enddatetime = s.Enddatetime.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fieldtech.IsUnset() { - t.Fieldtech = s.Fieldtech.MustGetNull() - } - if !s.Fish.IsUnset() { - t.Fish = s.Fish.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Habvalue1.IsUnset() { - t.Habvalue1 = s.Habvalue1.MustGetNull() - } - if !s.Habvalue1percent.IsUnset() { - t.Habvalue1percent = s.Habvalue1percent.MustGetNull() - } - if !s.Habvalue2.IsUnset() { - t.Habvalue2 = s.Habvalue2.MustGetNull() - } - if !s.Habvalue2percent.IsUnset() { - t.Habvalue2percent = s.Habvalue2percent.MustGetNull() - } - if !s.Larvaeinsidetreatedarea.IsUnset() { - t.Larvaeinsidetreatedarea = s.Larvaeinsidetreatedarea.MustGetNull() - } - if !s.Larvaeoutsidetreatedarea.IsUnset() { - t.Larvaeoutsidetreatedarea = s.Larvaeoutsidetreatedarea.MustGetNull() - } - if !s.Larvaepresent.IsUnset() { - t.Larvaepresent = s.Larvaepresent.MustGetNull() - } - if !s.Larvaereason.IsUnset() { - t.Larvaereason = s.Larvaereason.MustGetNull() - } - if !s.Linelocid.IsUnset() { - t.Linelocid = s.Linelocid.MustGetNull() - } - if !s.Locationname.IsUnset() { - t.Locationname = s.Locationname.MustGetNull() - } - if !s.LR.IsUnset() { - t.LR = s.LR.MustGetNull() - } - if !s.Mosquitohabitat.IsUnset() { - t.Mosquitohabitat = s.Mosquitohabitat.MustGetNull() - } - if !s.Movingwater.IsUnset() { - t.Movingwater = s.Movingwater.MustGetNull() - } - if !s.Negdips.IsUnset() { - t.Negdips = s.Negdips.MustGetNull() - } - if !s.Nowaterever.IsUnset() { - t.Nowaterever = s.Nowaterever.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Pointlocid.IsUnset() { - t.Pointlocid = s.Pointlocid.MustGetNull() - } - if !s.Polygonlocid.IsUnset() { - t.Polygonlocid = s.Polygonlocid.MustGetNull() - } - if !s.Posdips.IsUnset() { - t.Posdips = s.Posdips.MustGetNull() - } - if !s.Potential.IsUnset() { - t.Potential = s.Potential.MustGetNull() - } - if !s.Raingauge.IsUnset() { - t.Raingauge = s.Raingauge.MustGetNull() - } - if !s.Recordstatus.IsUnset() { - t.Recordstatus = s.Recordstatus.MustGetNull() - } - if !s.Reviewed.IsUnset() { - t.Reviewed = s.Reviewed.MustGetNull() - } - if !s.Reviewedby.IsUnset() { - t.Reviewedby = s.Reviewedby.MustGetNull() - } - if !s.Revieweddate.IsUnset() { - t.Revieweddate = s.Revieweddate.MustGetNull() - } - if !s.Sitetype.IsUnset() { - t.Sitetype = s.Sitetype.MustGetNull() - } - if !s.Soilconditions.IsUnset() { - t.Soilconditions = s.Soilconditions.MustGetNull() - } - if !s.Sourcereduction.IsUnset() { - t.Sourcereduction = s.Sourcereduction.MustGetNull() - } - if !s.Startdatetime.IsUnset() { - t.Startdatetime = s.Startdatetime.MustGetNull() - } - if !s.Totalacres.IsUnset() { - t.Totalacres = s.Totalacres.MustGetNull() - } - if !s.Vegetation.IsUnset() { - t.Vegetation = s.Vegetation.MustGetNull() - } - if !s.Waterconditions.IsUnset() { - t.Waterconditions = s.Waterconditions.MustGetNull() - } - if !s.Waterduration.IsUnset() { - t.Waterduration = s.Waterduration.MustGetNull() - } - if !s.Watermovement1.IsUnset() { - t.Watermovement1 = s.Watermovement1.MustGetNull() - } - if !s.Watermovement1percent.IsUnset() { - t.Watermovement1percent = s.Watermovement1percent.MustGetNull() - } - if !s.Watermovement2.IsUnset() { - t.Watermovement2 = s.Watermovement2.MustGetNull() - } - if !s.Watermovement2percent.IsUnset() { - t.Watermovement2percent = s.Watermovement2percent.MustGetNull() - } - if !s.Waterpresent.IsUnset() { - t.Waterpresent = s.Waterpresent.MustGetNull() - } - if !s.Watersource.IsUnset() { - t.Watersource = s.Watersource.MustGetNull() - } - if !s.Winddir.IsUnset() { - t.Winddir = s.Winddir.MustGetNull() - } - if !s.Windspeed.IsUnset() { - t.Windspeed = s.Windspeed.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryQamosquitoinspections.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 67) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Acresbreeding.IsUnset() { - vals[1] = psql.Arg(s.Acresbreeding.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Actiontaken.IsUnset() { - vals[2] = psql.Arg(s.Actiontaken.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Adultactivity.IsUnset() { - vals[3] = psql.Arg(s.Adultactivity.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Aquaticorganisms.IsUnset() { - vals[4] = psql.Arg(s.Aquaticorganisms.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Avetemp.IsUnset() { - vals[5] = psql.Arg(s.Avetemp.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Breedingpotential.IsUnset() { - vals[6] = psql.Arg(s.Breedingpotential.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[7] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[8] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[9] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Enddatetime.IsUnset() { - vals[10] = psql.Arg(s.Enddatetime.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[11] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[12] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Fieldtech.IsUnset() { - vals[13] = psql.Arg(s.Fieldtech.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Fish.IsUnset() { - vals[14] = psql.Arg(s.Fish.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[15] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Habvalue1.IsUnset() { - vals[16] = psql.Arg(s.Habvalue1.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Habvalue1percent.IsUnset() { - vals[17] = psql.Arg(s.Habvalue1percent.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Habvalue2.IsUnset() { - vals[18] = psql.Arg(s.Habvalue2.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Habvalue2percent.IsUnset() { - vals[19] = psql.Arg(s.Habvalue2percent.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Larvaeinsidetreatedarea.IsUnset() { - vals[20] = psql.Arg(s.Larvaeinsidetreatedarea.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Larvaeoutsidetreatedarea.IsUnset() { - vals[21] = psql.Arg(s.Larvaeoutsidetreatedarea.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Larvaepresent.IsUnset() { - vals[22] = psql.Arg(s.Larvaepresent.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Larvaereason.IsUnset() { - vals[23] = psql.Arg(s.Larvaereason.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Linelocid.IsUnset() { - vals[24] = psql.Arg(s.Linelocid.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Locationname.IsUnset() { - vals[25] = psql.Arg(s.Locationname.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.LR.IsUnset() { - vals[26] = psql.Arg(s.LR.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Mosquitohabitat.IsUnset() { - vals[27] = psql.Arg(s.Mosquitohabitat.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Movingwater.IsUnset() { - vals[28] = psql.Arg(s.Movingwater.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Negdips.IsUnset() { - vals[29] = psql.Arg(s.Negdips.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Nowaterever.IsUnset() { - vals[30] = psql.Arg(s.Nowaterever.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[31] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Pointlocid.IsUnset() { - vals[32] = psql.Arg(s.Pointlocid.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Polygonlocid.IsUnset() { - vals[33] = psql.Arg(s.Polygonlocid.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Posdips.IsUnset() { - vals[34] = psql.Arg(s.Posdips.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Potential.IsUnset() { - vals[35] = psql.Arg(s.Potential.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Raingauge.IsUnset() { - vals[36] = psql.Arg(s.Raingauge.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.Recordstatus.IsUnset() { - vals[37] = psql.Arg(s.Recordstatus.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.Reviewed.IsUnset() { - vals[38] = psql.Arg(s.Reviewed.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Reviewedby.IsUnset() { - vals[39] = psql.Arg(s.Reviewedby.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Revieweddate.IsUnset() { - vals[40] = psql.Arg(s.Revieweddate.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.Sitetype.IsUnset() { - vals[41] = psql.Arg(s.Sitetype.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.Soilconditions.IsUnset() { - vals[42] = psql.Arg(s.Soilconditions.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.Sourcereduction.IsUnset() { - vals[43] = psql.Arg(s.Sourcereduction.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.Startdatetime.IsUnset() { - vals[44] = psql.Arg(s.Startdatetime.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if !s.Totalacres.IsUnset() { - vals[45] = psql.Arg(s.Totalacres.MustGetNull()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if !s.Vegetation.IsUnset() { - vals[46] = psql.Arg(s.Vegetation.MustGetNull()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - if !s.Waterconditions.IsUnset() { - vals[47] = psql.Arg(s.Waterconditions.MustGetNull()) - } else { - vals[47] = psql.Raw("DEFAULT") - } - - if !s.Waterduration.IsUnset() { - vals[48] = psql.Arg(s.Waterduration.MustGetNull()) - } else { - vals[48] = psql.Raw("DEFAULT") - } - - if !s.Watermovement1.IsUnset() { - vals[49] = psql.Arg(s.Watermovement1.MustGetNull()) - } else { - vals[49] = psql.Raw("DEFAULT") - } - - if !s.Watermovement1percent.IsUnset() { - vals[50] = psql.Arg(s.Watermovement1percent.MustGetNull()) - } else { - vals[50] = psql.Raw("DEFAULT") - } - - if !s.Watermovement2.IsUnset() { - vals[51] = psql.Arg(s.Watermovement2.MustGetNull()) - } else { - vals[51] = psql.Raw("DEFAULT") - } - - if !s.Watermovement2percent.IsUnset() { - vals[52] = psql.Arg(s.Watermovement2percent.MustGetNull()) - } else { - vals[52] = psql.Raw("DEFAULT") - } - - if !s.Waterpresent.IsUnset() { - vals[53] = psql.Arg(s.Waterpresent.MustGetNull()) - } else { - vals[53] = psql.Raw("DEFAULT") - } - - if !s.Watersource.IsUnset() { - vals[54] = psql.Arg(s.Watersource.MustGetNull()) - } else { - vals[54] = psql.Raw("DEFAULT") - } - - if !s.Winddir.IsUnset() { - vals[55] = psql.Arg(s.Winddir.MustGetNull()) - } else { - vals[55] = psql.Raw("DEFAULT") - } - - if !s.Windspeed.IsUnset() { - vals[56] = psql.Arg(s.Windspeed.MustGetNull()) - } else { - vals[56] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[57] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[57] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[58] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[58] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[59] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[59] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[60] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[60] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[61] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[61] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[62] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[62] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[63] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[63] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[64] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[64] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[65] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[65] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[66] = psql.Arg(s.Version.MustGet()) - } else { - vals[66] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryQamosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryQamosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 67) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Acresbreeding.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "acresbreeding")...), - psql.Arg(s.Acresbreeding), - }}) - } - - if !s.Actiontaken.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "actiontaken")...), - psql.Arg(s.Actiontaken), - }}) - } - - if !s.Adultactivity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "adultactivity")...), - psql.Arg(s.Adultactivity), - }}) - } - - if !s.Aquaticorganisms.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "aquaticorganisms")...), - psql.Arg(s.Aquaticorganisms), - }}) - } - - if !s.Avetemp.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "avetemp")...), - psql.Arg(s.Avetemp), - }}) - } - - if !s.Breedingpotential.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "breedingpotential")...), - psql.Arg(s.Breedingpotential), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Enddatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "enddatetime")...), - psql.Arg(s.Enddatetime), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fieldtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldtech")...), - psql.Arg(s.Fieldtech), - }}) - } - - if !s.Fish.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fish")...), - psql.Arg(s.Fish), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habvalue1.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habvalue1")...), - psql.Arg(s.Habvalue1), - }}) - } - - if !s.Habvalue1percent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habvalue1percent")...), - psql.Arg(s.Habvalue1percent), - }}) - } - - if !s.Habvalue2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habvalue2")...), - psql.Arg(s.Habvalue2), - }}) - } - - if !s.Habvalue2percent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habvalue2percent")...), - psql.Arg(s.Habvalue2percent), - }}) - } - - if !s.Larvaeinsidetreatedarea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvaeinsidetreatedarea")...), - psql.Arg(s.Larvaeinsidetreatedarea), - }}) - } - - if !s.Larvaeoutsidetreatedarea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvaeoutsidetreatedarea")...), - psql.Arg(s.Larvaeoutsidetreatedarea), - }}) - } - - if !s.Larvaepresent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvaepresent")...), - psql.Arg(s.Larvaepresent), - }}) - } - - if !s.Larvaereason.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvaereason")...), - psql.Arg(s.Larvaereason), - }}) - } - - if !s.Linelocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "linelocid")...), - psql.Arg(s.Linelocid), - }}) - } - - if !s.Locationname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationname")...), - psql.Arg(s.Locationname), - }}) - } - - if !s.LR.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lr")...), - psql.Arg(s.LR), - }}) - } - - if !s.Mosquitohabitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "mosquitohabitat")...), - psql.Arg(s.Mosquitohabitat), - }}) - } - - if !s.Movingwater.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "movingwater")...), - psql.Arg(s.Movingwater), - }}) - } - - if !s.Negdips.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "negdips")...), - psql.Arg(s.Negdips), - }}) - } - - if !s.Nowaterever.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nowaterever")...), - psql.Arg(s.Nowaterever), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Pointlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pointlocid")...), - psql.Arg(s.Pointlocid), - }}) - } - - if !s.Polygonlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "polygonlocid")...), - psql.Arg(s.Polygonlocid), - }}) - } - - if !s.Posdips.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "posdips")...), - psql.Arg(s.Posdips), - }}) - } - - if !s.Potential.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "potential")...), - psql.Arg(s.Potential), - }}) - } - - if !s.Raingauge.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "raingauge")...), - psql.Arg(s.Raingauge), - }}) - } - - if !s.Recordstatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "recordstatus")...), - psql.Arg(s.Recordstatus), - }}) - } - - if !s.Reviewed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewed")...), - psql.Arg(s.Reviewed), - }}) - } - - if !s.Reviewedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewedby")...), - psql.Arg(s.Reviewedby), - }}) - } - - if !s.Revieweddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "revieweddate")...), - psql.Arg(s.Revieweddate), - }}) - } - - if !s.Sitetype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sitetype")...), - psql.Arg(s.Sitetype), - }}) - } - - if !s.Soilconditions.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "soilconditions")...), - psql.Arg(s.Soilconditions), - }}) - } - - if !s.Sourcereduction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sourcereduction")...), - psql.Arg(s.Sourcereduction), - }}) - } - - if !s.Startdatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "startdatetime")...), - psql.Arg(s.Startdatetime), - }}) - } - - if !s.Totalacres.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "totalacres")...), - psql.Arg(s.Totalacres), - }}) - } - - if !s.Vegetation.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vegetation")...), - psql.Arg(s.Vegetation), - }}) - } - - if !s.Waterconditions.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "waterconditions")...), - psql.Arg(s.Waterconditions), - }}) - } - - if !s.Waterduration.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "waterduration")...), - psql.Arg(s.Waterduration), - }}) - } - - if !s.Watermovement1.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "watermovement1")...), - psql.Arg(s.Watermovement1), - }}) - } - - if !s.Watermovement1percent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "watermovement1percent")...), - psql.Arg(s.Watermovement1percent), - }}) - } - - if !s.Watermovement2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "watermovement2")...), - psql.Arg(s.Watermovement2), - }}) - } - - if !s.Watermovement2percent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "watermovement2percent")...), - psql.Arg(s.Watermovement2percent), - }}) - } - - if !s.Waterpresent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "waterpresent")...), - psql.Arg(s.Waterpresent), - }}) - } - - if !s.Watersource.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "watersource")...), - psql.Arg(s.Watersource), - }}) - } - - if !s.Winddir.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "winddir")...), - psql.Arg(s.Winddir), - }}) - } - - if !s.Windspeed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "windspeed")...), - psql.Arg(s.Windspeed), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryQamosquitoinspection retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryQamosquitoinspection(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryQamosquitoinspection, error) { - if len(cols) == 0 { - return HistoryQamosquitoinspections.Query( - sm.Where(HistoryQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryQamosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryQamosquitoinspections.Query( - sm.Where(HistoryQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryQamosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryQamosquitoinspections.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryQamosquitoinspectionExists checks the presence of a single record by primary key -func HistoryQamosquitoinspectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryQamosquitoinspections.Query( - sm.Where(HistoryQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryQamosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryQamosquitoinspection is retrieved from the database -func (o *HistoryQamosquitoinspection) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryQamosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, HistoryQamosquitoinspectionSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryQamosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, HistoryQamosquitoinspectionSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryQamosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, HistoryQamosquitoinspectionSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryQamosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, HistoryQamosquitoinspectionSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryQamosquitoinspection -func (o *HistoryQamosquitoinspection) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryQamosquitoinspection) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_qamosquitoinspection", "objectid"), psql.Quote("history_qamosquitoinspection", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryQamosquitoinspection -func (o *HistoryQamosquitoinspection) Update(ctx context.Context, exec bob.Executor, s *HistoryQamosquitoinspectionSetter) error { - v, err := HistoryQamosquitoinspections.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 HistoryQamosquitoinspection record with an executor -func (o *HistoryQamosquitoinspection) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryQamosquitoinspections.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryQamosquitoinspection using the executor -func (o *HistoryQamosquitoinspection) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryQamosquitoinspections.Query( - sm.Where(HistoryQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryQamosquitoinspections.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryQamosquitoinspectionSlice is retrieved from the database -func (o HistoryQamosquitoinspectionSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryQamosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryQamosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryQamosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryQamosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryQamosquitoinspectionSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_qamosquitoinspection", "objectid"), psql.Quote("history_qamosquitoinspection", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryQamosquitoinspectionSlice) copyMatchingRows(from ...*HistoryQamosquitoinspection) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryQamosquitoinspectionSlice) 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 HistoryQamosquitoinspections.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 *HistoryQamosquitoinspection: - o.copyMatchingRows(retrieved) - case []*HistoryQamosquitoinspection: - o.copyMatchingRows(retrieved...) - case HistoryQamosquitoinspectionSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryQamosquitoinspection or a slice of HistoryQamosquitoinspection - // then run the AfterUpdateHooks on the slice - _, err = HistoryQamosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryQamosquitoinspectionSlice) 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 HistoryQamosquitoinspections.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 *HistoryQamosquitoinspection: - o.copyMatchingRows(retrieved) - case []*HistoryQamosquitoinspection: - o.copyMatchingRows(retrieved...) - case HistoryQamosquitoinspectionSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryQamosquitoinspection or a slice of HistoryQamosquitoinspection - // then run the AfterDeleteHooks on the slice - _, err = HistoryQamosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryQamosquitoinspectionSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryQamosquitoinspectionSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryQamosquitoinspections.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryQamosquitoinspectionSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryQamosquitoinspections.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryQamosquitoinspectionSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryQamosquitoinspections.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 *HistoryQamosquitoinspection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryQamosquitoinspectionSlice) 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 attachHistoryQamosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, historyQamosquitoinspection0 *HistoryQamosquitoinspection, organization1 *Organization) (*HistoryQamosquitoinspection, error) { - setter := &HistoryQamosquitoinspectionSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyQamosquitoinspection0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryQamosquitoinspectionOrganization0: %w", err) - } - - return historyQamosquitoinspection0, nil -} - -func (historyQamosquitoinspection0 *HistoryQamosquitoinspection) 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 = attachHistoryQamosquitoinspectionOrganization0(ctx, exec, 1, historyQamosquitoinspection0, organization1) - if err != nil { - return err - } - - historyQamosquitoinspection0.R.Organization = organization1 - - organization1.R.HistoryQamosquitoinspections = append(organization1.R.HistoryQamosquitoinspections, historyQamosquitoinspection0) - - return nil -} - -func (historyQamosquitoinspection0 *HistoryQamosquitoinspection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryQamosquitoinspectionOrganization0(ctx, exec, 1, historyQamosquitoinspection0, organization1) - if err != nil { - return err - } - - historyQamosquitoinspection0.R.Organization = organization1 - - organization1.R.HistoryQamosquitoinspections = append(organization1.R.HistoryQamosquitoinspections, historyQamosquitoinspection0) - - return nil -} - -type historyQamosquitoinspectionWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Acresbreeding psql.WhereNullMod[Q, float64] - Actiontaken psql.WhereNullMod[Q, string] - Adultactivity psql.WhereNullMod[Q, int16] - Aquaticorganisms psql.WhereNullMod[Q, string] - Avetemp psql.WhereNullMod[Q, float64] - Breedingpotential psql.WhereNullMod[Q, string] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Enddatetime psql.WhereNullMod[Q, int64] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fieldtech psql.WhereNullMod[Q, string] - Fish psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] - Habvalue1 psql.WhereNullMod[Q, int16] - Habvalue1percent psql.WhereNullMod[Q, int16] - Habvalue2 psql.WhereNullMod[Q, int16] - Habvalue2percent psql.WhereNullMod[Q, int16] - Larvaeinsidetreatedarea psql.WhereNullMod[Q, int16] - Larvaeoutsidetreatedarea psql.WhereNullMod[Q, int16] - Larvaepresent psql.WhereNullMod[Q, int16] - Larvaereason psql.WhereNullMod[Q, string] - Linelocid psql.WhereNullMod[Q, string] - Locationname psql.WhereNullMod[Q, string] - LR psql.WhereNullMod[Q, int16] - Mosquitohabitat psql.WhereNullMod[Q, string] - Movingwater psql.WhereNullMod[Q, int16] - Negdips psql.WhereNullMod[Q, int16] - Nowaterever psql.WhereNullMod[Q, int16] - Objectid psql.WhereMod[Q, int32] - Pointlocid psql.WhereNullMod[Q, string] - Polygonlocid psql.WhereNullMod[Q, string] - Posdips psql.WhereNullMod[Q, int16] - Potential psql.WhereNullMod[Q, int16] - Raingauge psql.WhereNullMod[Q, float64] - Recordstatus psql.WhereNullMod[Q, int16] - Reviewed psql.WhereNullMod[Q, int16] - Reviewedby psql.WhereNullMod[Q, string] - Revieweddate psql.WhereNullMod[Q, int64] - Sitetype psql.WhereNullMod[Q, string] - Soilconditions psql.WhereNullMod[Q, string] - Sourcereduction psql.WhereNullMod[Q, string] - Startdatetime psql.WhereNullMod[Q, int64] - Totalacres psql.WhereNullMod[Q, float64] - Vegetation psql.WhereNullMod[Q, string] - Waterconditions psql.WhereNullMod[Q, string] - Waterduration psql.WhereNullMod[Q, string] - Watermovement1 psql.WhereNullMod[Q, string] - Watermovement1percent psql.WhereNullMod[Q, int16] - Watermovement2 psql.WhereNullMod[Q, string] - Watermovement2percent psql.WhereNullMod[Q, int16] - Waterpresent psql.WhereNullMod[Q, int16] - Watersource psql.WhereNullMod[Q, string] - Winddir psql.WhereNullMod[Q, string] - Windspeed psql.WhereNullMod[Q, float64] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyQamosquitoinspectionWhere[Q]) AliasedAs(alias string) historyQamosquitoinspectionWhere[Q] { - return buildHistoryQamosquitoinspectionWhere[Q](buildHistoryQamosquitoinspectionColumns(alias)) -} - -func buildHistoryQamosquitoinspectionWhere[Q psql.Filterable](cols historyQamosquitoinspectionColumns) historyQamosquitoinspectionWhere[Q] { - return historyQamosquitoinspectionWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Acresbreeding: psql.WhereNull[Q, float64](cols.Acresbreeding), - Actiontaken: psql.WhereNull[Q, string](cols.Actiontaken), - Adultactivity: psql.WhereNull[Q, int16](cols.Adultactivity), - Aquaticorganisms: psql.WhereNull[Q, string](cols.Aquaticorganisms), - Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), - Breedingpotential: psql.WhereNull[Q, string](cols.Breedingpotential), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - 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), - Habvalue1: psql.WhereNull[Q, int16](cols.Habvalue1), - Habvalue1percent: psql.WhereNull[Q, int16](cols.Habvalue1percent), - Habvalue2: psql.WhereNull[Q, int16](cols.Habvalue2), - Habvalue2percent: psql.WhereNull[Q, int16](cols.Habvalue2percent), - Larvaeinsidetreatedarea: psql.WhereNull[Q, int16](cols.Larvaeinsidetreatedarea), - Larvaeoutsidetreatedarea: psql.WhereNull[Q, int16](cols.Larvaeoutsidetreatedarea), - Larvaepresent: psql.WhereNull[Q, int16](cols.Larvaepresent), - Larvaereason: psql.WhereNull[Q, string](cols.Larvaereason), - Linelocid: psql.WhereNull[Q, string](cols.Linelocid), - Locationname: psql.WhereNull[Q, string](cols.Locationname), - LR: psql.WhereNull[Q, int16](cols.LR), - Mosquitohabitat: psql.WhereNull[Q, string](cols.Mosquitohabitat), - Movingwater: psql.WhereNull[Q, int16](cols.Movingwater), - Negdips: psql.WhereNull[Q, int16](cols.Negdips), - Nowaterever: psql.WhereNull[Q, int16](cols.Nowaterever), - Objectid: psql.Where[Q, int32](cols.Objectid), - Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), - Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), - Posdips: psql.WhereNull[Q, int16](cols.Posdips), - Potential: psql.WhereNull[Q, int16](cols.Potential), - Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), - Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), - Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), - Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), - Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), - Sitetype: psql.WhereNull[Q, string](cols.Sitetype), - Soilconditions: psql.WhereNull[Q, string](cols.Soilconditions), - Sourcereduction: psql.WhereNull[Q, string](cols.Sourcereduction), - Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), - Totalacres: psql.WhereNull[Q, float64](cols.Totalacres), - Vegetation: psql.WhereNull[Q, string](cols.Vegetation), - Waterconditions: psql.WhereNull[Q, string](cols.Waterconditions), - Waterduration: psql.WhereNull[Q, string](cols.Waterduration), - Watermovement1: psql.WhereNull[Q, string](cols.Watermovement1), - Watermovement1percent: psql.WhereNull[Q, int16](cols.Watermovement1percent), - Watermovement2: psql.WhereNull[Q, string](cols.Watermovement2), - Watermovement2percent: psql.WhereNull[Q, int16](cols.Watermovement2percent), - Waterpresent: psql.WhereNull[Q, int16](cols.Waterpresent), - Watersource: psql.WhereNull[Q, string](cols.Watersource), - Winddir: psql.WhereNull[Q, string](cols.Winddir), - Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), - Zone: psql.WhereNull[Q, string](cols.Zone), - Zone2: psql.WhereNull[Q, string](cols.Zone2), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryQamosquitoinspection) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyQamosquitoinspection cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryQamosquitoinspections = HistoryQamosquitoinspectionSlice{o} - } - return nil - default: - return fmt.Errorf("historyQamosquitoinspection has no relationship %q", name) - } -} - -type historyQamosquitoinspectionPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryQamosquitoinspectionPreloader() historyQamosquitoinspectionPreloader { - return historyQamosquitoinspectionPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryQamosquitoinspections, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyQamosquitoinspectionThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryQamosquitoinspectionThenLoader[Q orm.Loadable]() historyQamosquitoinspectionThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyQamosquitoinspectionThenLoader[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 historyQamosquitoinspection's Organization into the .R struct -func (o *HistoryQamosquitoinspection) 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.HistoryQamosquitoinspections = HistoryQamosquitoinspectionSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyQamosquitoinspection's Organization into the .R struct -func (os HistoryQamosquitoinspectionSlice) 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.HistoryQamosquitoinspections = append(rel.R.HistoryQamosquitoinspections, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyQamosquitoinspectionJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyQamosquitoinspectionJoins[Q]) aliasedAs(alias string) historyQamosquitoinspectionJoins[Q] { - return buildHistoryQamosquitoinspectionJoins[Q](buildHistoryQamosquitoinspectionColumns(alias), j.typ) -} - -func buildHistoryQamosquitoinspectionJoins[Q dialect.Joinable](cols historyQamosquitoinspectionColumns, typ string) historyQamosquitoinspectionJoins[Q] { - return historyQamosquitoinspectionJoins[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/db/models/history_rodentlocation.bob.go b/db/models/history_rodentlocation.bob.go deleted file mode 100644 index 8b03f1fb..00000000 --- a/db/models/history_rodentlocation.bob.go +++ /dev/null @@ -1,1440 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryRodentlocation is an object representing the database table. -type HistoryRodentlocation struct { - OrganizationID int32 `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Lastinspectaction null.Val[string] `db:"lastinspectaction" ` - Lastinspectconditions null.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate null.Val[int64] `db:"lastinspectdate" ` - Lastinspectrodentevidence null.Val[string] `db:"lastinspectrodentevidence" ` - Lastinspectspecies null.Val[string] `db:"lastinspectspecies" ` - Locationname null.Val[string] `db:"locationname" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Symbology null.Val[string] `db:"symbology" ` - Usetype null.Val[string] `db:"usetype" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Version int32 `db:"version,pk" ` - - R historyRodentlocationR `db:"-" ` -} - -// HistoryRodentlocationSlice is an alias for a slice of pointers to HistoryRodentlocation. -// This should almost always be used instead of []*HistoryRodentlocation. -type HistoryRodentlocationSlice []*HistoryRodentlocation - -// HistoryRodentlocations contains methods to work with the history_rodentlocation table -var HistoryRodentlocations = psql.NewTablex[*HistoryRodentlocation, HistoryRodentlocationSlice, *HistoryRodentlocationSetter]("", "history_rodentlocation", buildHistoryRodentlocationColumns("history_rodentlocation")) - -// HistoryRodentlocationsQuery is a query on the history_rodentlocation table -type HistoryRodentlocationsQuery = *psql.ViewQuery[*HistoryRodentlocation, HistoryRodentlocationSlice] - -// historyRodentlocationR is where relationships are stored. -type historyRodentlocationR struct { - Organization *Organization // history_rodentlocation.history_rodentlocation_organization_id_fkey -} - -func buildHistoryRodentlocationColumns(alias string) historyRodentlocationColumns { - return historyRodentlocationColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "globalid", "habitat", "lastinspectaction", "lastinspectconditions", "lastinspectdate", "lastinspectrodentevidence", "lastinspectspecies", "locationname", "locationnumber", "nextactiondatescheduled", "objectid", "priority", "symbology", "usetype", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "jurisdiction", "version", - ).WithParent("history_rodentlocation"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accessdesc: psql.Quote(alias, "accessdesc"), - Active: psql.Quote(alias, "active"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Description: psql.Quote(alias, "description"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Habitat: psql.Quote(alias, "habitat"), - Lastinspectaction: psql.Quote(alias, "lastinspectaction"), - Lastinspectconditions: psql.Quote(alias, "lastinspectconditions"), - Lastinspectdate: psql.Quote(alias, "lastinspectdate"), - Lastinspectrodentevidence: psql.Quote(alias, "lastinspectrodentevidence"), - Lastinspectspecies: psql.Quote(alias, "lastinspectspecies"), - Locationname: psql.Quote(alias, "locationname"), - Locationnumber: psql.Quote(alias, "locationnumber"), - Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), - Objectid: psql.Quote(alias, "objectid"), - Priority: psql.Quote(alias, "priority"), - Symbology: psql.Quote(alias, "symbology"), - Usetype: psql.Quote(alias, "usetype"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Jurisdiction: psql.Quote(alias, "jurisdiction"), - Version: psql.Quote(alias, "version"), - } -} - -type historyRodentlocationColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accessdesc psql.Expression - Active psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Description psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Habitat psql.Expression - Lastinspectaction psql.Expression - Lastinspectconditions psql.Expression - Lastinspectdate psql.Expression - Lastinspectrodentevidence psql.Expression - Lastinspectspecies psql.Expression - Locationname psql.Expression - Locationnumber psql.Expression - Nextactiondatescheduled psql.Expression - Objectid psql.Expression - Priority psql.Expression - Symbology psql.Expression - Usetype psql.Expression - Zone psql.Expression - Zone2 psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Jurisdiction psql.Expression - Version psql.Expression -} - -func (c historyRodentlocationColumns) Alias() string { - return c.tableAlias -} - -func (historyRodentlocationColumns) AliasedAs(alias string) historyRodentlocationColumns { - return buildHistoryRodentlocationColumns(alias) -} - -// HistoryRodentlocationSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryRodentlocationSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Lastinspectaction omitnull.Val[string] `db:"lastinspectaction" ` - Lastinspectconditions omitnull.Val[string] `db:"lastinspectconditions" ` - Lastinspectdate omitnull.Val[int64] `db:"lastinspectdate" ` - Lastinspectrodentevidence omitnull.Val[string] `db:"lastinspectrodentevidence" ` - Lastinspectspecies omitnull.Val[string] `db:"lastinspectspecies" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Symbology omitnull.Val[string] `db:"symbology" ` - Usetype omitnull.Val[string] `db:"usetype" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryRodentlocationSetter) SetColumns() []string { - vals := make([]string, 0, 35) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accessdesc.IsUnset() { - vals = append(vals, "accessdesc") - } - if !s.Active.IsUnset() { - vals = append(vals, "active") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Description.IsUnset() { - vals = append(vals, "description") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Habitat.IsUnset() { - vals = append(vals, "habitat") - } - if !s.Lastinspectaction.IsUnset() { - vals = append(vals, "lastinspectaction") - } - if !s.Lastinspectconditions.IsUnset() { - vals = append(vals, "lastinspectconditions") - } - if !s.Lastinspectdate.IsUnset() { - vals = append(vals, "lastinspectdate") - } - if !s.Lastinspectrodentevidence.IsUnset() { - vals = append(vals, "lastinspectrodentevidence") - } - if !s.Lastinspectspecies.IsUnset() { - vals = append(vals, "lastinspectspecies") - } - if !s.Locationname.IsUnset() { - vals = append(vals, "locationname") - } - if !s.Locationnumber.IsUnset() { - vals = append(vals, "locationnumber") - } - if !s.Nextactiondatescheduled.IsUnset() { - vals = append(vals, "nextactiondatescheduled") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Symbology.IsUnset() { - vals = append(vals, "symbology") - } - if !s.Usetype.IsUnset() { - vals = append(vals, "usetype") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Jurisdiction.IsUnset() { - vals = append(vals, "jurisdiction") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryRodentlocationSetter) Overwrite(t *HistoryRodentlocation) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accessdesc.IsUnset() { - t.Accessdesc = s.Accessdesc.MustGetNull() - } - if !s.Active.IsUnset() { - t.Active = s.Active.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Description.IsUnset() { - t.Description = s.Description.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Habitat.IsUnset() { - t.Habitat = s.Habitat.MustGetNull() - } - if !s.Lastinspectaction.IsUnset() { - t.Lastinspectaction = s.Lastinspectaction.MustGetNull() - } - if !s.Lastinspectconditions.IsUnset() { - t.Lastinspectconditions = s.Lastinspectconditions.MustGetNull() - } - if !s.Lastinspectdate.IsUnset() { - t.Lastinspectdate = s.Lastinspectdate.MustGetNull() - } - if !s.Lastinspectrodentevidence.IsUnset() { - t.Lastinspectrodentevidence = s.Lastinspectrodentevidence.MustGetNull() - } - if !s.Lastinspectspecies.IsUnset() { - t.Lastinspectspecies = s.Lastinspectspecies.MustGetNull() - } - if !s.Locationname.IsUnset() { - t.Locationname = s.Locationname.MustGetNull() - } - if !s.Locationnumber.IsUnset() { - t.Locationnumber = s.Locationnumber.MustGetNull() - } - if !s.Nextactiondatescheduled.IsUnset() { - t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Symbology.IsUnset() { - t.Symbology = s.Symbology.MustGetNull() - } - if !s.Usetype.IsUnset() { - t.Usetype = s.Usetype.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Jurisdiction.IsUnset() { - t.Jurisdiction = s.Jurisdiction.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryRodentlocationSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryRodentlocations.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 35) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accessdesc.IsUnset() { - vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Active.IsUnset() { - vals[2] = psql.Arg(s.Active.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[3] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[4] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[5] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Description.IsUnset() { - vals[6] = psql.Arg(s.Description.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[7] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[8] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[9] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[10] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Habitat.IsUnset() { - vals[11] = psql.Arg(s.Habitat.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectaction.IsUnset() { - vals[12] = psql.Arg(s.Lastinspectaction.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectconditions.IsUnset() { - vals[13] = psql.Arg(s.Lastinspectconditions.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectdate.IsUnset() { - vals[14] = psql.Arg(s.Lastinspectdate.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectrodentevidence.IsUnset() { - vals[15] = psql.Arg(s.Lastinspectrodentevidence.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Lastinspectspecies.IsUnset() { - vals[16] = psql.Arg(s.Lastinspectspecies.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Locationname.IsUnset() { - vals[17] = psql.Arg(s.Locationname.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Locationnumber.IsUnset() { - vals[18] = psql.Arg(s.Locationnumber.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Nextactiondatescheduled.IsUnset() { - vals[19] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[20] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[21] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Symbology.IsUnset() { - vals[22] = psql.Arg(s.Symbology.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Usetype.IsUnset() { - vals[23] = psql.Arg(s.Usetype.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[24] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[25] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[26] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[27] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[28] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[29] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[30] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[31] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[32] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Jurisdiction.IsUnset() { - vals[33] = psql.Arg(s.Jurisdiction.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[34] = psql.Arg(s.Version.MustGet()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryRodentlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryRodentlocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 35) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accessdesc.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accessdesc")...), - psql.Arg(s.Accessdesc), - }}) - } - - if !s.Active.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "active")...), - psql.Arg(s.Active), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Description.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "description")...), - psql.Arg(s.Description), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitat")...), - psql.Arg(s.Habitat), - }}) - } - - if !s.Lastinspectaction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectaction")...), - psql.Arg(s.Lastinspectaction), - }}) - } - - if !s.Lastinspectconditions.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectconditions")...), - psql.Arg(s.Lastinspectconditions), - }}) - } - - if !s.Lastinspectdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectdate")...), - psql.Arg(s.Lastinspectdate), - }}) - } - - if !s.Lastinspectrodentevidence.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectrodentevidence")...), - psql.Arg(s.Lastinspectrodentevidence), - }}) - } - - if !s.Lastinspectspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastinspectspecies")...), - psql.Arg(s.Lastinspectspecies), - }}) - } - - if !s.Locationname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationname")...), - psql.Arg(s.Locationname), - }}) - } - - if !s.Locationnumber.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationnumber")...), - psql.Arg(s.Locationnumber), - }}) - } - - if !s.Nextactiondatescheduled.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nextactiondatescheduled")...), - psql.Arg(s.Nextactiondatescheduled), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Symbology.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "symbology")...), - psql.Arg(s.Symbology), - }}) - } - - if !s.Usetype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "usetype")...), - psql.Arg(s.Usetype), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Jurisdiction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "jurisdiction")...), - psql.Arg(s.Jurisdiction), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryRodentlocation retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryRodentlocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryRodentlocation, error) { - if len(cols) == 0 { - return HistoryRodentlocations.Query( - sm.Where(HistoryRodentlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryRodentlocations.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryRodentlocations.Query( - sm.Where(HistoryRodentlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryRodentlocations.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryRodentlocations.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryRodentlocationExists checks the presence of a single record by primary key -func HistoryRodentlocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryRodentlocations.Query( - sm.Where(HistoryRodentlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryRodentlocations.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryRodentlocation is retrieved from the database -func (o *HistoryRodentlocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryRodentlocations.AfterSelectHooks.RunHooks(ctx, exec, HistoryRodentlocationSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryRodentlocations.AfterInsertHooks.RunHooks(ctx, exec, HistoryRodentlocationSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryRodentlocations.AfterUpdateHooks.RunHooks(ctx, exec, HistoryRodentlocationSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryRodentlocations.AfterDeleteHooks.RunHooks(ctx, exec, HistoryRodentlocationSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryRodentlocation -func (o *HistoryRodentlocation) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryRodentlocation) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_rodentlocation", "objectid"), psql.Quote("history_rodentlocation", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryRodentlocation -func (o *HistoryRodentlocation) Update(ctx context.Context, exec bob.Executor, s *HistoryRodentlocationSetter) error { - v, err := HistoryRodentlocations.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 HistoryRodentlocation record with an executor -func (o *HistoryRodentlocation) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryRodentlocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryRodentlocation using the executor -func (o *HistoryRodentlocation) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryRodentlocations.Query( - sm.Where(HistoryRodentlocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryRodentlocations.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryRodentlocationSlice is retrieved from the database -func (o HistoryRodentlocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryRodentlocations.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryRodentlocations.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryRodentlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryRodentlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryRodentlocationSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_rodentlocation", "objectid"), psql.Quote("history_rodentlocation", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryRodentlocationSlice) copyMatchingRows(from ...*HistoryRodentlocation) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryRodentlocationSlice) 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 HistoryRodentlocations.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 *HistoryRodentlocation: - o.copyMatchingRows(retrieved) - case []*HistoryRodentlocation: - o.copyMatchingRows(retrieved...) - case HistoryRodentlocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryRodentlocation or a slice of HistoryRodentlocation - // then run the AfterUpdateHooks on the slice - _, err = HistoryRodentlocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryRodentlocationSlice) 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 HistoryRodentlocations.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 *HistoryRodentlocation: - o.copyMatchingRows(retrieved) - case []*HistoryRodentlocation: - o.copyMatchingRows(retrieved...) - case HistoryRodentlocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryRodentlocation or a slice of HistoryRodentlocation - // then run the AfterDeleteHooks on the slice - _, err = HistoryRodentlocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryRodentlocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryRodentlocationSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryRodentlocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryRodentlocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryRodentlocations.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryRodentlocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryRodentlocations.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 *HistoryRodentlocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryRodentlocationSlice) 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 attachHistoryRodentlocationOrganization0(ctx context.Context, exec bob.Executor, count int, historyRodentlocation0 *HistoryRodentlocation, organization1 *Organization) (*HistoryRodentlocation, error) { - setter := &HistoryRodentlocationSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyRodentlocation0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryRodentlocationOrganization0: %w", err) - } - - return historyRodentlocation0, nil -} - -func (historyRodentlocation0 *HistoryRodentlocation) 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 = attachHistoryRodentlocationOrganization0(ctx, exec, 1, historyRodentlocation0, organization1) - if err != nil { - return err - } - - historyRodentlocation0.R.Organization = organization1 - - organization1.R.HistoryRodentlocations = append(organization1.R.HistoryRodentlocations, historyRodentlocation0) - - return nil -} - -func (historyRodentlocation0 *HistoryRodentlocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryRodentlocationOrganization0(ctx, exec, 1, historyRodentlocation0, organization1) - if err != nil { - return err - } - - historyRodentlocation0.R.Organization = organization1 - - organization1.R.HistoryRodentlocations = append(organization1.R.HistoryRodentlocations, historyRodentlocation0) - - return nil -} - -type historyRodentlocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accessdesc psql.WhereNullMod[Q, string] - Active psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Description psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Habitat psql.WhereNullMod[Q, string] - Lastinspectaction psql.WhereNullMod[Q, string] - Lastinspectconditions psql.WhereNullMod[Q, string] - Lastinspectdate psql.WhereNullMod[Q, int64] - Lastinspectrodentevidence psql.WhereNullMod[Q, string] - Lastinspectspecies psql.WhereNullMod[Q, string] - Locationname psql.WhereNullMod[Q, string] - Locationnumber psql.WhereNullMod[Q, int64] - Nextactiondatescheduled psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Priority psql.WhereNullMod[Q, string] - Symbology psql.WhereNullMod[Q, string] - Usetype psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Jurisdiction psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyRodentlocationWhere[Q]) AliasedAs(alias string) historyRodentlocationWhere[Q] { - return buildHistoryRodentlocationWhere[Q](buildHistoryRodentlocationColumns(alias)) -} - -func buildHistoryRodentlocationWhere[Q psql.Filterable](cols historyRodentlocationColumns) historyRodentlocationWhere[Q] { - return historyRodentlocationWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), - Active: psql.WhereNull[Q, int16](cols.Active), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Description: psql.WhereNull[Q, string](cols.Description), - 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), - Habitat: psql.WhereNull[Q, string](cols.Habitat), - Lastinspectaction: psql.WhereNull[Q, string](cols.Lastinspectaction), - Lastinspectconditions: psql.WhereNull[Q, string](cols.Lastinspectconditions), - Lastinspectdate: psql.WhereNull[Q, int64](cols.Lastinspectdate), - Lastinspectrodentevidence: psql.WhereNull[Q, string](cols.Lastinspectrodentevidence), - Lastinspectspecies: psql.WhereNull[Q, string](cols.Lastinspectspecies), - Locationname: psql.WhereNull[Q, string](cols.Locationname), - Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), - Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), - Objectid: psql.Where[Q, int32](cols.Objectid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Symbology: psql.WhereNull[Q, string](cols.Symbology), - Usetype: psql.WhereNull[Q, string](cols.Usetype), - Zone: psql.WhereNull[Q, string](cols.Zone), - Zone2: psql.WhereNull[Q, string](cols.Zone2), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryRodentlocation) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyRodentlocation cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryRodentlocations = HistoryRodentlocationSlice{o} - } - return nil - default: - return fmt.Errorf("historyRodentlocation has no relationship %q", name) - } -} - -type historyRodentlocationPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryRodentlocationPreloader() historyRodentlocationPreloader { - return historyRodentlocationPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryRodentlocations, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyRodentlocationThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryRodentlocationThenLoader[Q orm.Loadable]() historyRodentlocationThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyRodentlocationThenLoader[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 historyRodentlocation's Organization into the .R struct -func (o *HistoryRodentlocation) 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.HistoryRodentlocations = HistoryRodentlocationSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyRodentlocation's Organization into the .R struct -func (os HistoryRodentlocationSlice) 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.HistoryRodentlocations = append(rel.R.HistoryRodentlocations, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyRodentlocationJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyRodentlocationJoins[Q]) aliasedAs(alias string) historyRodentlocationJoins[Q] { - return buildHistoryRodentlocationJoins[Q](buildHistoryRodentlocationColumns(alias), j.typ) -} - -func buildHistoryRodentlocationJoins[Q dialect.Joinable](cols historyRodentlocationColumns, typ string) historyRodentlocationJoins[Q] { - return historyRodentlocationJoins[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/db/models/history_samplecollection.bob.go b/db/models/history_samplecollection.bob.go deleted file mode 100644 index 3749b6cc..00000000 --- a/db/models/history_samplecollection.bob.go +++ /dev/null @@ -1,1840 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistorySamplecollection is an object representing the database table. -type HistorySamplecollection struct { - OrganizationID int32 `db:"organization_id" ` - Activity null.Val[string] `db:"activity" ` - Avetemp null.Val[float64] `db:"avetemp" ` - Chickenid null.Val[string] `db:"chickenid" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Datesent null.Val[int64] `db:"datesent" ` - Datetested null.Val[int64] `db:"datetested" ` - Diseasepos null.Val[string] `db:"diseasepos" ` - Diseasetested null.Val[string] `db:"diseasetested" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Flockid null.Val[string] `db:"flockid" ` - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid null.Val[string] `db:"globalid" ` - Lab null.Val[string] `db:"lab" ` - Locationname null.Val[string] `db:"locationname" ` - LocID null.Val[string] `db:"loc_id" ` - Objectid int32 `db:"objectid,pk" ` - Processed null.Val[int16] `db:"processed" ` - Raingauge null.Val[float64] `db:"raingauge" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Samplecond null.Val[string] `db:"samplecond" ` - Samplecount null.Val[int16] `db:"samplecount" ` - Sampleid null.Val[string] `db:"sampleid" ` - Sampletype null.Val[string] `db:"sampletype" ` - Sex null.Val[string] `db:"sex" ` - Sitecond null.Val[string] `db:"sitecond" ` - Species null.Val[string] `db:"species" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Survtech null.Val[string] `db:"survtech" ` - Testmethod null.Val[string] `db:"testmethod" ` - Testtech null.Val[string] `db:"testtech" ` - Winddir null.Val[string] `db:"winddir" ` - Windspeed null.Val[float64] `db:"windspeed" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historySamplecollectionR `db:"-" ` -} - -// HistorySamplecollectionSlice is an alias for a slice of pointers to HistorySamplecollection. -// This should almost always be used instead of []*HistorySamplecollection. -type HistorySamplecollectionSlice []*HistorySamplecollection - -// HistorySamplecollections contains methods to work with the history_samplecollection table -var HistorySamplecollections = psql.NewTablex[*HistorySamplecollection, HistorySamplecollectionSlice, *HistorySamplecollectionSetter]("", "history_samplecollection", buildHistorySamplecollectionColumns("history_samplecollection")) - -// HistorySamplecollectionsQuery is a query on the history_samplecollection table -type HistorySamplecollectionsQuery = *psql.ViewQuery[*HistorySamplecollection, HistorySamplecollectionSlice] - -// historySamplecollectionR is where relationships are stored. -type historySamplecollectionR struct { - Organization *Organization // history_samplecollection.history_samplecollection_organization_id_fkey -} - -func buildHistorySamplecollectionColumns(alias string) historySamplecollectionColumns { - return historySamplecollectionColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "activity", "avetemp", "chickenid", "comments", "creationdate", "creator", "datesent", "datetested", "diseasepos", "diseasetested", "enddatetime", "editdate", "editor", "fieldtech", "flockid", "gatewaysync", "globalid", "lab", "locationname", "loc_id", "objectid", "processed", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "samplecond", "samplecount", "sampleid", "sampletype", "sex", "sitecond", "species", "startdatetime", "survtech", "testmethod", "testtech", "winddir", "windspeed", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", - ).WithParent("history_samplecollection"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Activity: psql.Quote(alias, "activity"), - Avetemp: psql.Quote(alias, "avetemp"), - Chickenid: psql.Quote(alias, "chickenid"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Datesent: psql.Quote(alias, "datesent"), - Datetested: psql.Quote(alias, "datetested"), - Diseasepos: psql.Quote(alias, "diseasepos"), - Diseasetested: psql.Quote(alias, "diseasetested"), - Enddatetime: psql.Quote(alias, "enddatetime"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fieldtech: psql.Quote(alias, "fieldtech"), - Flockid: psql.Quote(alias, "flockid"), - Gatewaysync: psql.Quote(alias, "gatewaysync"), - Globalid: psql.Quote(alias, "globalid"), - Lab: psql.Quote(alias, "lab"), - Locationname: psql.Quote(alias, "locationname"), - LocID: psql.Quote(alias, "loc_id"), - Objectid: psql.Quote(alias, "objectid"), - Processed: psql.Quote(alias, "processed"), - Raingauge: psql.Quote(alias, "raingauge"), - Recordstatus: psql.Quote(alias, "recordstatus"), - Reviewed: psql.Quote(alias, "reviewed"), - Reviewedby: psql.Quote(alias, "reviewedby"), - Revieweddate: psql.Quote(alias, "revieweddate"), - Samplecond: psql.Quote(alias, "samplecond"), - Samplecount: psql.Quote(alias, "samplecount"), - Sampleid: psql.Quote(alias, "sampleid"), - Sampletype: psql.Quote(alias, "sampletype"), - Sex: psql.Quote(alias, "sex"), - Sitecond: psql.Quote(alias, "sitecond"), - Species: psql.Quote(alias, "species"), - Startdatetime: psql.Quote(alias, "startdatetime"), - Survtech: psql.Quote(alias, "survtech"), - Testmethod: psql.Quote(alias, "testmethod"), - Testtech: psql.Quote(alias, "testtech"), - Winddir: psql.Quote(alias, "winddir"), - Windspeed: psql.Quote(alias, "windspeed"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Version: psql.Quote(alias, "version"), - } -} - -type historySamplecollectionColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Activity psql.Expression - Avetemp psql.Expression - Chickenid psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Datesent psql.Expression - Datetested psql.Expression - Diseasepos psql.Expression - Diseasetested psql.Expression - Enddatetime psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fieldtech psql.Expression - Flockid psql.Expression - Gatewaysync psql.Expression - Globalid psql.Expression - Lab psql.Expression - Locationname psql.Expression - LocID psql.Expression - Objectid psql.Expression - Processed psql.Expression - Raingauge psql.Expression - Recordstatus psql.Expression - Reviewed psql.Expression - Reviewedby psql.Expression - Revieweddate psql.Expression - Samplecond psql.Expression - Samplecount psql.Expression - Sampleid psql.Expression - Sampletype psql.Expression - Sex psql.Expression - Sitecond psql.Expression - Species psql.Expression - Startdatetime psql.Expression - Survtech psql.Expression - Testmethod psql.Expression - Testtech psql.Expression - Winddir psql.Expression - Windspeed psql.Expression - Zone psql.Expression - Zone2 psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Version psql.Expression -} - -func (c historySamplecollectionColumns) Alias() string { - return c.tableAlias -} - -func (historySamplecollectionColumns) AliasedAs(alias string) historySamplecollectionColumns { - return buildHistorySamplecollectionColumns(alias) -} - -// HistorySamplecollectionSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistorySamplecollectionSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Activity omitnull.Val[string] `db:"activity" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Chickenid omitnull.Val[string] `db:"chickenid" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Datesent omitnull.Val[int64] `db:"datesent" ` - Datetested omitnull.Val[int64] `db:"datetested" ` - Diseasepos omitnull.Val[string] `db:"diseasepos" ` - Diseasetested omitnull.Val[string] `db:"diseasetested" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Flockid omitnull.Val[string] `db:"flockid" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Lab omitnull.Val[string] `db:"lab" ` - Locationname omitnull.Val[string] `db:"locationname" ` - LocID omitnull.Val[string] `db:"loc_id" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Processed omitnull.Val[int16] `db:"processed" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Samplecond omitnull.Val[string] `db:"samplecond" ` - Samplecount omitnull.Val[int16] `db:"samplecount" ` - Sampleid omitnull.Val[string] `db:"sampleid" ` - Sampletype omitnull.Val[string] `db:"sampletype" ` - Sex omitnull.Val[string] `db:"sex" ` - Sitecond omitnull.Val[string] `db:"sitecond" ` - Species omitnull.Val[string] `db:"species" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Survtech omitnull.Val[string] `db:"survtech" ` - Testmethod omitnull.Val[string] `db:"testmethod" ` - Testtech omitnull.Val[string] `db:"testtech" ` - Winddir omitnull.Val[string] `db:"winddir" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistorySamplecollectionSetter) SetColumns() []string { - vals := make([]string, 0, 51) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Activity.IsUnset() { - vals = append(vals, "activity") - } - if !s.Avetemp.IsUnset() { - vals = append(vals, "avetemp") - } - if !s.Chickenid.IsUnset() { - vals = append(vals, "chickenid") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Datesent.IsUnset() { - vals = append(vals, "datesent") - } - if !s.Datetested.IsUnset() { - vals = append(vals, "datetested") - } - if !s.Diseasepos.IsUnset() { - vals = append(vals, "diseasepos") - } - if !s.Diseasetested.IsUnset() { - vals = append(vals, "diseasetested") - } - if !s.Enddatetime.IsUnset() { - vals = append(vals, "enddatetime") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fieldtech.IsUnset() { - vals = append(vals, "fieldtech") - } - if !s.Flockid.IsUnset() { - vals = append(vals, "flockid") - } - if !s.Gatewaysync.IsUnset() { - vals = append(vals, "gatewaysync") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Lab.IsUnset() { - vals = append(vals, "lab") - } - if !s.Locationname.IsUnset() { - vals = append(vals, "locationname") - } - if !s.LocID.IsUnset() { - vals = append(vals, "loc_id") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Processed.IsUnset() { - vals = append(vals, "processed") - } - if !s.Raingauge.IsUnset() { - vals = append(vals, "raingauge") - } - if !s.Recordstatus.IsUnset() { - vals = append(vals, "recordstatus") - } - if !s.Reviewed.IsUnset() { - vals = append(vals, "reviewed") - } - if !s.Reviewedby.IsUnset() { - vals = append(vals, "reviewedby") - } - if !s.Revieweddate.IsUnset() { - vals = append(vals, "revieweddate") - } - if !s.Samplecond.IsUnset() { - vals = append(vals, "samplecond") - } - if !s.Samplecount.IsUnset() { - vals = append(vals, "samplecount") - } - if !s.Sampleid.IsUnset() { - vals = append(vals, "sampleid") - } - if !s.Sampletype.IsUnset() { - vals = append(vals, "sampletype") - } - if !s.Sex.IsUnset() { - vals = append(vals, "sex") - } - if !s.Sitecond.IsUnset() { - vals = append(vals, "sitecond") - } - if !s.Species.IsUnset() { - vals = append(vals, "species") - } - if !s.Startdatetime.IsUnset() { - vals = append(vals, "startdatetime") - } - if !s.Survtech.IsUnset() { - vals = append(vals, "survtech") - } - if !s.Testmethod.IsUnset() { - vals = append(vals, "testmethod") - } - if !s.Testtech.IsUnset() { - vals = append(vals, "testtech") - } - if !s.Winddir.IsUnset() { - vals = append(vals, "winddir") - } - if !s.Windspeed.IsUnset() { - vals = append(vals, "windspeed") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistorySamplecollectionSetter) Overwrite(t *HistorySamplecollection) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Activity.IsUnset() { - t.Activity = s.Activity.MustGetNull() - } - if !s.Avetemp.IsUnset() { - t.Avetemp = s.Avetemp.MustGetNull() - } - if !s.Chickenid.IsUnset() { - t.Chickenid = s.Chickenid.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Datesent.IsUnset() { - t.Datesent = s.Datesent.MustGetNull() - } - if !s.Datetested.IsUnset() { - t.Datetested = s.Datetested.MustGetNull() - } - if !s.Diseasepos.IsUnset() { - t.Diseasepos = s.Diseasepos.MustGetNull() - } - if !s.Diseasetested.IsUnset() { - t.Diseasetested = s.Diseasetested.MustGetNull() - } - if !s.Enddatetime.IsUnset() { - t.Enddatetime = s.Enddatetime.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fieldtech.IsUnset() { - t.Fieldtech = s.Fieldtech.MustGetNull() - } - if !s.Flockid.IsUnset() { - t.Flockid = s.Flockid.MustGetNull() - } - if !s.Gatewaysync.IsUnset() { - t.Gatewaysync = s.Gatewaysync.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Lab.IsUnset() { - t.Lab = s.Lab.MustGetNull() - } - if !s.Locationname.IsUnset() { - t.Locationname = s.Locationname.MustGetNull() - } - if !s.LocID.IsUnset() { - t.LocID = s.LocID.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Processed.IsUnset() { - t.Processed = s.Processed.MustGetNull() - } - if !s.Raingauge.IsUnset() { - t.Raingauge = s.Raingauge.MustGetNull() - } - if !s.Recordstatus.IsUnset() { - t.Recordstatus = s.Recordstatus.MustGetNull() - } - if !s.Reviewed.IsUnset() { - t.Reviewed = s.Reviewed.MustGetNull() - } - if !s.Reviewedby.IsUnset() { - t.Reviewedby = s.Reviewedby.MustGetNull() - } - if !s.Revieweddate.IsUnset() { - t.Revieweddate = s.Revieweddate.MustGetNull() - } - if !s.Samplecond.IsUnset() { - t.Samplecond = s.Samplecond.MustGetNull() - } - if !s.Samplecount.IsUnset() { - t.Samplecount = s.Samplecount.MustGetNull() - } - if !s.Sampleid.IsUnset() { - t.Sampleid = s.Sampleid.MustGetNull() - } - if !s.Sampletype.IsUnset() { - t.Sampletype = s.Sampletype.MustGetNull() - } - if !s.Sex.IsUnset() { - t.Sex = s.Sex.MustGetNull() - } - if !s.Sitecond.IsUnset() { - t.Sitecond = s.Sitecond.MustGetNull() - } - if !s.Species.IsUnset() { - t.Species = s.Species.MustGetNull() - } - if !s.Startdatetime.IsUnset() { - t.Startdatetime = s.Startdatetime.MustGetNull() - } - if !s.Survtech.IsUnset() { - t.Survtech = s.Survtech.MustGetNull() - } - if !s.Testmethod.IsUnset() { - t.Testmethod = s.Testmethod.MustGetNull() - } - if !s.Testtech.IsUnset() { - t.Testtech = s.Testtech.MustGetNull() - } - if !s.Winddir.IsUnset() { - t.Winddir = s.Winddir.MustGetNull() - } - if !s.Windspeed.IsUnset() { - t.Windspeed = s.Windspeed.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistorySamplecollectionSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistorySamplecollections.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 51) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Activity.IsUnset() { - vals[1] = psql.Arg(s.Activity.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Avetemp.IsUnset() { - vals[2] = psql.Arg(s.Avetemp.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Chickenid.IsUnset() { - vals[3] = psql.Arg(s.Chickenid.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[4] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[5] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[6] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Datesent.IsUnset() { - vals[7] = psql.Arg(s.Datesent.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Datetested.IsUnset() { - vals[8] = psql.Arg(s.Datetested.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Diseasepos.IsUnset() { - vals[9] = psql.Arg(s.Diseasepos.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Diseasetested.IsUnset() { - vals[10] = psql.Arg(s.Diseasetested.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Enddatetime.IsUnset() { - vals[11] = psql.Arg(s.Enddatetime.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[12] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[13] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Fieldtech.IsUnset() { - vals[14] = psql.Arg(s.Fieldtech.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Flockid.IsUnset() { - vals[15] = psql.Arg(s.Flockid.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Gatewaysync.IsUnset() { - vals[16] = psql.Arg(s.Gatewaysync.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[17] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Lab.IsUnset() { - vals[18] = psql.Arg(s.Lab.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Locationname.IsUnset() { - vals[19] = psql.Arg(s.Locationname.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.LocID.IsUnset() { - vals[20] = psql.Arg(s.LocID.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[21] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Processed.IsUnset() { - vals[22] = psql.Arg(s.Processed.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Raingauge.IsUnset() { - vals[23] = psql.Arg(s.Raingauge.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Recordstatus.IsUnset() { - vals[24] = psql.Arg(s.Recordstatus.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Reviewed.IsUnset() { - vals[25] = psql.Arg(s.Reviewed.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Reviewedby.IsUnset() { - vals[26] = psql.Arg(s.Reviewedby.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Revieweddate.IsUnset() { - vals[27] = psql.Arg(s.Revieweddate.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Samplecond.IsUnset() { - vals[28] = psql.Arg(s.Samplecond.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Samplecount.IsUnset() { - vals[29] = psql.Arg(s.Samplecount.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Sampleid.IsUnset() { - vals[30] = psql.Arg(s.Sampleid.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Sampletype.IsUnset() { - vals[31] = psql.Arg(s.Sampletype.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Sex.IsUnset() { - vals[32] = psql.Arg(s.Sex.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Sitecond.IsUnset() { - vals[33] = psql.Arg(s.Sitecond.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Species.IsUnset() { - vals[34] = psql.Arg(s.Species.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Startdatetime.IsUnset() { - vals[35] = psql.Arg(s.Startdatetime.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Survtech.IsUnset() { - vals[36] = psql.Arg(s.Survtech.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.Testmethod.IsUnset() { - vals[37] = psql.Arg(s.Testmethod.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.Testtech.IsUnset() { - vals[38] = psql.Arg(s.Testtech.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Winddir.IsUnset() { - vals[39] = psql.Arg(s.Winddir.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Windspeed.IsUnset() { - vals[40] = psql.Arg(s.Windspeed.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[41] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[42] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[43] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[44] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[45] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[46] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[47] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[47] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[48] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[48] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[49] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[49] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[50] = psql.Arg(s.Version.MustGet()) - } else { - vals[50] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistorySamplecollectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistorySamplecollectionSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 51) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Activity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "activity")...), - psql.Arg(s.Activity), - }}) - } - - if !s.Avetemp.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "avetemp")...), - psql.Arg(s.Avetemp), - }}) - } - - if !s.Chickenid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "chickenid")...), - psql.Arg(s.Chickenid), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Datesent.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "datesent")...), - psql.Arg(s.Datesent), - }}) - } - - if !s.Datetested.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "datetested")...), - psql.Arg(s.Datetested), - }}) - } - - if !s.Diseasepos.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "diseasepos")...), - psql.Arg(s.Diseasepos), - }}) - } - - if !s.Diseasetested.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "diseasetested")...), - psql.Arg(s.Diseasetested), - }}) - } - - if !s.Enddatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "enddatetime")...), - psql.Arg(s.Enddatetime), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fieldtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldtech")...), - psql.Arg(s.Fieldtech), - }}) - } - - if !s.Flockid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "flockid")...), - psql.Arg(s.Flockid), - }}) - } - - if !s.Gatewaysync.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "gatewaysync")...), - psql.Arg(s.Gatewaysync), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Lab.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lab")...), - psql.Arg(s.Lab), - }}) - } - - if !s.Locationname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationname")...), - psql.Arg(s.Locationname), - }}) - } - - if !s.LocID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "loc_id")...), - psql.Arg(s.LocID), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Processed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "processed")...), - psql.Arg(s.Processed), - }}) - } - - if !s.Raingauge.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "raingauge")...), - psql.Arg(s.Raingauge), - }}) - } - - if !s.Recordstatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "recordstatus")...), - psql.Arg(s.Recordstatus), - }}) - } - - if !s.Reviewed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewed")...), - psql.Arg(s.Reviewed), - }}) - } - - if !s.Reviewedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewedby")...), - psql.Arg(s.Reviewedby), - }}) - } - - if !s.Revieweddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "revieweddate")...), - psql.Arg(s.Revieweddate), - }}) - } - - if !s.Samplecond.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "samplecond")...), - psql.Arg(s.Samplecond), - }}) - } - - if !s.Samplecount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "samplecount")...), - psql.Arg(s.Samplecount), - }}) - } - - if !s.Sampleid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sampleid")...), - psql.Arg(s.Sampleid), - }}) - } - - if !s.Sampletype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sampletype")...), - psql.Arg(s.Sampletype), - }}) - } - - if !s.Sex.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sex")...), - psql.Arg(s.Sex), - }}) - } - - if !s.Sitecond.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sitecond")...), - psql.Arg(s.Sitecond), - }}) - } - - if !s.Species.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "species")...), - psql.Arg(s.Species), - }}) - } - - if !s.Startdatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "startdatetime")...), - psql.Arg(s.Startdatetime), - }}) - } - - if !s.Survtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "survtech")...), - psql.Arg(s.Survtech), - }}) - } - - if !s.Testmethod.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "testmethod")...), - psql.Arg(s.Testmethod), - }}) - } - - if !s.Testtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "testtech")...), - psql.Arg(s.Testtech), - }}) - } - - if !s.Winddir.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "winddir")...), - psql.Arg(s.Winddir), - }}) - } - - if !s.Windspeed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "windspeed")...), - psql.Arg(s.Windspeed), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistorySamplecollection retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistorySamplecollection(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistorySamplecollection, error) { - if len(cols) == 0 { - return HistorySamplecollections.Query( - sm.Where(HistorySamplecollections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistorySamplecollections.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistorySamplecollections.Query( - sm.Where(HistorySamplecollections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistorySamplecollections.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistorySamplecollections.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistorySamplecollectionExists checks the presence of a single record by primary key -func HistorySamplecollectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistorySamplecollections.Query( - sm.Where(HistorySamplecollections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistorySamplecollections.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistorySamplecollection is retrieved from the database -func (o *HistorySamplecollection) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistorySamplecollections.AfterSelectHooks.RunHooks(ctx, exec, HistorySamplecollectionSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistorySamplecollections.AfterInsertHooks.RunHooks(ctx, exec, HistorySamplecollectionSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistorySamplecollections.AfterUpdateHooks.RunHooks(ctx, exec, HistorySamplecollectionSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistorySamplecollections.AfterDeleteHooks.RunHooks(ctx, exec, HistorySamplecollectionSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistorySamplecollection -func (o *HistorySamplecollection) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistorySamplecollection) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_samplecollection", "objectid"), psql.Quote("history_samplecollection", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistorySamplecollection -func (o *HistorySamplecollection) Update(ctx context.Context, exec bob.Executor, s *HistorySamplecollectionSetter) error { - v, err := HistorySamplecollections.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 HistorySamplecollection record with an executor -func (o *HistorySamplecollection) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistorySamplecollections.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistorySamplecollection using the executor -func (o *HistorySamplecollection) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistorySamplecollections.Query( - sm.Where(HistorySamplecollections.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistorySamplecollections.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistorySamplecollectionSlice is retrieved from the database -func (o HistorySamplecollectionSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistorySamplecollections.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistorySamplecollections.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistorySamplecollections.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistorySamplecollections.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistorySamplecollectionSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_samplecollection", "objectid"), psql.Quote("history_samplecollection", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistorySamplecollectionSlice) copyMatchingRows(from ...*HistorySamplecollection) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistorySamplecollectionSlice) 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 HistorySamplecollections.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 *HistorySamplecollection: - o.copyMatchingRows(retrieved) - case []*HistorySamplecollection: - o.copyMatchingRows(retrieved...) - case HistorySamplecollectionSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistorySamplecollection or a slice of HistorySamplecollection - // then run the AfterUpdateHooks on the slice - _, err = HistorySamplecollections.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistorySamplecollectionSlice) 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 HistorySamplecollections.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 *HistorySamplecollection: - o.copyMatchingRows(retrieved) - case []*HistorySamplecollection: - o.copyMatchingRows(retrieved...) - case HistorySamplecollectionSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistorySamplecollection or a slice of HistorySamplecollection - // then run the AfterDeleteHooks on the slice - _, err = HistorySamplecollections.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistorySamplecollectionSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistorySamplecollectionSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistorySamplecollections.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistorySamplecollectionSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistorySamplecollections.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistorySamplecollectionSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistorySamplecollections.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 *HistorySamplecollection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistorySamplecollectionSlice) 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 attachHistorySamplecollectionOrganization0(ctx context.Context, exec bob.Executor, count int, historySamplecollection0 *HistorySamplecollection, organization1 *Organization) (*HistorySamplecollection, error) { - setter := &HistorySamplecollectionSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historySamplecollection0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistorySamplecollectionOrganization0: %w", err) - } - - return historySamplecollection0, nil -} - -func (historySamplecollection0 *HistorySamplecollection) 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 = attachHistorySamplecollectionOrganization0(ctx, exec, 1, historySamplecollection0, organization1) - if err != nil { - return err - } - - historySamplecollection0.R.Organization = organization1 - - organization1.R.HistorySamplecollections = append(organization1.R.HistorySamplecollections, historySamplecollection0) - - return nil -} - -func (historySamplecollection0 *HistorySamplecollection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistorySamplecollectionOrganization0(ctx, exec, 1, historySamplecollection0, organization1) - if err != nil { - return err - } - - historySamplecollection0.R.Organization = organization1 - - organization1.R.HistorySamplecollections = append(organization1.R.HistorySamplecollections, historySamplecollection0) - - return nil -} - -type historySamplecollectionWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Activity psql.WhereNullMod[Q, string] - Avetemp psql.WhereNullMod[Q, float64] - Chickenid psql.WhereNullMod[Q, string] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Datesent psql.WhereNullMod[Q, int64] - Datetested psql.WhereNullMod[Q, int64] - Diseasepos psql.WhereNullMod[Q, string] - Diseasetested psql.WhereNullMod[Q, string] - Enddatetime psql.WhereNullMod[Q, int64] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fieldtech psql.WhereNullMod[Q, string] - Flockid psql.WhereNullMod[Q, string] - Gatewaysync psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] - Lab psql.WhereNullMod[Q, string] - Locationname psql.WhereNullMod[Q, string] - LocID psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Processed psql.WhereNullMod[Q, int16] - Raingauge psql.WhereNullMod[Q, float64] - Recordstatus psql.WhereNullMod[Q, int16] - Reviewed psql.WhereNullMod[Q, int16] - Reviewedby psql.WhereNullMod[Q, string] - Revieweddate psql.WhereNullMod[Q, int64] - Samplecond psql.WhereNullMod[Q, string] - Samplecount psql.WhereNullMod[Q, int16] - Sampleid psql.WhereNullMod[Q, string] - Sampletype psql.WhereNullMod[Q, string] - Sex psql.WhereNullMod[Q, string] - Sitecond psql.WhereNullMod[Q, string] - Species psql.WhereNullMod[Q, string] - Startdatetime psql.WhereNullMod[Q, int64] - Survtech psql.WhereNullMod[Q, string] - Testmethod psql.WhereNullMod[Q, string] - Testtech psql.WhereNullMod[Q, string] - Winddir psql.WhereNullMod[Q, string] - Windspeed psql.WhereNullMod[Q, float64] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historySamplecollectionWhere[Q]) AliasedAs(alias string) historySamplecollectionWhere[Q] { - return buildHistorySamplecollectionWhere[Q](buildHistorySamplecollectionColumns(alias)) -} - -func buildHistorySamplecollectionWhere[Q psql.Filterable](cols historySamplecollectionColumns) historySamplecollectionWhere[Q] { - return historySamplecollectionWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Activity: psql.WhereNull[Q, string](cols.Activity), - Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), - Chickenid: psql.WhereNull[Q, string](cols.Chickenid), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Datesent: psql.WhereNull[Q, int64](cols.Datesent), - Datetested: psql.WhereNull[Q, int64](cols.Datetested), - Diseasepos: psql.WhereNull[Q, string](cols.Diseasepos), - Diseasetested: psql.WhereNull[Q, string](cols.Diseasetested), - Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - 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), - Lab: psql.WhereNull[Q, string](cols.Lab), - Locationname: psql.WhereNull[Q, string](cols.Locationname), - LocID: psql.WhereNull[Q, string](cols.LocID), - Objectid: psql.Where[Q, int32](cols.Objectid), - Processed: psql.WhereNull[Q, int16](cols.Processed), - Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), - Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), - Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), - Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), - Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), - Samplecond: psql.WhereNull[Q, string](cols.Samplecond), - Samplecount: psql.WhereNull[Q, int16](cols.Samplecount), - Sampleid: psql.WhereNull[Q, string](cols.Sampleid), - Sampletype: psql.WhereNull[Q, string](cols.Sampletype), - Sex: psql.WhereNull[Q, string](cols.Sex), - Sitecond: psql.WhereNull[Q, string](cols.Sitecond), - Species: psql.WhereNull[Q, string](cols.Species), - Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), - Survtech: psql.WhereNull[Q, string](cols.Survtech), - Testmethod: psql.WhereNull[Q, string](cols.Testmethod), - Testtech: psql.WhereNull[Q, string](cols.Testtech), - Winddir: psql.WhereNull[Q, string](cols.Winddir), - Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), - Zone: psql.WhereNull[Q, string](cols.Zone), - Zone2: psql.WhereNull[Q, string](cols.Zone2), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistorySamplecollection) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historySamplecollection cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistorySamplecollections = HistorySamplecollectionSlice{o} - } - return nil - default: - return fmt.Errorf("historySamplecollection has no relationship %q", name) - } -} - -type historySamplecollectionPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistorySamplecollectionPreloader() historySamplecollectionPreloader { - return historySamplecollectionPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistorySamplecollections, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historySamplecollectionThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistorySamplecollectionThenLoader[Q orm.Loadable]() historySamplecollectionThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historySamplecollectionThenLoader[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 historySamplecollection's Organization into the .R struct -func (o *HistorySamplecollection) 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.HistorySamplecollections = HistorySamplecollectionSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historySamplecollection's Organization into the .R struct -func (os HistorySamplecollectionSlice) 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.HistorySamplecollections = append(rel.R.HistorySamplecollections, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historySamplecollectionJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historySamplecollectionJoins[Q]) aliasedAs(alias string) historySamplecollectionJoins[Q] { - return buildHistorySamplecollectionJoins[Q](buildHistorySamplecollectionColumns(alias), j.typ) -} - -func buildHistorySamplecollectionJoins[Q dialect.Joinable](cols historySamplecollectionColumns, typ string) historySamplecollectionJoins[Q] { - return historySamplecollectionJoins[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/db/models/history_samplelocation.bob.go b/db/models/history_samplelocation.bob.go deleted file mode 100644 index eadf96d7..00000000 --- a/db/models/history_samplelocation.bob.go +++ /dev/null @@ -1,1290 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistorySamplelocation is an object representing the database table. -type HistorySamplelocation struct { - OrganizationID int32 `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid null.Val[string] `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Name null.Val[string] `db:"name" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Usetype null.Val[string] `db:"usetype" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historySamplelocationR `db:"-" ` -} - -// HistorySamplelocationSlice is an alias for a slice of pointers to HistorySamplelocation. -// This should almost always be used instead of []*HistorySamplelocation. -type HistorySamplelocationSlice []*HistorySamplelocation - -// HistorySamplelocations contains methods to work with the history_samplelocation table -var HistorySamplelocations = psql.NewTablex[*HistorySamplelocation, HistorySamplelocationSlice, *HistorySamplelocationSetter]("", "history_samplelocation", buildHistorySamplelocationColumns("history_samplelocation")) - -// HistorySamplelocationsQuery is a query on the history_samplelocation table -type HistorySamplelocationsQuery = *psql.ViewQuery[*HistorySamplelocation, HistorySamplelocationSlice] - -// historySamplelocationR is where relationships are stored. -type historySamplelocationR struct { - Organization *Organization // history_samplelocation.history_samplelocation_organization_id_fkey -} - -func buildHistorySamplelocationColumns(alias string) historySamplelocationColumns { - return historySamplelocationColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "gatewaysync", "globalid", "habitat", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "usetype", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", - ).WithParent("history_samplelocation"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accessdesc: psql.Quote(alias, "accessdesc"), - Active: psql.Quote(alias, "active"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Description: psql.Quote(alias, "description"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Gatewaysync: psql.Quote(alias, "gatewaysync"), - Globalid: psql.Quote(alias, "globalid"), - Habitat: psql.Quote(alias, "habitat"), - Locationnumber: psql.Quote(alias, "locationnumber"), - Name: psql.Quote(alias, "name"), - Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), - Objectid: psql.Quote(alias, "objectid"), - Priority: psql.Quote(alias, "priority"), - Usetype: psql.Quote(alias, "usetype"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Version: psql.Quote(alias, "version"), - } -} - -type historySamplelocationColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accessdesc psql.Expression - Active psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Description psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Gatewaysync psql.Expression - Globalid psql.Expression - Habitat psql.Expression - Locationnumber psql.Expression - Name psql.Expression - Nextactiondatescheduled psql.Expression - Objectid psql.Expression - Priority psql.Expression - Usetype psql.Expression - Zone psql.Expression - Zone2 psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Version psql.Expression -} - -func (c historySamplelocationColumns) Alias() string { - return c.tableAlias -} - -func (historySamplelocationColumns) AliasedAs(alias string) historySamplelocationColumns { - return buildHistorySamplelocationColumns(alias) -} - -// HistorySamplelocationSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistorySamplelocationSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Name omitnull.Val[string] `db:"name" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Usetype omitnull.Val[string] `db:"usetype" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistorySamplelocationSetter) SetColumns() []string { - vals := make([]string, 0, 29) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accessdesc.IsUnset() { - vals = append(vals, "accessdesc") - } - if !s.Active.IsUnset() { - vals = append(vals, "active") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Description.IsUnset() { - vals = append(vals, "description") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Gatewaysync.IsUnset() { - vals = append(vals, "gatewaysync") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Habitat.IsUnset() { - vals = append(vals, "habitat") - } - if !s.Locationnumber.IsUnset() { - vals = append(vals, "locationnumber") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if !s.Nextactiondatescheduled.IsUnset() { - vals = append(vals, "nextactiondatescheduled") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Usetype.IsUnset() { - vals = append(vals, "usetype") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistorySamplelocationSetter) Overwrite(t *HistorySamplelocation) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accessdesc.IsUnset() { - t.Accessdesc = s.Accessdesc.MustGetNull() - } - if !s.Active.IsUnset() { - t.Active = s.Active.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Description.IsUnset() { - t.Description = s.Description.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Gatewaysync.IsUnset() { - t.Gatewaysync = s.Gatewaysync.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Habitat.IsUnset() { - t.Habitat = s.Habitat.MustGetNull() - } - if !s.Locationnumber.IsUnset() { - t.Locationnumber = s.Locationnumber.MustGetNull() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if !s.Nextactiondatescheduled.IsUnset() { - t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Usetype.IsUnset() { - t.Usetype = s.Usetype.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistorySamplelocationSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistorySamplelocations.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 29) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accessdesc.IsUnset() { - vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Active.IsUnset() { - vals[2] = psql.Arg(s.Active.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[3] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[4] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[5] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Description.IsUnset() { - vals[6] = psql.Arg(s.Description.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[7] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[8] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[9] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Gatewaysync.IsUnset() { - vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[11] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Habitat.IsUnset() { - vals[12] = psql.Arg(s.Habitat.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Locationnumber.IsUnset() { - vals[13] = psql.Arg(s.Locationnumber.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[14] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Nextactiondatescheduled.IsUnset() { - vals[15] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[16] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[17] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Usetype.IsUnset() { - vals[18] = psql.Arg(s.Usetype.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[19] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[20] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[21] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[22] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[23] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[24] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[25] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[26] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[27] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[28] = psql.Arg(s.Version.MustGet()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistorySamplelocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistorySamplelocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 29) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accessdesc.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accessdesc")...), - psql.Arg(s.Accessdesc), - }}) - } - - if !s.Active.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "active")...), - psql.Arg(s.Active), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Description.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "description")...), - psql.Arg(s.Description), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Gatewaysync.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "gatewaysync")...), - psql.Arg(s.Gatewaysync), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitat")...), - psql.Arg(s.Habitat), - }}) - } - - if !s.Locationnumber.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationnumber")...), - psql.Arg(s.Locationnumber), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if !s.Nextactiondatescheduled.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nextactiondatescheduled")...), - psql.Arg(s.Nextactiondatescheduled), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Usetype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "usetype")...), - psql.Arg(s.Usetype), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistorySamplelocation retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistorySamplelocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistorySamplelocation, error) { - if len(cols) == 0 { - return HistorySamplelocations.Query( - sm.Where(HistorySamplelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistorySamplelocations.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistorySamplelocations.Query( - sm.Where(HistorySamplelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistorySamplelocations.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistorySamplelocations.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistorySamplelocationExists checks the presence of a single record by primary key -func HistorySamplelocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistorySamplelocations.Query( - sm.Where(HistorySamplelocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistorySamplelocations.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistorySamplelocation is retrieved from the database -func (o *HistorySamplelocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistorySamplelocations.AfterSelectHooks.RunHooks(ctx, exec, HistorySamplelocationSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistorySamplelocations.AfterInsertHooks.RunHooks(ctx, exec, HistorySamplelocationSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistorySamplelocations.AfterUpdateHooks.RunHooks(ctx, exec, HistorySamplelocationSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistorySamplelocations.AfterDeleteHooks.RunHooks(ctx, exec, HistorySamplelocationSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistorySamplelocation -func (o *HistorySamplelocation) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistorySamplelocation) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_samplelocation", "objectid"), psql.Quote("history_samplelocation", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistorySamplelocation -func (o *HistorySamplelocation) Update(ctx context.Context, exec bob.Executor, s *HistorySamplelocationSetter) error { - v, err := HistorySamplelocations.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 HistorySamplelocation record with an executor -func (o *HistorySamplelocation) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistorySamplelocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistorySamplelocation using the executor -func (o *HistorySamplelocation) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistorySamplelocations.Query( - sm.Where(HistorySamplelocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistorySamplelocations.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistorySamplelocationSlice is retrieved from the database -func (o HistorySamplelocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistorySamplelocations.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistorySamplelocations.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistorySamplelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistorySamplelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistorySamplelocationSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_samplelocation", "objectid"), psql.Quote("history_samplelocation", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistorySamplelocationSlice) copyMatchingRows(from ...*HistorySamplelocation) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistorySamplelocationSlice) 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 HistorySamplelocations.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 *HistorySamplelocation: - o.copyMatchingRows(retrieved) - case []*HistorySamplelocation: - o.copyMatchingRows(retrieved...) - case HistorySamplelocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistorySamplelocation or a slice of HistorySamplelocation - // then run the AfterUpdateHooks on the slice - _, err = HistorySamplelocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistorySamplelocationSlice) 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 HistorySamplelocations.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 *HistorySamplelocation: - o.copyMatchingRows(retrieved) - case []*HistorySamplelocation: - o.copyMatchingRows(retrieved...) - case HistorySamplelocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistorySamplelocation or a slice of HistorySamplelocation - // then run the AfterDeleteHooks on the slice - _, err = HistorySamplelocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistorySamplelocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistorySamplelocationSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistorySamplelocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistorySamplelocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistorySamplelocations.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistorySamplelocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistorySamplelocations.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 *HistorySamplelocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistorySamplelocationSlice) 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 attachHistorySamplelocationOrganization0(ctx context.Context, exec bob.Executor, count int, historySamplelocation0 *HistorySamplelocation, organization1 *Organization) (*HistorySamplelocation, error) { - setter := &HistorySamplelocationSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historySamplelocation0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistorySamplelocationOrganization0: %w", err) - } - - return historySamplelocation0, nil -} - -func (historySamplelocation0 *HistorySamplelocation) 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 = attachHistorySamplelocationOrganization0(ctx, exec, 1, historySamplelocation0, organization1) - if err != nil { - return err - } - - historySamplelocation0.R.Organization = organization1 - - organization1.R.HistorySamplelocations = append(organization1.R.HistorySamplelocations, historySamplelocation0) - - return nil -} - -func (historySamplelocation0 *HistorySamplelocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistorySamplelocationOrganization0(ctx, exec, 1, historySamplelocation0, organization1) - if err != nil { - return err - } - - historySamplelocation0.R.Organization = organization1 - - organization1.R.HistorySamplelocations = append(organization1.R.HistorySamplelocations, historySamplelocation0) - - return nil -} - -type historySamplelocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accessdesc psql.WhereNullMod[Q, string] - Active psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Description psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Gatewaysync psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] - Habitat psql.WhereNullMod[Q, string] - Locationnumber psql.WhereNullMod[Q, int64] - Name psql.WhereNullMod[Q, string] - Nextactiondatescheduled psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Priority psql.WhereNullMod[Q, string] - Usetype psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historySamplelocationWhere[Q]) AliasedAs(alias string) historySamplelocationWhere[Q] { - return buildHistorySamplelocationWhere[Q](buildHistorySamplelocationColumns(alias)) -} - -func buildHistorySamplelocationWhere[Q psql.Filterable](cols historySamplelocationColumns) historySamplelocationWhere[Q] { - return historySamplelocationWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), - Active: psql.WhereNull[Q, int16](cols.Active), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Description: psql.WhereNull[Q, string](cols.Description), - Externalid: psql.WhereNull[Q, string](cols.Externalid), - 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), - Habitat: psql.WhereNull[Q, string](cols.Habitat), - Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), - Name: psql.WhereNull[Q, string](cols.Name), - Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), - Objectid: psql.Where[Q, int32](cols.Objectid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Usetype: psql.WhereNull[Q, string](cols.Usetype), - Zone: psql.WhereNull[Q, string](cols.Zone), - Zone2: psql.WhereNull[Q, string](cols.Zone2), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistorySamplelocation) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historySamplelocation cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistorySamplelocations = HistorySamplelocationSlice{o} - } - return nil - default: - return fmt.Errorf("historySamplelocation has no relationship %q", name) - } -} - -type historySamplelocationPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistorySamplelocationPreloader() historySamplelocationPreloader { - return historySamplelocationPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistorySamplelocations, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historySamplelocationThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistorySamplelocationThenLoader[Q orm.Loadable]() historySamplelocationThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historySamplelocationThenLoader[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 historySamplelocation's Organization into the .R struct -func (o *HistorySamplelocation) 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.HistorySamplelocations = HistorySamplelocationSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historySamplelocation's Organization into the .R struct -func (os HistorySamplelocationSlice) 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.HistorySamplelocations = append(rel.R.HistorySamplelocations, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historySamplelocationJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historySamplelocationJoins[Q]) aliasedAs(alias string) historySamplelocationJoins[Q] { - return buildHistorySamplelocationJoins[Q](buildHistorySamplelocationColumns(alias), j.typ) -} - -func buildHistorySamplelocationJoins[Q dialect.Joinable](cols historySamplelocationColumns, typ string) historySamplelocationJoins[Q] { - return historySamplelocationJoins[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/db/models/history_servicerequest.bob.go b/db/models/history_servicerequest.bob.go deleted file mode 100644 index 23f20d47..00000000 --- a/db/models/history_servicerequest.bob.go +++ /dev/null @@ -1,2840 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryServicerequest is an object representing the database table. -type HistoryServicerequest 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" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historyServicerequestR `db:"-" ` -} - -// HistoryServicerequestSlice is an alias for a slice of pointers to HistoryServicerequest. -// This should almost always be used instead of []*HistoryServicerequest. -type HistoryServicerequestSlice []*HistoryServicerequest - -// HistoryServicerequests contains methods to work with the history_servicerequest table -var HistoryServicerequests = psql.NewTablex[*HistoryServicerequest, HistoryServicerequestSlice, *HistoryServicerequestSetter]("", "history_servicerequest", buildHistoryServicerequestColumns("history_servicerequest")) - -// HistoryServicerequestsQuery is a query on the history_servicerequest table -type HistoryServicerequestsQuery = *psql.ViewQuery[*HistoryServicerequest, HistoryServicerequestSlice] - -// historyServicerequestR is where relationships are stored. -type historyServicerequestR struct { - Organization *Organization // history_servicerequest.history_servicerequest_organization_id_fkey -} - -func buildHistoryServicerequestColumns(alias string) historyServicerequestColumns { - return historyServicerequestColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accepted", "acceptedby", "accepteddate", "allowed", "assignedtech", "clraddr1", "clraddr2", "clranon", "clrcity", "clrcompany", "clrcontpref", "clremail", "clrfname", "clrother", "clrphone1", "clrphone2", "clrstate", "clrzip", "comments", "creationdate", "creator", "datetimeclosed", "duedate", "entrytech", "estcompletedate", "externalerror", "externalid", "editdate", "editor", "firstresponsedate", "globalid", "issuesreported", "jurisdiction", "nextaction", "notificationtimestamp", "notified", "notifieddate", "objectid", "pointlocid", "priority", "recdatetime", "recordstatus", "rejectedby", "rejecteddate", "rejectedreason", "reqaddr1", "reqaddr2", "reqcity", "reqcompany", "reqcrossst", "reqdescr", "reqfldnotes", "reqmapgrid", "reqnotesforcust", "reqnotesfortech", "reqpermission", "reqprogramactions", "reqstate", "reqsubdiv", "reqtarget", "reqzip", "responsedaycount", "reviewed", "reviewedby", "revieweddate", "scheduled", "scheduleddate", "source", "sr_number", "status", "supervisor", "techclosed", "validx", "validy", "xvalue", "yvalue", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "dog", "spanish", "schedule_notes", "schedule_period", "version", - ).WithParent("history_servicerequest"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accepted: psql.Quote(alias, "accepted"), - Acceptedby: psql.Quote(alias, "acceptedby"), - Accepteddate: psql.Quote(alias, "accepteddate"), - Allowed: psql.Quote(alias, "allowed"), - Assignedtech: psql.Quote(alias, "assignedtech"), - Clraddr1: psql.Quote(alias, "clraddr1"), - Clraddr2: psql.Quote(alias, "clraddr2"), - Clranon: psql.Quote(alias, "clranon"), - Clrcity: psql.Quote(alias, "clrcity"), - Clrcompany: psql.Quote(alias, "clrcompany"), - Clrcontpref: psql.Quote(alias, "clrcontpref"), - Clremail: psql.Quote(alias, "clremail"), - Clrfname: psql.Quote(alias, "clrfname"), - Clrother: psql.Quote(alias, "clrother"), - Clrphone1: psql.Quote(alias, "clrphone1"), - Clrphone2: psql.Quote(alias, "clrphone2"), - Clrstate: psql.Quote(alias, "clrstate"), - Clrzip: psql.Quote(alias, "clrzip"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Datetimeclosed: psql.Quote(alias, "datetimeclosed"), - Duedate: psql.Quote(alias, "duedate"), - Entrytech: psql.Quote(alias, "entrytech"), - Estcompletedate: psql.Quote(alias, "estcompletedate"), - Externalerror: psql.Quote(alias, "externalerror"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Firstresponsedate: psql.Quote(alias, "firstresponsedate"), - Globalid: psql.Quote(alias, "globalid"), - Issuesreported: psql.Quote(alias, "issuesreported"), - Jurisdiction: psql.Quote(alias, "jurisdiction"), - Nextaction: psql.Quote(alias, "nextaction"), - Notificationtimestamp: psql.Quote(alias, "notificationtimestamp"), - Notified: psql.Quote(alias, "notified"), - Notifieddate: psql.Quote(alias, "notifieddate"), - Objectid: psql.Quote(alias, "objectid"), - Pointlocid: psql.Quote(alias, "pointlocid"), - Priority: psql.Quote(alias, "priority"), - Recdatetime: psql.Quote(alias, "recdatetime"), - Recordstatus: psql.Quote(alias, "recordstatus"), - Rejectedby: psql.Quote(alias, "rejectedby"), - Rejecteddate: psql.Quote(alias, "rejecteddate"), - Rejectedreason: psql.Quote(alias, "rejectedreason"), - Reqaddr1: psql.Quote(alias, "reqaddr1"), - Reqaddr2: psql.Quote(alias, "reqaddr2"), - Reqcity: psql.Quote(alias, "reqcity"), - Reqcompany: psql.Quote(alias, "reqcompany"), - Reqcrossst: psql.Quote(alias, "reqcrossst"), - Reqdescr: psql.Quote(alias, "reqdescr"), - Reqfldnotes: psql.Quote(alias, "reqfldnotes"), - Reqmapgrid: psql.Quote(alias, "reqmapgrid"), - Reqnotesforcust: psql.Quote(alias, "reqnotesforcust"), - Reqnotesfortech: psql.Quote(alias, "reqnotesfortech"), - Reqpermission: psql.Quote(alias, "reqpermission"), - Reqprogramactions: psql.Quote(alias, "reqprogramactions"), - Reqstate: psql.Quote(alias, "reqstate"), - Reqsubdiv: psql.Quote(alias, "reqsubdiv"), - Reqtarget: psql.Quote(alias, "reqtarget"), - Reqzip: psql.Quote(alias, "reqzip"), - Responsedaycount: psql.Quote(alias, "responsedaycount"), - Reviewed: psql.Quote(alias, "reviewed"), - Reviewedby: psql.Quote(alias, "reviewedby"), - Revieweddate: psql.Quote(alias, "revieweddate"), - Scheduled: psql.Quote(alias, "scheduled"), - Scheduleddate: psql.Quote(alias, "scheduleddate"), - Source: psql.Quote(alias, "source"), - SRNumber: psql.Quote(alias, "sr_number"), - Status: psql.Quote(alias, "status"), - Supervisor: psql.Quote(alias, "supervisor"), - Techclosed: psql.Quote(alias, "techclosed"), - Validx: psql.Quote(alias, "validx"), - Validy: psql.Quote(alias, "validy"), - Xvalue: psql.Quote(alias, "xvalue"), - Yvalue: psql.Quote(alias, "yvalue"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Dog: psql.Quote(alias, "dog"), - Spanish: psql.Quote(alias, "spanish"), - ScheduleNotes: psql.Quote(alias, "schedule_notes"), - SchedulePeriod: psql.Quote(alias, "schedule_period"), - Version: psql.Quote(alias, "version"), - } -} - -type historyServicerequestColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accepted psql.Expression - Acceptedby psql.Expression - Accepteddate psql.Expression - Allowed psql.Expression - Assignedtech psql.Expression - Clraddr1 psql.Expression - Clraddr2 psql.Expression - Clranon psql.Expression - Clrcity psql.Expression - Clrcompany psql.Expression - Clrcontpref psql.Expression - Clremail psql.Expression - Clrfname psql.Expression - Clrother psql.Expression - Clrphone1 psql.Expression - Clrphone2 psql.Expression - Clrstate psql.Expression - Clrzip psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Datetimeclosed psql.Expression - Duedate psql.Expression - Entrytech psql.Expression - Estcompletedate psql.Expression - Externalerror psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Firstresponsedate psql.Expression - Globalid psql.Expression - Issuesreported psql.Expression - Jurisdiction psql.Expression - Nextaction psql.Expression - Notificationtimestamp psql.Expression - Notified psql.Expression - Notifieddate psql.Expression - Objectid psql.Expression - Pointlocid psql.Expression - Priority psql.Expression - Recdatetime psql.Expression - Recordstatus psql.Expression - Rejectedby psql.Expression - Rejecteddate psql.Expression - Rejectedreason psql.Expression - Reqaddr1 psql.Expression - Reqaddr2 psql.Expression - Reqcity psql.Expression - Reqcompany psql.Expression - Reqcrossst psql.Expression - Reqdescr psql.Expression - Reqfldnotes psql.Expression - Reqmapgrid psql.Expression - Reqnotesforcust psql.Expression - Reqnotesfortech psql.Expression - Reqpermission psql.Expression - Reqprogramactions psql.Expression - Reqstate psql.Expression - Reqsubdiv psql.Expression - Reqtarget psql.Expression - Reqzip psql.Expression - Responsedaycount psql.Expression - Reviewed psql.Expression - Reviewedby psql.Expression - Revieweddate psql.Expression - Scheduled psql.Expression - Scheduleddate psql.Expression - Source psql.Expression - SRNumber psql.Expression - Status psql.Expression - Supervisor psql.Expression - Techclosed psql.Expression - Validx psql.Expression - Validy psql.Expression - Xvalue psql.Expression - Yvalue psql.Expression - Zone psql.Expression - Zone2 psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Dog psql.Expression - Spanish psql.Expression - ScheduleNotes psql.Expression - SchedulePeriod psql.Expression - Version psql.Expression -} - -func (c historyServicerequestColumns) Alias() string { - return c.tableAlias -} - -func (historyServicerequestColumns) AliasedAs(alias string) historyServicerequestColumns { - return buildHistoryServicerequestColumns(alias) -} - -// HistoryServicerequestSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryServicerequestSetter 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" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryServicerequestSetter) SetColumns() []string { - vals := make([]string, 0, 91) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accepted.IsUnset() { - vals = append(vals, "accepted") - } - if !s.Acceptedby.IsUnset() { - vals = append(vals, "acceptedby") - } - if !s.Accepteddate.IsUnset() { - vals = append(vals, "accepteddate") - } - if !s.Allowed.IsUnset() { - vals = append(vals, "allowed") - } - if !s.Assignedtech.IsUnset() { - vals = append(vals, "assignedtech") - } - if !s.Clraddr1.IsUnset() { - vals = append(vals, "clraddr1") - } - if !s.Clraddr2.IsUnset() { - vals = append(vals, "clraddr2") - } - if !s.Clranon.IsUnset() { - vals = append(vals, "clranon") - } - if !s.Clrcity.IsUnset() { - vals = append(vals, "clrcity") - } - if !s.Clrcompany.IsUnset() { - vals = append(vals, "clrcompany") - } - if !s.Clrcontpref.IsUnset() { - vals = append(vals, "clrcontpref") - } - if !s.Clremail.IsUnset() { - vals = append(vals, "clremail") - } - if !s.Clrfname.IsUnset() { - vals = append(vals, "clrfname") - } - if !s.Clrother.IsUnset() { - vals = append(vals, "clrother") - } - if !s.Clrphone1.IsUnset() { - vals = append(vals, "clrphone1") - } - if !s.Clrphone2.IsUnset() { - vals = append(vals, "clrphone2") - } - if !s.Clrstate.IsUnset() { - vals = append(vals, "clrstate") - } - if !s.Clrzip.IsUnset() { - vals = append(vals, "clrzip") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Datetimeclosed.IsUnset() { - vals = append(vals, "datetimeclosed") - } - if !s.Duedate.IsUnset() { - vals = append(vals, "duedate") - } - if !s.Entrytech.IsUnset() { - vals = append(vals, "entrytech") - } - if !s.Estcompletedate.IsUnset() { - vals = append(vals, "estcompletedate") - } - if !s.Externalerror.IsUnset() { - vals = append(vals, "externalerror") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Firstresponsedate.IsUnset() { - vals = append(vals, "firstresponsedate") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Issuesreported.IsUnset() { - vals = append(vals, "issuesreported") - } - if !s.Jurisdiction.IsUnset() { - vals = append(vals, "jurisdiction") - } - if !s.Nextaction.IsUnset() { - vals = append(vals, "nextaction") - } - if !s.Notificationtimestamp.IsUnset() { - vals = append(vals, "notificationtimestamp") - } - if !s.Notified.IsUnset() { - vals = append(vals, "notified") - } - if !s.Notifieddate.IsUnset() { - vals = append(vals, "notifieddate") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Pointlocid.IsUnset() { - vals = append(vals, "pointlocid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Recdatetime.IsUnset() { - vals = append(vals, "recdatetime") - } - if !s.Recordstatus.IsUnset() { - vals = append(vals, "recordstatus") - } - if !s.Rejectedby.IsUnset() { - vals = append(vals, "rejectedby") - } - if !s.Rejecteddate.IsUnset() { - vals = append(vals, "rejecteddate") - } - if !s.Rejectedreason.IsUnset() { - vals = append(vals, "rejectedreason") - } - if !s.Reqaddr1.IsUnset() { - vals = append(vals, "reqaddr1") - } - if !s.Reqaddr2.IsUnset() { - vals = append(vals, "reqaddr2") - } - if !s.Reqcity.IsUnset() { - vals = append(vals, "reqcity") - } - if !s.Reqcompany.IsUnset() { - vals = append(vals, "reqcompany") - } - if !s.Reqcrossst.IsUnset() { - vals = append(vals, "reqcrossst") - } - if !s.Reqdescr.IsUnset() { - vals = append(vals, "reqdescr") - } - if !s.Reqfldnotes.IsUnset() { - vals = append(vals, "reqfldnotes") - } - if !s.Reqmapgrid.IsUnset() { - vals = append(vals, "reqmapgrid") - } - if !s.Reqnotesforcust.IsUnset() { - vals = append(vals, "reqnotesforcust") - } - if !s.Reqnotesfortech.IsUnset() { - vals = append(vals, "reqnotesfortech") - } - if !s.Reqpermission.IsUnset() { - vals = append(vals, "reqpermission") - } - if !s.Reqprogramactions.IsUnset() { - vals = append(vals, "reqprogramactions") - } - if !s.Reqstate.IsUnset() { - vals = append(vals, "reqstate") - } - if !s.Reqsubdiv.IsUnset() { - vals = append(vals, "reqsubdiv") - } - if !s.Reqtarget.IsUnset() { - vals = append(vals, "reqtarget") - } - if !s.Reqzip.IsUnset() { - vals = append(vals, "reqzip") - } - if !s.Responsedaycount.IsUnset() { - vals = append(vals, "responsedaycount") - } - if !s.Reviewed.IsUnset() { - vals = append(vals, "reviewed") - } - if !s.Reviewedby.IsUnset() { - vals = append(vals, "reviewedby") - } - if !s.Revieweddate.IsUnset() { - vals = append(vals, "revieweddate") - } - if !s.Scheduled.IsUnset() { - vals = append(vals, "scheduled") - } - if !s.Scheduleddate.IsUnset() { - vals = append(vals, "scheduleddate") - } - if !s.Source.IsUnset() { - vals = append(vals, "source") - } - if !s.SRNumber.IsUnset() { - vals = append(vals, "sr_number") - } - if !s.Status.IsUnset() { - vals = append(vals, "status") - } - if !s.Supervisor.IsUnset() { - vals = append(vals, "supervisor") - } - if !s.Techclosed.IsUnset() { - vals = append(vals, "techclosed") - } - if !s.Validx.IsUnset() { - vals = append(vals, "validx") - } - if !s.Validy.IsUnset() { - vals = append(vals, "validy") - } - if !s.Xvalue.IsUnset() { - vals = append(vals, "xvalue") - } - if !s.Yvalue.IsUnset() { - vals = append(vals, "yvalue") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Dog.IsUnset() { - vals = append(vals, "dog") - } - if !s.Spanish.IsUnset() { - vals = append(vals, "spanish") - } - if !s.ScheduleNotes.IsUnset() { - vals = append(vals, "schedule_notes") - } - if !s.SchedulePeriod.IsUnset() { - vals = append(vals, "schedule_period") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryServicerequestSetter) Overwrite(t *HistoryServicerequest) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accepted.IsUnset() { - t.Accepted = s.Accepted.MustGetNull() - } - if !s.Acceptedby.IsUnset() { - t.Acceptedby = s.Acceptedby.MustGetNull() - } - if !s.Accepteddate.IsUnset() { - t.Accepteddate = s.Accepteddate.MustGetNull() - } - if !s.Allowed.IsUnset() { - t.Allowed = s.Allowed.MustGetNull() - } - if !s.Assignedtech.IsUnset() { - t.Assignedtech = s.Assignedtech.MustGetNull() - } - if !s.Clraddr1.IsUnset() { - t.Clraddr1 = s.Clraddr1.MustGetNull() - } - if !s.Clraddr2.IsUnset() { - t.Clraddr2 = s.Clraddr2.MustGetNull() - } - if !s.Clranon.IsUnset() { - t.Clranon = s.Clranon.MustGetNull() - } - if !s.Clrcity.IsUnset() { - t.Clrcity = s.Clrcity.MustGetNull() - } - if !s.Clrcompany.IsUnset() { - t.Clrcompany = s.Clrcompany.MustGetNull() - } - if !s.Clrcontpref.IsUnset() { - t.Clrcontpref = s.Clrcontpref.MustGetNull() - } - if !s.Clremail.IsUnset() { - t.Clremail = s.Clremail.MustGetNull() - } - if !s.Clrfname.IsUnset() { - t.Clrfname = s.Clrfname.MustGetNull() - } - if !s.Clrother.IsUnset() { - t.Clrother = s.Clrother.MustGetNull() - } - if !s.Clrphone1.IsUnset() { - t.Clrphone1 = s.Clrphone1.MustGetNull() - } - if !s.Clrphone2.IsUnset() { - t.Clrphone2 = s.Clrphone2.MustGetNull() - } - if !s.Clrstate.IsUnset() { - t.Clrstate = s.Clrstate.MustGetNull() - } - if !s.Clrzip.IsUnset() { - t.Clrzip = s.Clrzip.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Datetimeclosed.IsUnset() { - t.Datetimeclosed = s.Datetimeclosed.MustGetNull() - } - if !s.Duedate.IsUnset() { - t.Duedate = s.Duedate.MustGetNull() - } - if !s.Entrytech.IsUnset() { - t.Entrytech = s.Entrytech.MustGetNull() - } - if !s.Estcompletedate.IsUnset() { - t.Estcompletedate = s.Estcompletedate.MustGetNull() - } - if !s.Externalerror.IsUnset() { - t.Externalerror = s.Externalerror.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Firstresponsedate.IsUnset() { - t.Firstresponsedate = s.Firstresponsedate.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Issuesreported.IsUnset() { - t.Issuesreported = s.Issuesreported.MustGetNull() - } - if !s.Jurisdiction.IsUnset() { - t.Jurisdiction = s.Jurisdiction.MustGetNull() - } - if !s.Nextaction.IsUnset() { - t.Nextaction = s.Nextaction.MustGetNull() - } - if !s.Notificationtimestamp.IsUnset() { - t.Notificationtimestamp = s.Notificationtimestamp.MustGetNull() - } - if !s.Notified.IsUnset() { - t.Notified = s.Notified.MustGetNull() - } - if !s.Notifieddate.IsUnset() { - t.Notifieddate = s.Notifieddate.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Pointlocid.IsUnset() { - t.Pointlocid = s.Pointlocid.MustGetNull() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Recdatetime.IsUnset() { - t.Recdatetime = s.Recdatetime.MustGetNull() - } - if !s.Recordstatus.IsUnset() { - t.Recordstatus = s.Recordstatus.MustGetNull() - } - if !s.Rejectedby.IsUnset() { - t.Rejectedby = s.Rejectedby.MustGetNull() - } - if !s.Rejecteddate.IsUnset() { - t.Rejecteddate = s.Rejecteddate.MustGetNull() - } - if !s.Rejectedreason.IsUnset() { - t.Rejectedreason = s.Rejectedreason.MustGetNull() - } - if !s.Reqaddr1.IsUnset() { - t.Reqaddr1 = s.Reqaddr1.MustGetNull() - } - if !s.Reqaddr2.IsUnset() { - t.Reqaddr2 = s.Reqaddr2.MustGetNull() - } - if !s.Reqcity.IsUnset() { - t.Reqcity = s.Reqcity.MustGetNull() - } - if !s.Reqcompany.IsUnset() { - t.Reqcompany = s.Reqcompany.MustGetNull() - } - if !s.Reqcrossst.IsUnset() { - t.Reqcrossst = s.Reqcrossst.MustGetNull() - } - if !s.Reqdescr.IsUnset() { - t.Reqdescr = s.Reqdescr.MustGetNull() - } - if !s.Reqfldnotes.IsUnset() { - t.Reqfldnotes = s.Reqfldnotes.MustGetNull() - } - if !s.Reqmapgrid.IsUnset() { - t.Reqmapgrid = s.Reqmapgrid.MustGetNull() - } - if !s.Reqnotesforcust.IsUnset() { - t.Reqnotesforcust = s.Reqnotesforcust.MustGetNull() - } - if !s.Reqnotesfortech.IsUnset() { - t.Reqnotesfortech = s.Reqnotesfortech.MustGetNull() - } - if !s.Reqpermission.IsUnset() { - t.Reqpermission = s.Reqpermission.MustGetNull() - } - if !s.Reqprogramactions.IsUnset() { - t.Reqprogramactions = s.Reqprogramactions.MustGetNull() - } - if !s.Reqstate.IsUnset() { - t.Reqstate = s.Reqstate.MustGetNull() - } - if !s.Reqsubdiv.IsUnset() { - t.Reqsubdiv = s.Reqsubdiv.MustGetNull() - } - if !s.Reqtarget.IsUnset() { - t.Reqtarget = s.Reqtarget.MustGetNull() - } - if !s.Reqzip.IsUnset() { - t.Reqzip = s.Reqzip.MustGetNull() - } - if !s.Responsedaycount.IsUnset() { - t.Responsedaycount = s.Responsedaycount.MustGetNull() - } - if !s.Reviewed.IsUnset() { - t.Reviewed = s.Reviewed.MustGetNull() - } - if !s.Reviewedby.IsUnset() { - t.Reviewedby = s.Reviewedby.MustGetNull() - } - if !s.Revieweddate.IsUnset() { - t.Revieweddate = s.Revieweddate.MustGetNull() - } - if !s.Scheduled.IsUnset() { - t.Scheduled = s.Scheduled.MustGetNull() - } - if !s.Scheduleddate.IsUnset() { - t.Scheduleddate = s.Scheduleddate.MustGetNull() - } - if !s.Source.IsUnset() { - t.Source = s.Source.MustGetNull() - } - if !s.SRNumber.IsUnset() { - t.SRNumber = s.SRNumber.MustGetNull() - } - if !s.Status.IsUnset() { - t.Status = s.Status.MustGetNull() - } - if !s.Supervisor.IsUnset() { - t.Supervisor = s.Supervisor.MustGetNull() - } - if !s.Techclosed.IsUnset() { - t.Techclosed = s.Techclosed.MustGetNull() - } - if !s.Validx.IsUnset() { - t.Validx = s.Validx.MustGetNull() - } - if !s.Validy.IsUnset() { - t.Validy = s.Validy.MustGetNull() - } - if !s.Xvalue.IsUnset() { - t.Xvalue = s.Xvalue.MustGetNull() - } - if !s.Yvalue.IsUnset() { - t.Yvalue = s.Yvalue.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Dog.IsUnset() { - t.Dog = s.Dog.MustGetNull() - } - if !s.Spanish.IsUnset() { - t.Spanish = s.Spanish.MustGetNull() - } - if !s.ScheduleNotes.IsUnset() { - t.ScheduleNotes = s.ScheduleNotes.MustGetNull() - } - if !s.SchedulePeriod.IsUnset() { - t.SchedulePeriod = s.SchedulePeriod.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryServicerequestSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryServicerequests.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 91) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accepted.IsUnset() { - vals[1] = psql.Arg(s.Accepted.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Acceptedby.IsUnset() { - vals[2] = psql.Arg(s.Acceptedby.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Accepteddate.IsUnset() { - vals[3] = psql.Arg(s.Accepteddate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Allowed.IsUnset() { - vals[4] = psql.Arg(s.Allowed.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Assignedtech.IsUnset() { - vals[5] = psql.Arg(s.Assignedtech.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Clraddr1.IsUnset() { - vals[6] = psql.Arg(s.Clraddr1.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Clraddr2.IsUnset() { - vals[7] = psql.Arg(s.Clraddr2.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Clranon.IsUnset() { - vals[8] = psql.Arg(s.Clranon.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Clrcity.IsUnset() { - vals[9] = psql.Arg(s.Clrcity.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Clrcompany.IsUnset() { - vals[10] = psql.Arg(s.Clrcompany.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Clrcontpref.IsUnset() { - vals[11] = psql.Arg(s.Clrcontpref.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Clremail.IsUnset() { - vals[12] = psql.Arg(s.Clremail.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Clrfname.IsUnset() { - vals[13] = psql.Arg(s.Clrfname.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Clrother.IsUnset() { - vals[14] = psql.Arg(s.Clrother.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Clrphone1.IsUnset() { - vals[15] = psql.Arg(s.Clrphone1.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Clrphone2.IsUnset() { - vals[16] = psql.Arg(s.Clrphone2.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Clrstate.IsUnset() { - vals[17] = psql.Arg(s.Clrstate.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Clrzip.IsUnset() { - vals[18] = psql.Arg(s.Clrzip.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[19] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[20] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[21] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Datetimeclosed.IsUnset() { - vals[22] = psql.Arg(s.Datetimeclosed.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Duedate.IsUnset() { - vals[23] = psql.Arg(s.Duedate.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Entrytech.IsUnset() { - vals[24] = psql.Arg(s.Entrytech.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Estcompletedate.IsUnset() { - vals[25] = psql.Arg(s.Estcompletedate.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Externalerror.IsUnset() { - vals[26] = psql.Arg(s.Externalerror.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[27] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[28] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[29] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Firstresponsedate.IsUnset() { - vals[30] = psql.Arg(s.Firstresponsedate.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[31] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Issuesreported.IsUnset() { - vals[32] = psql.Arg(s.Issuesreported.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Jurisdiction.IsUnset() { - vals[33] = psql.Arg(s.Jurisdiction.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Nextaction.IsUnset() { - vals[34] = psql.Arg(s.Nextaction.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Notificationtimestamp.IsUnset() { - vals[35] = psql.Arg(s.Notificationtimestamp.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Notified.IsUnset() { - vals[36] = psql.Arg(s.Notified.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.Notifieddate.IsUnset() { - vals[37] = psql.Arg(s.Notifieddate.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[38] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Pointlocid.IsUnset() { - vals[39] = psql.Arg(s.Pointlocid.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[40] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.Recdatetime.IsUnset() { - vals[41] = psql.Arg(s.Recdatetime.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.Recordstatus.IsUnset() { - vals[42] = psql.Arg(s.Recordstatus.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.Rejectedby.IsUnset() { - vals[43] = psql.Arg(s.Rejectedby.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.Rejecteddate.IsUnset() { - vals[44] = psql.Arg(s.Rejecteddate.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if !s.Rejectedreason.IsUnset() { - vals[45] = psql.Arg(s.Rejectedreason.MustGetNull()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if !s.Reqaddr1.IsUnset() { - vals[46] = psql.Arg(s.Reqaddr1.MustGetNull()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - if !s.Reqaddr2.IsUnset() { - vals[47] = psql.Arg(s.Reqaddr2.MustGetNull()) - } else { - vals[47] = psql.Raw("DEFAULT") - } - - if !s.Reqcity.IsUnset() { - vals[48] = psql.Arg(s.Reqcity.MustGetNull()) - } else { - vals[48] = psql.Raw("DEFAULT") - } - - if !s.Reqcompany.IsUnset() { - vals[49] = psql.Arg(s.Reqcompany.MustGetNull()) - } else { - vals[49] = psql.Raw("DEFAULT") - } - - if !s.Reqcrossst.IsUnset() { - vals[50] = psql.Arg(s.Reqcrossst.MustGetNull()) - } else { - vals[50] = psql.Raw("DEFAULT") - } - - if !s.Reqdescr.IsUnset() { - vals[51] = psql.Arg(s.Reqdescr.MustGetNull()) - } else { - vals[51] = psql.Raw("DEFAULT") - } - - if !s.Reqfldnotes.IsUnset() { - vals[52] = psql.Arg(s.Reqfldnotes.MustGetNull()) - } else { - vals[52] = psql.Raw("DEFAULT") - } - - if !s.Reqmapgrid.IsUnset() { - vals[53] = psql.Arg(s.Reqmapgrid.MustGetNull()) - } else { - vals[53] = psql.Raw("DEFAULT") - } - - if !s.Reqnotesforcust.IsUnset() { - vals[54] = psql.Arg(s.Reqnotesforcust.MustGetNull()) - } else { - vals[54] = psql.Raw("DEFAULT") - } - - if !s.Reqnotesfortech.IsUnset() { - vals[55] = psql.Arg(s.Reqnotesfortech.MustGetNull()) - } else { - vals[55] = psql.Raw("DEFAULT") - } - - if !s.Reqpermission.IsUnset() { - vals[56] = psql.Arg(s.Reqpermission.MustGetNull()) - } else { - vals[56] = psql.Raw("DEFAULT") - } - - if !s.Reqprogramactions.IsUnset() { - vals[57] = psql.Arg(s.Reqprogramactions.MustGetNull()) - } else { - vals[57] = psql.Raw("DEFAULT") - } - - if !s.Reqstate.IsUnset() { - vals[58] = psql.Arg(s.Reqstate.MustGetNull()) - } else { - vals[58] = psql.Raw("DEFAULT") - } - - if !s.Reqsubdiv.IsUnset() { - vals[59] = psql.Arg(s.Reqsubdiv.MustGetNull()) - } else { - vals[59] = psql.Raw("DEFAULT") - } - - if !s.Reqtarget.IsUnset() { - vals[60] = psql.Arg(s.Reqtarget.MustGetNull()) - } else { - vals[60] = psql.Raw("DEFAULT") - } - - if !s.Reqzip.IsUnset() { - vals[61] = psql.Arg(s.Reqzip.MustGetNull()) - } else { - vals[61] = psql.Raw("DEFAULT") - } - - if !s.Responsedaycount.IsUnset() { - vals[62] = psql.Arg(s.Responsedaycount.MustGetNull()) - } else { - vals[62] = psql.Raw("DEFAULT") - } - - if !s.Reviewed.IsUnset() { - vals[63] = psql.Arg(s.Reviewed.MustGetNull()) - } else { - vals[63] = psql.Raw("DEFAULT") - } - - if !s.Reviewedby.IsUnset() { - vals[64] = psql.Arg(s.Reviewedby.MustGetNull()) - } else { - vals[64] = psql.Raw("DEFAULT") - } - - if !s.Revieweddate.IsUnset() { - vals[65] = psql.Arg(s.Revieweddate.MustGetNull()) - } else { - vals[65] = psql.Raw("DEFAULT") - } - - if !s.Scheduled.IsUnset() { - vals[66] = psql.Arg(s.Scheduled.MustGetNull()) - } else { - vals[66] = psql.Raw("DEFAULT") - } - - if !s.Scheduleddate.IsUnset() { - vals[67] = psql.Arg(s.Scheduleddate.MustGetNull()) - } else { - vals[67] = psql.Raw("DEFAULT") - } - - if !s.Source.IsUnset() { - vals[68] = psql.Arg(s.Source.MustGetNull()) - } else { - vals[68] = psql.Raw("DEFAULT") - } - - if !s.SRNumber.IsUnset() { - vals[69] = psql.Arg(s.SRNumber.MustGetNull()) - } else { - vals[69] = psql.Raw("DEFAULT") - } - - if !s.Status.IsUnset() { - vals[70] = psql.Arg(s.Status.MustGetNull()) - } else { - vals[70] = psql.Raw("DEFAULT") - } - - if !s.Supervisor.IsUnset() { - vals[71] = psql.Arg(s.Supervisor.MustGetNull()) - } else { - vals[71] = psql.Raw("DEFAULT") - } - - if !s.Techclosed.IsUnset() { - vals[72] = psql.Arg(s.Techclosed.MustGetNull()) - } else { - vals[72] = psql.Raw("DEFAULT") - } - - if !s.Validx.IsUnset() { - vals[73] = psql.Arg(s.Validx.MustGetNull()) - } else { - vals[73] = psql.Raw("DEFAULT") - } - - if !s.Validy.IsUnset() { - vals[74] = psql.Arg(s.Validy.MustGetNull()) - } else { - vals[74] = psql.Raw("DEFAULT") - } - - if !s.Xvalue.IsUnset() { - vals[75] = psql.Arg(s.Xvalue.MustGetNull()) - } else { - vals[75] = psql.Raw("DEFAULT") - } - - if !s.Yvalue.IsUnset() { - vals[76] = psql.Arg(s.Yvalue.MustGetNull()) - } else { - vals[76] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[77] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[77] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[78] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[78] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[79] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[79] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[80] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[80] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[81] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[81] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[82] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[82] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[83] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[83] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[84] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[84] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[85] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[85] = psql.Raw("DEFAULT") - } - - if !s.Dog.IsUnset() { - vals[86] = psql.Arg(s.Dog.MustGetNull()) - } else { - vals[86] = psql.Raw("DEFAULT") - } - - if !s.Spanish.IsUnset() { - vals[87] = psql.Arg(s.Spanish.MustGetNull()) - } else { - vals[87] = psql.Raw("DEFAULT") - } - - if !s.ScheduleNotes.IsUnset() { - vals[88] = psql.Arg(s.ScheduleNotes.MustGetNull()) - } else { - vals[88] = psql.Raw("DEFAULT") - } - - if !s.SchedulePeriod.IsUnset() { - vals[89] = psql.Arg(s.SchedulePeriod.MustGetNull()) - } else { - vals[89] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[90] = psql.Arg(s.Version.MustGet()) - } else { - vals[90] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryServicerequestSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryServicerequestSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 91) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accepted.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accepted")...), - psql.Arg(s.Accepted), - }}) - } - - if !s.Acceptedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "acceptedby")...), - psql.Arg(s.Acceptedby), - }}) - } - - if !s.Accepteddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accepteddate")...), - psql.Arg(s.Accepteddate), - }}) - } - - if !s.Allowed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "allowed")...), - psql.Arg(s.Allowed), - }}) - } - - if !s.Assignedtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "assignedtech")...), - psql.Arg(s.Assignedtech), - }}) - } - - if !s.Clraddr1.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clraddr1")...), - psql.Arg(s.Clraddr1), - }}) - } - - if !s.Clraddr2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clraddr2")...), - psql.Arg(s.Clraddr2), - }}) - } - - if !s.Clranon.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clranon")...), - psql.Arg(s.Clranon), - }}) - } - - if !s.Clrcity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrcity")...), - psql.Arg(s.Clrcity), - }}) - } - - if !s.Clrcompany.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrcompany")...), - psql.Arg(s.Clrcompany), - }}) - } - - if !s.Clrcontpref.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrcontpref")...), - psql.Arg(s.Clrcontpref), - }}) - } - - if !s.Clremail.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clremail")...), - psql.Arg(s.Clremail), - }}) - } - - if !s.Clrfname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrfname")...), - psql.Arg(s.Clrfname), - }}) - } - - if !s.Clrother.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrother")...), - psql.Arg(s.Clrother), - }}) - } - - if !s.Clrphone1.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrphone1")...), - psql.Arg(s.Clrphone1), - }}) - } - - if !s.Clrphone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrphone2")...), - psql.Arg(s.Clrphone2), - }}) - } - - if !s.Clrstate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrstate")...), - psql.Arg(s.Clrstate), - }}) - } - - if !s.Clrzip.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "clrzip")...), - psql.Arg(s.Clrzip), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Datetimeclosed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "datetimeclosed")...), - psql.Arg(s.Datetimeclosed), - }}) - } - - if !s.Duedate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "duedate")...), - psql.Arg(s.Duedate), - }}) - } - - if !s.Entrytech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "entrytech")...), - psql.Arg(s.Entrytech), - }}) - } - - if !s.Estcompletedate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "estcompletedate")...), - psql.Arg(s.Estcompletedate), - }}) - } - - if !s.Externalerror.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalerror")...), - psql.Arg(s.Externalerror), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Firstresponsedate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "firstresponsedate")...), - psql.Arg(s.Firstresponsedate), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Issuesreported.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "issuesreported")...), - psql.Arg(s.Issuesreported), - }}) - } - - if !s.Jurisdiction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "jurisdiction")...), - psql.Arg(s.Jurisdiction), - }}) - } - - if !s.Nextaction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nextaction")...), - psql.Arg(s.Nextaction), - }}) - } - - if !s.Notificationtimestamp.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "notificationtimestamp")...), - psql.Arg(s.Notificationtimestamp), - }}) - } - - if !s.Notified.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "notified")...), - psql.Arg(s.Notified), - }}) - } - - if !s.Notifieddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "notifieddate")...), - psql.Arg(s.Notifieddate), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Pointlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pointlocid")...), - psql.Arg(s.Pointlocid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Recdatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "recdatetime")...), - psql.Arg(s.Recdatetime), - }}) - } - - if !s.Recordstatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "recordstatus")...), - psql.Arg(s.Recordstatus), - }}) - } - - if !s.Rejectedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "rejectedby")...), - psql.Arg(s.Rejectedby), - }}) - } - - if !s.Rejecteddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "rejecteddate")...), - psql.Arg(s.Rejecteddate), - }}) - } - - if !s.Rejectedreason.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "rejectedreason")...), - psql.Arg(s.Rejectedreason), - }}) - } - - if !s.Reqaddr1.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqaddr1")...), - psql.Arg(s.Reqaddr1), - }}) - } - - if !s.Reqaddr2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqaddr2")...), - psql.Arg(s.Reqaddr2), - }}) - } - - if !s.Reqcity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqcity")...), - psql.Arg(s.Reqcity), - }}) - } - - if !s.Reqcompany.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqcompany")...), - psql.Arg(s.Reqcompany), - }}) - } - - if !s.Reqcrossst.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqcrossst")...), - psql.Arg(s.Reqcrossst), - }}) - } - - if !s.Reqdescr.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqdescr")...), - psql.Arg(s.Reqdescr), - }}) - } - - if !s.Reqfldnotes.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqfldnotes")...), - psql.Arg(s.Reqfldnotes), - }}) - } - - if !s.Reqmapgrid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqmapgrid")...), - psql.Arg(s.Reqmapgrid), - }}) - } - - if !s.Reqnotesforcust.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqnotesforcust")...), - psql.Arg(s.Reqnotesforcust), - }}) - } - - if !s.Reqnotesfortech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqnotesfortech")...), - psql.Arg(s.Reqnotesfortech), - }}) - } - - if !s.Reqpermission.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqpermission")...), - psql.Arg(s.Reqpermission), - }}) - } - - if !s.Reqprogramactions.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqprogramactions")...), - psql.Arg(s.Reqprogramactions), - }}) - } - - if !s.Reqstate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqstate")...), - psql.Arg(s.Reqstate), - }}) - } - - if !s.Reqsubdiv.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqsubdiv")...), - psql.Arg(s.Reqsubdiv), - }}) - } - - if !s.Reqtarget.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqtarget")...), - psql.Arg(s.Reqtarget), - }}) - } - - if !s.Reqzip.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reqzip")...), - psql.Arg(s.Reqzip), - }}) - } - - if !s.Responsedaycount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "responsedaycount")...), - psql.Arg(s.Responsedaycount), - }}) - } - - if !s.Reviewed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewed")...), - psql.Arg(s.Reviewed), - }}) - } - - if !s.Reviewedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewedby")...), - psql.Arg(s.Reviewedby), - }}) - } - - if !s.Revieweddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "revieweddate")...), - psql.Arg(s.Revieweddate), - }}) - } - - if !s.Scheduled.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "scheduled")...), - psql.Arg(s.Scheduled), - }}) - } - - if !s.Scheduleddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "scheduleddate")...), - psql.Arg(s.Scheduleddate), - }}) - } - - if !s.Source.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "source")...), - psql.Arg(s.Source), - }}) - } - - if !s.SRNumber.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sr_number")...), - psql.Arg(s.SRNumber), - }}) - } - - if !s.Status.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "status")...), - psql.Arg(s.Status), - }}) - } - - if !s.Supervisor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "supervisor")...), - psql.Arg(s.Supervisor), - }}) - } - - if !s.Techclosed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "techclosed")...), - psql.Arg(s.Techclosed), - }}) - } - - if !s.Validx.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "validx")...), - psql.Arg(s.Validx), - }}) - } - - if !s.Validy.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "validy")...), - psql.Arg(s.Validy), - }}) - } - - if !s.Xvalue.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "xvalue")...), - psql.Arg(s.Xvalue), - }}) - } - - if !s.Yvalue.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "yvalue")...), - psql.Arg(s.Yvalue), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Dog.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "dog")...), - psql.Arg(s.Dog), - }}) - } - - if !s.Spanish.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "spanish")...), - psql.Arg(s.Spanish), - }}) - } - - if !s.ScheduleNotes.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "schedule_notes")...), - psql.Arg(s.ScheduleNotes), - }}) - } - - if !s.SchedulePeriod.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "schedule_period")...), - psql.Arg(s.SchedulePeriod), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryServicerequest retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryServicerequest(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryServicerequest, error) { - if len(cols) == 0 { - return HistoryServicerequests.Query( - sm.Where(HistoryServicerequests.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryServicerequests.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryServicerequests.Query( - sm.Where(HistoryServicerequests.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryServicerequests.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryServicerequests.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryServicerequestExists checks the presence of a single record by primary key -func HistoryServicerequestExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryServicerequests.Query( - sm.Where(HistoryServicerequests.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryServicerequests.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryServicerequest is retrieved from the database -func (o *HistoryServicerequest) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryServicerequests.AfterSelectHooks.RunHooks(ctx, exec, HistoryServicerequestSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryServicerequests.AfterInsertHooks.RunHooks(ctx, exec, HistoryServicerequestSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryServicerequests.AfterUpdateHooks.RunHooks(ctx, exec, HistoryServicerequestSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryServicerequests.AfterDeleteHooks.RunHooks(ctx, exec, HistoryServicerequestSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryServicerequest -func (o *HistoryServicerequest) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryServicerequest) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_servicerequest", "objectid"), psql.Quote("history_servicerequest", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryServicerequest -func (o *HistoryServicerequest) Update(ctx context.Context, exec bob.Executor, s *HistoryServicerequestSetter) error { - v, err := HistoryServicerequests.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 HistoryServicerequest record with an executor -func (o *HistoryServicerequest) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryServicerequests.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryServicerequest using the executor -func (o *HistoryServicerequest) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryServicerequests.Query( - sm.Where(HistoryServicerequests.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryServicerequests.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryServicerequestSlice is retrieved from the database -func (o HistoryServicerequestSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryServicerequests.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryServicerequests.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryServicerequests.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryServicerequests.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryServicerequestSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_servicerequest", "objectid"), psql.Quote("history_servicerequest", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryServicerequestSlice) copyMatchingRows(from ...*HistoryServicerequest) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryServicerequestSlice) 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 HistoryServicerequests.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 *HistoryServicerequest: - o.copyMatchingRows(retrieved) - case []*HistoryServicerequest: - o.copyMatchingRows(retrieved...) - case HistoryServicerequestSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryServicerequest or a slice of HistoryServicerequest - // then run the AfterUpdateHooks on the slice - _, err = HistoryServicerequests.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryServicerequestSlice) 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 HistoryServicerequests.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 *HistoryServicerequest: - o.copyMatchingRows(retrieved) - case []*HistoryServicerequest: - o.copyMatchingRows(retrieved...) - case HistoryServicerequestSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryServicerequest or a slice of HistoryServicerequest - // then run the AfterDeleteHooks on the slice - _, err = HistoryServicerequests.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryServicerequestSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryServicerequestSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryServicerequests.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryServicerequestSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryServicerequests.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryServicerequestSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryServicerequests.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 *HistoryServicerequest) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryServicerequestSlice) 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 attachHistoryServicerequestOrganization0(ctx context.Context, exec bob.Executor, count int, historyServicerequest0 *HistoryServicerequest, organization1 *Organization) (*HistoryServicerequest, error) { - setter := &HistoryServicerequestSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyServicerequest0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryServicerequestOrganization0: %w", err) - } - - return historyServicerequest0, nil -} - -func (historyServicerequest0 *HistoryServicerequest) 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 = attachHistoryServicerequestOrganization0(ctx, exec, 1, historyServicerequest0, organization1) - if err != nil { - return err - } - - historyServicerequest0.R.Organization = organization1 - - organization1.R.HistoryServicerequests = append(organization1.R.HistoryServicerequests, historyServicerequest0) - - return nil -} - -func (historyServicerequest0 *HistoryServicerequest) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryServicerequestOrganization0(ctx, exec, 1, historyServicerequest0, organization1) - if err != nil { - return err - } - - historyServicerequest0.R.Organization = organization1 - - organization1.R.HistoryServicerequests = append(organization1.R.HistoryServicerequests, historyServicerequest0) - - return nil -} - -type historyServicerequestWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accepted psql.WhereNullMod[Q, int16] - Acceptedby psql.WhereNullMod[Q, string] - Accepteddate psql.WhereNullMod[Q, int64] - Allowed psql.WhereNullMod[Q, string] - Assignedtech psql.WhereNullMod[Q, string] - Clraddr1 psql.WhereNullMod[Q, string] - Clraddr2 psql.WhereNullMod[Q, string] - Clranon psql.WhereNullMod[Q, int16] - Clrcity psql.WhereNullMod[Q, string] - Clrcompany psql.WhereNullMod[Q, string] - Clrcontpref psql.WhereNullMod[Q, string] - Clremail psql.WhereNullMod[Q, string] - Clrfname psql.WhereNullMod[Q, string] - Clrother psql.WhereNullMod[Q, string] - Clrphone1 psql.WhereNullMod[Q, string] - Clrphone2 psql.WhereNullMod[Q, string] - Clrstate psql.WhereNullMod[Q, string] - Clrzip psql.WhereNullMod[Q, string] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Datetimeclosed psql.WhereNullMod[Q, int64] - Duedate psql.WhereNullMod[Q, int64] - Entrytech psql.WhereNullMod[Q, string] - Estcompletedate psql.WhereNullMod[Q, int64] - Externalerror psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Firstresponsedate psql.WhereNullMod[Q, int64] - Globalid psql.WhereNullMod[Q, string] - Issuesreported psql.WhereNullMod[Q, string] - Jurisdiction psql.WhereNullMod[Q, string] - Nextaction psql.WhereNullMod[Q, string] - Notificationtimestamp psql.WhereNullMod[Q, string] - Notified psql.WhereNullMod[Q, int16] - Notifieddate psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Pointlocid psql.WhereNullMod[Q, string] - Priority psql.WhereNullMod[Q, string] - Recdatetime psql.WhereNullMod[Q, int64] - Recordstatus psql.WhereNullMod[Q, int16] - Rejectedby psql.WhereNullMod[Q, string] - Rejecteddate psql.WhereNullMod[Q, int64] - Rejectedreason psql.WhereNullMod[Q, string] - Reqaddr1 psql.WhereNullMod[Q, string] - Reqaddr2 psql.WhereNullMod[Q, string] - Reqcity psql.WhereNullMod[Q, string] - Reqcompany psql.WhereNullMod[Q, string] - Reqcrossst psql.WhereNullMod[Q, string] - Reqdescr psql.WhereNullMod[Q, string] - Reqfldnotes psql.WhereNullMod[Q, string] - Reqmapgrid psql.WhereNullMod[Q, string] - Reqnotesforcust psql.WhereNullMod[Q, string] - Reqnotesfortech psql.WhereNullMod[Q, string] - Reqpermission psql.WhereNullMod[Q, int16] - Reqprogramactions psql.WhereNullMod[Q, string] - Reqstate psql.WhereNullMod[Q, string] - Reqsubdiv psql.WhereNullMod[Q, string] - Reqtarget psql.WhereNullMod[Q, string] - Reqzip psql.WhereNullMod[Q, string] - Responsedaycount psql.WhereNullMod[Q, int16] - Reviewed psql.WhereNullMod[Q, int16] - Reviewedby psql.WhereNullMod[Q, string] - Revieweddate psql.WhereNullMod[Q, int64] - Scheduled psql.WhereNullMod[Q, int16] - Scheduleddate psql.WhereNullMod[Q, int64] - Source psql.WhereNullMod[Q, string] - SRNumber psql.WhereNullMod[Q, int64] - Status psql.WhereNullMod[Q, string] - Supervisor psql.WhereNullMod[Q, string] - Techclosed psql.WhereNullMod[Q, string] - Validx psql.WhereNullMod[Q, string] - Validy psql.WhereNullMod[Q, string] - Xvalue psql.WhereNullMod[Q, string] - Yvalue psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Dog psql.WhereNullMod[Q, int64] - Spanish psql.WhereNullMod[Q, int64] - ScheduleNotes psql.WhereNullMod[Q, string] - SchedulePeriod psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyServicerequestWhere[Q]) AliasedAs(alias string) historyServicerequestWhere[Q] { - return buildHistoryServicerequestWhere[Q](buildHistoryServicerequestColumns(alias)) -} - -func buildHistoryServicerequestWhere[Q psql.Filterable](cols historyServicerequestColumns) historyServicerequestWhere[Q] { - return historyServicerequestWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accepted: psql.WhereNull[Q, int16](cols.Accepted), - Acceptedby: psql.WhereNull[Q, string](cols.Acceptedby), - Accepteddate: psql.WhereNull[Q, int64](cols.Accepteddate), - Allowed: psql.WhereNull[Q, string](cols.Allowed), - Assignedtech: psql.WhereNull[Q, string](cols.Assignedtech), - Clraddr1: psql.WhereNull[Q, string](cols.Clraddr1), - Clraddr2: psql.WhereNull[Q, string](cols.Clraddr2), - Clranon: psql.WhereNull[Q, int16](cols.Clranon), - Clrcity: psql.WhereNull[Q, string](cols.Clrcity), - Clrcompany: psql.WhereNull[Q, string](cols.Clrcompany), - Clrcontpref: psql.WhereNull[Q, string](cols.Clrcontpref), - Clremail: psql.WhereNull[Q, string](cols.Clremail), - Clrfname: psql.WhereNull[Q, string](cols.Clrfname), - Clrother: psql.WhereNull[Q, string](cols.Clrother), - Clrphone1: psql.WhereNull[Q, string](cols.Clrphone1), - Clrphone2: psql.WhereNull[Q, string](cols.Clrphone2), - Clrstate: psql.WhereNull[Q, string](cols.Clrstate), - Clrzip: psql.WhereNull[Q, string](cols.Clrzip), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Datetimeclosed: psql.WhereNull[Q, int64](cols.Datetimeclosed), - Duedate: psql.WhereNull[Q, int64](cols.Duedate), - Entrytech: psql.WhereNull[Q, string](cols.Entrytech), - Estcompletedate: psql.WhereNull[Q, int64](cols.Estcompletedate), - Externalerror: psql.WhereNull[Q, string](cols.Externalerror), - Externalid: psql.WhereNull[Q, string](cols.Externalid), - 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), - Issuesreported: psql.WhereNull[Q, string](cols.Issuesreported), - Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), - Nextaction: psql.WhereNull[Q, string](cols.Nextaction), - Notificationtimestamp: psql.WhereNull[Q, string](cols.Notificationtimestamp), - Notified: psql.WhereNull[Q, int16](cols.Notified), - Notifieddate: psql.WhereNull[Q, int64](cols.Notifieddate), - Objectid: psql.Where[Q, int32](cols.Objectid), - Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Recdatetime: psql.WhereNull[Q, int64](cols.Recdatetime), - Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), - Rejectedby: psql.WhereNull[Q, string](cols.Rejectedby), - Rejecteddate: psql.WhereNull[Q, int64](cols.Rejecteddate), - Rejectedreason: psql.WhereNull[Q, string](cols.Rejectedreason), - Reqaddr1: psql.WhereNull[Q, string](cols.Reqaddr1), - Reqaddr2: psql.WhereNull[Q, string](cols.Reqaddr2), - Reqcity: psql.WhereNull[Q, string](cols.Reqcity), - Reqcompany: psql.WhereNull[Q, string](cols.Reqcompany), - Reqcrossst: psql.WhereNull[Q, string](cols.Reqcrossst), - Reqdescr: psql.WhereNull[Q, string](cols.Reqdescr), - Reqfldnotes: psql.WhereNull[Q, string](cols.Reqfldnotes), - Reqmapgrid: psql.WhereNull[Q, string](cols.Reqmapgrid), - Reqnotesforcust: psql.WhereNull[Q, string](cols.Reqnotesforcust), - Reqnotesfortech: psql.WhereNull[Q, string](cols.Reqnotesfortech), - Reqpermission: psql.WhereNull[Q, int16](cols.Reqpermission), - Reqprogramactions: psql.WhereNull[Q, string](cols.Reqprogramactions), - Reqstate: psql.WhereNull[Q, string](cols.Reqstate), - Reqsubdiv: psql.WhereNull[Q, string](cols.Reqsubdiv), - Reqtarget: psql.WhereNull[Q, string](cols.Reqtarget), - Reqzip: psql.WhereNull[Q, string](cols.Reqzip), - Responsedaycount: psql.WhereNull[Q, int16](cols.Responsedaycount), - Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), - Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), - Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), - Scheduled: psql.WhereNull[Q, int16](cols.Scheduled), - Scheduleddate: psql.WhereNull[Q, int64](cols.Scheduleddate), - Source: psql.WhereNull[Q, string](cols.Source), - SRNumber: psql.WhereNull[Q, int64](cols.SRNumber), - Status: psql.WhereNull[Q, string](cols.Status), - Supervisor: psql.WhereNull[Q, string](cols.Supervisor), - Techclosed: psql.WhereNull[Q, string](cols.Techclosed), - Validx: psql.WhereNull[Q, string](cols.Validx), - Validy: psql.WhereNull[Q, string](cols.Validy), - Xvalue: psql.WhereNull[Q, string](cols.Xvalue), - Yvalue: psql.WhereNull[Q, string](cols.Yvalue), - Zone: psql.WhereNull[Q, string](cols.Zone), - Zone2: psql.WhereNull[Q, string](cols.Zone2), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Dog: psql.WhereNull[Q, int64](cols.Dog), - Spanish: psql.WhereNull[Q, int64](cols.Spanish), - ScheduleNotes: psql.WhereNull[Q, string](cols.ScheduleNotes), - SchedulePeriod: psql.WhereNull[Q, string](cols.SchedulePeriod), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryServicerequest) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyServicerequest cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryServicerequests = HistoryServicerequestSlice{o} - } - return nil - default: - return fmt.Errorf("historyServicerequest has no relationship %q", name) - } -} - -type historyServicerequestPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryServicerequestPreloader() historyServicerequestPreloader { - return historyServicerequestPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryServicerequests, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyServicerequestThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryServicerequestThenLoader[Q orm.Loadable]() historyServicerequestThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyServicerequestThenLoader[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 historyServicerequest's Organization into the .R struct -func (o *HistoryServicerequest) 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.HistoryServicerequests = HistoryServicerequestSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyServicerequest's Organization into the .R struct -func (os HistoryServicerequestSlice) 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.HistoryServicerequests = append(rel.R.HistoryServicerequests, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyServicerequestJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyServicerequestJoins[Q]) aliasedAs(alias string) historyServicerequestJoins[Q] { - return buildHistoryServicerequestJoins[Q](buildHistoryServicerequestColumns(alias), j.typ) -} - -func buildHistoryServicerequestJoins[Q dialect.Joinable](cols historyServicerequestColumns, typ string) historyServicerequestJoins[Q] { - return historyServicerequestJoins[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/db/models/history_speciesabundance.bob.go b/db/models/history_speciesabundance.bob.go deleted file mode 100644 index 0937f32a..00000000 --- a/db/models/history_speciesabundance.bob.go +++ /dev/null @@ -1,1415 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistorySpeciesabundance is an object representing the database table. -type HistorySpeciesabundance struct { - OrganizationID int32 `db:"organization_id" ` - Bloodedfem null.Val[int16] `db:"bloodedfem" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Eggs null.Val[int16] `db:"eggs" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Females null.Val[int64] `db:"females" ` - Gravidfem null.Val[int16] `db:"gravidfem" ` - Globalid null.Val[string] `db:"globalid" ` - Larvae null.Val[int16] `db:"larvae" ` - Males null.Val[int16] `db:"males" ` - Objectid int32 `db:"objectid,pk" ` - Poolstogen null.Val[int16] `db:"poolstogen" ` - Processed null.Val[int16] `db:"processed" ` - Pupae null.Val[int16] `db:"pupae" ` - Species null.Val[string] `db:"species" ` - Total null.Val[int64] `db:"total" ` - TrapdataID null.Val[string] `db:"trapdata_id" ` - Unknown null.Val[int16] `db:"unknown" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Globalzscore null.Val[float64] `db:"globalzscore" ` - H3R7 null.Val[string] `db:"h3r7" ` - H3R8 null.Val[string] `db:"h3r8" ` - R7score null.Val[float64] `db:"r7score" ` - R8score null.Val[float64] `db:"r8score" ` - Yearweek null.Val[int64] `db:"yearweek" ` - Version int32 `db:"version,pk" ` - - R historySpeciesabundanceR `db:"-" ` -} - -// HistorySpeciesabundanceSlice is an alias for a slice of pointers to HistorySpeciesabundance. -// This should almost always be used instead of []*HistorySpeciesabundance. -type HistorySpeciesabundanceSlice []*HistorySpeciesabundance - -// HistorySpeciesabundances contains methods to work with the history_speciesabundance table -var HistorySpeciesabundances = psql.NewTablex[*HistorySpeciesabundance, HistorySpeciesabundanceSlice, *HistorySpeciesabundanceSetter]("", "history_speciesabundance", buildHistorySpeciesabundanceColumns("history_speciesabundance")) - -// HistorySpeciesabundancesQuery is a query on the history_speciesabundance table -type HistorySpeciesabundancesQuery = *psql.ViewQuery[*HistorySpeciesabundance, HistorySpeciesabundanceSlice] - -// historySpeciesabundanceR is where relationships are stored. -type historySpeciesabundanceR struct { - Organization *Organization // history_speciesabundance.history_speciesabundance_organization_id_fkey -} - -func buildHistorySpeciesabundanceColumns(alias string) historySpeciesabundanceColumns { - return historySpeciesabundanceColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "bloodedfem", "creationdate", "creator", "eggs", "editdate", "editor", "females", "gravidfem", "globalid", "larvae", "males", "objectid", "poolstogen", "processed", "pupae", "species", "total", "trapdata_id", "unknown", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "globalzscore", "h3r7", "h3r8", "r7score", "r8score", "yearweek", "version", - ).WithParent("history_speciesabundance"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Bloodedfem: psql.Quote(alias, "bloodedfem"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Eggs: psql.Quote(alias, "eggs"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Females: psql.Quote(alias, "females"), - Gravidfem: psql.Quote(alias, "gravidfem"), - Globalid: psql.Quote(alias, "globalid"), - Larvae: psql.Quote(alias, "larvae"), - Males: psql.Quote(alias, "males"), - Objectid: psql.Quote(alias, "objectid"), - Poolstogen: psql.Quote(alias, "poolstogen"), - Processed: psql.Quote(alias, "processed"), - Pupae: psql.Quote(alias, "pupae"), - Species: psql.Quote(alias, "species"), - Total: psql.Quote(alias, "total"), - TrapdataID: psql.Quote(alias, "trapdata_id"), - Unknown: psql.Quote(alias, "unknown"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Globalzscore: psql.Quote(alias, "globalzscore"), - H3R7: psql.Quote(alias, "h3r7"), - H3R8: psql.Quote(alias, "h3r8"), - R7score: psql.Quote(alias, "r7score"), - R8score: psql.Quote(alias, "r8score"), - Yearweek: psql.Quote(alias, "yearweek"), - Version: psql.Quote(alias, "version"), - } -} - -type historySpeciesabundanceColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Bloodedfem psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Eggs psql.Expression - Editdate psql.Expression - Editor psql.Expression - Females psql.Expression - Gravidfem psql.Expression - Globalid psql.Expression - Larvae psql.Expression - Males psql.Expression - Objectid psql.Expression - Poolstogen psql.Expression - Processed psql.Expression - Pupae psql.Expression - Species psql.Expression - Total psql.Expression - TrapdataID psql.Expression - Unknown psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Globalzscore psql.Expression - H3R7 psql.Expression - H3R8 psql.Expression - R7score psql.Expression - R8score psql.Expression - Yearweek psql.Expression - Version psql.Expression -} - -func (c historySpeciesabundanceColumns) Alias() string { - return c.tableAlias -} - -func (historySpeciesabundanceColumns) AliasedAs(alias string) historySpeciesabundanceColumns { - return buildHistorySpeciesabundanceColumns(alias) -} - -// HistorySpeciesabundanceSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistorySpeciesabundanceSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Bloodedfem omitnull.Val[int16] `db:"bloodedfem" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Eggs omitnull.Val[int16] `db:"eggs" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Females omitnull.Val[int64] `db:"females" ` - Gravidfem omitnull.Val[int16] `db:"gravidfem" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Larvae omitnull.Val[int16] `db:"larvae" ` - Males omitnull.Val[int16] `db:"males" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Poolstogen omitnull.Val[int16] `db:"poolstogen" ` - Processed omitnull.Val[int16] `db:"processed" ` - Pupae omitnull.Val[int16] `db:"pupae" ` - Species omitnull.Val[string] `db:"species" ` - Total omitnull.Val[int64] `db:"total" ` - TrapdataID omitnull.Val[string] `db:"trapdata_id" ` - Unknown omitnull.Val[int16] `db:"unknown" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Globalzscore omitnull.Val[float64] `db:"globalzscore" ` - H3R7 omitnull.Val[string] `db:"h3r7" ` - H3R8 omitnull.Val[string] `db:"h3r8" ` - R7score omitnull.Val[float64] `db:"r7score" ` - R8score omitnull.Val[float64] `db:"r8score" ` - Yearweek omitnull.Val[int64] `db:"yearweek" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistorySpeciesabundanceSetter) SetColumns() []string { - vals := make([]string, 0, 34) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Bloodedfem.IsUnset() { - vals = append(vals, "bloodedfem") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Eggs.IsUnset() { - vals = append(vals, "eggs") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Females.IsUnset() { - vals = append(vals, "females") - } - if !s.Gravidfem.IsUnset() { - vals = append(vals, "gravidfem") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Larvae.IsUnset() { - vals = append(vals, "larvae") - } - if !s.Males.IsUnset() { - vals = append(vals, "males") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Poolstogen.IsUnset() { - vals = append(vals, "poolstogen") - } - if !s.Processed.IsUnset() { - vals = append(vals, "processed") - } - if !s.Pupae.IsUnset() { - vals = append(vals, "pupae") - } - if !s.Species.IsUnset() { - vals = append(vals, "species") - } - if !s.Total.IsUnset() { - vals = append(vals, "total") - } - if !s.TrapdataID.IsUnset() { - vals = append(vals, "trapdata_id") - } - if !s.Unknown.IsUnset() { - vals = append(vals, "unknown") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Globalzscore.IsUnset() { - vals = append(vals, "globalzscore") - } - if !s.H3R7.IsUnset() { - vals = append(vals, "h3r7") - } - if !s.H3R8.IsUnset() { - vals = append(vals, "h3r8") - } - if !s.R7score.IsUnset() { - vals = append(vals, "r7score") - } - if !s.R8score.IsUnset() { - vals = append(vals, "r8score") - } - if !s.Yearweek.IsUnset() { - vals = append(vals, "yearweek") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistorySpeciesabundanceSetter) Overwrite(t *HistorySpeciesabundance) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Bloodedfem.IsUnset() { - t.Bloodedfem = s.Bloodedfem.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Eggs.IsUnset() { - t.Eggs = s.Eggs.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Females.IsUnset() { - t.Females = s.Females.MustGetNull() - } - if !s.Gravidfem.IsUnset() { - t.Gravidfem = s.Gravidfem.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Larvae.IsUnset() { - t.Larvae = s.Larvae.MustGetNull() - } - if !s.Males.IsUnset() { - t.Males = s.Males.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Poolstogen.IsUnset() { - t.Poolstogen = s.Poolstogen.MustGetNull() - } - if !s.Processed.IsUnset() { - t.Processed = s.Processed.MustGetNull() - } - if !s.Pupae.IsUnset() { - t.Pupae = s.Pupae.MustGetNull() - } - if !s.Species.IsUnset() { - t.Species = s.Species.MustGetNull() - } - if !s.Total.IsUnset() { - t.Total = s.Total.MustGetNull() - } - if !s.TrapdataID.IsUnset() { - t.TrapdataID = s.TrapdataID.MustGetNull() - } - if !s.Unknown.IsUnset() { - t.Unknown = s.Unknown.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Globalzscore.IsUnset() { - t.Globalzscore = s.Globalzscore.MustGetNull() - } - if !s.H3R7.IsUnset() { - t.H3R7 = s.H3R7.MustGetNull() - } - if !s.H3R8.IsUnset() { - t.H3R8 = s.H3R8.MustGetNull() - } - if !s.R7score.IsUnset() { - t.R7score = s.R7score.MustGetNull() - } - if !s.R8score.IsUnset() { - t.R8score = s.R8score.MustGetNull() - } - if !s.Yearweek.IsUnset() { - t.Yearweek = s.Yearweek.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistorySpeciesabundanceSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistorySpeciesabundances.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 34) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Bloodedfem.IsUnset() { - vals[1] = psql.Arg(s.Bloodedfem.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[2] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[3] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Eggs.IsUnset() { - vals[4] = psql.Arg(s.Eggs.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[5] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[6] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Females.IsUnset() { - vals[7] = psql.Arg(s.Females.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Gravidfem.IsUnset() { - vals[8] = psql.Arg(s.Gravidfem.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[9] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Larvae.IsUnset() { - vals[10] = psql.Arg(s.Larvae.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Males.IsUnset() { - vals[11] = psql.Arg(s.Males.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[12] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Poolstogen.IsUnset() { - vals[13] = psql.Arg(s.Poolstogen.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Processed.IsUnset() { - vals[14] = psql.Arg(s.Processed.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Pupae.IsUnset() { - vals[15] = psql.Arg(s.Pupae.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Species.IsUnset() { - vals[16] = psql.Arg(s.Species.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Total.IsUnset() { - vals[17] = psql.Arg(s.Total.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.TrapdataID.IsUnset() { - vals[18] = psql.Arg(s.TrapdataID.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Unknown.IsUnset() { - vals[19] = psql.Arg(s.Unknown.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[20] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[21] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[22] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[23] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[24] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[25] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[26] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Globalzscore.IsUnset() { - vals[27] = psql.Arg(s.Globalzscore.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.H3R7.IsUnset() { - vals[28] = psql.Arg(s.H3R7.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.H3R8.IsUnset() { - vals[29] = psql.Arg(s.H3R8.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.R7score.IsUnset() { - vals[30] = psql.Arg(s.R7score.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.R8score.IsUnset() { - vals[31] = psql.Arg(s.R8score.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Yearweek.IsUnset() { - vals[32] = psql.Arg(s.Yearweek.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[33] = psql.Arg(s.Version.MustGet()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistorySpeciesabundanceSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistorySpeciesabundanceSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 34) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Bloodedfem.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "bloodedfem")...), - psql.Arg(s.Bloodedfem), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Eggs.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "eggs")...), - psql.Arg(s.Eggs), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Females.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "females")...), - psql.Arg(s.Females), - }}) - } - - if !s.Gravidfem.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "gravidfem")...), - psql.Arg(s.Gravidfem), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Larvae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "larvae")...), - psql.Arg(s.Larvae), - }}) - } - - if !s.Males.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "males")...), - psql.Arg(s.Males), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Poolstogen.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "poolstogen")...), - psql.Arg(s.Poolstogen), - }}) - } - - if !s.Processed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "processed")...), - psql.Arg(s.Processed), - }}) - } - - if !s.Pupae.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pupae")...), - psql.Arg(s.Pupae), - }}) - } - - if !s.Species.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "species")...), - psql.Arg(s.Species), - }}) - } - - if !s.Total.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "total")...), - psql.Arg(s.Total), - }}) - } - - if !s.TrapdataID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "trapdata_id")...), - psql.Arg(s.TrapdataID), - }}) - } - - if !s.Unknown.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "unknown")...), - psql.Arg(s.Unknown), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Globalzscore.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalzscore")...), - psql.Arg(s.Globalzscore), - }}) - } - - if !s.H3R7.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "h3r7")...), - psql.Arg(s.H3R7), - }}) - } - - if !s.H3R8.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "h3r8")...), - psql.Arg(s.H3R8), - }}) - } - - if !s.R7score.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "r7score")...), - psql.Arg(s.R7score), - }}) - } - - if !s.R8score.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "r8score")...), - psql.Arg(s.R8score), - }}) - } - - if !s.Yearweek.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "yearweek")...), - psql.Arg(s.Yearweek), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistorySpeciesabundance retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistorySpeciesabundance(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistorySpeciesabundance, error) { - if len(cols) == 0 { - return HistorySpeciesabundances.Query( - sm.Where(HistorySpeciesabundances.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistorySpeciesabundances.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistorySpeciesabundances.Query( - sm.Where(HistorySpeciesabundances.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistorySpeciesabundances.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistorySpeciesabundances.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistorySpeciesabundanceExists checks the presence of a single record by primary key -func HistorySpeciesabundanceExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistorySpeciesabundances.Query( - sm.Where(HistorySpeciesabundances.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistorySpeciesabundances.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistorySpeciesabundance is retrieved from the database -func (o *HistorySpeciesabundance) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistorySpeciesabundances.AfterSelectHooks.RunHooks(ctx, exec, HistorySpeciesabundanceSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistorySpeciesabundances.AfterInsertHooks.RunHooks(ctx, exec, HistorySpeciesabundanceSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistorySpeciesabundances.AfterUpdateHooks.RunHooks(ctx, exec, HistorySpeciesabundanceSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistorySpeciesabundances.AfterDeleteHooks.RunHooks(ctx, exec, HistorySpeciesabundanceSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistorySpeciesabundance -func (o *HistorySpeciesabundance) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistorySpeciesabundance) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_speciesabundance", "objectid"), psql.Quote("history_speciesabundance", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistorySpeciesabundance -func (o *HistorySpeciesabundance) Update(ctx context.Context, exec bob.Executor, s *HistorySpeciesabundanceSetter) error { - v, err := HistorySpeciesabundances.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 HistorySpeciesabundance record with an executor -func (o *HistorySpeciesabundance) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistorySpeciesabundances.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistorySpeciesabundance using the executor -func (o *HistorySpeciesabundance) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistorySpeciesabundances.Query( - sm.Where(HistorySpeciesabundances.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistorySpeciesabundances.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistorySpeciesabundanceSlice is retrieved from the database -func (o HistorySpeciesabundanceSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistorySpeciesabundances.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistorySpeciesabundances.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistorySpeciesabundances.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistorySpeciesabundances.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistorySpeciesabundanceSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_speciesabundance", "objectid"), psql.Quote("history_speciesabundance", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistorySpeciesabundanceSlice) copyMatchingRows(from ...*HistorySpeciesabundance) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistorySpeciesabundanceSlice) 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 HistorySpeciesabundances.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 *HistorySpeciesabundance: - o.copyMatchingRows(retrieved) - case []*HistorySpeciesabundance: - o.copyMatchingRows(retrieved...) - case HistorySpeciesabundanceSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistorySpeciesabundance or a slice of HistorySpeciesabundance - // then run the AfterUpdateHooks on the slice - _, err = HistorySpeciesabundances.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistorySpeciesabundanceSlice) 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 HistorySpeciesabundances.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 *HistorySpeciesabundance: - o.copyMatchingRows(retrieved) - case []*HistorySpeciesabundance: - o.copyMatchingRows(retrieved...) - case HistorySpeciesabundanceSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistorySpeciesabundance or a slice of HistorySpeciesabundance - // then run the AfterDeleteHooks on the slice - _, err = HistorySpeciesabundances.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistorySpeciesabundanceSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistorySpeciesabundanceSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistorySpeciesabundances.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistorySpeciesabundanceSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistorySpeciesabundances.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistorySpeciesabundanceSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistorySpeciesabundances.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 *HistorySpeciesabundance) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistorySpeciesabundanceSlice) 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 attachHistorySpeciesabundanceOrganization0(ctx context.Context, exec bob.Executor, count int, historySpeciesabundance0 *HistorySpeciesabundance, organization1 *Organization) (*HistorySpeciesabundance, error) { - setter := &HistorySpeciesabundanceSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historySpeciesabundance0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistorySpeciesabundanceOrganization0: %w", err) - } - - return historySpeciesabundance0, nil -} - -func (historySpeciesabundance0 *HistorySpeciesabundance) 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 = attachHistorySpeciesabundanceOrganization0(ctx, exec, 1, historySpeciesabundance0, organization1) - if err != nil { - return err - } - - historySpeciesabundance0.R.Organization = organization1 - - organization1.R.HistorySpeciesabundances = append(organization1.R.HistorySpeciesabundances, historySpeciesabundance0) - - return nil -} - -func (historySpeciesabundance0 *HistorySpeciesabundance) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistorySpeciesabundanceOrganization0(ctx, exec, 1, historySpeciesabundance0, organization1) - if err != nil { - return err - } - - historySpeciesabundance0.R.Organization = organization1 - - organization1.R.HistorySpeciesabundances = append(organization1.R.HistorySpeciesabundances, historySpeciesabundance0) - - return nil -} - -type historySpeciesabundanceWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Bloodedfem psql.WhereNullMod[Q, int16] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Eggs psql.WhereNullMod[Q, int16] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Females psql.WhereNullMod[Q, int64] - Gravidfem psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] - Larvae psql.WhereNullMod[Q, int16] - Males psql.WhereNullMod[Q, int16] - Objectid psql.WhereMod[Q, int32] - Poolstogen psql.WhereNullMod[Q, int16] - Processed psql.WhereNullMod[Q, int16] - Pupae psql.WhereNullMod[Q, int16] - Species psql.WhereNullMod[Q, string] - Total psql.WhereNullMod[Q, int64] - TrapdataID psql.WhereNullMod[Q, string] - Unknown psql.WhereNullMod[Q, int16] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Globalzscore psql.WhereNullMod[Q, float64] - H3R7 psql.WhereNullMod[Q, string] - H3R8 psql.WhereNullMod[Q, string] - R7score psql.WhereNullMod[Q, float64] - R8score psql.WhereNullMod[Q, float64] - Yearweek psql.WhereNullMod[Q, int64] - Version psql.WhereMod[Q, int32] -} - -func (historySpeciesabundanceWhere[Q]) AliasedAs(alias string) historySpeciesabundanceWhere[Q] { - return buildHistorySpeciesabundanceWhere[Q](buildHistorySpeciesabundanceColumns(alias)) -} - -func buildHistorySpeciesabundanceWhere[Q psql.Filterable](cols historySpeciesabundanceColumns) historySpeciesabundanceWhere[Q] { - return historySpeciesabundanceWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Bloodedfem: psql.WhereNull[Q, int16](cols.Bloodedfem), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Eggs: psql.WhereNull[Q, int16](cols.Eggs), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - 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), - Larvae: psql.WhereNull[Q, int16](cols.Larvae), - Males: psql.WhereNull[Q, int16](cols.Males), - Objectid: psql.Where[Q, int32](cols.Objectid), - Poolstogen: psql.WhereNull[Q, int16](cols.Poolstogen), - Processed: psql.WhereNull[Q, int16](cols.Processed), - Pupae: psql.WhereNull[Q, int16](cols.Pupae), - Species: psql.WhereNull[Q, string](cols.Species), - Total: psql.WhereNull[Q, int64](cols.Total), - TrapdataID: psql.WhereNull[Q, string](cols.TrapdataID), - Unknown: psql.WhereNull[Q, int16](cols.Unknown), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Globalzscore: psql.WhereNull[Q, float64](cols.Globalzscore), - H3R7: psql.WhereNull[Q, string](cols.H3R7), - H3R8: psql.WhereNull[Q, string](cols.H3R8), - R7score: psql.WhereNull[Q, float64](cols.R7score), - R8score: psql.WhereNull[Q, float64](cols.R8score), - Yearweek: psql.WhereNull[Q, int64](cols.Yearweek), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistorySpeciesabundance) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historySpeciesabundance cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistorySpeciesabundances = HistorySpeciesabundanceSlice{o} - } - return nil - default: - return fmt.Errorf("historySpeciesabundance has no relationship %q", name) - } -} - -type historySpeciesabundancePreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistorySpeciesabundancePreloader() historySpeciesabundancePreloader { - return historySpeciesabundancePreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistorySpeciesabundances, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historySpeciesabundanceThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistorySpeciesabundanceThenLoader[Q orm.Loadable]() historySpeciesabundanceThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historySpeciesabundanceThenLoader[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 historySpeciesabundance's Organization into the .R struct -func (o *HistorySpeciesabundance) 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.HistorySpeciesabundances = HistorySpeciesabundanceSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historySpeciesabundance's Organization into the .R struct -func (os HistorySpeciesabundanceSlice) 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.HistorySpeciesabundances = append(rel.R.HistorySpeciesabundances, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historySpeciesabundanceJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historySpeciesabundanceJoins[Q]) aliasedAs(alias string) historySpeciesabundanceJoins[Q] { - return buildHistorySpeciesabundanceJoins[Q](buildHistorySpeciesabundanceColumns(alias), j.typ) -} - -func buildHistorySpeciesabundanceJoins[Q dialect.Joinable](cols historySpeciesabundanceColumns, typ string) historySpeciesabundanceJoins[Q] { - return historySpeciesabundanceJoins[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/db/models/history_stormdrain.bob.go b/db/models/history_stormdrain.bob.go deleted file mode 100644 index 4129d578..00000000 --- a/db/models/history_stormdrain.bob.go +++ /dev/null @@ -1,1165 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryStormdrain is an object representing the database table. -type HistoryStormdrain struct { - OrganizationID int32 `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Jurisdiction null.Val[string] `db:"jurisdiction" ` - Lastaction null.Val[string] `db:"lastaction" ` - Laststatus null.Val[string] `db:"laststatus" ` - Lasttreatdate null.Val[int64] `db:"lasttreatdate" ` - Nexttreatmentdate null.Val[int64] `db:"nexttreatmentdate" ` - Objectid int32 `db:"objectid,pk" ` - Symbology null.Val[string] `db:"symbology" ` - Type null.Val[string] `db:"type" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historyStormdrainR `db:"-" ` -} - -// HistoryStormdrainSlice is an alias for a slice of pointers to HistoryStormdrain. -// This should almost always be used instead of []*HistoryStormdrain. -type HistoryStormdrainSlice []*HistoryStormdrain - -// HistoryStormdrains contains methods to work with the history_stormdrain table -var HistoryStormdrains = psql.NewTablex[*HistoryStormdrain, HistoryStormdrainSlice, *HistoryStormdrainSetter]("", "history_stormdrain", buildHistoryStormdrainColumns("history_stormdrain")) - -// HistoryStormdrainsQuery is a query on the history_stormdrain table -type HistoryStormdrainsQuery = *psql.ViewQuery[*HistoryStormdrain, HistoryStormdrainSlice] - -// historyStormdrainR is where relationships are stored. -type historyStormdrainR struct { - Organization *Organization // history_stormdrain.history_stormdrain_organization_id_fkey -} - -func buildHistoryStormdrainColumns(alias string) historyStormdrainColumns { - return historyStormdrainColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "jurisdiction", "lastaction", "laststatus", "lasttreatdate", "nexttreatmentdate", "objectid", "symbology", "type", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", - ).WithParent("history_stormdrain"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Jurisdiction: psql.Quote(alias, "jurisdiction"), - Lastaction: psql.Quote(alias, "lastaction"), - Laststatus: psql.Quote(alias, "laststatus"), - Lasttreatdate: psql.Quote(alias, "lasttreatdate"), - Nexttreatmentdate: psql.Quote(alias, "nexttreatmentdate"), - Objectid: psql.Quote(alias, "objectid"), - Symbology: psql.Quote(alias, "symbology"), - Type: psql.Quote(alias, "type"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Version: psql.Quote(alias, "version"), - } -} - -type historyStormdrainColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Jurisdiction psql.Expression - Lastaction psql.Expression - Laststatus psql.Expression - Lasttreatdate psql.Expression - Nexttreatmentdate psql.Expression - Objectid psql.Expression - Symbology psql.Expression - Type psql.Expression - Zone psql.Expression - Zone2 psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Version psql.Expression -} - -func (c historyStormdrainColumns) Alias() string { - return c.tableAlias -} - -func (historyStormdrainColumns) AliasedAs(alias string) historyStormdrainColumns { - return buildHistoryStormdrainColumns(alias) -} - -// HistoryStormdrainSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryStormdrainSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Jurisdiction omitnull.Val[string] `db:"jurisdiction" ` - Lastaction omitnull.Val[string] `db:"lastaction" ` - Laststatus omitnull.Val[string] `db:"laststatus" ` - Lasttreatdate omitnull.Val[int64] `db:"lasttreatdate" ` - Nexttreatmentdate omitnull.Val[int64] `db:"nexttreatmentdate" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Symbology omitnull.Val[string] `db:"symbology" ` - Type omitnull.Val[string] `db:"type" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryStormdrainSetter) SetColumns() []string { - vals := make([]string, 0, 24) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Jurisdiction.IsUnset() { - vals = append(vals, "jurisdiction") - } - if !s.Lastaction.IsUnset() { - vals = append(vals, "lastaction") - } - if !s.Laststatus.IsUnset() { - vals = append(vals, "laststatus") - } - if !s.Lasttreatdate.IsUnset() { - vals = append(vals, "lasttreatdate") - } - if !s.Nexttreatmentdate.IsUnset() { - vals = append(vals, "nexttreatmentdate") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Symbology.IsUnset() { - vals = append(vals, "symbology") - } - if !s.Type.IsUnset() { - vals = append(vals, "type") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryStormdrainSetter) Overwrite(t *HistoryStormdrain) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Jurisdiction.IsUnset() { - t.Jurisdiction = s.Jurisdiction.MustGetNull() - } - if !s.Lastaction.IsUnset() { - t.Lastaction = s.Lastaction.MustGetNull() - } - if !s.Laststatus.IsUnset() { - t.Laststatus = s.Laststatus.MustGetNull() - } - if !s.Lasttreatdate.IsUnset() { - t.Lasttreatdate = s.Lasttreatdate.MustGetNull() - } - if !s.Nexttreatmentdate.IsUnset() { - t.Nexttreatmentdate = s.Nexttreatmentdate.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Symbology.IsUnset() { - t.Symbology = s.Symbology.MustGetNull() - } - if !s.Type.IsUnset() { - t.Type = s.Type.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryStormdrainSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryStormdrains.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 24) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[1] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[2] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[3] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[4] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[5] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Jurisdiction.IsUnset() { - vals[6] = psql.Arg(s.Jurisdiction.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Lastaction.IsUnset() { - vals[7] = psql.Arg(s.Lastaction.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Laststatus.IsUnset() { - vals[8] = psql.Arg(s.Laststatus.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Lasttreatdate.IsUnset() { - vals[9] = psql.Arg(s.Lasttreatdate.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Nexttreatmentdate.IsUnset() { - vals[10] = psql.Arg(s.Nexttreatmentdate.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[11] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Symbology.IsUnset() { - vals[12] = psql.Arg(s.Symbology.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Type.IsUnset() { - vals[13] = psql.Arg(s.Type.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[14] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[15] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[16] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[17] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[18] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[19] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[20] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[21] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[22] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[23] = psql.Arg(s.Version.MustGet()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryStormdrainSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryStormdrainSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 24) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Jurisdiction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "jurisdiction")...), - psql.Arg(s.Jurisdiction), - }}) - } - - if !s.Lastaction.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lastaction")...), - psql.Arg(s.Lastaction), - }}) - } - - if !s.Laststatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "laststatus")...), - psql.Arg(s.Laststatus), - }}) - } - - if !s.Lasttreatdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lasttreatdate")...), - psql.Arg(s.Lasttreatdate), - }}) - } - - if !s.Nexttreatmentdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nexttreatmentdate")...), - psql.Arg(s.Nexttreatmentdate), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Symbology.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "symbology")...), - psql.Arg(s.Symbology), - }}) - } - - if !s.Type.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "type")...), - psql.Arg(s.Type), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryStormdrain retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryStormdrain(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryStormdrain, error) { - if len(cols) == 0 { - return HistoryStormdrains.Query( - sm.Where(HistoryStormdrains.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryStormdrains.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryStormdrains.Query( - sm.Where(HistoryStormdrains.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryStormdrains.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryStormdrains.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryStormdrainExists checks the presence of a single record by primary key -func HistoryStormdrainExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryStormdrains.Query( - sm.Where(HistoryStormdrains.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryStormdrains.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryStormdrain is retrieved from the database -func (o *HistoryStormdrain) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryStormdrains.AfterSelectHooks.RunHooks(ctx, exec, HistoryStormdrainSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryStormdrains.AfterInsertHooks.RunHooks(ctx, exec, HistoryStormdrainSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryStormdrains.AfterUpdateHooks.RunHooks(ctx, exec, HistoryStormdrainSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryStormdrains.AfterDeleteHooks.RunHooks(ctx, exec, HistoryStormdrainSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryStormdrain -func (o *HistoryStormdrain) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryStormdrain) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_stormdrain", "objectid"), psql.Quote("history_stormdrain", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryStormdrain -func (o *HistoryStormdrain) Update(ctx context.Context, exec bob.Executor, s *HistoryStormdrainSetter) error { - v, err := HistoryStormdrains.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 HistoryStormdrain record with an executor -func (o *HistoryStormdrain) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryStormdrains.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryStormdrain using the executor -func (o *HistoryStormdrain) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryStormdrains.Query( - sm.Where(HistoryStormdrains.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryStormdrains.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryStormdrainSlice is retrieved from the database -func (o HistoryStormdrainSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryStormdrains.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryStormdrains.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryStormdrains.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryStormdrains.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryStormdrainSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_stormdrain", "objectid"), psql.Quote("history_stormdrain", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryStormdrainSlice) copyMatchingRows(from ...*HistoryStormdrain) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryStormdrainSlice) 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 HistoryStormdrains.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 *HistoryStormdrain: - o.copyMatchingRows(retrieved) - case []*HistoryStormdrain: - o.copyMatchingRows(retrieved...) - case HistoryStormdrainSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryStormdrain or a slice of HistoryStormdrain - // then run the AfterUpdateHooks on the slice - _, err = HistoryStormdrains.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryStormdrainSlice) 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 HistoryStormdrains.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 *HistoryStormdrain: - o.copyMatchingRows(retrieved) - case []*HistoryStormdrain: - o.copyMatchingRows(retrieved...) - case HistoryStormdrainSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryStormdrain or a slice of HistoryStormdrain - // then run the AfterDeleteHooks on the slice - _, err = HistoryStormdrains.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryStormdrainSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryStormdrainSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryStormdrains.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryStormdrainSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryStormdrains.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryStormdrainSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryStormdrains.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 *HistoryStormdrain) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryStormdrainSlice) 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 attachHistoryStormdrainOrganization0(ctx context.Context, exec bob.Executor, count int, historyStormdrain0 *HistoryStormdrain, organization1 *Organization) (*HistoryStormdrain, error) { - setter := &HistoryStormdrainSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyStormdrain0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryStormdrainOrganization0: %w", err) - } - - return historyStormdrain0, nil -} - -func (historyStormdrain0 *HistoryStormdrain) 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 = attachHistoryStormdrainOrganization0(ctx, exec, 1, historyStormdrain0, organization1) - if err != nil { - return err - } - - historyStormdrain0.R.Organization = organization1 - - organization1.R.HistoryStormdrains = append(organization1.R.HistoryStormdrains, historyStormdrain0) - - return nil -} - -func (historyStormdrain0 *HistoryStormdrain) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryStormdrainOrganization0(ctx, exec, 1, historyStormdrain0, organization1) - if err != nil { - return err - } - - historyStormdrain0.R.Organization = organization1 - - organization1.R.HistoryStormdrains = append(organization1.R.HistoryStormdrains, historyStormdrain0) - - return nil -} - -type historyStormdrainWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Jurisdiction psql.WhereNullMod[Q, string] - Lastaction psql.WhereNullMod[Q, string] - Laststatus psql.WhereNullMod[Q, string] - Lasttreatdate psql.WhereNullMod[Q, int64] - Nexttreatmentdate psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Symbology psql.WhereNullMod[Q, string] - Type psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyStormdrainWhere[Q]) AliasedAs(alias string) historyStormdrainWhere[Q] { - return buildHistoryStormdrainWhere[Q](buildHistoryStormdrainColumns(alias)) -} - -func buildHistoryStormdrainWhere[Q psql.Filterable](cols historyStormdrainColumns) historyStormdrainWhere[Q] { - return historyStormdrainWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - 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), - Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction), - Lastaction: psql.WhereNull[Q, string](cols.Lastaction), - Laststatus: psql.WhereNull[Q, string](cols.Laststatus), - Lasttreatdate: psql.WhereNull[Q, int64](cols.Lasttreatdate), - Nexttreatmentdate: psql.WhereNull[Q, int64](cols.Nexttreatmentdate), - Objectid: psql.Where[Q, int32](cols.Objectid), - Symbology: psql.WhereNull[Q, string](cols.Symbology), - Type: psql.WhereNull[Q, string](cols.Type), - Zone: psql.WhereNull[Q, string](cols.Zone), - Zone2: psql.WhereNull[Q, string](cols.Zone2), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryStormdrain) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyStormdrain cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryStormdrains = HistoryStormdrainSlice{o} - } - return nil - default: - return fmt.Errorf("historyStormdrain has no relationship %q", name) - } -} - -type historyStormdrainPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryStormdrainPreloader() historyStormdrainPreloader { - return historyStormdrainPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryStormdrains, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyStormdrainThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryStormdrainThenLoader[Q orm.Loadable]() historyStormdrainThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyStormdrainThenLoader[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 historyStormdrain's Organization into the .R struct -func (o *HistoryStormdrain) 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.HistoryStormdrains = HistoryStormdrainSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyStormdrain's Organization into the .R struct -func (os HistoryStormdrainSlice) 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.HistoryStormdrains = append(rel.R.HistoryStormdrains, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyStormdrainJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyStormdrainJoins[Q]) aliasedAs(alias string) historyStormdrainJoins[Q] { - return buildHistoryStormdrainJoins[Q](buildHistoryStormdrainColumns(alias), j.typ) -} - -func buildHistoryStormdrainJoins[Q dialect.Joinable](cols historyStormdrainColumns, typ string) historyStormdrainJoins[Q] { - return historyStormdrainJoins[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/db/models/history_timecard.bob.go b/db/models/history_timecard.bob.go deleted file mode 100644 index 769943a0..00000000 --- a/db/models/history_timecard.bob.go +++ /dev/null @@ -1,1390 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryTimecard is an object representing the database table. -type HistoryTimecard struct { - OrganizationID int32 `db:"organization_id" ` - Activity null.Val[string] `db:"activity" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Equiptype null.Val[string] `db:"equiptype" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Globalid null.Val[string] `db:"globalid" ` - Lclocid null.Val[string] `db:"lclocid" ` - Linelocid null.Val[string] `db:"linelocid" ` - Locationname null.Val[string] `db:"locationname" ` - Objectid int32 `db:"objectid,pk" ` - Pointlocid null.Val[string] `db:"pointlocid" ` - Polygonlocid null.Val[string] `db:"polygonlocid" ` - Samplelocid null.Val[string] `db:"samplelocid" ` - Srid null.Val[string] `db:"srid" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Traplocid null.Val[string] `db:"traplocid" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Rodentlocid null.Val[string] `db:"rodentlocid" ` - Version int32 `db:"version,pk" ` - - R historyTimecardR `db:"-" ` -} - -// HistoryTimecardSlice is an alias for a slice of pointers to HistoryTimecard. -// This should almost always be used instead of []*HistoryTimecard. -type HistoryTimecardSlice []*HistoryTimecard - -// HistoryTimecards contains methods to work with the history_timecard table -var HistoryTimecards = psql.NewTablex[*HistoryTimecard, HistoryTimecardSlice, *HistoryTimecardSetter]("", "history_timecard", buildHistoryTimecardColumns("history_timecard")) - -// HistoryTimecardsQuery is a query on the history_timecard table -type HistoryTimecardsQuery = *psql.ViewQuery[*HistoryTimecard, HistoryTimecardSlice] - -// historyTimecardR is where relationships are stored. -type historyTimecardR struct { - Organization *Organization // history_timecard.history_timecard_organization_id_fkey -} - -func buildHistoryTimecardColumns(alias string) historyTimecardColumns { - return historyTimecardColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "activity", "comments", "creationdate", "creator", "enddatetime", "equiptype", "externalid", "editdate", "editor", "fieldtech", "globalid", "lclocid", "linelocid", "locationname", "objectid", "pointlocid", "polygonlocid", "samplelocid", "srid", "startdatetime", "traplocid", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "rodentlocid", "version", - ).WithParent("history_timecard"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Activity: psql.Quote(alias, "activity"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Enddatetime: psql.Quote(alias, "enddatetime"), - Equiptype: psql.Quote(alias, "equiptype"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fieldtech: psql.Quote(alias, "fieldtech"), - Globalid: psql.Quote(alias, "globalid"), - Lclocid: psql.Quote(alias, "lclocid"), - Linelocid: psql.Quote(alias, "linelocid"), - Locationname: psql.Quote(alias, "locationname"), - Objectid: psql.Quote(alias, "objectid"), - Pointlocid: psql.Quote(alias, "pointlocid"), - Polygonlocid: psql.Quote(alias, "polygonlocid"), - Samplelocid: psql.Quote(alias, "samplelocid"), - Srid: psql.Quote(alias, "srid"), - Startdatetime: psql.Quote(alias, "startdatetime"), - Traplocid: psql.Quote(alias, "traplocid"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Rodentlocid: psql.Quote(alias, "rodentlocid"), - Version: psql.Quote(alias, "version"), - } -} - -type historyTimecardColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Activity psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Enddatetime psql.Expression - Equiptype psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fieldtech psql.Expression - Globalid psql.Expression - Lclocid psql.Expression - Linelocid psql.Expression - Locationname psql.Expression - Objectid psql.Expression - Pointlocid psql.Expression - Polygonlocid psql.Expression - Samplelocid psql.Expression - Srid psql.Expression - Startdatetime psql.Expression - Traplocid psql.Expression - Zone psql.Expression - Zone2 psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Rodentlocid psql.Expression - Version psql.Expression -} - -func (c historyTimecardColumns) Alias() string { - return c.tableAlias -} - -func (historyTimecardColumns) AliasedAs(alias string) historyTimecardColumns { - return buildHistoryTimecardColumns(alias) -} - -// HistoryTimecardSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryTimecardSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Activity omitnull.Val[string] `db:"activity" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Equiptype omitnull.Val[string] `db:"equiptype" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Lclocid omitnull.Val[string] `db:"lclocid" ` - Linelocid omitnull.Val[string] `db:"linelocid" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Pointlocid omitnull.Val[string] `db:"pointlocid" ` - Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` - Samplelocid omitnull.Val[string] `db:"samplelocid" ` - Srid omitnull.Val[string] `db:"srid" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Traplocid omitnull.Val[string] `db:"traplocid" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Rodentlocid omitnull.Val[string] `db:"rodentlocid" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryTimecardSetter) SetColumns() []string { - vals := make([]string, 0, 33) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Activity.IsUnset() { - vals = append(vals, "activity") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Enddatetime.IsUnset() { - vals = append(vals, "enddatetime") - } - if !s.Equiptype.IsUnset() { - vals = append(vals, "equiptype") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fieldtech.IsUnset() { - vals = append(vals, "fieldtech") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Lclocid.IsUnset() { - vals = append(vals, "lclocid") - } - if !s.Linelocid.IsUnset() { - vals = append(vals, "linelocid") - } - if !s.Locationname.IsUnset() { - vals = append(vals, "locationname") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Pointlocid.IsUnset() { - vals = append(vals, "pointlocid") - } - if !s.Polygonlocid.IsUnset() { - vals = append(vals, "polygonlocid") - } - if !s.Samplelocid.IsUnset() { - vals = append(vals, "samplelocid") - } - if !s.Srid.IsUnset() { - vals = append(vals, "srid") - } - if !s.Startdatetime.IsUnset() { - vals = append(vals, "startdatetime") - } - if !s.Traplocid.IsUnset() { - vals = append(vals, "traplocid") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Rodentlocid.IsUnset() { - vals = append(vals, "rodentlocid") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryTimecardSetter) Overwrite(t *HistoryTimecard) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Activity.IsUnset() { - t.Activity = s.Activity.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Enddatetime.IsUnset() { - t.Enddatetime = s.Enddatetime.MustGetNull() - } - if !s.Equiptype.IsUnset() { - t.Equiptype = s.Equiptype.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fieldtech.IsUnset() { - t.Fieldtech = s.Fieldtech.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Lclocid.IsUnset() { - t.Lclocid = s.Lclocid.MustGetNull() - } - if !s.Linelocid.IsUnset() { - t.Linelocid = s.Linelocid.MustGetNull() - } - if !s.Locationname.IsUnset() { - t.Locationname = s.Locationname.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Pointlocid.IsUnset() { - t.Pointlocid = s.Pointlocid.MustGetNull() - } - if !s.Polygonlocid.IsUnset() { - t.Polygonlocid = s.Polygonlocid.MustGetNull() - } - if !s.Samplelocid.IsUnset() { - t.Samplelocid = s.Samplelocid.MustGetNull() - } - if !s.Srid.IsUnset() { - t.Srid = s.Srid.MustGetNull() - } - if !s.Startdatetime.IsUnset() { - t.Startdatetime = s.Startdatetime.MustGetNull() - } - if !s.Traplocid.IsUnset() { - t.Traplocid = s.Traplocid.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Rodentlocid.IsUnset() { - t.Rodentlocid = s.Rodentlocid.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryTimecardSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryTimecards.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 33) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Activity.IsUnset() { - vals[1] = psql.Arg(s.Activity.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[2] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[3] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[4] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Enddatetime.IsUnset() { - vals[5] = psql.Arg(s.Enddatetime.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Equiptype.IsUnset() { - vals[6] = psql.Arg(s.Equiptype.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[7] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[8] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[9] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Fieldtech.IsUnset() { - vals[10] = psql.Arg(s.Fieldtech.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[11] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Lclocid.IsUnset() { - vals[12] = psql.Arg(s.Lclocid.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Linelocid.IsUnset() { - vals[13] = psql.Arg(s.Linelocid.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Locationname.IsUnset() { - vals[14] = psql.Arg(s.Locationname.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[15] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Pointlocid.IsUnset() { - vals[16] = psql.Arg(s.Pointlocid.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Polygonlocid.IsUnset() { - vals[17] = psql.Arg(s.Polygonlocid.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Samplelocid.IsUnset() { - vals[18] = psql.Arg(s.Samplelocid.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Srid.IsUnset() { - vals[19] = psql.Arg(s.Srid.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Startdatetime.IsUnset() { - vals[20] = psql.Arg(s.Startdatetime.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Traplocid.IsUnset() { - vals[21] = psql.Arg(s.Traplocid.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[22] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[23] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[24] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[25] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[26] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[27] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[28] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[29] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[30] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Rodentlocid.IsUnset() { - vals[31] = psql.Arg(s.Rodentlocid.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[32] = psql.Arg(s.Version.MustGet()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryTimecardSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryTimecardSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 33) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Activity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "activity")...), - psql.Arg(s.Activity), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Enddatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "enddatetime")...), - psql.Arg(s.Enddatetime), - }}) - } - - if !s.Equiptype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "equiptype")...), - psql.Arg(s.Equiptype), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fieldtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldtech")...), - psql.Arg(s.Fieldtech), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Lclocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lclocid")...), - psql.Arg(s.Lclocid), - }}) - } - - if !s.Linelocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "linelocid")...), - psql.Arg(s.Linelocid), - }}) - } - - if !s.Locationname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationname")...), - psql.Arg(s.Locationname), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Pointlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pointlocid")...), - psql.Arg(s.Pointlocid), - }}) - } - - if !s.Polygonlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "polygonlocid")...), - psql.Arg(s.Polygonlocid), - }}) - } - - if !s.Samplelocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "samplelocid")...), - psql.Arg(s.Samplelocid), - }}) - } - - if !s.Srid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "srid")...), - psql.Arg(s.Srid), - }}) - } - - if !s.Startdatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "startdatetime")...), - psql.Arg(s.Startdatetime), - }}) - } - - if !s.Traplocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "traplocid")...), - psql.Arg(s.Traplocid), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Rodentlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "rodentlocid")...), - psql.Arg(s.Rodentlocid), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryTimecard retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryTimecard(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryTimecard, error) { - if len(cols) == 0 { - return HistoryTimecards.Query( - sm.Where(HistoryTimecards.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryTimecards.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryTimecards.Query( - sm.Where(HistoryTimecards.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryTimecards.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryTimecards.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryTimecardExists checks the presence of a single record by primary key -func HistoryTimecardExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryTimecards.Query( - sm.Where(HistoryTimecards.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryTimecards.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryTimecard is retrieved from the database -func (o *HistoryTimecard) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryTimecards.AfterSelectHooks.RunHooks(ctx, exec, HistoryTimecardSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryTimecards.AfterInsertHooks.RunHooks(ctx, exec, HistoryTimecardSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryTimecards.AfterUpdateHooks.RunHooks(ctx, exec, HistoryTimecardSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryTimecards.AfterDeleteHooks.RunHooks(ctx, exec, HistoryTimecardSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryTimecard -func (o *HistoryTimecard) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryTimecard) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_timecard", "objectid"), psql.Quote("history_timecard", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryTimecard -func (o *HistoryTimecard) Update(ctx context.Context, exec bob.Executor, s *HistoryTimecardSetter) error { - v, err := HistoryTimecards.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 HistoryTimecard record with an executor -func (o *HistoryTimecard) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryTimecards.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryTimecard using the executor -func (o *HistoryTimecard) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryTimecards.Query( - sm.Where(HistoryTimecards.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryTimecards.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryTimecardSlice is retrieved from the database -func (o HistoryTimecardSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryTimecards.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryTimecards.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryTimecards.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryTimecards.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryTimecardSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_timecard", "objectid"), psql.Quote("history_timecard", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryTimecardSlice) copyMatchingRows(from ...*HistoryTimecard) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryTimecardSlice) 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 HistoryTimecards.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 *HistoryTimecard: - o.copyMatchingRows(retrieved) - case []*HistoryTimecard: - o.copyMatchingRows(retrieved...) - case HistoryTimecardSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryTimecard or a slice of HistoryTimecard - // then run the AfterUpdateHooks on the slice - _, err = HistoryTimecards.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryTimecardSlice) 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 HistoryTimecards.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 *HistoryTimecard: - o.copyMatchingRows(retrieved) - case []*HistoryTimecard: - o.copyMatchingRows(retrieved...) - case HistoryTimecardSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryTimecard or a slice of HistoryTimecard - // then run the AfterDeleteHooks on the slice - _, err = HistoryTimecards.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryTimecardSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryTimecardSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryTimecards.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryTimecardSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryTimecards.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryTimecardSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryTimecards.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 *HistoryTimecard) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryTimecardSlice) 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 attachHistoryTimecardOrganization0(ctx context.Context, exec bob.Executor, count int, historyTimecard0 *HistoryTimecard, organization1 *Organization) (*HistoryTimecard, error) { - setter := &HistoryTimecardSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyTimecard0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryTimecardOrganization0: %w", err) - } - - return historyTimecard0, nil -} - -func (historyTimecard0 *HistoryTimecard) 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 = attachHistoryTimecardOrganization0(ctx, exec, 1, historyTimecard0, organization1) - if err != nil { - return err - } - - historyTimecard0.R.Organization = organization1 - - organization1.R.HistoryTimecards = append(organization1.R.HistoryTimecards, historyTimecard0) - - return nil -} - -func (historyTimecard0 *HistoryTimecard) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryTimecardOrganization0(ctx, exec, 1, historyTimecard0, organization1) - if err != nil { - return err - } - - historyTimecard0.R.Organization = organization1 - - organization1.R.HistoryTimecards = append(organization1.R.HistoryTimecards, historyTimecard0) - - return nil -} - -type historyTimecardWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Activity psql.WhereNullMod[Q, string] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Enddatetime psql.WhereNullMod[Q, int64] - Equiptype psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fieldtech psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Lclocid psql.WhereNullMod[Q, string] - Linelocid psql.WhereNullMod[Q, string] - Locationname psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Pointlocid psql.WhereNullMod[Q, string] - Polygonlocid psql.WhereNullMod[Q, string] - Samplelocid psql.WhereNullMod[Q, string] - Srid psql.WhereNullMod[Q, string] - Startdatetime psql.WhereNullMod[Q, int64] - Traplocid psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Rodentlocid psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyTimecardWhere[Q]) AliasedAs(alias string) historyTimecardWhere[Q] { - return buildHistoryTimecardWhere[Q](buildHistoryTimecardColumns(alias)) -} - -func buildHistoryTimecardWhere[Q psql.Filterable](cols historyTimecardColumns) historyTimecardWhere[Q] { - return historyTimecardWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Activity: psql.WhereNull[Q, string](cols.Activity), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), - Equiptype: psql.WhereNull[Q, string](cols.Equiptype), - Externalid: psql.WhereNull[Q, string](cols.Externalid), - 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), - Lclocid: psql.WhereNull[Q, string](cols.Lclocid), - Linelocid: psql.WhereNull[Q, string](cols.Linelocid), - Locationname: psql.WhereNull[Q, string](cols.Locationname), - Objectid: psql.Where[Q, int32](cols.Objectid), - Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), - Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), - Samplelocid: psql.WhereNull[Q, string](cols.Samplelocid), - Srid: psql.WhereNull[Q, string](cols.Srid), - Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), - Traplocid: psql.WhereNull[Q, string](cols.Traplocid), - Zone: psql.WhereNull[Q, string](cols.Zone), - Zone2: psql.WhereNull[Q, string](cols.Zone2), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Rodentlocid: psql.WhereNull[Q, string](cols.Rodentlocid), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryTimecard) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyTimecard cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryTimecards = HistoryTimecardSlice{o} - } - return nil - default: - return fmt.Errorf("historyTimecard has no relationship %q", name) - } -} - -type historyTimecardPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryTimecardPreloader() historyTimecardPreloader { - return historyTimecardPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryTimecards, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyTimecardThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryTimecardThenLoader[Q orm.Loadable]() historyTimecardThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyTimecardThenLoader[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 historyTimecard's Organization into the .R struct -func (o *HistoryTimecard) 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.HistoryTimecards = HistoryTimecardSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyTimecard's Organization into the .R struct -func (os HistoryTimecardSlice) 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.HistoryTimecards = append(rel.R.HistoryTimecards, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyTimecardJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyTimecardJoins[Q]) aliasedAs(alias string) historyTimecardJoins[Q] { - return buildHistoryTimecardJoins[Q](buildHistoryTimecardColumns(alias), j.typ) -} - -func buildHistoryTimecardJoins[Q dialect.Joinable](cols historyTimecardColumns, typ string) historyTimecardJoins[Q] { - return historyTimecardJoins[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/db/models/history_trapdata.bob.go b/db/models/history_trapdata.bob.go deleted file mode 100644 index d29cb6b8..00000000 --- a/db/models/history_trapdata.bob.go +++ /dev/null @@ -1,1740 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryTrapdatum is an object representing the database table. -type HistoryTrapdatum struct { - OrganizationID int32 `db:"organization_id" ` - Avetemp null.Val[float64] `db:"avetemp" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Field null.Val[int64] `db:"field" ` - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid null.Val[string] `db:"globalid" ` - Idbytech null.Val[string] `db:"idbytech" ` - Locationname null.Val[string] `db:"locationname" ` - LocID null.Val[string] `db:"loc_id" ` - LR null.Val[int16] `db:"lr" ` - Objectid int32 `db:"objectid,pk" ` - Processed null.Val[int16] `db:"processed" ` - Raingauge null.Val[float64] `db:"raingauge" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Sitecond null.Val[string] `db:"sitecond" ` - Sortbytech null.Val[string] `db:"sortbytech" ` - Srid null.Val[string] `db:"srid" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Trapactivitytype null.Val[string] `db:"trapactivitytype" ` - Trapcondition null.Val[string] `db:"trapcondition" ` - Trapnights null.Val[int16] `db:"trapnights" ` - Traptype null.Val[string] `db:"traptype" ` - Voltage null.Val[float64] `db:"voltage" ` - Winddir null.Val[string] `db:"winddir" ` - Windspeed null.Val[float64] `db:"windspeed" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Lure null.Val[string] `db:"lure" ` - Vectorsurvtrapdataid null.Val[string] `db:"vectorsurvtrapdataid" ` - Vectorsurvtraplocationid null.Val[string] `db:"vectorsurvtraplocationid" ` - Version int32 `db:"version,pk" ` - - R historyTrapdatumR `db:"-" ` -} - -// HistoryTrapdatumSlice is an alias for a slice of pointers to HistoryTrapdatum. -// This should almost always be used instead of []*HistoryTrapdatum. -type HistoryTrapdatumSlice []*HistoryTrapdatum - -// HistoryTrapdata contains methods to work with the history_trapdata table -var HistoryTrapdata = psql.NewTablex[*HistoryTrapdatum, HistoryTrapdatumSlice, *HistoryTrapdatumSetter]("", "history_trapdata", buildHistoryTrapdatumColumns("history_trapdata")) - -// HistoryTrapdataQuery is a query on the history_trapdata table -type HistoryTrapdataQuery = *psql.ViewQuery[*HistoryTrapdatum, HistoryTrapdatumSlice] - -// historyTrapdatumR is where relationships are stored. -type historyTrapdatumR struct { - Organization *Organization // history_trapdata.history_trapdata_organization_id_fkey -} - -func buildHistoryTrapdatumColumns(alias string) historyTrapdatumColumns { - return historyTrapdatumColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "avetemp", "comments", "creationdate", "creator", "enddatetime", "editdate", "editor", "fieldtech", "field", "gatewaysync", "globalid", "idbytech", "locationname", "loc_id", "lr", "objectid", "processed", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sitecond", "sortbytech", "srid", "startdatetime", "trapactivitytype", "trapcondition", "trapnights", "traptype", "voltage", "winddir", "windspeed", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "lure", "vectorsurvtrapdataid", "vectorsurvtraplocationid", "version", - ).WithParent("history_trapdata"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Avetemp: psql.Quote(alias, "avetemp"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Enddatetime: psql.Quote(alias, "enddatetime"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fieldtech: psql.Quote(alias, "fieldtech"), - Field: psql.Quote(alias, "field"), - Gatewaysync: psql.Quote(alias, "gatewaysync"), - Globalid: psql.Quote(alias, "globalid"), - Idbytech: psql.Quote(alias, "idbytech"), - Locationname: psql.Quote(alias, "locationname"), - LocID: psql.Quote(alias, "loc_id"), - LR: psql.Quote(alias, "lr"), - Objectid: psql.Quote(alias, "objectid"), - Processed: psql.Quote(alias, "processed"), - Raingauge: psql.Quote(alias, "raingauge"), - Recordstatus: psql.Quote(alias, "recordstatus"), - Reviewed: psql.Quote(alias, "reviewed"), - Reviewedby: psql.Quote(alias, "reviewedby"), - Revieweddate: psql.Quote(alias, "revieweddate"), - Sitecond: psql.Quote(alias, "sitecond"), - Sortbytech: psql.Quote(alias, "sortbytech"), - Srid: psql.Quote(alias, "srid"), - Startdatetime: psql.Quote(alias, "startdatetime"), - Trapactivitytype: psql.Quote(alias, "trapactivitytype"), - Trapcondition: psql.Quote(alias, "trapcondition"), - Trapnights: psql.Quote(alias, "trapnights"), - Traptype: psql.Quote(alias, "traptype"), - Voltage: psql.Quote(alias, "voltage"), - Winddir: psql.Quote(alias, "winddir"), - Windspeed: psql.Quote(alias, "windspeed"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Lure: psql.Quote(alias, "lure"), - Vectorsurvtrapdataid: psql.Quote(alias, "vectorsurvtrapdataid"), - Vectorsurvtraplocationid: psql.Quote(alias, "vectorsurvtraplocationid"), - Version: psql.Quote(alias, "version"), - } -} - -type historyTrapdatumColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Avetemp psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Enddatetime psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fieldtech psql.Expression - Field psql.Expression - Gatewaysync psql.Expression - Globalid psql.Expression - Idbytech psql.Expression - Locationname psql.Expression - LocID psql.Expression - LR psql.Expression - Objectid psql.Expression - Processed psql.Expression - Raingauge psql.Expression - Recordstatus psql.Expression - Reviewed psql.Expression - Reviewedby psql.Expression - Revieweddate psql.Expression - Sitecond psql.Expression - Sortbytech psql.Expression - Srid psql.Expression - Startdatetime psql.Expression - Trapactivitytype psql.Expression - Trapcondition psql.Expression - Trapnights psql.Expression - Traptype psql.Expression - Voltage psql.Expression - Winddir psql.Expression - Windspeed psql.Expression - Zone psql.Expression - Zone2 psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Lure psql.Expression - Vectorsurvtrapdataid psql.Expression - Vectorsurvtraplocationid psql.Expression - Version psql.Expression -} - -func (c historyTrapdatumColumns) Alias() string { - return c.tableAlias -} - -func (historyTrapdatumColumns) AliasedAs(alias string) historyTrapdatumColumns { - return buildHistoryTrapdatumColumns(alias) -} - -// HistoryTrapdatumSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryTrapdatumSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Field omitnull.Val[int64] `db:"field" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Idbytech omitnull.Val[string] `db:"idbytech" ` - Locationname omitnull.Val[string] `db:"locationname" ` - LocID omitnull.Val[string] `db:"loc_id" ` - LR omitnull.Val[int16] `db:"lr" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Processed omitnull.Val[int16] `db:"processed" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Sitecond omitnull.Val[string] `db:"sitecond" ` - Sortbytech omitnull.Val[string] `db:"sortbytech" ` - Srid omitnull.Val[string] `db:"srid" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Trapactivitytype omitnull.Val[string] `db:"trapactivitytype" ` - Trapcondition omitnull.Val[string] `db:"trapcondition" ` - Trapnights omitnull.Val[int16] `db:"trapnights" ` - Traptype omitnull.Val[string] `db:"traptype" ` - Voltage omitnull.Val[float64] `db:"voltage" ` - Winddir omitnull.Val[string] `db:"winddir" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Lure omitnull.Val[string] `db:"lure" ` - Vectorsurvtrapdataid omitnull.Val[string] `db:"vectorsurvtrapdataid" ` - Vectorsurvtraplocationid omitnull.Val[string] `db:"vectorsurvtraplocationid" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryTrapdatumSetter) SetColumns() []string { - vals := make([]string, 0, 47) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Avetemp.IsUnset() { - vals = append(vals, "avetemp") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Enddatetime.IsUnset() { - vals = append(vals, "enddatetime") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fieldtech.IsUnset() { - vals = append(vals, "fieldtech") - } - if !s.Field.IsUnset() { - vals = append(vals, "field") - } - if !s.Gatewaysync.IsUnset() { - vals = append(vals, "gatewaysync") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Idbytech.IsUnset() { - vals = append(vals, "idbytech") - } - if !s.Locationname.IsUnset() { - vals = append(vals, "locationname") - } - if !s.LocID.IsUnset() { - vals = append(vals, "loc_id") - } - if !s.LR.IsUnset() { - vals = append(vals, "lr") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Processed.IsUnset() { - vals = append(vals, "processed") - } - if !s.Raingauge.IsUnset() { - vals = append(vals, "raingauge") - } - if !s.Recordstatus.IsUnset() { - vals = append(vals, "recordstatus") - } - if !s.Reviewed.IsUnset() { - vals = append(vals, "reviewed") - } - if !s.Reviewedby.IsUnset() { - vals = append(vals, "reviewedby") - } - if !s.Revieweddate.IsUnset() { - vals = append(vals, "revieweddate") - } - if !s.Sitecond.IsUnset() { - vals = append(vals, "sitecond") - } - if !s.Sortbytech.IsUnset() { - vals = append(vals, "sortbytech") - } - if !s.Srid.IsUnset() { - vals = append(vals, "srid") - } - if !s.Startdatetime.IsUnset() { - vals = append(vals, "startdatetime") - } - if !s.Trapactivitytype.IsUnset() { - vals = append(vals, "trapactivitytype") - } - if !s.Trapcondition.IsUnset() { - vals = append(vals, "trapcondition") - } - if !s.Trapnights.IsUnset() { - vals = append(vals, "trapnights") - } - if !s.Traptype.IsUnset() { - vals = append(vals, "traptype") - } - if !s.Voltage.IsUnset() { - vals = append(vals, "voltage") - } - if !s.Winddir.IsUnset() { - vals = append(vals, "winddir") - } - if !s.Windspeed.IsUnset() { - vals = append(vals, "windspeed") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Lure.IsUnset() { - vals = append(vals, "lure") - } - if !s.Vectorsurvtrapdataid.IsUnset() { - vals = append(vals, "vectorsurvtrapdataid") - } - if !s.Vectorsurvtraplocationid.IsUnset() { - vals = append(vals, "vectorsurvtraplocationid") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryTrapdatumSetter) Overwrite(t *HistoryTrapdatum) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Avetemp.IsUnset() { - t.Avetemp = s.Avetemp.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Enddatetime.IsUnset() { - t.Enddatetime = s.Enddatetime.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fieldtech.IsUnset() { - t.Fieldtech = s.Fieldtech.MustGetNull() - } - if !s.Field.IsUnset() { - t.Field = s.Field.MustGetNull() - } - if !s.Gatewaysync.IsUnset() { - t.Gatewaysync = s.Gatewaysync.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Idbytech.IsUnset() { - t.Idbytech = s.Idbytech.MustGetNull() - } - if !s.Locationname.IsUnset() { - t.Locationname = s.Locationname.MustGetNull() - } - if !s.LocID.IsUnset() { - t.LocID = s.LocID.MustGetNull() - } - if !s.LR.IsUnset() { - t.LR = s.LR.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Processed.IsUnset() { - t.Processed = s.Processed.MustGetNull() - } - if !s.Raingauge.IsUnset() { - t.Raingauge = s.Raingauge.MustGetNull() - } - if !s.Recordstatus.IsUnset() { - t.Recordstatus = s.Recordstatus.MustGetNull() - } - if !s.Reviewed.IsUnset() { - t.Reviewed = s.Reviewed.MustGetNull() - } - if !s.Reviewedby.IsUnset() { - t.Reviewedby = s.Reviewedby.MustGetNull() - } - if !s.Revieweddate.IsUnset() { - t.Revieweddate = s.Revieweddate.MustGetNull() - } - if !s.Sitecond.IsUnset() { - t.Sitecond = s.Sitecond.MustGetNull() - } - if !s.Sortbytech.IsUnset() { - t.Sortbytech = s.Sortbytech.MustGetNull() - } - if !s.Srid.IsUnset() { - t.Srid = s.Srid.MustGetNull() - } - if !s.Startdatetime.IsUnset() { - t.Startdatetime = s.Startdatetime.MustGetNull() - } - if !s.Trapactivitytype.IsUnset() { - t.Trapactivitytype = s.Trapactivitytype.MustGetNull() - } - if !s.Trapcondition.IsUnset() { - t.Trapcondition = s.Trapcondition.MustGetNull() - } - if !s.Trapnights.IsUnset() { - t.Trapnights = s.Trapnights.MustGetNull() - } - if !s.Traptype.IsUnset() { - t.Traptype = s.Traptype.MustGetNull() - } - if !s.Voltage.IsUnset() { - t.Voltage = s.Voltage.MustGetNull() - } - if !s.Winddir.IsUnset() { - t.Winddir = s.Winddir.MustGetNull() - } - if !s.Windspeed.IsUnset() { - t.Windspeed = s.Windspeed.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Lure.IsUnset() { - t.Lure = s.Lure.MustGetNull() - } - if !s.Vectorsurvtrapdataid.IsUnset() { - t.Vectorsurvtrapdataid = s.Vectorsurvtrapdataid.MustGetNull() - } - if !s.Vectorsurvtraplocationid.IsUnset() { - t.Vectorsurvtraplocationid = s.Vectorsurvtraplocationid.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryTrapdatumSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryTrapdata.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 47) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Avetemp.IsUnset() { - vals[1] = psql.Arg(s.Avetemp.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[2] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[3] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[4] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Enddatetime.IsUnset() { - vals[5] = psql.Arg(s.Enddatetime.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[6] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[7] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Fieldtech.IsUnset() { - vals[8] = psql.Arg(s.Fieldtech.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Field.IsUnset() { - vals[9] = psql.Arg(s.Field.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Gatewaysync.IsUnset() { - vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[11] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Idbytech.IsUnset() { - vals[12] = psql.Arg(s.Idbytech.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Locationname.IsUnset() { - vals[13] = psql.Arg(s.Locationname.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.LocID.IsUnset() { - vals[14] = psql.Arg(s.LocID.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.LR.IsUnset() { - vals[15] = psql.Arg(s.LR.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[16] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Processed.IsUnset() { - vals[17] = psql.Arg(s.Processed.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Raingauge.IsUnset() { - vals[18] = psql.Arg(s.Raingauge.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Recordstatus.IsUnset() { - vals[19] = psql.Arg(s.Recordstatus.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Reviewed.IsUnset() { - vals[20] = psql.Arg(s.Reviewed.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Reviewedby.IsUnset() { - vals[21] = psql.Arg(s.Reviewedby.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Revieweddate.IsUnset() { - vals[22] = psql.Arg(s.Revieweddate.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.Sitecond.IsUnset() { - vals[23] = psql.Arg(s.Sitecond.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Sortbytech.IsUnset() { - vals[24] = psql.Arg(s.Sortbytech.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Srid.IsUnset() { - vals[25] = psql.Arg(s.Srid.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Startdatetime.IsUnset() { - vals[26] = psql.Arg(s.Startdatetime.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Trapactivitytype.IsUnset() { - vals[27] = psql.Arg(s.Trapactivitytype.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Trapcondition.IsUnset() { - vals[28] = psql.Arg(s.Trapcondition.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Trapnights.IsUnset() { - vals[29] = psql.Arg(s.Trapnights.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Traptype.IsUnset() { - vals[30] = psql.Arg(s.Traptype.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Voltage.IsUnset() { - vals[31] = psql.Arg(s.Voltage.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Winddir.IsUnset() { - vals[32] = psql.Arg(s.Winddir.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Windspeed.IsUnset() { - vals[33] = psql.Arg(s.Windspeed.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[34] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[35] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[36] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[37] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[38] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[39] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[40] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[41] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[42] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.Lure.IsUnset() { - vals[43] = psql.Arg(s.Lure.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.Vectorsurvtrapdataid.IsUnset() { - vals[44] = psql.Arg(s.Vectorsurvtrapdataid.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if !s.Vectorsurvtraplocationid.IsUnset() { - vals[45] = psql.Arg(s.Vectorsurvtraplocationid.MustGetNull()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[46] = psql.Arg(s.Version.MustGet()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryTrapdatumSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryTrapdatumSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 47) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Avetemp.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "avetemp")...), - psql.Arg(s.Avetemp), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Enddatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "enddatetime")...), - psql.Arg(s.Enddatetime), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fieldtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldtech")...), - psql.Arg(s.Fieldtech), - }}) - } - - if !s.Field.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "field")...), - psql.Arg(s.Field), - }}) - } - - if !s.Gatewaysync.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "gatewaysync")...), - psql.Arg(s.Gatewaysync), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Idbytech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "idbytech")...), - psql.Arg(s.Idbytech), - }}) - } - - if !s.Locationname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationname")...), - psql.Arg(s.Locationname), - }}) - } - - if !s.LocID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "loc_id")...), - psql.Arg(s.LocID), - }}) - } - - if !s.LR.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lr")...), - psql.Arg(s.LR), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Processed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "processed")...), - psql.Arg(s.Processed), - }}) - } - - if !s.Raingauge.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "raingauge")...), - psql.Arg(s.Raingauge), - }}) - } - - if !s.Recordstatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "recordstatus")...), - psql.Arg(s.Recordstatus), - }}) - } - - if !s.Reviewed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewed")...), - psql.Arg(s.Reviewed), - }}) - } - - if !s.Reviewedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewedby")...), - psql.Arg(s.Reviewedby), - }}) - } - - if !s.Revieweddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "revieweddate")...), - psql.Arg(s.Revieweddate), - }}) - } - - if !s.Sitecond.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sitecond")...), - psql.Arg(s.Sitecond), - }}) - } - - if !s.Sortbytech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sortbytech")...), - psql.Arg(s.Sortbytech), - }}) - } - - if !s.Srid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "srid")...), - psql.Arg(s.Srid), - }}) - } - - if !s.Startdatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "startdatetime")...), - psql.Arg(s.Startdatetime), - }}) - } - - if !s.Trapactivitytype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "trapactivitytype")...), - psql.Arg(s.Trapactivitytype), - }}) - } - - if !s.Trapcondition.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "trapcondition")...), - psql.Arg(s.Trapcondition), - }}) - } - - if !s.Trapnights.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "trapnights")...), - psql.Arg(s.Trapnights), - }}) - } - - if !s.Traptype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "traptype")...), - psql.Arg(s.Traptype), - }}) - } - - if !s.Voltage.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "voltage")...), - psql.Arg(s.Voltage), - }}) - } - - if !s.Winddir.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "winddir")...), - psql.Arg(s.Winddir), - }}) - } - - if !s.Windspeed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "windspeed")...), - psql.Arg(s.Windspeed), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Lure.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "lure")...), - psql.Arg(s.Lure), - }}) - } - - if !s.Vectorsurvtrapdataid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vectorsurvtrapdataid")...), - psql.Arg(s.Vectorsurvtrapdataid), - }}) - } - - if !s.Vectorsurvtraplocationid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vectorsurvtraplocationid")...), - psql.Arg(s.Vectorsurvtraplocationid), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryTrapdatum retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryTrapdatum(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryTrapdatum, error) { - if len(cols) == 0 { - return HistoryTrapdata.Query( - sm.Where(HistoryTrapdata.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryTrapdata.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryTrapdata.Query( - sm.Where(HistoryTrapdata.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryTrapdata.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryTrapdata.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryTrapdatumExists checks the presence of a single record by primary key -func HistoryTrapdatumExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryTrapdata.Query( - sm.Where(HistoryTrapdata.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryTrapdata.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryTrapdatum is retrieved from the database -func (o *HistoryTrapdatum) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryTrapdata.AfterSelectHooks.RunHooks(ctx, exec, HistoryTrapdatumSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryTrapdata.AfterInsertHooks.RunHooks(ctx, exec, HistoryTrapdatumSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryTrapdata.AfterUpdateHooks.RunHooks(ctx, exec, HistoryTrapdatumSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryTrapdata.AfterDeleteHooks.RunHooks(ctx, exec, HistoryTrapdatumSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryTrapdatum -func (o *HistoryTrapdatum) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryTrapdatum) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_trapdata", "objectid"), psql.Quote("history_trapdata", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryTrapdatum -func (o *HistoryTrapdatum) Update(ctx context.Context, exec bob.Executor, s *HistoryTrapdatumSetter) error { - v, err := HistoryTrapdata.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 HistoryTrapdatum record with an executor -func (o *HistoryTrapdatum) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryTrapdata.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryTrapdatum using the executor -func (o *HistoryTrapdatum) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryTrapdata.Query( - sm.Where(HistoryTrapdata.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryTrapdata.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryTrapdatumSlice is retrieved from the database -func (o HistoryTrapdatumSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryTrapdata.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryTrapdata.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryTrapdata.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryTrapdata.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryTrapdatumSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_trapdata", "objectid"), psql.Quote("history_trapdata", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryTrapdatumSlice) copyMatchingRows(from ...*HistoryTrapdatum) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryTrapdatumSlice) 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 HistoryTrapdata.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 *HistoryTrapdatum: - o.copyMatchingRows(retrieved) - case []*HistoryTrapdatum: - o.copyMatchingRows(retrieved...) - case HistoryTrapdatumSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryTrapdatum or a slice of HistoryTrapdatum - // then run the AfterUpdateHooks on the slice - _, err = HistoryTrapdata.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryTrapdatumSlice) 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 HistoryTrapdata.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 *HistoryTrapdatum: - o.copyMatchingRows(retrieved) - case []*HistoryTrapdatum: - o.copyMatchingRows(retrieved...) - case HistoryTrapdatumSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryTrapdatum or a slice of HistoryTrapdatum - // then run the AfterDeleteHooks on the slice - _, err = HistoryTrapdata.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryTrapdatumSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryTrapdatumSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryTrapdata.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryTrapdatumSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryTrapdata.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryTrapdatumSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryTrapdata.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 *HistoryTrapdatum) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryTrapdatumSlice) 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 attachHistoryTrapdatumOrganization0(ctx context.Context, exec bob.Executor, count int, historyTrapdatum0 *HistoryTrapdatum, organization1 *Organization) (*HistoryTrapdatum, error) { - setter := &HistoryTrapdatumSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyTrapdatum0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryTrapdatumOrganization0: %w", err) - } - - return historyTrapdatum0, nil -} - -func (historyTrapdatum0 *HistoryTrapdatum) 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 = attachHistoryTrapdatumOrganization0(ctx, exec, 1, historyTrapdatum0, organization1) - if err != nil { - return err - } - - historyTrapdatum0.R.Organization = organization1 - - organization1.R.HistoryTrapdata = append(organization1.R.HistoryTrapdata, historyTrapdatum0) - - return nil -} - -func (historyTrapdatum0 *HistoryTrapdatum) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryTrapdatumOrganization0(ctx, exec, 1, historyTrapdatum0, organization1) - if err != nil { - return err - } - - historyTrapdatum0.R.Organization = organization1 - - organization1.R.HistoryTrapdata = append(organization1.R.HistoryTrapdata, historyTrapdatum0) - - return nil -} - -type historyTrapdatumWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Avetemp psql.WhereNullMod[Q, float64] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Enddatetime psql.WhereNullMod[Q, int64] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fieldtech psql.WhereNullMod[Q, string] - Field psql.WhereNullMod[Q, int64] - Gatewaysync psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] - Idbytech psql.WhereNullMod[Q, string] - Locationname psql.WhereNullMod[Q, string] - LocID psql.WhereNullMod[Q, string] - LR psql.WhereNullMod[Q, int16] - Objectid psql.WhereMod[Q, int32] - Processed psql.WhereNullMod[Q, int16] - Raingauge psql.WhereNullMod[Q, float64] - Recordstatus psql.WhereNullMod[Q, int16] - Reviewed psql.WhereNullMod[Q, int16] - Reviewedby psql.WhereNullMod[Q, string] - Revieweddate psql.WhereNullMod[Q, int64] - Sitecond psql.WhereNullMod[Q, string] - Sortbytech psql.WhereNullMod[Q, string] - Srid psql.WhereNullMod[Q, string] - Startdatetime psql.WhereNullMod[Q, int64] - Trapactivitytype psql.WhereNullMod[Q, string] - Trapcondition psql.WhereNullMod[Q, string] - Trapnights psql.WhereNullMod[Q, int16] - Traptype psql.WhereNullMod[Q, string] - Voltage psql.WhereNullMod[Q, float64] - Winddir psql.WhereNullMod[Q, string] - Windspeed psql.WhereNullMod[Q, float64] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Lure psql.WhereNullMod[Q, string] - Vectorsurvtrapdataid psql.WhereNullMod[Q, string] - Vectorsurvtraplocationid psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyTrapdatumWhere[Q]) AliasedAs(alias string) historyTrapdatumWhere[Q] { - return buildHistoryTrapdatumWhere[Q](buildHistoryTrapdatumColumns(alias)) -} - -func buildHistoryTrapdatumWhere[Q psql.Filterable](cols historyTrapdatumColumns) historyTrapdatumWhere[Q] { - return historyTrapdatumWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - Editor: psql.WhereNull[Q, string](cols.Editor), - 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), - Idbytech: psql.WhereNull[Q, string](cols.Idbytech), - Locationname: psql.WhereNull[Q, string](cols.Locationname), - LocID: psql.WhereNull[Q, string](cols.LocID), - LR: psql.WhereNull[Q, int16](cols.LR), - Objectid: psql.Where[Q, int32](cols.Objectid), - Processed: psql.WhereNull[Q, int16](cols.Processed), - Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), - Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), - Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), - Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), - Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), - Sitecond: psql.WhereNull[Q, string](cols.Sitecond), - Sortbytech: psql.WhereNull[Q, string](cols.Sortbytech), - Srid: psql.WhereNull[Q, string](cols.Srid), - Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), - Trapactivitytype: psql.WhereNull[Q, string](cols.Trapactivitytype), - Trapcondition: psql.WhereNull[Q, string](cols.Trapcondition), - Trapnights: psql.WhereNull[Q, int16](cols.Trapnights), - Traptype: psql.WhereNull[Q, string](cols.Traptype), - Voltage: psql.WhereNull[Q, float64](cols.Voltage), - Winddir: psql.WhereNull[Q, string](cols.Winddir), - Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), - Zone: psql.WhereNull[Q, string](cols.Zone), - Zone2: psql.WhereNull[Q, string](cols.Zone2), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Lure: psql.WhereNull[Q, string](cols.Lure), - Vectorsurvtrapdataid: psql.WhereNull[Q, string](cols.Vectorsurvtrapdataid), - Vectorsurvtraplocationid: psql.WhereNull[Q, string](cols.Vectorsurvtraplocationid), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryTrapdatum) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyTrapdatum cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryTrapdata = HistoryTrapdatumSlice{o} - } - return nil - default: - return fmt.Errorf("historyTrapdatum has no relationship %q", name) - } -} - -type historyTrapdatumPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryTrapdatumPreloader() historyTrapdatumPreloader { - return historyTrapdatumPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryTrapdata, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyTrapdatumThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryTrapdatumThenLoader[Q orm.Loadable]() historyTrapdatumThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyTrapdatumThenLoader[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 historyTrapdatum's Organization into the .R struct -func (o *HistoryTrapdatum) 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.HistoryTrapdata = HistoryTrapdatumSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyTrapdatum's Organization into the .R struct -func (os HistoryTrapdatumSlice) 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.HistoryTrapdata = append(rel.R.HistoryTrapdata, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyTrapdatumJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyTrapdatumJoins[Q]) aliasedAs(alias string) historyTrapdatumJoins[Q] { - return buildHistoryTrapdatumJoins[Q](buildHistoryTrapdatumColumns(alias), j.typ) -} - -func buildHistoryTrapdatumJoins[Q dialect.Joinable](cols historyTrapdatumColumns, typ string) historyTrapdatumJoins[Q] { - return historyTrapdatumJoins[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/db/models/history_traplocation.bob.go b/db/models/history_traplocation.bob.go deleted file mode 100644 index 61269a79..00000000 --- a/db/models/history_traplocation.bob.go +++ /dev/null @@ -1,1440 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryTraplocation is an object representing the database table. -type HistoryTraplocation struct { - OrganizationID int32 `db:"organization_id" ` - Accessdesc null.Val[string] `db:"accessdesc" ` - Active null.Val[int16] `db:"active" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Description null.Val[string] `db:"description" ` - Externalid null.Val[string] `db:"externalid" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Gatewaysync null.Val[int16] `db:"gatewaysync" ` - Globalid null.Val[string] `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - Locationnumber null.Val[int64] `db:"locationnumber" ` - Name null.Val[string] `db:"name" ` - Nextactiondatescheduled null.Val[int64] `db:"nextactiondatescheduled" ` - Objectid int32 `db:"objectid,pk" ` - Priority null.Val[string] `db:"priority" ` - Usetype null.Val[string] `db:"usetype" ` - Zone null.Val[string] `db:"zone" ` - Zone2 null.Val[string] `db:"zone2" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Route null.Val[int64] `db:"route" ` - RouteOrder null.Val[int64] `db:"route_order" ` - SetDow null.Val[int64] `db:"set_dow" ` - Vectorsurvsiteid null.Val[string] `db:"vectorsurvsiteid" ` - H3R7 null.Val[string] `db:"h3r7" ` - H3R8 null.Val[string] `db:"h3r8" ` - Version int32 `db:"version,pk" ` - - R historyTraplocationR `db:"-" ` -} - -// HistoryTraplocationSlice is an alias for a slice of pointers to HistoryTraplocation. -// This should almost always be used instead of []*HistoryTraplocation. -type HistoryTraplocationSlice []*HistoryTraplocation - -// HistoryTraplocations contains methods to work with the history_traplocation table -var HistoryTraplocations = psql.NewTablex[*HistoryTraplocation, HistoryTraplocationSlice, *HistoryTraplocationSetter]("", "history_traplocation", buildHistoryTraplocationColumns("history_traplocation")) - -// HistoryTraplocationsQuery is a query on the history_traplocation table -type HistoryTraplocationsQuery = *psql.ViewQuery[*HistoryTraplocation, HistoryTraplocationSlice] - -// historyTraplocationR is where relationships are stored. -type historyTraplocationR struct { - Organization *Organization // history_traplocation.history_traplocation_organization_id_fkey -} - -func buildHistoryTraplocationColumns(alias string) historyTraplocationColumns { - return historyTraplocationColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "accessdesc", "active", "comments", "creationdate", "creator", "description", "externalid", "editdate", "editor", "gatewaysync", "globalid", "habitat", "locationnumber", "name", "nextactiondatescheduled", "objectid", "priority", "usetype", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "route", "route_order", "set_dow", "vectorsurvsiteid", "h3r7", "h3r8", "version", - ).WithParent("history_traplocation"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Accessdesc: psql.Quote(alias, "accessdesc"), - Active: psql.Quote(alias, "active"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Description: psql.Quote(alias, "description"), - Externalid: psql.Quote(alias, "externalid"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Gatewaysync: psql.Quote(alias, "gatewaysync"), - Globalid: psql.Quote(alias, "globalid"), - Habitat: psql.Quote(alias, "habitat"), - Locationnumber: psql.Quote(alias, "locationnumber"), - Name: psql.Quote(alias, "name"), - Nextactiondatescheduled: psql.Quote(alias, "nextactiondatescheduled"), - Objectid: psql.Quote(alias, "objectid"), - Priority: psql.Quote(alias, "priority"), - Usetype: psql.Quote(alias, "usetype"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Route: psql.Quote(alias, "route"), - RouteOrder: psql.Quote(alias, "route_order"), - SetDow: psql.Quote(alias, "set_dow"), - Vectorsurvsiteid: psql.Quote(alias, "vectorsurvsiteid"), - H3R7: psql.Quote(alias, "h3r7"), - H3R8: psql.Quote(alias, "h3r8"), - Version: psql.Quote(alias, "version"), - } -} - -type historyTraplocationColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Accessdesc psql.Expression - Active psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Description psql.Expression - Externalid psql.Expression - Editdate psql.Expression - Editor psql.Expression - Gatewaysync psql.Expression - Globalid psql.Expression - Habitat psql.Expression - Locationnumber psql.Expression - Name psql.Expression - Nextactiondatescheduled psql.Expression - Objectid psql.Expression - Priority psql.Expression - Usetype psql.Expression - Zone psql.Expression - Zone2 psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Route psql.Expression - RouteOrder psql.Expression - SetDow psql.Expression - Vectorsurvsiteid psql.Expression - H3R7 psql.Expression - H3R8 psql.Expression - Version psql.Expression -} - -func (c historyTraplocationColumns) Alias() string { - return c.tableAlias -} - -func (historyTraplocationColumns) AliasedAs(alias string) historyTraplocationColumns { - return buildHistoryTraplocationColumns(alias) -} - -// HistoryTraplocationSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryTraplocationSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Accessdesc omitnull.Val[string] `db:"accessdesc" ` - Active omitnull.Val[int16] `db:"active" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Description omitnull.Val[string] `db:"description" ` - Externalid omitnull.Val[string] `db:"externalid" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Gatewaysync omitnull.Val[int16] `db:"gatewaysync" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - Locationnumber omitnull.Val[int64] `db:"locationnumber" ` - Name omitnull.Val[string] `db:"name" ` - Nextactiondatescheduled omitnull.Val[int64] `db:"nextactiondatescheduled" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Priority omitnull.Val[string] `db:"priority" ` - Usetype omitnull.Val[string] `db:"usetype" ` - Zone omitnull.Val[string] `db:"zone" ` - Zone2 omitnull.Val[string] `db:"zone2" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Route omitnull.Val[int64] `db:"route" ` - RouteOrder omitnull.Val[int64] `db:"route_order" ` - SetDow omitnull.Val[int64] `db:"set_dow" ` - Vectorsurvsiteid omitnull.Val[string] `db:"vectorsurvsiteid" ` - H3R7 omitnull.Val[string] `db:"h3r7" ` - H3R8 omitnull.Val[string] `db:"h3r8" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryTraplocationSetter) SetColumns() []string { - vals := make([]string, 0, 35) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Accessdesc.IsUnset() { - vals = append(vals, "accessdesc") - } - if !s.Active.IsUnset() { - vals = append(vals, "active") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Description.IsUnset() { - vals = append(vals, "description") - } - if !s.Externalid.IsUnset() { - vals = append(vals, "externalid") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Gatewaysync.IsUnset() { - vals = append(vals, "gatewaysync") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Habitat.IsUnset() { - vals = append(vals, "habitat") - } - if !s.Locationnumber.IsUnset() { - vals = append(vals, "locationnumber") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if !s.Nextactiondatescheduled.IsUnset() { - vals = append(vals, "nextactiondatescheduled") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Priority.IsUnset() { - vals = append(vals, "priority") - } - if !s.Usetype.IsUnset() { - vals = append(vals, "usetype") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if !s.Route.IsUnset() { - vals = append(vals, "route") - } - if !s.RouteOrder.IsUnset() { - vals = append(vals, "route_order") - } - if !s.SetDow.IsUnset() { - vals = append(vals, "set_dow") - } - if !s.Vectorsurvsiteid.IsUnset() { - vals = append(vals, "vectorsurvsiteid") - } - if !s.H3R7.IsUnset() { - vals = append(vals, "h3r7") - } - if !s.H3R8.IsUnset() { - vals = append(vals, "h3r8") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryTraplocationSetter) Overwrite(t *HistoryTraplocation) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Accessdesc.IsUnset() { - t.Accessdesc = s.Accessdesc.MustGetNull() - } - if !s.Active.IsUnset() { - t.Active = s.Active.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Description.IsUnset() { - t.Description = s.Description.MustGetNull() - } - if !s.Externalid.IsUnset() { - t.Externalid = s.Externalid.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Gatewaysync.IsUnset() { - t.Gatewaysync = s.Gatewaysync.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Habitat.IsUnset() { - t.Habitat = s.Habitat.MustGetNull() - } - if !s.Locationnumber.IsUnset() { - t.Locationnumber = s.Locationnumber.MustGetNull() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if !s.Nextactiondatescheduled.IsUnset() { - t.Nextactiondatescheduled = s.Nextactiondatescheduled.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Priority.IsUnset() { - t.Priority = s.Priority.MustGetNull() - } - if !s.Usetype.IsUnset() { - t.Usetype = s.Usetype.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if !s.Route.IsUnset() { - t.Route = s.Route.MustGetNull() - } - if !s.RouteOrder.IsUnset() { - t.RouteOrder = s.RouteOrder.MustGetNull() - } - if !s.SetDow.IsUnset() { - t.SetDow = s.SetDow.MustGetNull() - } - if !s.Vectorsurvsiteid.IsUnset() { - t.Vectorsurvsiteid = s.Vectorsurvsiteid.MustGetNull() - } - if !s.H3R7.IsUnset() { - t.H3R7 = s.H3R7.MustGetNull() - } - if !s.H3R8.IsUnset() { - t.H3R8 = s.H3R8.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryTraplocationSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryTraplocations.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 35) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Accessdesc.IsUnset() { - vals[1] = psql.Arg(s.Accessdesc.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Active.IsUnset() { - vals[2] = psql.Arg(s.Active.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[3] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[4] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[5] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Description.IsUnset() { - vals[6] = psql.Arg(s.Description.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Externalid.IsUnset() { - vals[7] = psql.Arg(s.Externalid.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[8] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[9] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Gatewaysync.IsUnset() { - vals[10] = psql.Arg(s.Gatewaysync.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[11] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Habitat.IsUnset() { - vals[12] = psql.Arg(s.Habitat.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Locationnumber.IsUnset() { - vals[13] = psql.Arg(s.Locationnumber.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[14] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Nextactiondatescheduled.IsUnset() { - vals[15] = psql.Arg(s.Nextactiondatescheduled.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[16] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Priority.IsUnset() { - vals[17] = psql.Arg(s.Priority.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.Usetype.IsUnset() { - vals[18] = psql.Arg(s.Usetype.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[19] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[20] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[21] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[22] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[23] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[24] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[25] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[26] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[27] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Route.IsUnset() { - vals[28] = psql.Arg(s.Route.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.RouteOrder.IsUnset() { - vals[29] = psql.Arg(s.RouteOrder.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.SetDow.IsUnset() { - vals[30] = psql.Arg(s.SetDow.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Vectorsurvsiteid.IsUnset() { - vals[31] = psql.Arg(s.Vectorsurvsiteid.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.H3R7.IsUnset() { - vals[32] = psql.Arg(s.H3R7.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.H3R8.IsUnset() { - vals[33] = psql.Arg(s.H3R8.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[34] = psql.Arg(s.Version.MustGet()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryTraplocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryTraplocationSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 35) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Accessdesc.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "accessdesc")...), - psql.Arg(s.Accessdesc), - }}) - } - - if !s.Active.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "active")...), - psql.Arg(s.Active), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Description.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "description")...), - psql.Arg(s.Description), - }}) - } - - if !s.Externalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "externalid")...), - psql.Arg(s.Externalid), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Gatewaysync.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "gatewaysync")...), - psql.Arg(s.Gatewaysync), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitat")...), - psql.Arg(s.Habitat), - }}) - } - - if !s.Locationnumber.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationnumber")...), - psql.Arg(s.Locationnumber), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if !s.Nextactiondatescheduled.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "nextactiondatescheduled")...), - psql.Arg(s.Nextactiondatescheduled), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Priority.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "priority")...), - psql.Arg(s.Priority), - }}) - } - - if !s.Usetype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "usetype")...), - psql.Arg(s.Usetype), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if !s.Route.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "route")...), - psql.Arg(s.Route), - }}) - } - - if !s.RouteOrder.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "route_order")...), - psql.Arg(s.RouteOrder), - }}) - } - - if !s.SetDow.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "set_dow")...), - psql.Arg(s.SetDow), - }}) - } - - if !s.Vectorsurvsiteid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "vectorsurvsiteid")...), - psql.Arg(s.Vectorsurvsiteid), - }}) - } - - if !s.H3R7.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "h3r7")...), - psql.Arg(s.H3R7), - }}) - } - - if !s.H3R8.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "h3r8")...), - psql.Arg(s.H3R8), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryTraplocation retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryTraplocation(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryTraplocation, error) { - if len(cols) == 0 { - return HistoryTraplocations.Query( - sm.Where(HistoryTraplocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryTraplocations.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryTraplocations.Query( - sm.Where(HistoryTraplocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryTraplocations.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryTraplocations.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryTraplocationExists checks the presence of a single record by primary key -func HistoryTraplocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryTraplocations.Query( - sm.Where(HistoryTraplocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryTraplocations.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryTraplocation is retrieved from the database -func (o *HistoryTraplocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryTraplocations.AfterSelectHooks.RunHooks(ctx, exec, HistoryTraplocationSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryTraplocations.AfterInsertHooks.RunHooks(ctx, exec, HistoryTraplocationSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryTraplocations.AfterUpdateHooks.RunHooks(ctx, exec, HistoryTraplocationSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryTraplocations.AfterDeleteHooks.RunHooks(ctx, exec, HistoryTraplocationSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryTraplocation -func (o *HistoryTraplocation) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryTraplocation) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_traplocation", "objectid"), psql.Quote("history_traplocation", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryTraplocation -func (o *HistoryTraplocation) Update(ctx context.Context, exec bob.Executor, s *HistoryTraplocationSetter) error { - v, err := HistoryTraplocations.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 HistoryTraplocation record with an executor -func (o *HistoryTraplocation) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryTraplocations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryTraplocation using the executor -func (o *HistoryTraplocation) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryTraplocations.Query( - sm.Where(HistoryTraplocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryTraplocations.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryTraplocationSlice is retrieved from the database -func (o HistoryTraplocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryTraplocations.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryTraplocations.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryTraplocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryTraplocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryTraplocationSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_traplocation", "objectid"), psql.Quote("history_traplocation", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryTraplocationSlice) copyMatchingRows(from ...*HistoryTraplocation) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryTraplocationSlice) 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 HistoryTraplocations.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 *HistoryTraplocation: - o.copyMatchingRows(retrieved) - case []*HistoryTraplocation: - o.copyMatchingRows(retrieved...) - case HistoryTraplocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryTraplocation or a slice of HistoryTraplocation - // then run the AfterUpdateHooks on the slice - _, err = HistoryTraplocations.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryTraplocationSlice) 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 HistoryTraplocations.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 *HistoryTraplocation: - o.copyMatchingRows(retrieved) - case []*HistoryTraplocation: - o.copyMatchingRows(retrieved...) - case HistoryTraplocationSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryTraplocation or a slice of HistoryTraplocation - // then run the AfterDeleteHooks on the slice - _, err = HistoryTraplocations.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryTraplocationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryTraplocationSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryTraplocations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryTraplocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryTraplocations.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryTraplocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryTraplocations.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 *HistoryTraplocation) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryTraplocationSlice) 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 attachHistoryTraplocationOrganization0(ctx context.Context, exec bob.Executor, count int, historyTraplocation0 *HistoryTraplocation, organization1 *Organization) (*HistoryTraplocation, error) { - setter := &HistoryTraplocationSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyTraplocation0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryTraplocationOrganization0: %w", err) - } - - return historyTraplocation0, nil -} - -func (historyTraplocation0 *HistoryTraplocation) 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 = attachHistoryTraplocationOrganization0(ctx, exec, 1, historyTraplocation0, organization1) - if err != nil { - return err - } - - historyTraplocation0.R.Organization = organization1 - - organization1.R.HistoryTraplocations = append(organization1.R.HistoryTraplocations, historyTraplocation0) - - return nil -} - -func (historyTraplocation0 *HistoryTraplocation) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryTraplocationOrganization0(ctx, exec, 1, historyTraplocation0, organization1) - if err != nil { - return err - } - - historyTraplocation0.R.Organization = organization1 - - organization1.R.HistoryTraplocations = append(organization1.R.HistoryTraplocations, historyTraplocation0) - - return nil -} - -type historyTraplocationWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Accessdesc psql.WhereNullMod[Q, string] - Active psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Description psql.WhereNullMod[Q, string] - Externalid psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Gatewaysync psql.WhereNullMod[Q, int16] - Globalid psql.WhereNullMod[Q, string] - Habitat psql.WhereNullMod[Q, string] - Locationnumber psql.WhereNullMod[Q, int64] - Name psql.WhereNullMod[Q, string] - Nextactiondatescheduled psql.WhereNullMod[Q, int64] - Objectid psql.WhereMod[Q, int32] - Priority psql.WhereNullMod[Q, string] - Usetype psql.WhereNullMod[Q, string] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Route psql.WhereNullMod[Q, int64] - RouteOrder psql.WhereNullMod[Q, int64] - SetDow psql.WhereNullMod[Q, int64] - Vectorsurvsiteid psql.WhereNullMod[Q, string] - H3R7 psql.WhereNullMod[Q, string] - H3R8 psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyTraplocationWhere[Q]) AliasedAs(alias string) historyTraplocationWhere[Q] { - return buildHistoryTraplocationWhere[Q](buildHistoryTraplocationColumns(alias)) -} - -func buildHistoryTraplocationWhere[Q psql.Filterable](cols historyTraplocationColumns) historyTraplocationWhere[Q] { - return historyTraplocationWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Accessdesc: psql.WhereNull[Q, string](cols.Accessdesc), - Active: psql.WhereNull[Q, int16](cols.Active), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Description: psql.WhereNull[Q, string](cols.Description), - Externalid: psql.WhereNull[Q, string](cols.Externalid), - 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), - Habitat: psql.WhereNull[Q, string](cols.Habitat), - Locationnumber: psql.WhereNull[Q, int64](cols.Locationnumber), - Name: psql.WhereNull[Q, string](cols.Name), - Nextactiondatescheduled: psql.WhereNull[Q, int64](cols.Nextactiondatescheduled), - Objectid: psql.Where[Q, int32](cols.Objectid), - Priority: psql.WhereNull[Q, string](cols.Priority), - Usetype: psql.WhereNull[Q, string](cols.Usetype), - Zone: psql.WhereNull[Q, string](cols.Zone), - Zone2: psql.WhereNull[Q, string](cols.Zone2), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Route: psql.WhereNull[Q, int64](cols.Route), - RouteOrder: psql.WhereNull[Q, int64](cols.RouteOrder), - SetDow: psql.WhereNull[Q, int64](cols.SetDow), - Vectorsurvsiteid: psql.WhereNull[Q, string](cols.Vectorsurvsiteid), - H3R7: psql.WhereNull[Q, string](cols.H3R7), - H3R8: psql.WhereNull[Q, string](cols.H3R8), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryTraplocation) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyTraplocation cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryTraplocations = HistoryTraplocationSlice{o} - } - return nil - default: - return fmt.Errorf("historyTraplocation has no relationship %q", name) - } -} - -type historyTraplocationPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryTraplocationPreloader() historyTraplocationPreloader { - return historyTraplocationPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryTraplocations, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyTraplocationThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryTraplocationThenLoader[Q orm.Loadable]() historyTraplocationThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyTraplocationThenLoader[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 historyTraplocation's Organization into the .R struct -func (o *HistoryTraplocation) 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.HistoryTraplocations = HistoryTraplocationSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyTraplocation's Organization into the .R struct -func (os HistoryTraplocationSlice) 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.HistoryTraplocations = append(rel.R.HistoryTraplocations, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyTraplocationJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyTraplocationJoins[Q]) aliasedAs(alias string) historyTraplocationJoins[Q] { - return buildHistoryTraplocationJoins[Q](buildHistoryTraplocationColumns(alias), j.typ) -} - -func buildHistoryTraplocationJoins[Q dialect.Joinable](cols historyTraplocationColumns, typ string) historyTraplocationJoins[Q] { - return historyTraplocationJoins[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/db/models/history_treatment.bob.go b/db/models/history_treatment.bob.go deleted file mode 100644 index 18f845de..00000000 --- a/db/models/history_treatment.bob.go +++ /dev/null @@ -1,2040 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryTreatment is an object representing the database table. -type HistoryTreatment struct { - OrganizationID int32 `db:"organization_id" ` - Activity null.Val[string] `db:"activity" ` - Areaunit null.Val[string] `db:"areaunit" ` - Avetemp null.Val[float64] `db:"avetemp" ` - Barrierrouteid null.Val[string] `db:"barrierrouteid" ` - Cbcount null.Val[int16] `db:"cbcount" ` - Comments null.Val[string] `db:"comments" ` - Containercount null.Val[int16] `db:"containercount" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Enddatetime null.Val[int64] `db:"enddatetime" ` - Equiptype null.Val[string] `db:"equiptype" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Fieldtech null.Val[string] `db:"fieldtech" ` - Flowrate null.Val[float64] `db:"flowrate" ` - Globalid null.Val[string] `db:"globalid" ` - Habitat null.Val[string] `db:"habitat" ` - InspID null.Val[string] `db:"insp_id" ` - Invloc null.Val[string] `db:"invloc" ` - Linelocid null.Val[string] `db:"linelocid" ` - Locationname null.Val[string] `db:"locationname" ` - Method null.Val[string] `db:"method" ` - Objectid int32 `db:"objectid,pk" ` - Pointlocid null.Val[string] `db:"pointlocid" ` - Polygonlocid null.Val[string] `db:"polygonlocid" ` - Product null.Val[string] `db:"product" ` - Ptaid null.Val[string] `db:"ptaid" ` - Qty null.Val[float64] `db:"qty" ` - Qtyunit null.Val[string] `db:"qtyunit" ` - Raingauge null.Val[float64] `db:"raingauge" ` - Recordstatus null.Val[int16] `db:"recordstatus" ` - Reviewed null.Val[int16] `db:"reviewed" ` - Reviewedby null.Val[string] `db:"reviewedby" ` - Revieweddate null.Val[int64] `db:"revieweddate" ` - Sdid null.Val[string] `db:"sdid" ` - Sitecond null.Val[string] `db:"sitecond" ` - Srid null.Val[string] `db:"srid" ` - Startdatetime null.Val[int64] `db:"startdatetime" ` - Targetspecies null.Val[string] `db:"targetspecies" ` - Tirecount null.Val[int16] `db:"tirecount" ` - Treatacres null.Val[float64] `db:"treatacres" ` - Treatarea null.Val[float64] `db:"treatarea" ` - Treathectares null.Val[float64] `db:"treathectares" ` - Treatmenthours null.Val[float64] `db:"treatmenthours" ` - Treatmentlength null.Val[float64] `db:"treatmentlength" ` - Treatmentlengthunits null.Val[string] `db:"treatmentlengthunits" ` - Totalcostprodcut null.Val[float64] `db:"totalcostprodcut" ` - Ulvrouteid null.Val[string] `db:"ulvrouteid" ` - Warningoverride null.Val[int16] `db:"warningoverride" ` - Winddir null.Val[string] `db:"winddir" ` - Windspeed null.Val[float64] `db:"windspeed" ` - 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" ` - TempSitecond null.Val[string] `db:"temp_sitecond" ` - Version int32 `db:"version,pk" ` - Created null.Val[time.Time] `db:"created" ` - - R historyTreatmentR `db:"-" ` -} - -// HistoryTreatmentSlice is an alias for a slice of pointers to HistoryTreatment. -// This should almost always be used instead of []*HistoryTreatment. -type HistoryTreatmentSlice []*HistoryTreatment - -// HistoryTreatments contains methods to work with the history_treatment table -var HistoryTreatments = psql.NewTablex[*HistoryTreatment, HistoryTreatmentSlice, *HistoryTreatmentSetter]("", "history_treatment", buildHistoryTreatmentColumns("history_treatment")) - -// HistoryTreatmentsQuery is a query on the history_treatment table -type HistoryTreatmentsQuery = *psql.ViewQuery[*HistoryTreatment, HistoryTreatmentSlice] - -// historyTreatmentR is where relationships are stored. -type historyTreatmentR struct { - Organization *Organization // history_treatment.history_treatment_organization_id_fkey -} - -func buildHistoryTreatmentColumns(alias string) historyTreatmentColumns { - return historyTreatmentColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "activity", "areaunit", "avetemp", "barrierrouteid", "cbcount", "comments", "containercount", "creationdate", "creator", "enddatetime", "equiptype", "editdate", "editor", "fieldtech", "flowrate", "globalid", "habitat", "insp_id", "invloc", "linelocid", "locationname", "method", "objectid", "pointlocid", "polygonlocid", "product", "ptaid", "qty", "qtyunit", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sdid", "sitecond", "srid", "startdatetime", "targetspecies", "tirecount", "treatacres", "treatarea", "treathectares", "treatmenthours", "treatmentlength", "treatmentlengthunits", "totalcostprodcut", "ulvrouteid", "warningoverride", "winddir", "windspeed", "zone", "zone2", "geometry_x", "geometry_y", "temp_sitecond", "version", "created", - ).WithParent("history_treatment"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Activity: psql.Quote(alias, "activity"), - Areaunit: psql.Quote(alias, "areaunit"), - Avetemp: psql.Quote(alias, "avetemp"), - Barrierrouteid: psql.Quote(alias, "barrierrouteid"), - Cbcount: psql.Quote(alias, "cbcount"), - Comments: psql.Quote(alias, "comments"), - Containercount: psql.Quote(alias, "containercount"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Enddatetime: psql.Quote(alias, "enddatetime"), - Equiptype: psql.Quote(alias, "equiptype"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Fieldtech: psql.Quote(alias, "fieldtech"), - Flowrate: psql.Quote(alias, "flowrate"), - Globalid: psql.Quote(alias, "globalid"), - Habitat: psql.Quote(alias, "habitat"), - InspID: psql.Quote(alias, "insp_id"), - Invloc: psql.Quote(alias, "invloc"), - Linelocid: psql.Quote(alias, "linelocid"), - Locationname: psql.Quote(alias, "locationname"), - Method: psql.Quote(alias, "method"), - Objectid: psql.Quote(alias, "objectid"), - Pointlocid: psql.Quote(alias, "pointlocid"), - Polygonlocid: psql.Quote(alias, "polygonlocid"), - Product: psql.Quote(alias, "product"), - Ptaid: psql.Quote(alias, "ptaid"), - Qty: psql.Quote(alias, "qty"), - Qtyunit: psql.Quote(alias, "qtyunit"), - Raingauge: psql.Quote(alias, "raingauge"), - Recordstatus: psql.Quote(alias, "recordstatus"), - Reviewed: psql.Quote(alias, "reviewed"), - Reviewedby: psql.Quote(alias, "reviewedby"), - Revieweddate: psql.Quote(alias, "revieweddate"), - Sdid: psql.Quote(alias, "sdid"), - Sitecond: psql.Quote(alias, "sitecond"), - Srid: psql.Quote(alias, "srid"), - Startdatetime: psql.Quote(alias, "startdatetime"), - Targetspecies: psql.Quote(alias, "targetspecies"), - Tirecount: psql.Quote(alias, "tirecount"), - Treatacres: psql.Quote(alias, "treatacres"), - Treatarea: psql.Quote(alias, "treatarea"), - Treathectares: psql.Quote(alias, "treathectares"), - Treatmenthours: psql.Quote(alias, "treatmenthours"), - Treatmentlength: psql.Quote(alias, "treatmentlength"), - Treatmentlengthunits: psql.Quote(alias, "treatmentlengthunits"), - Totalcostprodcut: psql.Quote(alias, "totalcostprodcut"), - Ulvrouteid: psql.Quote(alias, "ulvrouteid"), - Warningoverride: psql.Quote(alias, "warningoverride"), - Winddir: psql.Quote(alias, "winddir"), - Windspeed: psql.Quote(alias, "windspeed"), - Zone: psql.Quote(alias, "zone"), - Zone2: psql.Quote(alias, "zone2"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - TempSitecond: psql.Quote(alias, "temp_sitecond"), - Version: psql.Quote(alias, "version"), - Created: psql.Quote(alias, "created"), - } -} - -type historyTreatmentColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Activity psql.Expression - Areaunit psql.Expression - Avetemp psql.Expression - Barrierrouteid psql.Expression - Cbcount psql.Expression - Comments psql.Expression - Containercount psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Enddatetime psql.Expression - Equiptype psql.Expression - Editdate psql.Expression - Editor psql.Expression - Fieldtech psql.Expression - Flowrate psql.Expression - Globalid psql.Expression - Habitat psql.Expression - InspID psql.Expression - Invloc psql.Expression - Linelocid psql.Expression - Locationname psql.Expression - Method psql.Expression - Objectid psql.Expression - Pointlocid psql.Expression - Polygonlocid psql.Expression - Product psql.Expression - Ptaid psql.Expression - Qty psql.Expression - Qtyunit psql.Expression - Raingauge psql.Expression - Recordstatus psql.Expression - Reviewed psql.Expression - Reviewedby psql.Expression - Revieweddate psql.Expression - Sdid psql.Expression - Sitecond psql.Expression - Srid psql.Expression - Startdatetime psql.Expression - Targetspecies psql.Expression - Tirecount psql.Expression - Treatacres psql.Expression - Treatarea psql.Expression - Treathectares psql.Expression - Treatmenthours psql.Expression - Treatmentlength psql.Expression - Treatmentlengthunits psql.Expression - Totalcostprodcut psql.Expression - Ulvrouteid psql.Expression - Warningoverride psql.Expression - Winddir psql.Expression - Windspeed psql.Expression - Zone psql.Expression - Zone2 psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - TempSitecond psql.Expression - Version psql.Expression - Created psql.Expression -} - -func (c historyTreatmentColumns) Alias() string { - return c.tableAlias -} - -func (historyTreatmentColumns) AliasedAs(alias string) historyTreatmentColumns { - return buildHistoryTreatmentColumns(alias) -} - -// HistoryTreatmentSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryTreatmentSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Activity omitnull.Val[string] `db:"activity" ` - Areaunit omitnull.Val[string] `db:"areaunit" ` - Avetemp omitnull.Val[float64] `db:"avetemp" ` - Barrierrouteid omitnull.Val[string] `db:"barrierrouteid" ` - Cbcount omitnull.Val[int16] `db:"cbcount" ` - Comments omitnull.Val[string] `db:"comments" ` - Containercount omitnull.Val[int16] `db:"containercount" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Enddatetime omitnull.Val[int64] `db:"enddatetime" ` - Equiptype omitnull.Val[string] `db:"equiptype" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Fieldtech omitnull.Val[string] `db:"fieldtech" ` - Flowrate omitnull.Val[float64] `db:"flowrate" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Habitat omitnull.Val[string] `db:"habitat" ` - InspID omitnull.Val[string] `db:"insp_id" ` - Invloc omitnull.Val[string] `db:"invloc" ` - Linelocid omitnull.Val[string] `db:"linelocid" ` - Locationname omitnull.Val[string] `db:"locationname" ` - Method omitnull.Val[string] `db:"method" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - Pointlocid omitnull.Val[string] `db:"pointlocid" ` - Polygonlocid omitnull.Val[string] `db:"polygonlocid" ` - Product omitnull.Val[string] `db:"product" ` - Ptaid omitnull.Val[string] `db:"ptaid" ` - Qty omitnull.Val[float64] `db:"qty" ` - Qtyunit omitnull.Val[string] `db:"qtyunit" ` - Raingauge omitnull.Val[float64] `db:"raingauge" ` - Recordstatus omitnull.Val[int16] `db:"recordstatus" ` - Reviewed omitnull.Val[int16] `db:"reviewed" ` - Reviewedby omitnull.Val[string] `db:"reviewedby" ` - Revieweddate omitnull.Val[int64] `db:"revieweddate" ` - Sdid omitnull.Val[string] `db:"sdid" ` - Sitecond omitnull.Val[string] `db:"sitecond" ` - Srid omitnull.Val[string] `db:"srid" ` - Startdatetime omitnull.Val[int64] `db:"startdatetime" ` - Targetspecies omitnull.Val[string] `db:"targetspecies" ` - Tirecount omitnull.Val[int16] `db:"tirecount" ` - Treatacres omitnull.Val[float64] `db:"treatacres" ` - Treatarea omitnull.Val[float64] `db:"treatarea" ` - Treathectares omitnull.Val[float64] `db:"treathectares" ` - Treatmenthours omitnull.Val[float64] `db:"treatmenthours" ` - Treatmentlength omitnull.Val[float64] `db:"treatmentlength" ` - Treatmentlengthunits omitnull.Val[string] `db:"treatmentlengthunits" ` - Totalcostprodcut omitnull.Val[float64] `db:"totalcostprodcut" ` - Ulvrouteid omitnull.Val[string] `db:"ulvrouteid" ` - Warningoverride omitnull.Val[int16] `db:"warningoverride" ` - Winddir omitnull.Val[string] `db:"winddir" ` - Windspeed omitnull.Val[float64] `db:"windspeed" ` - 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" ` - TempSitecond omitnull.Val[string] `db:"temp_sitecond" ` - Version omit.Val[int32] `db:"version,pk" ` - Created omitnull.Val[time.Time] `db:"created" ` -} - -func (s HistoryTreatmentSetter) SetColumns() []string { - vals := make([]string, 0, 59) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Activity.IsUnset() { - vals = append(vals, "activity") - } - if !s.Areaunit.IsUnset() { - vals = append(vals, "areaunit") - } - if !s.Avetemp.IsUnset() { - vals = append(vals, "avetemp") - } - if !s.Barrierrouteid.IsUnset() { - vals = append(vals, "barrierrouteid") - } - if !s.Cbcount.IsUnset() { - vals = append(vals, "cbcount") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Containercount.IsUnset() { - vals = append(vals, "containercount") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Enddatetime.IsUnset() { - vals = append(vals, "enddatetime") - } - if !s.Equiptype.IsUnset() { - vals = append(vals, "equiptype") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Fieldtech.IsUnset() { - vals = append(vals, "fieldtech") - } - if !s.Flowrate.IsUnset() { - vals = append(vals, "flowrate") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Habitat.IsUnset() { - vals = append(vals, "habitat") - } - if !s.InspID.IsUnset() { - vals = append(vals, "insp_id") - } - if !s.Invloc.IsUnset() { - vals = append(vals, "invloc") - } - if !s.Linelocid.IsUnset() { - vals = append(vals, "linelocid") - } - if !s.Locationname.IsUnset() { - vals = append(vals, "locationname") - } - if !s.Method.IsUnset() { - vals = append(vals, "method") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.Pointlocid.IsUnset() { - vals = append(vals, "pointlocid") - } - if !s.Polygonlocid.IsUnset() { - vals = append(vals, "polygonlocid") - } - if !s.Product.IsUnset() { - vals = append(vals, "product") - } - if !s.Ptaid.IsUnset() { - vals = append(vals, "ptaid") - } - if !s.Qty.IsUnset() { - vals = append(vals, "qty") - } - if !s.Qtyunit.IsUnset() { - vals = append(vals, "qtyunit") - } - if !s.Raingauge.IsUnset() { - vals = append(vals, "raingauge") - } - if !s.Recordstatus.IsUnset() { - vals = append(vals, "recordstatus") - } - if !s.Reviewed.IsUnset() { - vals = append(vals, "reviewed") - } - if !s.Reviewedby.IsUnset() { - vals = append(vals, "reviewedby") - } - if !s.Revieweddate.IsUnset() { - vals = append(vals, "revieweddate") - } - if !s.Sdid.IsUnset() { - vals = append(vals, "sdid") - } - if !s.Sitecond.IsUnset() { - vals = append(vals, "sitecond") - } - if !s.Srid.IsUnset() { - vals = append(vals, "srid") - } - if !s.Startdatetime.IsUnset() { - vals = append(vals, "startdatetime") - } - if !s.Targetspecies.IsUnset() { - vals = append(vals, "targetspecies") - } - if !s.Tirecount.IsUnset() { - vals = append(vals, "tirecount") - } - if !s.Treatacres.IsUnset() { - vals = append(vals, "treatacres") - } - if !s.Treatarea.IsUnset() { - vals = append(vals, "treatarea") - } - if !s.Treathectares.IsUnset() { - vals = append(vals, "treathectares") - } - if !s.Treatmenthours.IsUnset() { - vals = append(vals, "treatmenthours") - } - if !s.Treatmentlength.IsUnset() { - vals = append(vals, "treatmentlength") - } - if !s.Treatmentlengthunits.IsUnset() { - vals = append(vals, "treatmentlengthunits") - } - if !s.Totalcostprodcut.IsUnset() { - vals = append(vals, "totalcostprodcut") - } - if !s.Ulvrouteid.IsUnset() { - vals = append(vals, "ulvrouteid") - } - if !s.Warningoverride.IsUnset() { - vals = append(vals, "warningoverride") - } - if !s.Winddir.IsUnset() { - vals = append(vals, "winddir") - } - if !s.Windspeed.IsUnset() { - vals = append(vals, "windspeed") - } - if !s.Zone.IsUnset() { - vals = append(vals, "zone") - } - if !s.Zone2.IsUnset() { - vals = append(vals, "zone2") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.TempSitecond.IsUnset() { - vals = append(vals, "temp_sitecond") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - return vals -} - -func (s HistoryTreatmentSetter) Overwrite(t *HistoryTreatment) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Activity.IsUnset() { - t.Activity = s.Activity.MustGetNull() - } - if !s.Areaunit.IsUnset() { - t.Areaunit = s.Areaunit.MustGetNull() - } - if !s.Avetemp.IsUnset() { - t.Avetemp = s.Avetemp.MustGetNull() - } - if !s.Barrierrouteid.IsUnset() { - t.Barrierrouteid = s.Barrierrouteid.MustGetNull() - } - if !s.Cbcount.IsUnset() { - t.Cbcount = s.Cbcount.MustGetNull() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Containercount.IsUnset() { - t.Containercount = s.Containercount.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Enddatetime.IsUnset() { - t.Enddatetime = s.Enddatetime.MustGetNull() - } - if !s.Equiptype.IsUnset() { - t.Equiptype = s.Equiptype.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Fieldtech.IsUnset() { - t.Fieldtech = s.Fieldtech.MustGetNull() - } - if !s.Flowrate.IsUnset() { - t.Flowrate = s.Flowrate.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Habitat.IsUnset() { - t.Habitat = s.Habitat.MustGetNull() - } - if !s.InspID.IsUnset() { - t.InspID = s.InspID.MustGetNull() - } - if !s.Invloc.IsUnset() { - t.Invloc = s.Invloc.MustGetNull() - } - if !s.Linelocid.IsUnset() { - t.Linelocid = s.Linelocid.MustGetNull() - } - if !s.Locationname.IsUnset() { - t.Locationname = s.Locationname.MustGetNull() - } - if !s.Method.IsUnset() { - t.Method = s.Method.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.Pointlocid.IsUnset() { - t.Pointlocid = s.Pointlocid.MustGetNull() - } - if !s.Polygonlocid.IsUnset() { - t.Polygonlocid = s.Polygonlocid.MustGetNull() - } - if !s.Product.IsUnset() { - t.Product = s.Product.MustGetNull() - } - if !s.Ptaid.IsUnset() { - t.Ptaid = s.Ptaid.MustGetNull() - } - if !s.Qty.IsUnset() { - t.Qty = s.Qty.MustGetNull() - } - if !s.Qtyunit.IsUnset() { - t.Qtyunit = s.Qtyunit.MustGetNull() - } - if !s.Raingauge.IsUnset() { - t.Raingauge = s.Raingauge.MustGetNull() - } - if !s.Recordstatus.IsUnset() { - t.Recordstatus = s.Recordstatus.MustGetNull() - } - if !s.Reviewed.IsUnset() { - t.Reviewed = s.Reviewed.MustGetNull() - } - if !s.Reviewedby.IsUnset() { - t.Reviewedby = s.Reviewedby.MustGetNull() - } - if !s.Revieweddate.IsUnset() { - t.Revieweddate = s.Revieweddate.MustGetNull() - } - if !s.Sdid.IsUnset() { - t.Sdid = s.Sdid.MustGetNull() - } - if !s.Sitecond.IsUnset() { - t.Sitecond = s.Sitecond.MustGetNull() - } - if !s.Srid.IsUnset() { - t.Srid = s.Srid.MustGetNull() - } - if !s.Startdatetime.IsUnset() { - t.Startdatetime = s.Startdatetime.MustGetNull() - } - if !s.Targetspecies.IsUnset() { - t.Targetspecies = s.Targetspecies.MustGetNull() - } - if !s.Tirecount.IsUnset() { - t.Tirecount = s.Tirecount.MustGetNull() - } - if !s.Treatacres.IsUnset() { - t.Treatacres = s.Treatacres.MustGetNull() - } - if !s.Treatarea.IsUnset() { - t.Treatarea = s.Treatarea.MustGetNull() - } - if !s.Treathectares.IsUnset() { - t.Treathectares = s.Treathectares.MustGetNull() - } - if !s.Treatmenthours.IsUnset() { - t.Treatmenthours = s.Treatmenthours.MustGetNull() - } - if !s.Treatmentlength.IsUnset() { - t.Treatmentlength = s.Treatmentlength.MustGetNull() - } - if !s.Treatmentlengthunits.IsUnset() { - t.Treatmentlengthunits = s.Treatmentlengthunits.MustGetNull() - } - if !s.Totalcostprodcut.IsUnset() { - t.Totalcostprodcut = s.Totalcostprodcut.MustGetNull() - } - if !s.Ulvrouteid.IsUnset() { - t.Ulvrouteid = s.Ulvrouteid.MustGetNull() - } - if !s.Warningoverride.IsUnset() { - t.Warningoverride = s.Warningoverride.MustGetNull() - } - if !s.Winddir.IsUnset() { - t.Winddir = s.Winddir.MustGetNull() - } - if !s.Windspeed.IsUnset() { - t.Windspeed = s.Windspeed.MustGetNull() - } - if !s.Zone.IsUnset() { - t.Zone = s.Zone.MustGetNull() - } - if !s.Zone2.IsUnset() { - t.Zone2 = s.Zone2.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.TempSitecond.IsUnset() { - t.TempSitecond = s.TempSitecond.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } -} - -func (s *HistoryTreatmentSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryTreatments.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 59) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Activity.IsUnset() { - vals[1] = psql.Arg(s.Activity.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Areaunit.IsUnset() { - vals[2] = psql.Arg(s.Areaunit.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Avetemp.IsUnset() { - vals[3] = psql.Arg(s.Avetemp.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Barrierrouteid.IsUnset() { - vals[4] = psql.Arg(s.Barrierrouteid.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Cbcount.IsUnset() { - vals[5] = psql.Arg(s.Cbcount.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[6] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Containercount.IsUnset() { - vals[7] = psql.Arg(s.Containercount.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[8] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[9] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Enddatetime.IsUnset() { - vals[10] = psql.Arg(s.Enddatetime.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Equiptype.IsUnset() { - vals[11] = psql.Arg(s.Equiptype.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[12] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[13] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Fieldtech.IsUnset() { - vals[14] = psql.Arg(s.Fieldtech.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Flowrate.IsUnset() { - vals[15] = psql.Arg(s.Flowrate.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[16] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.Habitat.IsUnset() { - vals[17] = psql.Arg(s.Habitat.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.InspID.IsUnset() { - vals[18] = psql.Arg(s.InspID.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.Invloc.IsUnset() { - vals[19] = psql.Arg(s.Invloc.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.Linelocid.IsUnset() { - vals[20] = psql.Arg(s.Linelocid.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.Locationname.IsUnset() { - vals[21] = psql.Arg(s.Locationname.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if !s.Method.IsUnset() { - vals[22] = psql.Arg(s.Method.MustGetNull()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[23] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if !s.Pointlocid.IsUnset() { - vals[24] = psql.Arg(s.Pointlocid.MustGetNull()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Polygonlocid.IsUnset() { - vals[25] = psql.Arg(s.Polygonlocid.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if !s.Product.IsUnset() { - vals[26] = psql.Arg(s.Product.MustGetNull()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.Ptaid.IsUnset() { - vals[27] = psql.Arg(s.Ptaid.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - - if !s.Qty.IsUnset() { - vals[28] = psql.Arg(s.Qty.MustGetNull()) - } else { - vals[28] = psql.Raw("DEFAULT") - } - - if !s.Qtyunit.IsUnset() { - vals[29] = psql.Arg(s.Qtyunit.MustGetNull()) - } else { - vals[29] = psql.Raw("DEFAULT") - } - - if !s.Raingauge.IsUnset() { - vals[30] = psql.Arg(s.Raingauge.MustGetNull()) - } else { - vals[30] = psql.Raw("DEFAULT") - } - - if !s.Recordstatus.IsUnset() { - vals[31] = psql.Arg(s.Recordstatus.MustGetNull()) - } else { - vals[31] = psql.Raw("DEFAULT") - } - - if !s.Reviewed.IsUnset() { - vals[32] = psql.Arg(s.Reviewed.MustGetNull()) - } else { - vals[32] = psql.Raw("DEFAULT") - } - - if !s.Reviewedby.IsUnset() { - vals[33] = psql.Arg(s.Reviewedby.MustGetNull()) - } else { - vals[33] = psql.Raw("DEFAULT") - } - - if !s.Revieweddate.IsUnset() { - vals[34] = psql.Arg(s.Revieweddate.MustGetNull()) - } else { - vals[34] = psql.Raw("DEFAULT") - } - - if !s.Sdid.IsUnset() { - vals[35] = psql.Arg(s.Sdid.MustGetNull()) - } else { - vals[35] = psql.Raw("DEFAULT") - } - - if !s.Sitecond.IsUnset() { - vals[36] = psql.Arg(s.Sitecond.MustGetNull()) - } else { - vals[36] = psql.Raw("DEFAULT") - } - - if !s.Srid.IsUnset() { - vals[37] = psql.Arg(s.Srid.MustGetNull()) - } else { - vals[37] = psql.Raw("DEFAULT") - } - - if !s.Startdatetime.IsUnset() { - vals[38] = psql.Arg(s.Startdatetime.MustGetNull()) - } else { - vals[38] = psql.Raw("DEFAULT") - } - - if !s.Targetspecies.IsUnset() { - vals[39] = psql.Arg(s.Targetspecies.MustGetNull()) - } else { - vals[39] = psql.Raw("DEFAULT") - } - - if !s.Tirecount.IsUnset() { - vals[40] = psql.Arg(s.Tirecount.MustGetNull()) - } else { - vals[40] = psql.Raw("DEFAULT") - } - - if !s.Treatacres.IsUnset() { - vals[41] = psql.Arg(s.Treatacres.MustGetNull()) - } else { - vals[41] = psql.Raw("DEFAULT") - } - - if !s.Treatarea.IsUnset() { - vals[42] = psql.Arg(s.Treatarea.MustGetNull()) - } else { - vals[42] = psql.Raw("DEFAULT") - } - - if !s.Treathectares.IsUnset() { - vals[43] = psql.Arg(s.Treathectares.MustGetNull()) - } else { - vals[43] = psql.Raw("DEFAULT") - } - - if !s.Treatmenthours.IsUnset() { - vals[44] = psql.Arg(s.Treatmenthours.MustGetNull()) - } else { - vals[44] = psql.Raw("DEFAULT") - } - - if !s.Treatmentlength.IsUnset() { - vals[45] = psql.Arg(s.Treatmentlength.MustGetNull()) - } else { - vals[45] = psql.Raw("DEFAULT") - } - - if !s.Treatmentlengthunits.IsUnset() { - vals[46] = psql.Arg(s.Treatmentlengthunits.MustGetNull()) - } else { - vals[46] = psql.Raw("DEFAULT") - } - - if !s.Totalcostprodcut.IsUnset() { - vals[47] = psql.Arg(s.Totalcostprodcut.MustGetNull()) - } else { - vals[47] = psql.Raw("DEFAULT") - } - - if !s.Ulvrouteid.IsUnset() { - vals[48] = psql.Arg(s.Ulvrouteid.MustGetNull()) - } else { - vals[48] = psql.Raw("DEFAULT") - } - - if !s.Warningoverride.IsUnset() { - vals[49] = psql.Arg(s.Warningoverride.MustGetNull()) - } else { - vals[49] = psql.Raw("DEFAULT") - } - - if !s.Winddir.IsUnset() { - vals[50] = psql.Arg(s.Winddir.MustGetNull()) - } else { - vals[50] = psql.Raw("DEFAULT") - } - - if !s.Windspeed.IsUnset() { - vals[51] = psql.Arg(s.Windspeed.MustGetNull()) - } else { - vals[51] = psql.Raw("DEFAULT") - } - - if !s.Zone.IsUnset() { - vals[52] = psql.Arg(s.Zone.MustGetNull()) - } else { - vals[52] = psql.Raw("DEFAULT") - } - - if !s.Zone2.IsUnset() { - vals[53] = psql.Arg(s.Zone2.MustGetNull()) - } else { - vals[53] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[54] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[54] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[55] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[55] = psql.Raw("DEFAULT") - } - - if !s.TempSitecond.IsUnset() { - vals[56] = psql.Arg(s.TempSitecond.MustGetNull()) - } else { - vals[56] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[57] = psql.Arg(s.Version.MustGet()) - } else { - vals[57] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[58] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[58] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryTreatmentSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryTreatmentSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 59) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Activity.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "activity")...), - psql.Arg(s.Activity), - }}) - } - - if !s.Areaunit.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "areaunit")...), - psql.Arg(s.Areaunit), - }}) - } - - if !s.Avetemp.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "avetemp")...), - psql.Arg(s.Avetemp), - }}) - } - - if !s.Barrierrouteid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "barrierrouteid")...), - psql.Arg(s.Barrierrouteid), - }}) - } - - if !s.Cbcount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "cbcount")...), - psql.Arg(s.Cbcount), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Containercount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "containercount")...), - psql.Arg(s.Containercount), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Enddatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "enddatetime")...), - psql.Arg(s.Enddatetime), - }}) - } - - if !s.Equiptype.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "equiptype")...), - psql.Arg(s.Equiptype), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Fieldtech.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "fieldtech")...), - psql.Arg(s.Fieldtech), - }}) - } - - if !s.Flowrate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "flowrate")...), - psql.Arg(s.Flowrate), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Habitat.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "habitat")...), - psql.Arg(s.Habitat), - }}) - } - - if !s.InspID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "insp_id")...), - psql.Arg(s.InspID), - }}) - } - - if !s.Invloc.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "invloc")...), - psql.Arg(s.Invloc), - }}) - } - - if !s.Linelocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "linelocid")...), - psql.Arg(s.Linelocid), - }}) - } - - if !s.Locationname.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "locationname")...), - psql.Arg(s.Locationname), - }}) - } - - if !s.Method.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "method")...), - psql.Arg(s.Method), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.Pointlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pointlocid")...), - psql.Arg(s.Pointlocid), - }}) - } - - if !s.Polygonlocid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "polygonlocid")...), - psql.Arg(s.Polygonlocid), - }}) - } - - if !s.Product.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "product")...), - psql.Arg(s.Product), - }}) - } - - if !s.Ptaid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "ptaid")...), - psql.Arg(s.Ptaid), - }}) - } - - if !s.Qty.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "qty")...), - psql.Arg(s.Qty), - }}) - } - - if !s.Qtyunit.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "qtyunit")...), - psql.Arg(s.Qtyunit), - }}) - } - - if !s.Raingauge.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "raingauge")...), - psql.Arg(s.Raingauge), - }}) - } - - if !s.Recordstatus.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "recordstatus")...), - psql.Arg(s.Recordstatus), - }}) - } - - if !s.Reviewed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewed")...), - psql.Arg(s.Reviewed), - }}) - } - - if !s.Reviewedby.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "reviewedby")...), - psql.Arg(s.Reviewedby), - }}) - } - - if !s.Revieweddate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "revieweddate")...), - psql.Arg(s.Revieweddate), - }}) - } - - if !s.Sdid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sdid")...), - psql.Arg(s.Sdid), - }}) - } - - if !s.Sitecond.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "sitecond")...), - psql.Arg(s.Sitecond), - }}) - } - - if !s.Srid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "srid")...), - psql.Arg(s.Srid), - }}) - } - - if !s.Startdatetime.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "startdatetime")...), - psql.Arg(s.Startdatetime), - }}) - } - - if !s.Targetspecies.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "targetspecies")...), - psql.Arg(s.Targetspecies), - }}) - } - - if !s.Tirecount.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "tirecount")...), - psql.Arg(s.Tirecount), - }}) - } - - if !s.Treatacres.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treatacres")...), - psql.Arg(s.Treatacres), - }}) - } - - if !s.Treatarea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treatarea")...), - psql.Arg(s.Treatarea), - }}) - } - - if !s.Treathectares.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treathectares")...), - psql.Arg(s.Treathectares), - }}) - } - - if !s.Treatmenthours.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treatmenthours")...), - psql.Arg(s.Treatmenthours), - }}) - } - - if !s.Treatmentlength.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treatmentlength")...), - psql.Arg(s.Treatmentlength), - }}) - } - - if !s.Treatmentlengthunits.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treatmentlengthunits")...), - psql.Arg(s.Treatmentlengthunits), - }}) - } - - if !s.Totalcostprodcut.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "totalcostprodcut")...), - psql.Arg(s.Totalcostprodcut), - }}) - } - - if !s.Ulvrouteid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "ulvrouteid")...), - psql.Arg(s.Ulvrouteid), - }}) - } - - if !s.Warningoverride.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "warningoverride")...), - psql.Arg(s.Warningoverride), - }}) - } - - if !s.Winddir.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "winddir")...), - psql.Arg(s.Winddir), - }}) - } - - if !s.Windspeed.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "windspeed")...), - psql.Arg(s.Windspeed), - }}) - } - - if !s.Zone.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone")...), - psql.Arg(s.Zone), - }}) - } - - if !s.Zone2.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "zone2")...), - psql.Arg(s.Zone2), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.TempSitecond.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "temp_sitecond")...), - psql.Arg(s.TempSitecond), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - return exprs -} - -// FindHistoryTreatment retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryTreatment(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryTreatment, error) { - if len(cols) == 0 { - return HistoryTreatments.Query( - sm.Where(HistoryTreatments.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryTreatments.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryTreatments.Query( - sm.Where(HistoryTreatments.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryTreatments.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryTreatments.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryTreatmentExists checks the presence of a single record by primary key -func HistoryTreatmentExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryTreatments.Query( - sm.Where(HistoryTreatments.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryTreatments.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryTreatment is retrieved from the database -func (o *HistoryTreatment) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryTreatments.AfterSelectHooks.RunHooks(ctx, exec, HistoryTreatmentSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryTreatments.AfterInsertHooks.RunHooks(ctx, exec, HistoryTreatmentSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryTreatments.AfterUpdateHooks.RunHooks(ctx, exec, HistoryTreatmentSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryTreatments.AfterDeleteHooks.RunHooks(ctx, exec, HistoryTreatmentSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryTreatment -func (o *HistoryTreatment) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryTreatment) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_treatment", "objectid"), psql.Quote("history_treatment", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryTreatment -func (o *HistoryTreatment) Update(ctx context.Context, exec bob.Executor, s *HistoryTreatmentSetter) error { - v, err := HistoryTreatments.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 HistoryTreatment record with an executor -func (o *HistoryTreatment) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryTreatments.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryTreatment using the executor -func (o *HistoryTreatment) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryTreatments.Query( - sm.Where(HistoryTreatments.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryTreatments.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryTreatmentSlice is retrieved from the database -func (o HistoryTreatmentSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryTreatments.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryTreatments.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryTreatments.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryTreatments.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryTreatmentSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_treatment", "objectid"), psql.Quote("history_treatment", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryTreatmentSlice) copyMatchingRows(from ...*HistoryTreatment) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryTreatmentSlice) 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 HistoryTreatments.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 *HistoryTreatment: - o.copyMatchingRows(retrieved) - case []*HistoryTreatment: - o.copyMatchingRows(retrieved...) - case HistoryTreatmentSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryTreatment or a slice of HistoryTreatment - // then run the AfterUpdateHooks on the slice - _, err = HistoryTreatments.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryTreatmentSlice) 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 HistoryTreatments.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 *HistoryTreatment: - o.copyMatchingRows(retrieved) - case []*HistoryTreatment: - o.copyMatchingRows(retrieved...) - case HistoryTreatmentSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryTreatment or a slice of HistoryTreatment - // then run the AfterDeleteHooks on the slice - _, err = HistoryTreatments.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryTreatmentSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryTreatmentSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryTreatments.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryTreatmentSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryTreatments.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryTreatmentSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryTreatments.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 *HistoryTreatment) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryTreatmentSlice) 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 attachHistoryTreatmentOrganization0(ctx context.Context, exec bob.Executor, count int, historyTreatment0 *HistoryTreatment, organization1 *Organization) (*HistoryTreatment, error) { - setter := &HistoryTreatmentSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyTreatment0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryTreatmentOrganization0: %w", err) - } - - return historyTreatment0, nil -} - -func (historyTreatment0 *HistoryTreatment) 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 = attachHistoryTreatmentOrganization0(ctx, exec, 1, historyTreatment0, organization1) - if err != nil { - return err - } - - historyTreatment0.R.Organization = organization1 - - organization1.R.HistoryTreatments = append(organization1.R.HistoryTreatments, historyTreatment0) - - return nil -} - -func (historyTreatment0 *HistoryTreatment) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryTreatmentOrganization0(ctx, exec, 1, historyTreatment0, organization1) - if err != nil { - return err - } - - historyTreatment0.R.Organization = organization1 - - organization1.R.HistoryTreatments = append(organization1.R.HistoryTreatments, historyTreatment0) - - return nil -} - -type historyTreatmentWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Activity psql.WhereNullMod[Q, string] - Areaunit psql.WhereNullMod[Q, string] - Avetemp psql.WhereNullMod[Q, float64] - Barrierrouteid psql.WhereNullMod[Q, string] - Cbcount psql.WhereNullMod[Q, int16] - Comments psql.WhereNullMod[Q, string] - Containercount psql.WhereNullMod[Q, int16] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Enddatetime psql.WhereNullMod[Q, int64] - Equiptype psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Fieldtech psql.WhereNullMod[Q, string] - Flowrate psql.WhereNullMod[Q, float64] - Globalid psql.WhereNullMod[Q, string] - Habitat psql.WhereNullMod[Q, string] - InspID psql.WhereNullMod[Q, string] - Invloc psql.WhereNullMod[Q, string] - Linelocid psql.WhereNullMod[Q, string] - Locationname psql.WhereNullMod[Q, string] - Method psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - Pointlocid psql.WhereNullMod[Q, string] - Polygonlocid psql.WhereNullMod[Q, string] - Product psql.WhereNullMod[Q, string] - Ptaid psql.WhereNullMod[Q, string] - Qty psql.WhereNullMod[Q, float64] - Qtyunit psql.WhereNullMod[Q, string] - Raingauge psql.WhereNullMod[Q, float64] - Recordstatus psql.WhereNullMod[Q, int16] - Reviewed psql.WhereNullMod[Q, int16] - Reviewedby psql.WhereNullMod[Q, string] - Revieweddate psql.WhereNullMod[Q, int64] - Sdid psql.WhereNullMod[Q, string] - Sitecond psql.WhereNullMod[Q, string] - Srid psql.WhereNullMod[Q, string] - Startdatetime psql.WhereNullMod[Q, int64] - Targetspecies psql.WhereNullMod[Q, string] - Tirecount psql.WhereNullMod[Q, int16] - Treatacres psql.WhereNullMod[Q, float64] - Treatarea psql.WhereNullMod[Q, float64] - Treathectares psql.WhereNullMod[Q, float64] - Treatmenthours psql.WhereNullMod[Q, float64] - Treatmentlength psql.WhereNullMod[Q, float64] - Treatmentlengthunits psql.WhereNullMod[Q, string] - Totalcostprodcut psql.WhereNullMod[Q, float64] - Ulvrouteid psql.WhereNullMod[Q, string] - Warningoverride psql.WhereNullMod[Q, int16] - Winddir psql.WhereNullMod[Q, string] - Windspeed psql.WhereNullMod[Q, float64] - Zone psql.WhereNullMod[Q, string] - Zone2 psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - TempSitecond psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] - Created psql.WhereNullMod[Q, time.Time] -} - -func (historyTreatmentWhere[Q]) AliasedAs(alias string) historyTreatmentWhere[Q] { - return buildHistoryTreatmentWhere[Q](buildHistoryTreatmentColumns(alias)) -} - -func buildHistoryTreatmentWhere[Q psql.Filterable](cols historyTreatmentColumns) historyTreatmentWhere[Q] { - return historyTreatmentWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Activity: psql.WhereNull[Q, string](cols.Activity), - Areaunit: psql.WhereNull[Q, string](cols.Areaunit), - Avetemp: psql.WhereNull[Q, float64](cols.Avetemp), - Barrierrouteid: psql.WhereNull[Q, string](cols.Barrierrouteid), - Cbcount: psql.WhereNull[Q, int16](cols.Cbcount), - Comments: psql.WhereNull[Q, string](cols.Comments), - Containercount: psql.WhereNull[Q, int16](cols.Containercount), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - Creator: psql.WhereNull[Q, string](cols.Creator), - Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime), - Equiptype: psql.WhereNull[Q, string](cols.Equiptype), - Editdate: psql.WhereNull[Q, int64](cols.Editdate), - 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), - Habitat: psql.WhereNull[Q, string](cols.Habitat), - InspID: psql.WhereNull[Q, string](cols.InspID), - Invloc: psql.WhereNull[Q, string](cols.Invloc), - Linelocid: psql.WhereNull[Q, string](cols.Linelocid), - Locationname: psql.WhereNull[Q, string](cols.Locationname), - Method: psql.WhereNull[Q, string](cols.Method), - Objectid: psql.Where[Q, int32](cols.Objectid), - Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid), - Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid), - Product: psql.WhereNull[Q, string](cols.Product), - Ptaid: psql.WhereNull[Q, string](cols.Ptaid), - Qty: psql.WhereNull[Q, float64](cols.Qty), - Qtyunit: psql.WhereNull[Q, string](cols.Qtyunit), - Raingauge: psql.WhereNull[Q, float64](cols.Raingauge), - Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus), - Reviewed: psql.WhereNull[Q, int16](cols.Reviewed), - Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby), - Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate), - Sdid: psql.WhereNull[Q, string](cols.Sdid), - Sitecond: psql.WhereNull[Q, string](cols.Sitecond), - Srid: psql.WhereNull[Q, string](cols.Srid), - Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime), - Targetspecies: psql.WhereNull[Q, string](cols.Targetspecies), - Tirecount: psql.WhereNull[Q, int16](cols.Tirecount), - Treatacres: psql.WhereNull[Q, float64](cols.Treatacres), - Treatarea: psql.WhereNull[Q, float64](cols.Treatarea), - Treathectares: psql.WhereNull[Q, float64](cols.Treathectares), - Treatmenthours: psql.WhereNull[Q, float64](cols.Treatmenthours), - Treatmentlength: psql.WhereNull[Q, float64](cols.Treatmentlength), - Treatmentlengthunits: psql.WhereNull[Q, string](cols.Treatmentlengthunits), - Totalcostprodcut: psql.WhereNull[Q, float64](cols.Totalcostprodcut), - Ulvrouteid: psql.WhereNull[Q, string](cols.Ulvrouteid), - Warningoverride: psql.WhereNull[Q, int16](cols.Warningoverride), - Winddir: psql.WhereNull[Q, string](cols.Winddir), - Windspeed: psql.WhereNull[Q, float64](cols.Windspeed), - 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), - TempSitecond: psql.WhereNull[Q, string](cols.TempSitecond), - Version: psql.Where[Q, int32](cols.Version), - Created: psql.WhereNull[Q, time.Time](cols.Created), - } -} - -func (o *HistoryTreatment) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyTreatment cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryTreatments = HistoryTreatmentSlice{o} - } - return nil - default: - return fmt.Errorf("historyTreatment has no relationship %q", name) - } -} - -type historyTreatmentPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryTreatmentPreloader() historyTreatmentPreloader { - return historyTreatmentPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryTreatments, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyTreatmentThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryTreatmentThenLoader[Q orm.Loadable]() historyTreatmentThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyTreatmentThenLoader[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 historyTreatment's Organization into the .R struct -func (o *HistoryTreatment) 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.HistoryTreatments = HistoryTreatmentSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyTreatment's Organization into the .R struct -func (os HistoryTreatmentSlice) 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.HistoryTreatments = append(rel.R.HistoryTreatments, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyTreatmentJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyTreatmentJoins[Q]) aliasedAs(alias string) historyTreatmentJoins[Q] { - return buildHistoryTreatmentJoins[Q](buildHistoryTreatmentColumns(alias), j.typ) -} - -func buildHistoryTreatmentJoins[Q dialect.Joinable](cols historyTreatmentColumns, typ string) historyTreatmentJoins[Q] { - return historyTreatmentJoins[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/db/models/history_treatmentarea.bob.go b/db/models/history_treatmentarea.bob.go deleted file mode 100644 index 349cb0af..00000000 --- a/db/models/history_treatmentarea.bob.go +++ /dev/null @@ -1,1140 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryTreatmentarea is an object representing the database table. -type HistoryTreatmentarea struct { - OrganizationID int32 `db:"organization_id" ` - Comments null.Val[string] `db:"comments" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Notified null.Val[int16] `db:"notified" ` - Objectid int32 `db:"objectid,pk" ` - SessionID null.Val[string] `db:"session_id" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - Treatdate null.Val[int64] `db:"treatdate" ` - TreatID null.Val[string] `db:"treat_id" ` - Type null.Val[string] `db:"type" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historyTreatmentareaR `db:"-" ` -} - -// HistoryTreatmentareaSlice is an alias for a slice of pointers to HistoryTreatmentarea. -// This should almost always be used instead of []*HistoryTreatmentarea. -type HistoryTreatmentareaSlice []*HistoryTreatmentarea - -// HistoryTreatmentareas contains methods to work with the history_treatmentarea table -var HistoryTreatmentareas = psql.NewTablex[*HistoryTreatmentarea, HistoryTreatmentareaSlice, *HistoryTreatmentareaSetter]("", "history_treatmentarea", buildHistoryTreatmentareaColumns("history_treatmentarea")) - -// HistoryTreatmentareasQuery is a query on the history_treatmentarea table -type HistoryTreatmentareasQuery = *psql.ViewQuery[*HistoryTreatmentarea, HistoryTreatmentareaSlice] - -// historyTreatmentareaR is where relationships are stored. -type historyTreatmentareaR struct { - Organization *Organization // history_treatmentarea.history_treatmentarea_organization_id_fkey -} - -func buildHistoryTreatmentareaColumns(alias string) historyTreatmentareaColumns { - return historyTreatmentareaColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "comments", "creationdate", "creator", "editdate", "editor", "globalid", "notified", "objectid", "session_id", "shape__area", "shape__length", "treatdate", "treat_id", "type", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", - ).WithParent("history_treatmentarea"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Comments: psql.Quote(alias, "comments"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Notified: psql.Quote(alias, "notified"), - Objectid: psql.Quote(alias, "objectid"), - SessionID: psql.Quote(alias, "session_id"), - ShapeArea: psql.Quote(alias, "shape__area"), - ShapeLength: psql.Quote(alias, "shape__length"), - Treatdate: psql.Quote(alias, "treatdate"), - TreatID: psql.Quote(alias, "treat_id"), - Type: psql.Quote(alias, "type"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Version: psql.Quote(alias, "version"), - } -} - -type historyTreatmentareaColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Comments psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Notified psql.Expression - Objectid psql.Expression - SessionID psql.Expression - ShapeArea psql.Expression - ShapeLength psql.Expression - Treatdate psql.Expression - TreatID psql.Expression - Type psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Version psql.Expression -} - -func (c historyTreatmentareaColumns) Alias() string { - return c.tableAlias -} - -func (historyTreatmentareaColumns) AliasedAs(alias string) historyTreatmentareaColumns { - return buildHistoryTreatmentareaColumns(alias) -} - -// HistoryTreatmentareaSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryTreatmentareaSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Comments omitnull.Val[string] `db:"comments" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Notified omitnull.Val[int16] `db:"notified" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - SessionID omitnull.Val[string] `db:"session_id" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Treatdate omitnull.Val[int64] `db:"treatdate" ` - TreatID omitnull.Val[string] `db:"treat_id" ` - Type omitnull.Val[string] `db:"type" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryTreatmentareaSetter) SetColumns() []string { - vals := make([]string, 0, 23) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Comments.IsUnset() { - vals = append(vals, "comments") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Notified.IsUnset() { - vals = append(vals, "notified") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.SessionID.IsUnset() { - vals = append(vals, "session_id") - } - if !s.ShapeArea.IsUnset() { - vals = append(vals, "shape__area") - } - if !s.ShapeLength.IsUnset() { - vals = append(vals, "shape__length") - } - if !s.Treatdate.IsUnset() { - vals = append(vals, "treatdate") - } - if !s.TreatID.IsUnset() { - vals = append(vals, "treat_id") - } - if !s.Type.IsUnset() { - vals = append(vals, "type") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryTreatmentareaSetter) Overwrite(t *HistoryTreatmentarea) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Comments.IsUnset() { - t.Comments = s.Comments.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Notified.IsUnset() { - t.Notified = s.Notified.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.SessionID.IsUnset() { - t.SessionID = s.SessionID.MustGetNull() - } - if !s.ShapeArea.IsUnset() { - t.ShapeArea = s.ShapeArea.MustGetNull() - } - if !s.ShapeLength.IsUnset() { - t.ShapeLength = s.ShapeLength.MustGetNull() - } - if !s.Treatdate.IsUnset() { - t.Treatdate = s.Treatdate.MustGetNull() - } - if !s.TreatID.IsUnset() { - t.TreatID = s.TreatID.MustGetNull() - } - if !s.Type.IsUnset() { - t.Type = s.Type.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryTreatmentareaSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryTreatmentareas.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 23) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Comments.IsUnset() { - vals[1] = psql.Arg(s.Comments.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[2] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[3] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[4] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[5] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[6] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Notified.IsUnset() { - vals[7] = psql.Arg(s.Notified.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[8] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.SessionID.IsUnset() { - vals[9] = psql.Arg(s.SessionID.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.ShapeArea.IsUnset() { - vals[10] = psql.Arg(s.ShapeArea.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.ShapeLength.IsUnset() { - vals[11] = psql.Arg(s.ShapeLength.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.Treatdate.IsUnset() { - vals[12] = psql.Arg(s.Treatdate.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.TreatID.IsUnset() { - vals[13] = psql.Arg(s.TreatID.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.Type.IsUnset() { - vals[14] = psql.Arg(s.Type.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[15] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[16] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[17] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[18] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[19] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[20] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[21] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[22] = psql.Arg(s.Version.MustGet()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryTreatmentareaSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryTreatmentareaSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 23) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Comments.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "comments")...), - psql.Arg(s.Comments), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Notified.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "notified")...), - psql.Arg(s.Notified), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.SessionID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "session_id")...), - psql.Arg(s.SessionID), - }}) - } - - if !s.ShapeArea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__area")...), - psql.Arg(s.ShapeArea), - }}) - } - - if !s.ShapeLength.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__length")...), - psql.Arg(s.ShapeLength), - }}) - } - - if !s.Treatdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treatdate")...), - psql.Arg(s.Treatdate), - }}) - } - - if !s.TreatID.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "treat_id")...), - psql.Arg(s.TreatID), - }}) - } - - if !s.Type.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "type")...), - psql.Arg(s.Type), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryTreatmentarea retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryTreatmentarea(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryTreatmentarea, error) { - if len(cols) == 0 { - return HistoryTreatmentareas.Query( - sm.Where(HistoryTreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryTreatmentareas.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryTreatmentareas.Query( - sm.Where(HistoryTreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryTreatmentareas.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryTreatmentareas.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryTreatmentareaExists checks the presence of a single record by primary key -func HistoryTreatmentareaExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryTreatmentareas.Query( - sm.Where(HistoryTreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryTreatmentareas.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryTreatmentarea is retrieved from the database -func (o *HistoryTreatmentarea) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryTreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, HistoryTreatmentareaSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryTreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, HistoryTreatmentareaSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryTreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, HistoryTreatmentareaSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryTreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, HistoryTreatmentareaSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryTreatmentarea -func (o *HistoryTreatmentarea) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryTreatmentarea) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_treatmentarea", "objectid"), psql.Quote("history_treatmentarea", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryTreatmentarea -func (o *HistoryTreatmentarea) Update(ctx context.Context, exec bob.Executor, s *HistoryTreatmentareaSetter) error { - v, err := HistoryTreatmentareas.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 HistoryTreatmentarea record with an executor -func (o *HistoryTreatmentarea) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryTreatmentareas.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryTreatmentarea using the executor -func (o *HistoryTreatmentarea) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryTreatmentareas.Query( - sm.Where(HistoryTreatmentareas.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryTreatmentareas.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryTreatmentareaSlice is retrieved from the database -func (o HistoryTreatmentareaSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryTreatmentareas.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryTreatmentareas.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryTreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryTreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryTreatmentareaSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_treatmentarea", "objectid"), psql.Quote("history_treatmentarea", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryTreatmentareaSlice) copyMatchingRows(from ...*HistoryTreatmentarea) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryTreatmentareaSlice) 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 HistoryTreatmentareas.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 *HistoryTreatmentarea: - o.copyMatchingRows(retrieved) - case []*HistoryTreatmentarea: - o.copyMatchingRows(retrieved...) - case HistoryTreatmentareaSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryTreatmentarea or a slice of HistoryTreatmentarea - // then run the AfterUpdateHooks on the slice - _, err = HistoryTreatmentareas.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryTreatmentareaSlice) 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 HistoryTreatmentareas.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 *HistoryTreatmentarea: - o.copyMatchingRows(retrieved) - case []*HistoryTreatmentarea: - o.copyMatchingRows(retrieved...) - case HistoryTreatmentareaSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryTreatmentarea or a slice of HistoryTreatmentarea - // then run the AfterDeleteHooks on the slice - _, err = HistoryTreatmentareas.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryTreatmentareaSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryTreatmentareaSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryTreatmentareas.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryTreatmentareaSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryTreatmentareas.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryTreatmentareaSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryTreatmentareas.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 *HistoryTreatmentarea) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryTreatmentareaSlice) 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 attachHistoryTreatmentareaOrganization0(ctx context.Context, exec bob.Executor, count int, historyTreatmentarea0 *HistoryTreatmentarea, organization1 *Organization) (*HistoryTreatmentarea, error) { - setter := &HistoryTreatmentareaSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyTreatmentarea0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryTreatmentareaOrganization0: %w", err) - } - - return historyTreatmentarea0, nil -} - -func (historyTreatmentarea0 *HistoryTreatmentarea) 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 = attachHistoryTreatmentareaOrganization0(ctx, exec, 1, historyTreatmentarea0, organization1) - if err != nil { - return err - } - - historyTreatmentarea0.R.Organization = organization1 - - organization1.R.HistoryTreatmentareas = append(organization1.R.HistoryTreatmentareas, historyTreatmentarea0) - - return nil -} - -func (historyTreatmentarea0 *HistoryTreatmentarea) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryTreatmentareaOrganization0(ctx, exec, 1, historyTreatmentarea0, organization1) - if err != nil { - return err - } - - historyTreatmentarea0.R.Organization = organization1 - - organization1.R.HistoryTreatmentareas = append(organization1.R.HistoryTreatmentareas, historyTreatmentarea0) - - return nil -} - -type historyTreatmentareaWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Comments psql.WhereNullMod[Q, string] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Notified psql.WhereNullMod[Q, int16] - Objectid psql.WhereMod[Q, int32] - SessionID psql.WhereNullMod[Q, string] - ShapeArea psql.WhereNullMod[Q, float64] - ShapeLength psql.WhereNullMod[Q, float64] - Treatdate psql.WhereNullMod[Q, int64] - TreatID psql.WhereNullMod[Q, string] - Type psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyTreatmentareaWhere[Q]) AliasedAs(alias string) historyTreatmentareaWhere[Q] { - return buildHistoryTreatmentareaWhere[Q](buildHistoryTreatmentareaColumns(alias)) -} - -func buildHistoryTreatmentareaWhere[Q psql.Filterable](cols historyTreatmentareaColumns) historyTreatmentareaWhere[Q] { - return historyTreatmentareaWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Comments: psql.WhereNull[Q, string](cols.Comments), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - 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), - Notified: psql.WhereNull[Q, int16](cols.Notified), - Objectid: psql.Where[Q, int32](cols.Objectid), - SessionID: psql.WhereNull[Q, string](cols.SessionID), - ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), - ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), - Treatdate: psql.WhereNull[Q, int64](cols.Treatdate), - TreatID: psql.WhereNull[Q, string](cols.TreatID), - Type: psql.WhereNull[Q, string](cols.Type), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryTreatmentarea) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyTreatmentarea cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryTreatmentareas = HistoryTreatmentareaSlice{o} - } - return nil - default: - return fmt.Errorf("historyTreatmentarea has no relationship %q", name) - } -} - -type historyTreatmentareaPreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryTreatmentareaPreloader() historyTreatmentareaPreloader { - return historyTreatmentareaPreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryTreatmentareas, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyTreatmentareaThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryTreatmentareaThenLoader[Q orm.Loadable]() historyTreatmentareaThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyTreatmentareaThenLoader[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 historyTreatmentarea's Organization into the .R struct -func (o *HistoryTreatmentarea) 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.HistoryTreatmentareas = HistoryTreatmentareaSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyTreatmentarea's Organization into the .R struct -func (os HistoryTreatmentareaSlice) 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.HistoryTreatmentareas = append(rel.R.HistoryTreatmentareas, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyTreatmentareaJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyTreatmentareaJoins[Q]) aliasedAs(alias string) historyTreatmentareaJoins[Q] { - return buildHistoryTreatmentareaJoins[Q](buildHistoryTreatmentareaColumns(alias), j.typ) -} - -func buildHistoryTreatmentareaJoins[Q dialect.Joinable](cols historyTreatmentareaColumns, typ string) historyTreatmentareaJoins[Q] { - return historyTreatmentareaJoins[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/db/models/history_zones.bob.go b/db/models/history_zones.bob.go deleted file mode 100644 index 3f407719..00000000 --- a/db/models/history_zones.bob.go +++ /dev/null @@ -1,1040 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryZone is an object representing the database table. -type HistoryZone struct { - OrganizationID int32 `db:"organization_id" ` - Active null.Val[int64] `db:"active" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Name null.Val[string] `db:"name" ` - Objectid int32 `db:"objectid,pk" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historyZoneR `db:"-" ` -} - -// HistoryZoneSlice is an alias for a slice of pointers to HistoryZone. -// This should almost always be used instead of []*HistoryZone. -type HistoryZoneSlice []*HistoryZone - -// HistoryZones contains methods to work with the history_zones table -var HistoryZones = psql.NewTablex[*HistoryZone, HistoryZoneSlice, *HistoryZoneSetter]("", "history_zones", buildHistoryZoneColumns("history_zones")) - -// HistoryZonesQuery is a query on the history_zones table -type HistoryZonesQuery = *psql.ViewQuery[*HistoryZone, HistoryZoneSlice] - -// historyZoneR is where relationships are stored. -type historyZoneR struct { - Organization *Organization // history_zones.history_zones_organization_id_fkey -} - -func buildHistoryZoneColumns(alias string) historyZoneColumns { - return historyZoneColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "active", "creationdate", "creator", "editdate", "editor", "globalid", "name", "objectid", "shape__area", "shape__length", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", - ).WithParent("history_zones"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Active: psql.Quote(alias, "active"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Name: psql.Quote(alias, "name"), - Objectid: psql.Quote(alias, "objectid"), - ShapeArea: psql.Quote(alias, "shape__area"), - ShapeLength: psql.Quote(alias, "shape__length"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Version: psql.Quote(alias, "version"), - } -} - -type historyZoneColumns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Active psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Name psql.Expression - Objectid psql.Expression - ShapeArea psql.Expression - ShapeLength psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Version psql.Expression -} - -func (c historyZoneColumns) Alias() string { - return c.tableAlias -} - -func (historyZoneColumns) AliasedAs(alias string) historyZoneColumns { - return buildHistoryZoneColumns(alias) -} - -// HistoryZoneSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryZoneSetter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Active omitnull.Val[int64] `db:"active" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Name omitnull.Val[string] `db:"name" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryZoneSetter) SetColumns() []string { - vals := make([]string, 0, 19) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Active.IsUnset() { - vals = append(vals, "active") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.ShapeArea.IsUnset() { - vals = append(vals, "shape__area") - } - if !s.ShapeLength.IsUnset() { - vals = append(vals, "shape__length") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryZoneSetter) Overwrite(t *HistoryZone) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Active.IsUnset() { - t.Active = s.Active.MustGetNull() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.ShapeArea.IsUnset() { - t.ShapeArea = s.ShapeArea.MustGetNull() - } - if !s.ShapeLength.IsUnset() { - t.ShapeLength = s.ShapeLength.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryZoneSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryZones.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 19) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Active.IsUnset() { - vals[1] = psql.Arg(s.Active.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[2] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[3] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[4] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[5] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[6] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[7] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[8] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.ShapeArea.IsUnset() { - vals[9] = psql.Arg(s.ShapeArea.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.ShapeLength.IsUnset() { - vals[10] = psql.Arg(s.ShapeLength.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[11] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[12] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[13] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[14] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[15] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[16] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[17] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[18] = psql.Arg(s.Version.MustGet()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryZoneSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryZoneSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 19) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Active.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "active")...), - psql.Arg(s.Active), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.ShapeArea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__area")...), - psql.Arg(s.ShapeArea), - }}) - } - - if !s.ShapeLength.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__length")...), - psql.Arg(s.ShapeLength), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryZone retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryZone(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryZone, error) { - if len(cols) == 0 { - return HistoryZones.Query( - sm.Where(HistoryZones.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryZones.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryZones.Query( - sm.Where(HistoryZones.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryZones.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryZones.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryZoneExists checks the presence of a single record by primary key -func HistoryZoneExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryZones.Query( - sm.Where(HistoryZones.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryZones.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryZone is retrieved from the database -func (o *HistoryZone) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryZones.AfterSelectHooks.RunHooks(ctx, exec, HistoryZoneSlice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryZones.AfterInsertHooks.RunHooks(ctx, exec, HistoryZoneSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryZones.AfterUpdateHooks.RunHooks(ctx, exec, HistoryZoneSlice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryZones.AfterDeleteHooks.RunHooks(ctx, exec, HistoryZoneSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryZone -func (o *HistoryZone) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryZone) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_zones", "objectid"), psql.Quote("history_zones", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryZone -func (o *HistoryZone) Update(ctx context.Context, exec bob.Executor, s *HistoryZoneSetter) error { - v, err := HistoryZones.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 HistoryZone record with an executor -func (o *HistoryZone) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryZones.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryZone using the executor -func (o *HistoryZone) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryZones.Query( - sm.Where(HistoryZones.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryZones.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryZoneSlice is retrieved from the database -func (o HistoryZoneSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryZones.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryZones.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryZones.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryZones.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryZoneSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_zones", "objectid"), psql.Quote("history_zones", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryZoneSlice) copyMatchingRows(from ...*HistoryZone) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryZoneSlice) 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 HistoryZones.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 *HistoryZone: - o.copyMatchingRows(retrieved) - case []*HistoryZone: - o.copyMatchingRows(retrieved...) - case HistoryZoneSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryZone or a slice of HistoryZone - // then run the AfterUpdateHooks on the slice - _, err = HistoryZones.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryZoneSlice) 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 HistoryZones.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 *HistoryZone: - o.copyMatchingRows(retrieved) - case []*HistoryZone: - o.copyMatchingRows(retrieved...) - case HistoryZoneSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryZone or a slice of HistoryZone - // then run the AfterDeleteHooks on the slice - _, err = HistoryZones.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryZoneSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryZoneSetter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryZones.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryZoneSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryZones.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryZoneSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryZones.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 *HistoryZone) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryZoneSlice) 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 attachHistoryZoneOrganization0(ctx context.Context, exec bob.Executor, count int, historyZone0 *HistoryZone, organization1 *Organization) (*HistoryZone, error) { - setter := &HistoryZoneSetter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyZone0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryZoneOrganization0: %w", err) - } - - return historyZone0, nil -} - -func (historyZone0 *HistoryZone) 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 = attachHistoryZoneOrganization0(ctx, exec, 1, historyZone0, organization1) - if err != nil { - return err - } - - historyZone0.R.Organization = organization1 - - organization1.R.HistoryZones = append(organization1.R.HistoryZones, historyZone0) - - return nil -} - -func (historyZone0 *HistoryZone) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryZoneOrganization0(ctx, exec, 1, historyZone0, organization1) - if err != nil { - return err - } - - historyZone0.R.Organization = organization1 - - organization1.R.HistoryZones = append(organization1.R.HistoryZones, historyZone0) - - return nil -} - -type historyZoneWhere[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Active psql.WhereNullMod[Q, int64] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Name psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - ShapeArea psql.WhereNullMod[Q, float64] - ShapeLength psql.WhereNullMod[Q, float64] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyZoneWhere[Q]) AliasedAs(alias string) historyZoneWhere[Q] { - return buildHistoryZoneWhere[Q](buildHistoryZoneColumns(alias)) -} - -func buildHistoryZoneWhere[Q psql.Filterable](cols historyZoneColumns) historyZoneWhere[Q] { - return historyZoneWhere[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Active: psql.WhereNull[Q, int64](cols.Active), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - 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), - Name: psql.WhereNull[Q, string](cols.Name), - Objectid: psql.Where[Q, int32](cols.Objectid), - ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), - ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryZone) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyZone cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryZones = HistoryZoneSlice{o} - } - return nil - default: - return fmt.Errorf("historyZone has no relationship %q", name) - } -} - -type historyZonePreloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryZonePreloader() historyZonePreloader { - return historyZonePreloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryZones, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyZoneThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryZoneThenLoader[Q orm.Loadable]() historyZoneThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyZoneThenLoader[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 historyZone's Organization into the .R struct -func (o *HistoryZone) 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.HistoryZones = HistoryZoneSlice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyZone's Organization into the .R struct -func (os HistoryZoneSlice) 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.HistoryZones = append(rel.R.HistoryZones, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyZoneJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyZoneJoins[Q]) aliasedAs(alias string) historyZoneJoins[Q] { - return buildHistoryZoneJoins[Q](buildHistoryZoneColumns(alias), j.typ) -} - -func buildHistoryZoneJoins[Q dialect.Joinable](cols historyZoneColumns, typ string) historyZoneJoins[Q] { - return historyZoneJoins[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/db/models/history_zones2.bob.go b/db/models/history_zones2.bob.go deleted file mode 100644 index fad9595a..00000000 --- a/db/models/history_zones2.bob.go +++ /dev/null @@ -1,1015 +0,0 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. 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" - "time" - - "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" - "github.com/stephenafamo/bob/mods" - "github.com/stephenafamo/bob/orm" - "github.com/stephenafamo/bob/types/pgtypes" -) - -// HistoryZones2 is an object representing the database table. -type HistoryZones2 struct { - OrganizationID int32 `db:"organization_id" ` - Creationdate null.Val[int64] `db:"creationdate" ` - Creator null.Val[string] `db:"creator" ` - Editdate null.Val[int64] `db:"editdate" ` - Editor null.Val[string] `db:"editor" ` - Globalid null.Val[string] `db:"globalid" ` - Name null.Val[string] `db:"name" ` - Objectid int32 `db:"objectid,pk" ` - ShapeArea null.Val[float64] `db:"shape__area" ` - ShapeLength null.Val[float64] `db:"shape__length" ` - Created null.Val[time.Time] `db:"created" ` - 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" ` - Version int32 `db:"version,pk" ` - - R historyZones2R `db:"-" ` -} - -// HistoryZones2Slice is an alias for a slice of pointers to HistoryZones2. -// This should almost always be used instead of []*HistoryZones2. -type HistoryZones2Slice []*HistoryZones2 - -// HistoryZones2s contains methods to work with the history_zones2 table -var HistoryZones2s = psql.NewTablex[*HistoryZones2, HistoryZones2Slice, *HistoryZones2Setter]("", "history_zones2", buildHistoryZones2Columns("history_zones2")) - -// HistoryZones2sQuery is a query on the history_zones2 table -type HistoryZones2sQuery = *psql.ViewQuery[*HistoryZones2, HistoryZones2Slice] - -// historyZones2R is where relationships are stored. -type historyZones2R struct { - Organization *Organization // history_zones2.history_zones2_organization_id_fkey -} - -func buildHistoryZones2Columns(alias string) historyZones2Columns { - return historyZones2Columns{ - ColumnsExpr: expr.NewColumnsExpr( - "organization_id", "creationdate", "creator", "editdate", "editor", "globalid", "name", "objectid", "shape__area", "shape__length", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version", - ).WithParent("history_zones2"), - tableAlias: alias, - OrganizationID: psql.Quote(alias, "organization_id"), - Creationdate: psql.Quote(alias, "creationdate"), - Creator: psql.Quote(alias, "creator"), - Editdate: psql.Quote(alias, "editdate"), - Editor: psql.Quote(alias, "editor"), - Globalid: psql.Quote(alias, "globalid"), - Name: psql.Quote(alias, "name"), - Objectid: psql.Quote(alias, "objectid"), - ShapeArea: psql.Quote(alias, "shape__area"), - ShapeLength: psql.Quote(alias, "shape__length"), - Created: psql.Quote(alias, "created"), - CreatedDate: psql.Quote(alias, "created_date"), - CreatedUser: psql.Quote(alias, "created_user"), - GeometryX: psql.Quote(alias, "geometry_x"), - GeometryY: psql.Quote(alias, "geometry_y"), - LastEditedDate: psql.Quote(alias, "last_edited_date"), - LastEditedUser: psql.Quote(alias, "last_edited_user"), - Version: psql.Quote(alias, "version"), - } -} - -type historyZones2Columns struct { - expr.ColumnsExpr - tableAlias string - OrganizationID psql.Expression - Creationdate psql.Expression - Creator psql.Expression - Editdate psql.Expression - Editor psql.Expression - Globalid psql.Expression - Name psql.Expression - Objectid psql.Expression - ShapeArea psql.Expression - ShapeLength psql.Expression - Created psql.Expression - CreatedDate psql.Expression - CreatedUser psql.Expression - GeometryX psql.Expression - GeometryY psql.Expression - LastEditedDate psql.Expression - LastEditedUser psql.Expression - Version psql.Expression -} - -func (c historyZones2Columns) Alias() string { - return c.tableAlias -} - -func (historyZones2Columns) AliasedAs(alias string) historyZones2Columns { - return buildHistoryZones2Columns(alias) -} - -// HistoryZones2Setter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type HistoryZones2Setter struct { - OrganizationID omit.Val[int32] `db:"organization_id" ` - Creationdate omitnull.Val[int64] `db:"creationdate" ` - Creator omitnull.Val[string] `db:"creator" ` - Editdate omitnull.Val[int64] `db:"editdate" ` - Editor omitnull.Val[string] `db:"editor" ` - Globalid omitnull.Val[string] `db:"globalid" ` - Name omitnull.Val[string] `db:"name" ` - Objectid omit.Val[int32] `db:"objectid,pk" ` - ShapeArea omitnull.Val[float64] `db:"shape__area" ` - ShapeLength omitnull.Val[float64] `db:"shape__length" ` - Created omitnull.Val[time.Time] `db:"created" ` - 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" ` - Version omit.Val[int32] `db:"version,pk" ` -} - -func (s HistoryZones2Setter) SetColumns() []string { - vals := make([]string, 0, 18) - if s.OrganizationID.IsValue() { - vals = append(vals, "organization_id") - } - if !s.Creationdate.IsUnset() { - vals = append(vals, "creationdate") - } - if !s.Creator.IsUnset() { - vals = append(vals, "creator") - } - if !s.Editdate.IsUnset() { - vals = append(vals, "editdate") - } - if !s.Editor.IsUnset() { - vals = append(vals, "editor") - } - if !s.Globalid.IsUnset() { - vals = append(vals, "globalid") - } - if !s.Name.IsUnset() { - vals = append(vals, "name") - } - if s.Objectid.IsValue() { - vals = append(vals, "objectid") - } - if !s.ShapeArea.IsUnset() { - vals = append(vals, "shape__area") - } - if !s.ShapeLength.IsUnset() { - vals = append(vals, "shape__length") - } - if !s.Created.IsUnset() { - vals = append(vals, "created") - } - if !s.CreatedDate.IsUnset() { - vals = append(vals, "created_date") - } - if !s.CreatedUser.IsUnset() { - vals = append(vals, "created_user") - } - if !s.GeometryX.IsUnset() { - vals = append(vals, "geometry_x") - } - if !s.GeometryY.IsUnset() { - vals = append(vals, "geometry_y") - } - if !s.LastEditedDate.IsUnset() { - vals = append(vals, "last_edited_date") - } - if !s.LastEditedUser.IsUnset() { - vals = append(vals, "last_edited_user") - } - if s.Version.IsValue() { - vals = append(vals, "version") - } - return vals -} - -func (s HistoryZones2Setter) Overwrite(t *HistoryZones2) { - if s.OrganizationID.IsValue() { - t.OrganizationID = s.OrganizationID.MustGet() - } - if !s.Creationdate.IsUnset() { - t.Creationdate = s.Creationdate.MustGetNull() - } - if !s.Creator.IsUnset() { - t.Creator = s.Creator.MustGetNull() - } - if !s.Editdate.IsUnset() { - t.Editdate = s.Editdate.MustGetNull() - } - if !s.Editor.IsUnset() { - t.Editor = s.Editor.MustGetNull() - } - if !s.Globalid.IsUnset() { - t.Globalid = s.Globalid.MustGetNull() - } - if !s.Name.IsUnset() { - t.Name = s.Name.MustGetNull() - } - if s.Objectid.IsValue() { - t.Objectid = s.Objectid.MustGet() - } - if !s.ShapeArea.IsUnset() { - t.ShapeArea = s.ShapeArea.MustGetNull() - } - if !s.ShapeLength.IsUnset() { - t.ShapeLength = s.ShapeLength.MustGetNull() - } - if !s.Created.IsUnset() { - t.Created = s.Created.MustGetNull() - } - if !s.CreatedDate.IsUnset() { - t.CreatedDate = s.CreatedDate.MustGetNull() - } - if !s.CreatedUser.IsUnset() { - t.CreatedUser = s.CreatedUser.MustGetNull() - } - if !s.GeometryX.IsUnset() { - t.GeometryX = s.GeometryX.MustGetNull() - } - if !s.GeometryY.IsUnset() { - t.GeometryY = s.GeometryY.MustGetNull() - } - if !s.LastEditedDate.IsUnset() { - t.LastEditedDate = s.LastEditedDate.MustGetNull() - } - if !s.LastEditedUser.IsUnset() { - t.LastEditedUser = s.LastEditedUser.MustGetNull() - } - if s.Version.IsValue() { - t.Version = s.Version.MustGet() - } -} - -func (s *HistoryZones2Setter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return HistoryZones2s.BeforeInsertHooks.RunHooks(ctx, exec, s) - }) - - q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - vals := make([]bob.Expression, 18) - if s.OrganizationID.IsValue() { - vals[0] = psql.Arg(s.OrganizationID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if !s.Creationdate.IsUnset() { - vals[1] = psql.Arg(s.Creationdate.MustGetNull()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - if !s.Creator.IsUnset() { - vals[2] = psql.Arg(s.Creator.MustGetNull()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if !s.Editdate.IsUnset() { - vals[3] = psql.Arg(s.Editdate.MustGetNull()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if !s.Editor.IsUnset() { - vals[4] = psql.Arg(s.Editor.MustGetNull()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if !s.Globalid.IsUnset() { - vals[5] = psql.Arg(s.Globalid.MustGetNull()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Name.IsUnset() { - vals[6] = psql.Arg(s.Name.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - if s.Objectid.IsValue() { - vals[7] = psql.Arg(s.Objectid.MustGet()) - } else { - vals[7] = psql.Raw("DEFAULT") - } - - if !s.ShapeArea.IsUnset() { - vals[8] = psql.Arg(s.ShapeArea.MustGetNull()) - } else { - vals[8] = psql.Raw("DEFAULT") - } - - if !s.ShapeLength.IsUnset() { - vals[9] = psql.Arg(s.ShapeLength.MustGetNull()) - } else { - vals[9] = psql.Raw("DEFAULT") - } - - if !s.Created.IsUnset() { - vals[10] = psql.Arg(s.Created.MustGetNull()) - } else { - vals[10] = psql.Raw("DEFAULT") - } - - if !s.CreatedDate.IsUnset() { - vals[11] = psql.Arg(s.CreatedDate.MustGetNull()) - } else { - vals[11] = psql.Raw("DEFAULT") - } - - if !s.CreatedUser.IsUnset() { - vals[12] = psql.Arg(s.CreatedUser.MustGetNull()) - } else { - vals[12] = psql.Raw("DEFAULT") - } - - if !s.GeometryX.IsUnset() { - vals[13] = psql.Arg(s.GeometryX.MustGetNull()) - } else { - vals[13] = psql.Raw("DEFAULT") - } - - if !s.GeometryY.IsUnset() { - vals[14] = psql.Arg(s.GeometryY.MustGetNull()) - } else { - vals[14] = psql.Raw("DEFAULT") - } - - if !s.LastEditedDate.IsUnset() { - vals[15] = psql.Arg(s.LastEditedDate.MustGetNull()) - } else { - vals[15] = psql.Raw("DEFAULT") - } - - if !s.LastEditedUser.IsUnset() { - vals[16] = psql.Arg(s.LastEditedUser.MustGetNull()) - } else { - vals[16] = psql.Raw("DEFAULT") - } - - if s.Version.IsValue() { - vals[17] = psql.Arg(s.Version.MustGet()) - } else { - vals[17] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s HistoryZones2Setter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s HistoryZones2Setter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 18) - - if s.OrganizationID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "organization_id")...), - psql.Arg(s.OrganizationID), - }}) - } - - if !s.Creationdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creationdate")...), - psql.Arg(s.Creationdate), - }}) - } - - if !s.Creator.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "creator")...), - psql.Arg(s.Creator), - }}) - } - - if !s.Editdate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editdate")...), - psql.Arg(s.Editdate), - }}) - } - - if !s.Editor.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "editor")...), - psql.Arg(s.Editor), - }}) - } - - if !s.Globalid.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "globalid")...), - psql.Arg(s.Globalid), - }}) - } - - if !s.Name.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "name")...), - psql.Arg(s.Name), - }}) - } - - if s.Objectid.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "objectid")...), - psql.Arg(s.Objectid), - }}) - } - - if !s.ShapeArea.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__area")...), - psql.Arg(s.ShapeArea), - }}) - } - - if !s.ShapeLength.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "shape__length")...), - psql.Arg(s.ShapeLength), - }}) - } - - if !s.Created.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created")...), - psql.Arg(s.Created), - }}) - } - - if !s.CreatedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_date")...), - psql.Arg(s.CreatedDate), - }}) - } - - if !s.CreatedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "created_user")...), - psql.Arg(s.CreatedUser), - }}) - } - - if !s.GeometryX.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_x")...), - psql.Arg(s.GeometryX), - }}) - } - - if !s.GeometryY.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry_y")...), - psql.Arg(s.GeometryY), - }}) - } - - if !s.LastEditedDate.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_date")...), - psql.Arg(s.LastEditedDate), - }}) - } - - if !s.LastEditedUser.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "last_edited_user")...), - psql.Arg(s.LastEditedUser), - }}) - } - - if s.Version.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "version")...), - psql.Arg(s.Version), - }}) - } - - return exprs -} - -// FindHistoryZones2 retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindHistoryZones2(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryZones2, error) { - if len(cols) == 0 { - return HistoryZones2s.Query( - sm.Where(HistoryZones2s.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryZones2s.Columns.Version.EQ(psql.Arg(VersionPK))), - ).One(ctx, exec) - } - - return HistoryZones2s.Query( - sm.Where(HistoryZones2s.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryZones2s.Columns.Version.EQ(psql.Arg(VersionPK))), - sm.Columns(HistoryZones2s.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// HistoryZones2Exists checks the presence of a single record by primary key -func HistoryZones2Exists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) { - return HistoryZones2s.Query( - sm.Where(HistoryZones2s.Columns.Objectid.EQ(psql.Arg(ObjectidPK))), - sm.Where(HistoryZones2s.Columns.Version.EQ(psql.Arg(VersionPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after HistoryZones2 is retrieved from the database -func (o *HistoryZones2) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryZones2s.AfterSelectHooks.RunHooks(ctx, exec, HistoryZones2Slice{o}) - case bob.QueryTypeInsert: - ctx, err = HistoryZones2s.AfterInsertHooks.RunHooks(ctx, exec, HistoryZones2Slice{o}) - case bob.QueryTypeUpdate: - ctx, err = HistoryZones2s.AfterUpdateHooks.RunHooks(ctx, exec, HistoryZones2Slice{o}) - case bob.QueryTypeDelete: - ctx, err = HistoryZones2s.AfterDeleteHooks.RunHooks(ctx, exec, HistoryZones2Slice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the HistoryZones2 -func (o *HistoryZones2) primaryKeyVals() bob.Expression { - return psql.ArgGroup( - o.Objectid, - o.Version, - ) -} - -func (o *HistoryZones2) pkEQ() dialect.Expression { - return psql.Group(psql.Quote("history_zones2", "objectid"), psql.Quote("history_zones2", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - return o.primaryKeyVals().WriteSQL(ctx, w, d, start) - })) -} - -// Update uses an executor to update the HistoryZones2 -func (o *HistoryZones2) Update(ctx context.Context, exec bob.Executor, s *HistoryZones2Setter) error { - v, err := HistoryZones2s.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 HistoryZones2 record with an executor -func (o *HistoryZones2) Delete(ctx context.Context, exec bob.Executor) error { - _, err := HistoryZones2s.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the HistoryZones2 using the executor -func (o *HistoryZones2) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := HistoryZones2s.Query( - sm.Where(HistoryZones2s.Columns.Objectid.EQ(psql.Arg(o.Objectid))), - sm.Where(HistoryZones2s.Columns.Version.EQ(psql.Arg(o.Version))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after HistoryZones2Slice is retrieved from the database -func (o HistoryZones2Slice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = HistoryZones2s.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = HistoryZones2s.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = HistoryZones2s.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = HistoryZones2s.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o HistoryZones2Slice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Group(psql.Quote("history_zones2", "objectid"), psql.Quote("history_zones2", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 HistoryZones2Slice) copyMatchingRows(from ...*HistoryZones2) { - for i, old := range o { - for _, new := range from { - if new.Objectid != old.Objectid { - continue - } - if new.Version != old.Version { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o HistoryZones2Slice) 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 HistoryZones2s.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 *HistoryZones2: - o.copyMatchingRows(retrieved) - case []*HistoryZones2: - o.copyMatchingRows(retrieved...) - case HistoryZones2Slice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryZones2 or a slice of HistoryZones2 - // then run the AfterUpdateHooks on the slice - _, err = HistoryZones2s.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o HistoryZones2Slice) 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 HistoryZones2s.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 *HistoryZones2: - o.copyMatchingRows(retrieved) - case []*HistoryZones2: - o.copyMatchingRows(retrieved...) - case HistoryZones2Slice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a HistoryZones2 or a slice of HistoryZones2 - // then run the AfterDeleteHooks on the slice - _, err = HistoryZones2s.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o HistoryZones2Slice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryZones2Setter) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryZones2s.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o HistoryZones2Slice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := HistoryZones2s.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o HistoryZones2Slice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := HistoryZones2s.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 *HistoryZones2) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { - return Organizations.Query(append(mods, - sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), - )...) -} - -func (os HistoryZones2Slice) 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 attachHistoryZones2Organization0(ctx context.Context, exec bob.Executor, count int, historyZones20 *HistoryZones2, organization1 *Organization) (*HistoryZones2, error) { - setter := &HistoryZones2Setter{ - OrganizationID: omit.From(organization1.ID), - } - - err := historyZones20.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachHistoryZones2Organization0: %w", err) - } - - return historyZones20, nil -} - -func (historyZones20 *HistoryZones2) 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 = attachHistoryZones2Organization0(ctx, exec, 1, historyZones20, organization1) - if err != nil { - return err - } - - historyZones20.R.Organization = organization1 - - organization1.R.HistoryZones2s = append(organization1.R.HistoryZones2s, historyZones20) - - return nil -} - -func (historyZones20 *HistoryZones2) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { - var err error - - _, err = attachHistoryZones2Organization0(ctx, exec, 1, historyZones20, organization1) - if err != nil { - return err - } - - historyZones20.R.Organization = organization1 - - organization1.R.HistoryZones2s = append(organization1.R.HistoryZones2s, historyZones20) - - return nil -} - -type historyZones2Where[Q psql.Filterable] struct { - OrganizationID psql.WhereMod[Q, int32] - Creationdate psql.WhereNullMod[Q, int64] - Creator psql.WhereNullMod[Q, string] - Editdate psql.WhereNullMod[Q, int64] - Editor psql.WhereNullMod[Q, string] - Globalid psql.WhereNullMod[Q, string] - Name psql.WhereNullMod[Q, string] - Objectid psql.WhereMod[Q, int32] - ShapeArea psql.WhereNullMod[Q, float64] - ShapeLength psql.WhereNullMod[Q, float64] - Created psql.WhereNullMod[Q, time.Time] - CreatedDate psql.WhereNullMod[Q, int64] - CreatedUser psql.WhereNullMod[Q, string] - GeometryX psql.WhereNullMod[Q, float64] - GeometryY psql.WhereNullMod[Q, float64] - LastEditedDate psql.WhereNullMod[Q, int64] - LastEditedUser psql.WhereNullMod[Q, string] - Version psql.WhereMod[Q, int32] -} - -func (historyZones2Where[Q]) AliasedAs(alias string) historyZones2Where[Q] { - return buildHistoryZones2Where[Q](buildHistoryZones2Columns(alias)) -} - -func buildHistoryZones2Where[Q psql.Filterable](cols historyZones2Columns) historyZones2Where[Q] { - return historyZones2Where[Q]{ - OrganizationID: psql.Where[Q, int32](cols.OrganizationID), - Creationdate: psql.WhereNull[Q, int64](cols.Creationdate), - 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), - Name: psql.WhereNull[Q, string](cols.Name), - Objectid: psql.Where[Q, int32](cols.Objectid), - ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea), - ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength), - Created: psql.WhereNull[Q, time.Time](cols.Created), - 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), - LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate), - LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser), - Version: psql.Where[Q, int32](cols.Version), - } -} - -func (o *HistoryZones2) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Organization": - rel, ok := retrieved.(*Organization) - if !ok { - return fmt.Errorf("historyZones2 cannot load %T as %q", retrieved, name) - } - - o.R.Organization = rel - - if rel != nil { - rel.R.HistoryZones2s = HistoryZones2Slice{o} - } - return nil - default: - return fmt.Errorf("historyZones2 has no relationship %q", name) - } -} - -type historyZones2Preloader struct { - Organization func(...psql.PreloadOption) psql.Preloader -} - -func buildHistoryZones2Preloader() historyZones2Preloader { - return historyZones2Preloader{ - Organization: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ - Name: "Organization", - Sides: []psql.PreloadSide{ - { - From: HistoryZones2s, - To: Organizations, - FromColumns: []string{"organization_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Organizations.Columns.Names(), opts...) - }, - } -} - -type historyZones2ThenLoader[Q orm.Loadable] struct { - Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildHistoryZones2ThenLoader[Q orm.Loadable]() historyZones2ThenLoader[Q] { - type OrganizationLoadInterface interface { - LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return historyZones2ThenLoader[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 historyZones2's Organization into the .R struct -func (o *HistoryZones2) 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.HistoryZones2s = HistoryZones2Slice{o} - - o.R.Organization = related - return nil -} - -// LoadOrganization loads the historyZones2's Organization into the .R struct -func (os HistoryZones2Slice) 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.HistoryZones2s = append(rel.R.HistoryZones2s, o) - - o.R.Organization = rel - break - } - } - - return nil -} - -type historyZones2Joins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j historyZones2Joins[Q]) aliasedAs(alias string) historyZones2Joins[Q] { - return buildHistoryZones2Joins[Q](buildHistoryZones2Columns(alias), j.typ) -} - -func buildHistoryZones2Joins[Q dialect.Joinable](cols historyZones2Columns, typ string) historyZones2Joins[Q] { - return historyZones2Joins[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/db/models/note_audio.bob.go b/db/models/note_audio.bob.go new file mode 100644 index 00000000..25f21d5e --- /dev/null +++ b/db/models/note_audio.bob.go @@ -0,0 +1,1577 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package models + +import ( + "context" + "fmt" + "io" + "time" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/google/uuid" + "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" +) + +// NoteAudio is an object representing the database table. +type NoteAudio struct { + Created time.Time `db:"created" ` + CreatorID int32 `db:"creator_id" ` + Deleted null.Val[time.Time] `db:"deleted" ` + DeletorID null.Val[int32] `db:"deletor_id" ` + Duration float32 `db:"duration" ` + OrganizationID int32 `db:"organization_id" ` + Transcription null.Val[string] `db:"transcription" ` + TranscriptionUserEdited bool `db:"transcription_user_edited" ` + Version int32 `db:"version,pk" ` + UUID uuid.UUID `db:"uuid,pk" ` + + R noteAudioR `db:"-" ` +} + +// NoteAudioSlice is an alias for a slice of pointers to NoteAudio. +// This should almost always be used instead of []*NoteAudio. +type NoteAudioSlice []*NoteAudio + +// NoteAudios contains methods to work with the note_audio table +var NoteAudios = psql.NewTablex[*NoteAudio, NoteAudioSlice, *NoteAudioSetter]("", "note_audio", buildNoteAudioColumns("note_audio")) + +// NoteAudiosQuery is a query on the note_audio table +type NoteAudiosQuery = *psql.ViewQuery[*NoteAudio, NoteAudioSlice] + +// noteAudioR is where relationships are stored. +type noteAudioR struct { + CreatorUser *User // note_audio.note_audio_creator_id_fkey + DeletorUser *User // note_audio.note_audio_deletor_id_fkey + Organization *Organization // note_audio.note_audio_organization_id_fkey + NoteAudioBreadcrumbs NoteAudioBreadcrumbSlice // note_audio_breadcrumb.note_audio_breadcrumb_note_audio_version_note_audio_uuid_fkey + NoteAudioData NoteAudioDatumSlice // note_audio_data.note_audio_data_note_audio_version_note_audio_uuid_fkey +} + +func buildNoteAudioColumns(alias string) noteAudioColumns { + return noteAudioColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "created", "creator_id", "deleted", "deletor_id", "duration", "organization_id", "transcription", "transcription_user_edited", "version", "uuid", + ).WithParent("note_audio"), + tableAlias: alias, + Created: psql.Quote(alias, "created"), + CreatorID: psql.Quote(alias, "creator_id"), + Deleted: psql.Quote(alias, "deleted"), + DeletorID: psql.Quote(alias, "deletor_id"), + Duration: psql.Quote(alias, "duration"), + OrganizationID: psql.Quote(alias, "organization_id"), + Transcription: psql.Quote(alias, "transcription"), + TranscriptionUserEdited: psql.Quote(alias, "transcription_user_edited"), + Version: psql.Quote(alias, "version"), + UUID: psql.Quote(alias, "uuid"), + } +} + +type noteAudioColumns struct { + expr.ColumnsExpr + tableAlias string + Created psql.Expression + CreatorID psql.Expression + Deleted psql.Expression + DeletorID psql.Expression + Duration psql.Expression + OrganizationID psql.Expression + Transcription psql.Expression + TranscriptionUserEdited psql.Expression + Version psql.Expression + UUID psql.Expression +} + +func (c noteAudioColumns) Alias() string { + return c.tableAlias +} + +func (noteAudioColumns) AliasedAs(alias string) noteAudioColumns { + return buildNoteAudioColumns(alias) +} + +// NoteAudioSetter is used for insert/upsert/update operations +// All values are optional, and do not have to be set +// Generated columns are not included +type NoteAudioSetter struct { + Created omit.Val[time.Time] `db:"created" ` + CreatorID omit.Val[int32] `db:"creator_id" ` + Deleted omitnull.Val[time.Time] `db:"deleted" ` + DeletorID omitnull.Val[int32] `db:"deletor_id" ` + Duration omit.Val[float32] `db:"duration" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Transcription omitnull.Val[string] `db:"transcription" ` + TranscriptionUserEdited omit.Val[bool] `db:"transcription_user_edited" ` + Version omit.Val[int32] `db:"version,pk" ` + UUID omit.Val[uuid.UUID] `db:"uuid,pk" ` +} + +func (s NoteAudioSetter) SetColumns() []string { + vals := make([]string, 0, 10) + if s.Created.IsValue() { + vals = append(vals, "created") + } + if s.CreatorID.IsValue() { + vals = append(vals, "creator_id") + } + if !s.Deleted.IsUnset() { + vals = append(vals, "deleted") + } + if !s.DeletorID.IsUnset() { + vals = append(vals, "deletor_id") + } + if s.Duration.IsValue() { + vals = append(vals, "duration") + } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } + if !s.Transcription.IsUnset() { + vals = append(vals, "transcription") + } + if s.TranscriptionUserEdited.IsValue() { + vals = append(vals, "transcription_user_edited") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + if s.UUID.IsValue() { + vals = append(vals, "uuid") + } + return vals +} + +func (s NoteAudioSetter) Overwrite(t *NoteAudio) { + if s.Created.IsValue() { + t.Created = s.Created.MustGet() + } + if s.CreatorID.IsValue() { + t.CreatorID = s.CreatorID.MustGet() + } + if !s.Deleted.IsUnset() { + t.Deleted = s.Deleted.MustGetNull() + } + if !s.DeletorID.IsUnset() { + t.DeletorID = s.DeletorID.MustGetNull() + } + if s.Duration.IsValue() { + t.Duration = s.Duration.MustGet() + } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } + if !s.Transcription.IsUnset() { + t.Transcription = s.Transcription.MustGetNull() + } + if s.TranscriptionUserEdited.IsValue() { + t.TranscriptionUserEdited = s.TranscriptionUserEdited.MustGet() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } + if s.UUID.IsValue() { + t.UUID = s.UUID.MustGet() + } +} + +func (s *NoteAudioSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return NoteAudios.BeforeInsertHooks.RunHooks(ctx, exec, s) + }) + + q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { + vals := make([]bob.Expression, 10) + if s.Created.IsValue() { + vals[0] = psql.Arg(s.Created.MustGet()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if s.CreatorID.IsValue() { + vals[1] = psql.Arg(s.CreatorID.MustGet()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Deleted.IsUnset() { + vals[2] = psql.Arg(s.Deleted.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.DeletorID.IsUnset() { + vals[3] = psql.Arg(s.DeletorID.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if s.Duration.IsValue() { + vals[4] = psql.Arg(s.Duration.MustGet()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[5] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Transcription.IsUnset() { + vals[6] = psql.Arg(s.Transcription.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + if s.TranscriptionUserEdited.IsValue() { + vals[7] = psql.Arg(s.TranscriptionUserEdited.MustGet()) + } else { + vals[7] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[8] = psql.Arg(s.Version.MustGet()) + } else { + vals[8] = psql.Raw("DEFAULT") + } + + if s.UUID.IsValue() { + vals[9] = psql.Arg(s.UUID.MustGet()) + } else { + vals[9] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s NoteAudioSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s NoteAudioSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 10) + + if s.Created.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + + if s.CreatorID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator_id")...), + psql.Arg(s.CreatorID), + }}) + } + + if !s.Deleted.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "deleted")...), + psql.Arg(s.Deleted), + }}) + } + + if !s.DeletorID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "deletor_id")...), + psql.Arg(s.DeletorID), + }}) + } + + if s.Duration.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "duration")...), + psql.Arg(s.Duration), + }}) + } + + if s.OrganizationID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if !s.Transcription.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "transcription")...), + psql.Arg(s.Transcription), + }}) + } + + if s.TranscriptionUserEdited.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "transcription_user_edited")...), + psql.Arg(s.TranscriptionUserEdited), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + if s.UUID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "uuid")...), + psql.Arg(s.UUID), + }}) + } + + return exprs +} + +// FindNoteAudio retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindNoteAudio(ctx context.Context, exec bob.Executor, VersionPK int32, UUIDPK uuid.UUID, cols ...string) (*NoteAudio, error) { + if len(cols) == 0 { + return NoteAudios.Query( + sm.Where(NoteAudios.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Where(NoteAudios.Columns.UUID.EQ(psql.Arg(UUIDPK))), + ).One(ctx, exec) + } + + return NoteAudios.Query( + sm.Where(NoteAudios.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Where(NoteAudios.Columns.UUID.EQ(psql.Arg(UUIDPK))), + sm.Columns(NoteAudios.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// NoteAudioExists checks the presence of a single record by primary key +func NoteAudioExists(ctx context.Context, exec bob.Executor, VersionPK int32, UUIDPK uuid.UUID) (bool, error) { + return NoteAudios.Query( + sm.Where(NoteAudios.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Where(NoteAudios.Columns.UUID.EQ(psql.Arg(UUIDPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after NoteAudio is retrieved from the database +func (o *NoteAudio) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = NoteAudios.AfterSelectHooks.RunHooks(ctx, exec, NoteAudioSlice{o}) + case bob.QueryTypeInsert: + ctx, err = NoteAudios.AfterInsertHooks.RunHooks(ctx, exec, NoteAudioSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = NoteAudios.AfterUpdateHooks.RunHooks(ctx, exec, NoteAudioSlice{o}) + case bob.QueryTypeDelete: + ctx, err = NoteAudios.AfterDeleteHooks.RunHooks(ctx, exec, NoteAudioSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the NoteAudio +func (o *NoteAudio) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Version, + o.UUID, + ) +} + +func (o *NoteAudio) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("note_audio", "version"), psql.Quote("note_audio", "uuid")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { + return o.primaryKeyVals().WriteSQL(ctx, w, d, start) + })) +} + +// Update uses an executor to update the NoteAudio +func (o *NoteAudio) Update(ctx context.Context, exec bob.Executor, s *NoteAudioSetter) error { + v, err := NoteAudios.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 NoteAudio record with an executor +func (o *NoteAudio) Delete(ctx context.Context, exec bob.Executor) error { + _, err := NoteAudios.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the NoteAudio using the executor +func (o *NoteAudio) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := NoteAudios.Query( + sm.Where(NoteAudios.Columns.Version.EQ(psql.Arg(o.Version))), + sm.Where(NoteAudios.Columns.UUID.EQ(psql.Arg(o.UUID))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after NoteAudioSlice is retrieved from the database +func (o NoteAudioSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = NoteAudios.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = NoteAudios.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = NoteAudios.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = NoteAudios.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o NoteAudioSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("note_audio", "version"), psql.Quote("note_audio", "uuid")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 NoteAudioSlice) copyMatchingRows(from ...*NoteAudio) { + for i, old := range o { + for _, new := range from { + if new.Version != old.Version { + continue + } + if new.UUID != old.UUID { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o NoteAudioSlice) 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 NoteAudios.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 *NoteAudio: + o.copyMatchingRows(retrieved) + case []*NoteAudio: + o.copyMatchingRows(retrieved...) + case NoteAudioSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a NoteAudio or a slice of NoteAudio + // then run the AfterUpdateHooks on the slice + _, err = NoteAudios.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o NoteAudioSlice) 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 NoteAudios.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 *NoteAudio: + o.copyMatchingRows(retrieved) + case []*NoteAudio: + o.copyMatchingRows(retrieved...) + case NoteAudioSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a NoteAudio or a slice of NoteAudio + // then run the AfterDeleteHooks on the slice + _, err = NoteAudios.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o NoteAudioSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals NoteAudioSetter) error { + if len(o) == 0 { + return nil + } + + _, err := NoteAudios.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o NoteAudioSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := NoteAudios.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o NoteAudioSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := NoteAudios.Query(sm.Where(o.pkIN())).All(ctx, exec) + if err != nil { + return err + } + + o.copyMatchingRows(o2...) + + return nil +} + +// CreatorUser starts a query for related objects on user_ +func (o *NoteAudio) CreatorUser(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery { + return Users.Query(append(mods, + sm.Where(Users.Columns.ID.EQ(psql.Arg(o.CreatorID))), + )...) +} + +func (os NoteAudioSlice) CreatorUser(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery { + pkCreatorID := make(pgtypes.Array[int32], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkCreatorID = append(pkCreatorID, o.CreatorID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkCreatorID), "integer[]")), + )) + + return Users.Query(append(mods, + sm.Where(psql.Group(Users.Columns.ID).OP("IN", PKArgExpr)), + )...) +} + +// DeletorUser starts a query for related objects on user_ +func (o *NoteAudio) DeletorUser(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery { + return Users.Query(append(mods, + sm.Where(Users.Columns.ID.EQ(psql.Arg(o.DeletorID))), + )...) +} + +func (os NoteAudioSlice) DeletorUser(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery { + pkDeletorID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkDeletorID = append(pkDeletorID, o.DeletorID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkDeletorID), "integer[]")), + )) + + return Users.Query(append(mods, + sm.Where(psql.Group(Users.Columns.ID).OP("IN", PKArgExpr)), + )...) +} + +// Organization starts a query for related objects on organization +func (o *NoteAudio) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os NoteAudioSlice) 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)), + )...) +} + +// NoteAudioBreadcrumbs starts a query for related objects on note_audio_breadcrumb +func (o *NoteAudio) NoteAudioBreadcrumbs(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudioBreadcrumbsQuery { + return NoteAudioBreadcrumbs.Query(append(mods, + sm.Where(NoteAudioBreadcrumbs.Columns.NoteAudioVersion.EQ(psql.Arg(o.Version))), sm.Where(NoteAudioBreadcrumbs.Columns.NoteAudioUUID.EQ(psql.Arg(o.UUID))), + )...) +} + +func (os NoteAudioSlice) NoteAudioBreadcrumbs(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudioBreadcrumbsQuery { + pkVersion := make(pgtypes.Array[int32], 0, len(os)) + + pkUUID := make(pgtypes.Array[uuid.UUID], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkVersion = append(pkVersion, o.Version) + pkUUID = append(pkUUID, o.UUID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkVersion), "integer[]")), + psql.F("unnest", psql.Cast(psql.Arg(pkUUID), "uuid[]")), + )) + + return NoteAudioBreadcrumbs.Query(append(mods, + sm.Where(psql.Group(NoteAudioBreadcrumbs.Columns.NoteAudioVersion, NoteAudioBreadcrumbs.Columns.NoteAudioUUID).OP("IN", PKArgExpr)), + )...) +} + +// NoteAudioData starts a query for related objects on note_audio_data +func (o *NoteAudio) NoteAudioData(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudioDataQuery { + return NoteAudioData.Query(append(mods, + sm.Where(NoteAudioData.Columns.NoteAudioVersion.EQ(psql.Arg(o.Version))), sm.Where(NoteAudioData.Columns.NoteAudioUUID.EQ(psql.Arg(o.UUID))), + )...) +} + +func (os NoteAudioSlice) NoteAudioData(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudioDataQuery { + pkVersion := make(pgtypes.Array[int32], 0, len(os)) + + pkUUID := make(pgtypes.Array[uuid.UUID], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkVersion = append(pkVersion, o.Version) + pkUUID = append(pkUUID, o.UUID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkVersion), "integer[]")), + psql.F("unnest", psql.Cast(psql.Arg(pkUUID), "uuid[]")), + )) + + return NoteAudioData.Query(append(mods, + sm.Where(psql.Group(NoteAudioData.Columns.NoteAudioVersion, NoteAudioData.Columns.NoteAudioUUID).OP("IN", PKArgExpr)), + )...) +} + +func attachNoteAudioCreatorUser0(ctx context.Context, exec bob.Executor, count int, noteAudio0 *NoteAudio, user1 *User) (*NoteAudio, error) { + setter := &NoteAudioSetter{ + CreatorID: omit.From(user1.ID), + } + + err := noteAudio0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachNoteAudioCreatorUser0: %w", err) + } + + return noteAudio0, nil +} + +func (noteAudio0 *NoteAudio) InsertCreatorUser(ctx context.Context, exec bob.Executor, related *UserSetter) error { + var err error + + user1, err := Users.Insert(related).One(ctx, exec) + if err != nil { + return fmt.Errorf("inserting related objects: %w", err) + } + + _, err = attachNoteAudioCreatorUser0(ctx, exec, 1, noteAudio0, user1) + if err != nil { + return err + } + + noteAudio0.R.CreatorUser = user1 + + user1.R.CreatorNoteAudios = append(user1.R.CreatorNoteAudios, noteAudio0) + + return nil +} + +func (noteAudio0 *NoteAudio) AttachCreatorUser(ctx context.Context, exec bob.Executor, user1 *User) error { + var err error + + _, err = attachNoteAudioCreatorUser0(ctx, exec, 1, noteAudio0, user1) + if err != nil { + return err + } + + noteAudio0.R.CreatorUser = user1 + + user1.R.CreatorNoteAudios = append(user1.R.CreatorNoteAudios, noteAudio0) + + return nil +} + +func attachNoteAudioDeletorUser0(ctx context.Context, exec bob.Executor, count int, noteAudio0 *NoteAudio, user1 *User) (*NoteAudio, error) { + setter := &NoteAudioSetter{ + DeletorID: omitnull.From(user1.ID), + } + + err := noteAudio0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachNoteAudioDeletorUser0: %w", err) + } + + return noteAudio0, nil +} + +func (noteAudio0 *NoteAudio) InsertDeletorUser(ctx context.Context, exec bob.Executor, related *UserSetter) error { + var err error + + user1, err := Users.Insert(related).One(ctx, exec) + if err != nil { + return fmt.Errorf("inserting related objects: %w", err) + } + + _, err = attachNoteAudioDeletorUser0(ctx, exec, 1, noteAudio0, user1) + if err != nil { + return err + } + + noteAudio0.R.DeletorUser = user1 + + user1.R.DeletorNoteAudios = append(user1.R.DeletorNoteAudios, noteAudio0) + + return nil +} + +func (noteAudio0 *NoteAudio) AttachDeletorUser(ctx context.Context, exec bob.Executor, user1 *User) error { + var err error + + _, err = attachNoteAudioDeletorUser0(ctx, exec, 1, noteAudio0, user1) + if err != nil { + return err + } + + noteAudio0.R.DeletorUser = user1 + + user1.R.DeletorNoteAudios = append(user1.R.DeletorNoteAudios, noteAudio0) + + return nil +} + +func attachNoteAudioOrganization0(ctx context.Context, exec bob.Executor, count int, noteAudio0 *NoteAudio, organization1 *Organization) (*NoteAudio, error) { + setter := &NoteAudioSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := noteAudio0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachNoteAudioOrganization0: %w", err) + } + + return noteAudio0, nil +} + +func (noteAudio0 *NoteAudio) 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 = attachNoteAudioOrganization0(ctx, exec, 1, noteAudio0, organization1) + if err != nil { + return err + } + + noteAudio0.R.Organization = organization1 + + organization1.R.NoteAudios = append(organization1.R.NoteAudios, noteAudio0) + + return nil +} + +func (noteAudio0 *NoteAudio) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachNoteAudioOrganization0(ctx, exec, 1, noteAudio0, organization1) + if err != nil { + return err + } + + noteAudio0.R.Organization = organization1 + + organization1.R.NoteAudios = append(organization1.R.NoteAudios, noteAudio0) + + return nil +} + +func insertNoteAudioNoteAudioBreadcrumbs0(ctx context.Context, exec bob.Executor, noteAudioBreadcrumbs1 []*NoteAudioBreadcrumbSetter, noteAudio0 *NoteAudio) (NoteAudioBreadcrumbSlice, error) { + for i := range noteAudioBreadcrumbs1 { + noteAudioBreadcrumbs1[i].NoteAudioVersion = omit.From(noteAudio0.Version) + noteAudioBreadcrumbs1[i].NoteAudioUUID = omit.From(noteAudio0.UUID) + } + + ret, err := NoteAudioBreadcrumbs.Insert(bob.ToMods(noteAudioBreadcrumbs1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertNoteAudioNoteAudioBreadcrumbs0: %w", err) + } + + return ret, nil +} + +func attachNoteAudioNoteAudioBreadcrumbs0(ctx context.Context, exec bob.Executor, count int, noteAudioBreadcrumbs1 NoteAudioBreadcrumbSlice, noteAudio0 *NoteAudio) (NoteAudioBreadcrumbSlice, error) { + setter := &NoteAudioBreadcrumbSetter{ + NoteAudioVersion: omit.From(noteAudio0.Version), + NoteAudioUUID: omit.From(noteAudio0.UUID), + } + + err := noteAudioBreadcrumbs1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachNoteAudioNoteAudioBreadcrumbs0: %w", err) + } + + return noteAudioBreadcrumbs1, nil +} + +func (noteAudio0 *NoteAudio) InsertNoteAudioBreadcrumbs(ctx context.Context, exec bob.Executor, related ...*NoteAudioBreadcrumbSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + noteAudioBreadcrumbs1, err := insertNoteAudioNoteAudioBreadcrumbs0(ctx, exec, related, noteAudio0) + if err != nil { + return err + } + + noteAudio0.R.NoteAudioBreadcrumbs = append(noteAudio0.R.NoteAudioBreadcrumbs, noteAudioBreadcrumbs1...) + + for _, rel := range noteAudioBreadcrumbs1 { + rel.R.NoteAudio = noteAudio0 + } + return nil +} + +func (noteAudio0 *NoteAudio) AttachNoteAudioBreadcrumbs(ctx context.Context, exec bob.Executor, related ...*NoteAudioBreadcrumb) error { + if len(related) == 0 { + return nil + } + + var err error + noteAudioBreadcrumbs1 := NoteAudioBreadcrumbSlice(related) + + _, err = attachNoteAudioNoteAudioBreadcrumbs0(ctx, exec, len(related), noteAudioBreadcrumbs1, noteAudio0) + if err != nil { + return err + } + + noteAudio0.R.NoteAudioBreadcrumbs = append(noteAudio0.R.NoteAudioBreadcrumbs, noteAudioBreadcrumbs1...) + + for _, rel := range related { + rel.R.NoteAudio = noteAudio0 + } + + return nil +} + +func insertNoteAudioNoteAudioData0(ctx context.Context, exec bob.Executor, noteAudioData1 []*NoteAudioDatumSetter, noteAudio0 *NoteAudio) (NoteAudioDatumSlice, error) { + for i := range noteAudioData1 { + noteAudioData1[i].NoteAudioVersion = omit.From(noteAudio0.Version) + noteAudioData1[i].NoteAudioUUID = omit.From(noteAudio0.UUID) + } + + ret, err := NoteAudioData.Insert(bob.ToMods(noteAudioData1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertNoteAudioNoteAudioData0: %w", err) + } + + return ret, nil +} + +func attachNoteAudioNoteAudioData0(ctx context.Context, exec bob.Executor, count int, noteAudioData1 NoteAudioDatumSlice, noteAudio0 *NoteAudio) (NoteAudioDatumSlice, error) { + setter := &NoteAudioDatumSetter{ + NoteAudioVersion: omit.From(noteAudio0.Version), + NoteAudioUUID: omit.From(noteAudio0.UUID), + } + + err := noteAudioData1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachNoteAudioNoteAudioData0: %w", err) + } + + return noteAudioData1, nil +} + +func (noteAudio0 *NoteAudio) InsertNoteAudioData(ctx context.Context, exec bob.Executor, related ...*NoteAudioDatumSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + noteAudioData1, err := insertNoteAudioNoteAudioData0(ctx, exec, related, noteAudio0) + if err != nil { + return err + } + + noteAudio0.R.NoteAudioData = append(noteAudio0.R.NoteAudioData, noteAudioData1...) + + for _, rel := range noteAudioData1 { + rel.R.NoteAudio = noteAudio0 + } + return nil +} + +func (noteAudio0 *NoteAudio) AttachNoteAudioData(ctx context.Context, exec bob.Executor, related ...*NoteAudioDatum) error { + if len(related) == 0 { + return nil + } + + var err error + noteAudioData1 := NoteAudioDatumSlice(related) + + _, err = attachNoteAudioNoteAudioData0(ctx, exec, len(related), noteAudioData1, noteAudio0) + if err != nil { + return err + } + + noteAudio0.R.NoteAudioData = append(noteAudio0.R.NoteAudioData, noteAudioData1...) + + for _, rel := range related { + rel.R.NoteAudio = noteAudio0 + } + + return nil +} + +type noteAudioWhere[Q psql.Filterable] struct { + Created psql.WhereMod[Q, time.Time] + CreatorID psql.WhereMod[Q, int32] + Deleted psql.WhereNullMod[Q, time.Time] + DeletorID psql.WhereNullMod[Q, int32] + Duration psql.WhereMod[Q, float32] + OrganizationID psql.WhereMod[Q, int32] + Transcription psql.WhereNullMod[Q, string] + TranscriptionUserEdited psql.WhereMod[Q, bool] + Version psql.WhereMod[Q, int32] + UUID psql.WhereMod[Q, uuid.UUID] +} + +func (noteAudioWhere[Q]) AliasedAs(alias string) noteAudioWhere[Q] { + return buildNoteAudioWhere[Q](buildNoteAudioColumns(alias)) +} + +func buildNoteAudioWhere[Q psql.Filterable](cols noteAudioColumns) noteAudioWhere[Q] { + return noteAudioWhere[Q]{ + Created: psql.Where[Q, time.Time](cols.Created), + CreatorID: psql.Where[Q, int32](cols.CreatorID), + Deleted: psql.WhereNull[Q, time.Time](cols.Deleted), + DeletorID: psql.WhereNull[Q, int32](cols.DeletorID), + Duration: psql.Where[Q, float32](cols.Duration), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + Transcription: psql.WhereNull[Q, string](cols.Transcription), + TranscriptionUserEdited: psql.Where[Q, bool](cols.TranscriptionUserEdited), + Version: psql.Where[Q, int32](cols.Version), + UUID: psql.Where[Q, uuid.UUID](cols.UUID), + } +} + +func (o *NoteAudio) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "CreatorUser": + rel, ok := retrieved.(*User) + if !ok { + return fmt.Errorf("noteAudio cannot load %T as %q", retrieved, name) + } + + o.R.CreatorUser = rel + + if rel != nil { + rel.R.CreatorNoteAudios = NoteAudioSlice{o} + } + return nil + case "DeletorUser": + rel, ok := retrieved.(*User) + if !ok { + return fmt.Errorf("noteAudio cannot load %T as %q", retrieved, name) + } + + o.R.DeletorUser = rel + + if rel != nil { + rel.R.DeletorNoteAudios = NoteAudioSlice{o} + } + return nil + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("noteAudio cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.NoteAudios = NoteAudioSlice{o} + } + return nil + case "NoteAudioBreadcrumbs": + rels, ok := retrieved.(NoteAudioBreadcrumbSlice) + if !ok { + return fmt.Errorf("noteAudio cannot load %T as %q", retrieved, name) + } + + o.R.NoteAudioBreadcrumbs = rels + + for _, rel := range rels { + if rel != nil { + rel.R.NoteAudio = o + } + } + return nil + case "NoteAudioData": + rels, ok := retrieved.(NoteAudioDatumSlice) + if !ok { + return fmt.Errorf("noteAudio cannot load %T as %q", retrieved, name) + } + + o.R.NoteAudioData = rels + + for _, rel := range rels { + if rel != nil { + rel.R.NoteAudio = o + } + } + return nil + default: + return fmt.Errorf("noteAudio has no relationship %q", name) + } +} + +type noteAudioPreloader struct { + CreatorUser func(...psql.PreloadOption) psql.Preloader + DeletorUser func(...psql.PreloadOption) psql.Preloader + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildNoteAudioPreloader() noteAudioPreloader { + return noteAudioPreloader{ + CreatorUser: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*User, UserSlice](psql.PreloadRel{ + Name: "CreatorUser", + Sides: []psql.PreloadSide{ + { + From: NoteAudios, + To: Users, + FromColumns: []string{"creator_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Users.Columns.Names(), opts...) + }, + DeletorUser: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*User, UserSlice](psql.PreloadRel{ + Name: "DeletorUser", + Sides: []psql.PreloadSide{ + { + From: NoteAudios, + To: Users, + FromColumns: []string{"deletor_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Users.Columns.Names(), opts...) + }, + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: NoteAudios, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type noteAudioThenLoader[Q orm.Loadable] struct { + CreatorUser func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + DeletorUser func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + NoteAudioBreadcrumbs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + NoteAudioData func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildNoteAudioThenLoader[Q orm.Loadable]() noteAudioThenLoader[Q] { + type CreatorUserLoadInterface interface { + LoadCreatorUser(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type DeletorUserLoadInterface interface { + LoadDeletorUser(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type NoteAudioBreadcrumbsLoadInterface interface { + LoadNoteAudioBreadcrumbs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type NoteAudioDataLoadInterface interface { + LoadNoteAudioData(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return noteAudioThenLoader[Q]{ + CreatorUser: thenLoadBuilder[Q]( + "CreatorUser", + func(ctx context.Context, exec bob.Executor, retrieved CreatorUserLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadCreatorUser(ctx, exec, mods...) + }, + ), + DeletorUser: thenLoadBuilder[Q]( + "DeletorUser", + func(ctx context.Context, exec bob.Executor, retrieved DeletorUserLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadDeletorUser(ctx, exec, mods...) + }, + ), + 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...) + }, + ), + NoteAudioBreadcrumbs: thenLoadBuilder[Q]( + "NoteAudioBreadcrumbs", + func(ctx context.Context, exec bob.Executor, retrieved NoteAudioBreadcrumbsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadNoteAudioBreadcrumbs(ctx, exec, mods...) + }, + ), + NoteAudioData: thenLoadBuilder[Q]( + "NoteAudioData", + func(ctx context.Context, exec bob.Executor, retrieved NoteAudioDataLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadNoteAudioData(ctx, exec, mods...) + }, + ), + } +} + +// LoadCreatorUser loads the noteAudio's CreatorUser into the .R struct +func (o *NoteAudio) LoadCreatorUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.CreatorUser = nil + + related, err := o.CreatorUser(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.CreatorNoteAudios = NoteAudioSlice{o} + + o.R.CreatorUser = related + return nil +} + +// LoadCreatorUser loads the noteAudio's CreatorUser into the .R struct +func (os NoteAudioSlice) LoadCreatorUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + users, err := os.CreatorUser(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range users { + + if !(o.CreatorID == rel.ID) { + continue + } + + rel.R.CreatorNoteAudios = append(rel.R.CreatorNoteAudios, o) + + o.R.CreatorUser = rel + break + } + } + + return nil +} + +// LoadDeletorUser loads the noteAudio's DeletorUser into the .R struct +func (o *NoteAudio) LoadDeletorUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.DeletorUser = nil + + related, err := o.DeletorUser(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.DeletorNoteAudios = NoteAudioSlice{o} + + o.R.DeletorUser = related + return nil +} + +// LoadDeletorUser loads the noteAudio's DeletorUser into the .R struct +func (os NoteAudioSlice) LoadDeletorUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + users, err := os.DeletorUser(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range users { + if !o.DeletorID.IsValue() { + continue + } + + if !(o.DeletorID.IsValue() && o.DeletorID.MustGet() == rel.ID) { + continue + } + + rel.R.DeletorNoteAudios = append(rel.R.DeletorNoteAudios, o) + + o.R.DeletorUser = rel + break + } + } + + return nil +} + +// LoadOrganization loads the noteAudio's Organization into the .R struct +func (o *NoteAudio) 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.NoteAudios = NoteAudioSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the noteAudio's Organization into the .R struct +func (os NoteAudioSlice) 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.NoteAudios = append(rel.R.NoteAudios, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +// LoadNoteAudioBreadcrumbs loads the noteAudio's NoteAudioBreadcrumbs into the .R struct +func (o *NoteAudio) LoadNoteAudioBreadcrumbs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.NoteAudioBreadcrumbs = nil + + related, err := o.NoteAudioBreadcrumbs(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.NoteAudio = o + } + + o.R.NoteAudioBreadcrumbs = related + return nil +} + +// LoadNoteAudioBreadcrumbs loads the noteAudio's NoteAudioBreadcrumbs into the .R struct +func (os NoteAudioSlice) LoadNoteAudioBreadcrumbs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + noteAudioBreadcrumbs, err := os.NoteAudioBreadcrumbs(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.NoteAudioBreadcrumbs = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range noteAudioBreadcrumbs { + + if !(o.Version == rel.NoteAudioVersion) { + continue + } + + if !(o.UUID == rel.NoteAudioUUID) { + continue + } + + rel.R.NoteAudio = o + + o.R.NoteAudioBreadcrumbs = append(o.R.NoteAudioBreadcrumbs, rel) + } + } + + return nil +} + +// LoadNoteAudioData loads the noteAudio's NoteAudioData into the .R struct +func (o *NoteAudio) LoadNoteAudioData(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.NoteAudioData = nil + + related, err := o.NoteAudioData(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.NoteAudio = o + } + + o.R.NoteAudioData = related + return nil +} + +// LoadNoteAudioData loads the noteAudio's NoteAudioData into the .R struct +func (os NoteAudioSlice) LoadNoteAudioData(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + noteAudioData, err := os.NoteAudioData(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.NoteAudioData = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range noteAudioData { + + if !(o.Version == rel.NoteAudioVersion) { + continue + } + + if !(o.UUID == rel.NoteAudioUUID) { + continue + } + + rel.R.NoteAudio = o + + o.R.NoteAudioData = append(o.R.NoteAudioData, rel) + } + } + + return nil +} + +type noteAudioJoins[Q dialect.Joinable] struct { + typ string + CreatorUser modAs[Q, userColumns] + DeletorUser modAs[Q, userColumns] + Organization modAs[Q, organizationColumns] + NoteAudioBreadcrumbs modAs[Q, noteAudioBreadcrumbColumns] + NoteAudioData modAs[Q, noteAudioDatumColumns] +} + +func (j noteAudioJoins[Q]) aliasedAs(alias string) noteAudioJoins[Q] { + return buildNoteAudioJoins[Q](buildNoteAudioColumns(alias), j.typ) +} + +func buildNoteAudioJoins[Q dialect.Joinable](cols noteAudioColumns, typ string) noteAudioJoins[Q] { + return noteAudioJoins[Q]{ + typ: typ, + CreatorUser: modAs[Q, userColumns]{ + c: Users.Columns, + f: func(to userColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, Users.Name().As(to.Alias())).On( + to.ID.EQ(cols.CreatorID), + )) + } + + return mods + }, + }, + DeletorUser: modAs[Q, userColumns]{ + c: Users.Columns, + f: func(to userColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, Users.Name().As(to.Alias())).On( + to.ID.EQ(cols.DeletorID), + )) + } + + return mods + }, + }, + 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 + }, + }, + NoteAudioBreadcrumbs: modAs[Q, noteAudioBreadcrumbColumns]{ + c: NoteAudioBreadcrumbs.Columns, + f: func(to noteAudioBreadcrumbColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, NoteAudioBreadcrumbs.Name().As(to.Alias())).On( + to.NoteAudioVersion.EQ(cols.Version), to.NoteAudioUUID.EQ(cols.UUID), + )) + } + + return mods + }, + }, + NoteAudioData: modAs[Q, noteAudioDatumColumns]{ + c: NoteAudioData.Columns, + f: func(to noteAudioDatumColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, NoteAudioData.Name().As(to.Alias())).On( + to.NoteAudioVersion.EQ(cols.Version), to.NoteAudioUUID.EQ(cols.UUID), + )) + } + + return mods + }, + }, + } +} diff --git a/db/models/note_audio_breadcrumb.bob.go b/db/models/note_audio_breadcrumb.bob.go new file mode 100644 index 00000000..ac5998e8 --- /dev/null +++ b/db/models/note_audio_breadcrumb.bob.go @@ -0,0 +1,731 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package models + +import ( + "context" + "fmt" + "io" + "time" + + "github.com/aarondl/opt/omit" + "github.com/google/uuid" + "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" +) + +// NoteAudioBreadcrumb is an object representing the database table. +type NoteAudioBreadcrumb struct { + Cell string `db:"cell" ` + Created time.Time `db:"created" ` + ManuallySelected bool `db:"manually_selected" ` + NoteAudioVersion int32 `db:"note_audio_version,pk" ` + NoteAudioUUID uuid.UUID `db:"note_audio_uuid,pk" ` + Position int32 `db:"position,pk" ` + + R noteAudioBreadcrumbR `db:"-" ` +} + +// NoteAudioBreadcrumbSlice is an alias for a slice of pointers to NoteAudioBreadcrumb. +// This should almost always be used instead of []*NoteAudioBreadcrumb. +type NoteAudioBreadcrumbSlice []*NoteAudioBreadcrumb + +// NoteAudioBreadcrumbs contains methods to work with the note_audio_breadcrumb table +var NoteAudioBreadcrumbs = psql.NewTablex[*NoteAudioBreadcrumb, NoteAudioBreadcrumbSlice, *NoteAudioBreadcrumbSetter]("", "note_audio_breadcrumb", buildNoteAudioBreadcrumbColumns("note_audio_breadcrumb")) + +// NoteAudioBreadcrumbsQuery is a query on the note_audio_breadcrumb table +type NoteAudioBreadcrumbsQuery = *psql.ViewQuery[*NoteAudioBreadcrumb, NoteAudioBreadcrumbSlice] + +// noteAudioBreadcrumbR is where relationships are stored. +type noteAudioBreadcrumbR struct { + NoteAudio *NoteAudio // note_audio_breadcrumb.note_audio_breadcrumb_note_audio_version_note_audio_uuid_fkey +} + +func buildNoteAudioBreadcrumbColumns(alias string) noteAudioBreadcrumbColumns { + return noteAudioBreadcrumbColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "cell", "created", "manually_selected", "note_audio_version", "note_audio_uuid", "position", + ).WithParent("note_audio_breadcrumb"), + tableAlias: alias, + Cell: psql.Quote(alias, "cell"), + Created: psql.Quote(alias, "created"), + ManuallySelected: psql.Quote(alias, "manually_selected"), + NoteAudioVersion: psql.Quote(alias, "note_audio_version"), + NoteAudioUUID: psql.Quote(alias, "note_audio_uuid"), + Position: psql.Quote(alias, "position"), + } +} + +type noteAudioBreadcrumbColumns struct { + expr.ColumnsExpr + tableAlias string + Cell psql.Expression + Created psql.Expression + ManuallySelected psql.Expression + NoteAudioVersion psql.Expression + NoteAudioUUID psql.Expression + Position psql.Expression +} + +func (c noteAudioBreadcrumbColumns) Alias() string { + return c.tableAlias +} + +func (noteAudioBreadcrumbColumns) AliasedAs(alias string) noteAudioBreadcrumbColumns { + return buildNoteAudioBreadcrumbColumns(alias) +} + +// NoteAudioBreadcrumbSetter is used for insert/upsert/update operations +// All values are optional, and do not have to be set +// Generated columns are not included +type NoteAudioBreadcrumbSetter struct { + Cell omit.Val[string] `db:"cell" ` + Created omit.Val[time.Time] `db:"created" ` + ManuallySelected omit.Val[bool] `db:"manually_selected" ` + NoteAudioVersion omit.Val[int32] `db:"note_audio_version,pk" ` + NoteAudioUUID omit.Val[uuid.UUID] `db:"note_audio_uuid,pk" ` + Position omit.Val[int32] `db:"position,pk" ` +} + +func (s NoteAudioBreadcrumbSetter) SetColumns() []string { + vals := make([]string, 0, 6) + if s.Cell.IsValue() { + vals = append(vals, "cell") + } + if s.Created.IsValue() { + vals = append(vals, "created") + } + if s.ManuallySelected.IsValue() { + vals = append(vals, "manually_selected") + } + if s.NoteAudioVersion.IsValue() { + vals = append(vals, "note_audio_version") + } + if s.NoteAudioUUID.IsValue() { + vals = append(vals, "note_audio_uuid") + } + if s.Position.IsValue() { + vals = append(vals, "position") + } + return vals +} + +func (s NoteAudioBreadcrumbSetter) Overwrite(t *NoteAudioBreadcrumb) { + if s.Cell.IsValue() { + t.Cell = s.Cell.MustGet() + } + if s.Created.IsValue() { + t.Created = s.Created.MustGet() + } + if s.ManuallySelected.IsValue() { + t.ManuallySelected = s.ManuallySelected.MustGet() + } + if s.NoteAudioVersion.IsValue() { + t.NoteAudioVersion = s.NoteAudioVersion.MustGet() + } + if s.NoteAudioUUID.IsValue() { + t.NoteAudioUUID = s.NoteAudioUUID.MustGet() + } + if s.Position.IsValue() { + t.Position = s.Position.MustGet() + } +} + +func (s *NoteAudioBreadcrumbSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return NoteAudioBreadcrumbs.BeforeInsertHooks.RunHooks(ctx, exec, s) + }) + + q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { + vals := make([]bob.Expression, 6) + if s.Cell.IsValue() { + vals[0] = psql.Arg(s.Cell.MustGet()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if s.Created.IsValue() { + vals[1] = psql.Arg(s.Created.MustGet()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if s.ManuallySelected.IsValue() { + vals[2] = psql.Arg(s.ManuallySelected.MustGet()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if s.NoteAudioVersion.IsValue() { + vals[3] = psql.Arg(s.NoteAudioVersion.MustGet()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if s.NoteAudioUUID.IsValue() { + vals[4] = psql.Arg(s.NoteAudioUUID.MustGet()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if s.Position.IsValue() { + vals[5] = psql.Arg(s.Position.MustGet()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s NoteAudioBreadcrumbSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s NoteAudioBreadcrumbSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 6) + + if s.Cell.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "cell")...), + psql.Arg(s.Cell), + }}) + } + + if s.Created.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + + if s.ManuallySelected.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "manually_selected")...), + psql.Arg(s.ManuallySelected), + }}) + } + + if s.NoteAudioVersion.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "note_audio_version")...), + psql.Arg(s.NoteAudioVersion), + }}) + } + + if s.NoteAudioUUID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "note_audio_uuid")...), + psql.Arg(s.NoteAudioUUID), + }}) + } + + if s.Position.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "position")...), + psql.Arg(s.Position), + }}) + } + + return exprs +} + +// FindNoteAudioBreadcrumb retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindNoteAudioBreadcrumb(ctx context.Context, exec bob.Executor, NoteAudioVersionPK int32, NoteAudioUUIDPK uuid.UUID, PositionPK int32, cols ...string) (*NoteAudioBreadcrumb, error) { + if len(cols) == 0 { + return NoteAudioBreadcrumbs.Query( + sm.Where(NoteAudioBreadcrumbs.Columns.NoteAudioVersion.EQ(psql.Arg(NoteAudioVersionPK))), + sm.Where(NoteAudioBreadcrumbs.Columns.NoteAudioUUID.EQ(psql.Arg(NoteAudioUUIDPK))), + sm.Where(NoteAudioBreadcrumbs.Columns.Position.EQ(psql.Arg(PositionPK))), + ).One(ctx, exec) + } + + return NoteAudioBreadcrumbs.Query( + sm.Where(NoteAudioBreadcrumbs.Columns.NoteAudioVersion.EQ(psql.Arg(NoteAudioVersionPK))), + sm.Where(NoteAudioBreadcrumbs.Columns.NoteAudioUUID.EQ(psql.Arg(NoteAudioUUIDPK))), + sm.Where(NoteAudioBreadcrumbs.Columns.Position.EQ(psql.Arg(PositionPK))), + sm.Columns(NoteAudioBreadcrumbs.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// NoteAudioBreadcrumbExists checks the presence of a single record by primary key +func NoteAudioBreadcrumbExists(ctx context.Context, exec bob.Executor, NoteAudioVersionPK int32, NoteAudioUUIDPK uuid.UUID, PositionPK int32) (bool, error) { + return NoteAudioBreadcrumbs.Query( + sm.Where(NoteAudioBreadcrumbs.Columns.NoteAudioVersion.EQ(psql.Arg(NoteAudioVersionPK))), + sm.Where(NoteAudioBreadcrumbs.Columns.NoteAudioUUID.EQ(psql.Arg(NoteAudioUUIDPK))), + sm.Where(NoteAudioBreadcrumbs.Columns.Position.EQ(psql.Arg(PositionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after NoteAudioBreadcrumb is retrieved from the database +func (o *NoteAudioBreadcrumb) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = NoteAudioBreadcrumbs.AfterSelectHooks.RunHooks(ctx, exec, NoteAudioBreadcrumbSlice{o}) + case bob.QueryTypeInsert: + ctx, err = NoteAudioBreadcrumbs.AfterInsertHooks.RunHooks(ctx, exec, NoteAudioBreadcrumbSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = NoteAudioBreadcrumbs.AfterUpdateHooks.RunHooks(ctx, exec, NoteAudioBreadcrumbSlice{o}) + case bob.QueryTypeDelete: + ctx, err = NoteAudioBreadcrumbs.AfterDeleteHooks.RunHooks(ctx, exec, NoteAudioBreadcrumbSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the NoteAudioBreadcrumb +func (o *NoteAudioBreadcrumb) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.NoteAudioVersion, + o.NoteAudioUUID, + o.Position, + ) +} + +func (o *NoteAudioBreadcrumb) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("note_audio_breadcrumb", "note_audio_version"), psql.Quote("note_audio_breadcrumb", "note_audio_uuid"), psql.Quote("note_audio_breadcrumb", "position")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { + return o.primaryKeyVals().WriteSQL(ctx, w, d, start) + })) +} + +// Update uses an executor to update the NoteAudioBreadcrumb +func (o *NoteAudioBreadcrumb) Update(ctx context.Context, exec bob.Executor, s *NoteAudioBreadcrumbSetter) error { + v, err := NoteAudioBreadcrumbs.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 NoteAudioBreadcrumb record with an executor +func (o *NoteAudioBreadcrumb) Delete(ctx context.Context, exec bob.Executor) error { + _, err := NoteAudioBreadcrumbs.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the NoteAudioBreadcrumb using the executor +func (o *NoteAudioBreadcrumb) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := NoteAudioBreadcrumbs.Query( + sm.Where(NoteAudioBreadcrumbs.Columns.NoteAudioVersion.EQ(psql.Arg(o.NoteAudioVersion))), + sm.Where(NoteAudioBreadcrumbs.Columns.NoteAudioUUID.EQ(psql.Arg(o.NoteAudioUUID))), + sm.Where(NoteAudioBreadcrumbs.Columns.Position.EQ(psql.Arg(o.Position))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after NoteAudioBreadcrumbSlice is retrieved from the database +func (o NoteAudioBreadcrumbSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = NoteAudioBreadcrumbs.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = NoteAudioBreadcrumbs.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = NoteAudioBreadcrumbs.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = NoteAudioBreadcrumbs.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o NoteAudioBreadcrumbSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("note_audio_breadcrumb", "note_audio_version"), psql.Quote("note_audio_breadcrumb", "note_audio_uuid"), psql.Quote("note_audio_breadcrumb", "position")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 NoteAudioBreadcrumbSlice) copyMatchingRows(from ...*NoteAudioBreadcrumb) { + for i, old := range o { + for _, new := range from { + if new.NoteAudioVersion != old.NoteAudioVersion { + continue + } + if new.NoteAudioUUID != old.NoteAudioUUID { + continue + } + if new.Position != old.Position { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o NoteAudioBreadcrumbSlice) 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 NoteAudioBreadcrumbs.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 *NoteAudioBreadcrumb: + o.copyMatchingRows(retrieved) + case []*NoteAudioBreadcrumb: + o.copyMatchingRows(retrieved...) + case NoteAudioBreadcrumbSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a NoteAudioBreadcrumb or a slice of NoteAudioBreadcrumb + // then run the AfterUpdateHooks on the slice + _, err = NoteAudioBreadcrumbs.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o NoteAudioBreadcrumbSlice) 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 NoteAudioBreadcrumbs.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 *NoteAudioBreadcrumb: + o.copyMatchingRows(retrieved) + case []*NoteAudioBreadcrumb: + o.copyMatchingRows(retrieved...) + case NoteAudioBreadcrumbSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a NoteAudioBreadcrumb or a slice of NoteAudioBreadcrumb + // then run the AfterDeleteHooks on the slice + _, err = NoteAudioBreadcrumbs.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o NoteAudioBreadcrumbSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals NoteAudioBreadcrumbSetter) error { + if len(o) == 0 { + return nil + } + + _, err := NoteAudioBreadcrumbs.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o NoteAudioBreadcrumbSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := NoteAudioBreadcrumbs.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o NoteAudioBreadcrumbSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := NoteAudioBreadcrumbs.Query(sm.Where(o.pkIN())).All(ctx, exec) + if err != nil { + return err + } + + o.copyMatchingRows(o2...) + + return nil +} + +// NoteAudio starts a query for related objects on note_audio +func (o *NoteAudioBreadcrumb) NoteAudio(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudiosQuery { + return NoteAudios.Query(append(mods, + sm.Where(NoteAudios.Columns.Version.EQ(psql.Arg(o.NoteAudioVersion))), sm.Where(NoteAudios.Columns.UUID.EQ(psql.Arg(o.NoteAudioUUID))), + )...) +} + +func (os NoteAudioBreadcrumbSlice) NoteAudio(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudiosQuery { + pkNoteAudioVersion := make(pgtypes.Array[int32], 0, len(os)) + + pkNoteAudioUUID := make(pgtypes.Array[uuid.UUID], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkNoteAudioVersion = append(pkNoteAudioVersion, o.NoteAudioVersion) + pkNoteAudioUUID = append(pkNoteAudioUUID, o.NoteAudioUUID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkNoteAudioVersion), "integer[]")), + psql.F("unnest", psql.Cast(psql.Arg(pkNoteAudioUUID), "uuid[]")), + )) + + return NoteAudios.Query(append(mods, + sm.Where(psql.Group(NoteAudios.Columns.Version, NoteAudios.Columns.UUID).OP("IN", PKArgExpr)), + )...) +} + +func attachNoteAudioBreadcrumbNoteAudio0(ctx context.Context, exec bob.Executor, count int, noteAudioBreadcrumb0 *NoteAudioBreadcrumb, noteAudio1 *NoteAudio) (*NoteAudioBreadcrumb, error) { + setter := &NoteAudioBreadcrumbSetter{ + NoteAudioVersion: omit.From(noteAudio1.Version), + NoteAudioUUID: omit.From(noteAudio1.UUID), + } + + err := noteAudioBreadcrumb0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachNoteAudioBreadcrumbNoteAudio0: %w", err) + } + + return noteAudioBreadcrumb0, nil +} + +func (noteAudioBreadcrumb0 *NoteAudioBreadcrumb) InsertNoteAudio(ctx context.Context, exec bob.Executor, related *NoteAudioSetter) error { + var err error + + noteAudio1, err := NoteAudios.Insert(related).One(ctx, exec) + if err != nil { + return fmt.Errorf("inserting related objects: %w", err) + } + + _, err = attachNoteAudioBreadcrumbNoteAudio0(ctx, exec, 1, noteAudioBreadcrumb0, noteAudio1) + if err != nil { + return err + } + + noteAudioBreadcrumb0.R.NoteAudio = noteAudio1 + + noteAudio1.R.NoteAudioBreadcrumbs = append(noteAudio1.R.NoteAudioBreadcrumbs, noteAudioBreadcrumb0) + + return nil +} + +func (noteAudioBreadcrumb0 *NoteAudioBreadcrumb) AttachNoteAudio(ctx context.Context, exec bob.Executor, noteAudio1 *NoteAudio) error { + var err error + + _, err = attachNoteAudioBreadcrumbNoteAudio0(ctx, exec, 1, noteAudioBreadcrumb0, noteAudio1) + if err != nil { + return err + } + + noteAudioBreadcrumb0.R.NoteAudio = noteAudio1 + + noteAudio1.R.NoteAudioBreadcrumbs = append(noteAudio1.R.NoteAudioBreadcrumbs, noteAudioBreadcrumb0) + + return nil +} + +type noteAudioBreadcrumbWhere[Q psql.Filterable] struct { + Cell psql.WhereMod[Q, string] + Created psql.WhereMod[Q, time.Time] + ManuallySelected psql.WhereMod[Q, bool] + NoteAudioVersion psql.WhereMod[Q, int32] + NoteAudioUUID psql.WhereMod[Q, uuid.UUID] + Position psql.WhereMod[Q, int32] +} + +func (noteAudioBreadcrumbWhere[Q]) AliasedAs(alias string) noteAudioBreadcrumbWhere[Q] { + return buildNoteAudioBreadcrumbWhere[Q](buildNoteAudioBreadcrumbColumns(alias)) +} + +func buildNoteAudioBreadcrumbWhere[Q psql.Filterable](cols noteAudioBreadcrumbColumns) noteAudioBreadcrumbWhere[Q] { + return noteAudioBreadcrumbWhere[Q]{ + Cell: psql.Where[Q, string](cols.Cell), + Created: psql.Where[Q, time.Time](cols.Created), + ManuallySelected: psql.Where[Q, bool](cols.ManuallySelected), + NoteAudioVersion: psql.Where[Q, int32](cols.NoteAudioVersion), + NoteAudioUUID: psql.Where[Q, uuid.UUID](cols.NoteAudioUUID), + Position: psql.Where[Q, int32](cols.Position), + } +} + +func (o *NoteAudioBreadcrumb) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "NoteAudio": + rel, ok := retrieved.(*NoteAudio) + if !ok { + return fmt.Errorf("noteAudioBreadcrumb cannot load %T as %q", retrieved, name) + } + + o.R.NoteAudio = rel + + if rel != nil { + rel.R.NoteAudioBreadcrumbs = NoteAudioBreadcrumbSlice{o} + } + return nil + default: + return fmt.Errorf("noteAudioBreadcrumb has no relationship %q", name) + } +} + +type noteAudioBreadcrumbPreloader struct { + NoteAudio func(...psql.PreloadOption) psql.Preloader +} + +func buildNoteAudioBreadcrumbPreloader() noteAudioBreadcrumbPreloader { + return noteAudioBreadcrumbPreloader{ + NoteAudio: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*NoteAudio, NoteAudioSlice](psql.PreloadRel{ + Name: "NoteAudio", + Sides: []psql.PreloadSide{ + { + From: NoteAudioBreadcrumbs, + To: NoteAudios, + FromColumns: []string{"note_audio_version", "note_audio_uuid"}, + ToColumns: []string{"version", "uuid"}, + }, + }, + }, NoteAudios.Columns.Names(), opts...) + }, + } +} + +type noteAudioBreadcrumbThenLoader[Q orm.Loadable] struct { + NoteAudio func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildNoteAudioBreadcrumbThenLoader[Q orm.Loadable]() noteAudioBreadcrumbThenLoader[Q] { + type NoteAudioLoadInterface interface { + LoadNoteAudio(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return noteAudioBreadcrumbThenLoader[Q]{ + NoteAudio: thenLoadBuilder[Q]( + "NoteAudio", + func(ctx context.Context, exec bob.Executor, retrieved NoteAudioLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadNoteAudio(ctx, exec, mods...) + }, + ), + } +} + +// LoadNoteAudio loads the noteAudioBreadcrumb's NoteAudio into the .R struct +func (o *NoteAudioBreadcrumb) LoadNoteAudio(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.NoteAudio = nil + + related, err := o.NoteAudio(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.NoteAudioBreadcrumbs = NoteAudioBreadcrumbSlice{o} + + o.R.NoteAudio = related + return nil +} + +// LoadNoteAudio loads the noteAudioBreadcrumb's NoteAudio into the .R struct +func (os NoteAudioBreadcrumbSlice) LoadNoteAudio(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + noteAudios, err := os.NoteAudio(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range noteAudios { + + if !(o.NoteAudioVersion == rel.Version) { + continue + } + + if !(o.NoteAudioUUID == rel.UUID) { + continue + } + + rel.R.NoteAudioBreadcrumbs = append(rel.R.NoteAudioBreadcrumbs, o) + + o.R.NoteAudio = rel + break + } + } + + return nil +} + +type noteAudioBreadcrumbJoins[Q dialect.Joinable] struct { + typ string + NoteAudio modAs[Q, noteAudioColumns] +} + +func (j noteAudioBreadcrumbJoins[Q]) aliasedAs(alias string) noteAudioBreadcrumbJoins[Q] { + return buildNoteAudioBreadcrumbJoins[Q](buildNoteAudioBreadcrumbColumns(alias), j.typ) +} + +func buildNoteAudioBreadcrumbJoins[Q dialect.Joinable](cols noteAudioBreadcrumbColumns, typ string) noteAudioBreadcrumbJoins[Q] { + return noteAudioBreadcrumbJoins[Q]{ + typ: typ, + NoteAudio: modAs[Q, noteAudioColumns]{ + c: NoteAudios.Columns, + f: func(to noteAudioColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, NoteAudios.Name().As(to.Alias())).On( + to.Version.EQ(cols.NoteAudioVersion), to.UUID.EQ(cols.NoteAudioUUID), + )) + } + + return mods + }, + }, + } +} diff --git a/db/models/note_audio_data.bob.go b/db/models/note_audio_data.bob.go new file mode 100644 index 00000000..8c3fb330 --- /dev/null +++ b/db/models/note_audio_data.bob.go @@ -0,0 +1,682 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package models + +import ( + "context" + "fmt" + "io" + "time" + + enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" + "github.com/aarondl/opt/omit" + "github.com/google/uuid" + "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" +) + +// NoteAudioDatum is an object representing the database table. +type NoteAudioDatum struct { + Created time.Time `db:"created" ` + NoteAudioVersion int32 `db:"note_audio_version,pk" ` + NoteAudioUUID uuid.UUID `db:"note_audio_uuid,pk" ` + Type enums.Audiodatatype `db:"type_,pk" ` + + R noteAudioDatumR `db:"-" ` +} + +// NoteAudioDatumSlice is an alias for a slice of pointers to NoteAudioDatum. +// This should almost always be used instead of []*NoteAudioDatum. +type NoteAudioDatumSlice []*NoteAudioDatum + +// NoteAudioData contains methods to work with the note_audio_data table +var NoteAudioData = psql.NewTablex[*NoteAudioDatum, NoteAudioDatumSlice, *NoteAudioDatumSetter]("", "note_audio_data", buildNoteAudioDatumColumns("note_audio_data")) + +// NoteAudioDataQuery is a query on the note_audio_data table +type NoteAudioDataQuery = *psql.ViewQuery[*NoteAudioDatum, NoteAudioDatumSlice] + +// noteAudioDatumR is where relationships are stored. +type noteAudioDatumR struct { + NoteAudio *NoteAudio // note_audio_data.note_audio_data_note_audio_version_note_audio_uuid_fkey +} + +func buildNoteAudioDatumColumns(alias string) noteAudioDatumColumns { + return noteAudioDatumColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "created", "note_audio_version", "note_audio_uuid", "type_", + ).WithParent("note_audio_data"), + tableAlias: alias, + Created: psql.Quote(alias, "created"), + NoteAudioVersion: psql.Quote(alias, "note_audio_version"), + NoteAudioUUID: psql.Quote(alias, "note_audio_uuid"), + Type: psql.Quote(alias, "type_"), + } +} + +type noteAudioDatumColumns struct { + expr.ColumnsExpr + tableAlias string + Created psql.Expression + NoteAudioVersion psql.Expression + NoteAudioUUID psql.Expression + Type psql.Expression +} + +func (c noteAudioDatumColumns) Alias() string { + return c.tableAlias +} + +func (noteAudioDatumColumns) AliasedAs(alias string) noteAudioDatumColumns { + return buildNoteAudioDatumColumns(alias) +} + +// NoteAudioDatumSetter is used for insert/upsert/update operations +// All values are optional, and do not have to be set +// Generated columns are not included +type NoteAudioDatumSetter struct { + Created omit.Val[time.Time] `db:"created" ` + NoteAudioVersion omit.Val[int32] `db:"note_audio_version,pk" ` + NoteAudioUUID omit.Val[uuid.UUID] `db:"note_audio_uuid,pk" ` + Type omit.Val[enums.Audiodatatype] `db:"type_,pk" ` +} + +func (s NoteAudioDatumSetter) SetColumns() []string { + vals := make([]string, 0, 4) + if s.Created.IsValue() { + vals = append(vals, "created") + } + if s.NoteAudioVersion.IsValue() { + vals = append(vals, "note_audio_version") + } + if s.NoteAudioUUID.IsValue() { + vals = append(vals, "note_audio_uuid") + } + if s.Type.IsValue() { + vals = append(vals, "type_") + } + return vals +} + +func (s NoteAudioDatumSetter) Overwrite(t *NoteAudioDatum) { + if s.Created.IsValue() { + t.Created = s.Created.MustGet() + } + if s.NoteAudioVersion.IsValue() { + t.NoteAudioVersion = s.NoteAudioVersion.MustGet() + } + if s.NoteAudioUUID.IsValue() { + t.NoteAudioUUID = s.NoteAudioUUID.MustGet() + } + if s.Type.IsValue() { + t.Type = s.Type.MustGet() + } +} + +func (s *NoteAudioDatumSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return NoteAudioData.BeforeInsertHooks.RunHooks(ctx, exec, s) + }) + + q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { + vals := make([]bob.Expression, 4) + if s.Created.IsValue() { + vals[0] = psql.Arg(s.Created.MustGet()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if s.NoteAudioVersion.IsValue() { + vals[1] = psql.Arg(s.NoteAudioVersion.MustGet()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if s.NoteAudioUUID.IsValue() { + vals[2] = psql.Arg(s.NoteAudioUUID.MustGet()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if s.Type.IsValue() { + vals[3] = psql.Arg(s.Type.MustGet()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s NoteAudioDatumSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s NoteAudioDatumSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 4) + + if s.Created.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + + if s.NoteAudioVersion.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "note_audio_version")...), + psql.Arg(s.NoteAudioVersion), + }}) + } + + if s.NoteAudioUUID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "note_audio_uuid")...), + psql.Arg(s.NoteAudioUUID), + }}) + } + + if s.Type.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "type_")...), + psql.Arg(s.Type), + }}) + } + + return exprs +} + +// FindNoteAudioDatum retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindNoteAudioDatum(ctx context.Context, exec bob.Executor, NoteAudioVersionPK int32, NoteAudioUUIDPK uuid.UUID, TypePK enums.Audiodatatype, cols ...string) (*NoteAudioDatum, error) { + if len(cols) == 0 { + return NoteAudioData.Query( + sm.Where(NoteAudioData.Columns.NoteAudioVersion.EQ(psql.Arg(NoteAudioVersionPK))), + sm.Where(NoteAudioData.Columns.NoteAudioUUID.EQ(psql.Arg(NoteAudioUUIDPK))), + sm.Where(NoteAudioData.Columns.Type.EQ(psql.Arg(TypePK))), + ).One(ctx, exec) + } + + return NoteAudioData.Query( + sm.Where(NoteAudioData.Columns.NoteAudioVersion.EQ(psql.Arg(NoteAudioVersionPK))), + sm.Where(NoteAudioData.Columns.NoteAudioUUID.EQ(psql.Arg(NoteAudioUUIDPK))), + sm.Where(NoteAudioData.Columns.Type.EQ(psql.Arg(TypePK))), + sm.Columns(NoteAudioData.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// NoteAudioDatumExists checks the presence of a single record by primary key +func NoteAudioDatumExists(ctx context.Context, exec bob.Executor, NoteAudioVersionPK int32, NoteAudioUUIDPK uuid.UUID, TypePK enums.Audiodatatype) (bool, error) { + return NoteAudioData.Query( + sm.Where(NoteAudioData.Columns.NoteAudioVersion.EQ(psql.Arg(NoteAudioVersionPK))), + sm.Where(NoteAudioData.Columns.NoteAudioUUID.EQ(psql.Arg(NoteAudioUUIDPK))), + sm.Where(NoteAudioData.Columns.Type.EQ(psql.Arg(TypePK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after NoteAudioDatum is retrieved from the database +func (o *NoteAudioDatum) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = NoteAudioData.AfterSelectHooks.RunHooks(ctx, exec, NoteAudioDatumSlice{o}) + case bob.QueryTypeInsert: + ctx, err = NoteAudioData.AfterInsertHooks.RunHooks(ctx, exec, NoteAudioDatumSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = NoteAudioData.AfterUpdateHooks.RunHooks(ctx, exec, NoteAudioDatumSlice{o}) + case bob.QueryTypeDelete: + ctx, err = NoteAudioData.AfterDeleteHooks.RunHooks(ctx, exec, NoteAudioDatumSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the NoteAudioDatum +func (o *NoteAudioDatum) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.NoteAudioVersion, + o.NoteAudioUUID, + o.Type, + ) +} + +func (o *NoteAudioDatum) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("note_audio_data", "note_audio_version"), psql.Quote("note_audio_data", "note_audio_uuid"), psql.Quote("note_audio_data", "type_")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { + return o.primaryKeyVals().WriteSQL(ctx, w, d, start) + })) +} + +// Update uses an executor to update the NoteAudioDatum +func (o *NoteAudioDatum) Update(ctx context.Context, exec bob.Executor, s *NoteAudioDatumSetter) error { + v, err := NoteAudioData.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 NoteAudioDatum record with an executor +func (o *NoteAudioDatum) Delete(ctx context.Context, exec bob.Executor) error { + _, err := NoteAudioData.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the NoteAudioDatum using the executor +func (o *NoteAudioDatum) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := NoteAudioData.Query( + sm.Where(NoteAudioData.Columns.NoteAudioVersion.EQ(psql.Arg(o.NoteAudioVersion))), + sm.Where(NoteAudioData.Columns.NoteAudioUUID.EQ(psql.Arg(o.NoteAudioUUID))), + sm.Where(NoteAudioData.Columns.Type.EQ(psql.Arg(o.Type))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after NoteAudioDatumSlice is retrieved from the database +func (o NoteAudioDatumSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = NoteAudioData.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = NoteAudioData.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = NoteAudioData.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = NoteAudioData.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o NoteAudioDatumSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("note_audio_data", "note_audio_version"), psql.Quote("note_audio_data", "note_audio_uuid"), psql.Quote("note_audio_data", "type_")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 NoteAudioDatumSlice) copyMatchingRows(from ...*NoteAudioDatum) { + for i, old := range o { + for _, new := range from { + if new.NoteAudioVersion != old.NoteAudioVersion { + continue + } + if new.NoteAudioUUID != old.NoteAudioUUID { + continue + } + if new.Type != old.Type { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o NoteAudioDatumSlice) 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 NoteAudioData.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 *NoteAudioDatum: + o.copyMatchingRows(retrieved) + case []*NoteAudioDatum: + o.copyMatchingRows(retrieved...) + case NoteAudioDatumSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a NoteAudioDatum or a slice of NoteAudioDatum + // then run the AfterUpdateHooks on the slice + _, err = NoteAudioData.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o NoteAudioDatumSlice) 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 NoteAudioData.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 *NoteAudioDatum: + o.copyMatchingRows(retrieved) + case []*NoteAudioDatum: + o.copyMatchingRows(retrieved...) + case NoteAudioDatumSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a NoteAudioDatum or a slice of NoteAudioDatum + // then run the AfterDeleteHooks on the slice + _, err = NoteAudioData.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o NoteAudioDatumSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals NoteAudioDatumSetter) error { + if len(o) == 0 { + return nil + } + + _, err := NoteAudioData.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o NoteAudioDatumSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := NoteAudioData.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o NoteAudioDatumSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := NoteAudioData.Query(sm.Where(o.pkIN())).All(ctx, exec) + if err != nil { + return err + } + + o.copyMatchingRows(o2...) + + return nil +} + +// NoteAudio starts a query for related objects on note_audio +func (o *NoteAudioDatum) NoteAudio(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudiosQuery { + return NoteAudios.Query(append(mods, + sm.Where(NoteAudios.Columns.Version.EQ(psql.Arg(o.NoteAudioVersion))), sm.Where(NoteAudios.Columns.UUID.EQ(psql.Arg(o.NoteAudioUUID))), + )...) +} + +func (os NoteAudioDatumSlice) NoteAudio(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudiosQuery { + pkNoteAudioVersion := make(pgtypes.Array[int32], 0, len(os)) + + pkNoteAudioUUID := make(pgtypes.Array[uuid.UUID], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkNoteAudioVersion = append(pkNoteAudioVersion, o.NoteAudioVersion) + pkNoteAudioUUID = append(pkNoteAudioUUID, o.NoteAudioUUID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkNoteAudioVersion), "integer[]")), + psql.F("unnest", psql.Cast(psql.Arg(pkNoteAudioUUID), "uuid[]")), + )) + + return NoteAudios.Query(append(mods, + sm.Where(psql.Group(NoteAudios.Columns.Version, NoteAudios.Columns.UUID).OP("IN", PKArgExpr)), + )...) +} + +func attachNoteAudioDatumNoteAudio0(ctx context.Context, exec bob.Executor, count int, noteAudioDatum0 *NoteAudioDatum, noteAudio1 *NoteAudio) (*NoteAudioDatum, error) { + setter := &NoteAudioDatumSetter{ + NoteAudioVersion: omit.From(noteAudio1.Version), + NoteAudioUUID: omit.From(noteAudio1.UUID), + } + + err := noteAudioDatum0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachNoteAudioDatumNoteAudio0: %w", err) + } + + return noteAudioDatum0, nil +} + +func (noteAudioDatum0 *NoteAudioDatum) InsertNoteAudio(ctx context.Context, exec bob.Executor, related *NoteAudioSetter) error { + var err error + + noteAudio1, err := NoteAudios.Insert(related).One(ctx, exec) + if err != nil { + return fmt.Errorf("inserting related objects: %w", err) + } + + _, err = attachNoteAudioDatumNoteAudio0(ctx, exec, 1, noteAudioDatum0, noteAudio1) + if err != nil { + return err + } + + noteAudioDatum0.R.NoteAudio = noteAudio1 + + noteAudio1.R.NoteAudioData = append(noteAudio1.R.NoteAudioData, noteAudioDatum0) + + return nil +} + +func (noteAudioDatum0 *NoteAudioDatum) AttachNoteAudio(ctx context.Context, exec bob.Executor, noteAudio1 *NoteAudio) error { + var err error + + _, err = attachNoteAudioDatumNoteAudio0(ctx, exec, 1, noteAudioDatum0, noteAudio1) + if err != nil { + return err + } + + noteAudioDatum0.R.NoteAudio = noteAudio1 + + noteAudio1.R.NoteAudioData = append(noteAudio1.R.NoteAudioData, noteAudioDatum0) + + return nil +} + +type noteAudioDatumWhere[Q psql.Filterable] struct { + Created psql.WhereMod[Q, time.Time] + NoteAudioVersion psql.WhereMod[Q, int32] + NoteAudioUUID psql.WhereMod[Q, uuid.UUID] + Type psql.WhereMod[Q, enums.Audiodatatype] +} + +func (noteAudioDatumWhere[Q]) AliasedAs(alias string) noteAudioDatumWhere[Q] { + return buildNoteAudioDatumWhere[Q](buildNoteAudioDatumColumns(alias)) +} + +func buildNoteAudioDatumWhere[Q psql.Filterable](cols noteAudioDatumColumns) noteAudioDatumWhere[Q] { + return noteAudioDatumWhere[Q]{ + Created: psql.Where[Q, time.Time](cols.Created), + NoteAudioVersion: psql.Where[Q, int32](cols.NoteAudioVersion), + NoteAudioUUID: psql.Where[Q, uuid.UUID](cols.NoteAudioUUID), + Type: psql.Where[Q, enums.Audiodatatype](cols.Type), + } +} + +func (o *NoteAudioDatum) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "NoteAudio": + rel, ok := retrieved.(*NoteAudio) + if !ok { + return fmt.Errorf("noteAudioDatum cannot load %T as %q", retrieved, name) + } + + o.R.NoteAudio = rel + + if rel != nil { + rel.R.NoteAudioData = NoteAudioDatumSlice{o} + } + return nil + default: + return fmt.Errorf("noteAudioDatum has no relationship %q", name) + } +} + +type noteAudioDatumPreloader struct { + NoteAudio func(...psql.PreloadOption) psql.Preloader +} + +func buildNoteAudioDatumPreloader() noteAudioDatumPreloader { + return noteAudioDatumPreloader{ + NoteAudio: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*NoteAudio, NoteAudioSlice](psql.PreloadRel{ + Name: "NoteAudio", + Sides: []psql.PreloadSide{ + { + From: NoteAudioData, + To: NoteAudios, + FromColumns: []string{"note_audio_version", "note_audio_uuid"}, + ToColumns: []string{"version", "uuid"}, + }, + }, + }, NoteAudios.Columns.Names(), opts...) + }, + } +} + +type noteAudioDatumThenLoader[Q orm.Loadable] struct { + NoteAudio func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildNoteAudioDatumThenLoader[Q orm.Loadable]() noteAudioDatumThenLoader[Q] { + type NoteAudioLoadInterface interface { + LoadNoteAudio(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return noteAudioDatumThenLoader[Q]{ + NoteAudio: thenLoadBuilder[Q]( + "NoteAudio", + func(ctx context.Context, exec bob.Executor, retrieved NoteAudioLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadNoteAudio(ctx, exec, mods...) + }, + ), + } +} + +// LoadNoteAudio loads the noteAudioDatum's NoteAudio into the .R struct +func (o *NoteAudioDatum) LoadNoteAudio(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.NoteAudio = nil + + related, err := o.NoteAudio(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.NoteAudioData = NoteAudioDatumSlice{o} + + o.R.NoteAudio = related + return nil +} + +// LoadNoteAudio loads the noteAudioDatum's NoteAudio into the .R struct +func (os NoteAudioDatumSlice) LoadNoteAudio(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + noteAudios, err := os.NoteAudio(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range noteAudios { + + if !(o.NoteAudioVersion == rel.Version) { + continue + } + + if !(o.NoteAudioUUID == rel.UUID) { + continue + } + + rel.R.NoteAudioData = append(rel.R.NoteAudioData, o) + + o.R.NoteAudio = rel + break + } + } + + return nil +} + +type noteAudioDatumJoins[Q dialect.Joinable] struct { + typ string + NoteAudio modAs[Q, noteAudioColumns] +} + +func (j noteAudioDatumJoins[Q]) aliasedAs(alias string) noteAudioDatumJoins[Q] { + return buildNoteAudioDatumJoins[Q](buildNoteAudioDatumColumns(alias), j.typ) +} + +func buildNoteAudioDatumJoins[Q dialect.Joinable](cols noteAudioDatumColumns, typ string) noteAudioDatumJoins[Q] { + return noteAudioDatumJoins[Q]{ + typ: typ, + NoteAudio: modAs[Q, noteAudioColumns]{ + c: NoteAudios.Columns, + f: func(to noteAudioColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, NoteAudios.Name().As(to.Alias())).On( + to.Version.EQ(cols.NoteAudioVersion), to.UUID.EQ(cols.NoteAudioUUID), + )) + } + + return mods + }, + }, + } +} diff --git a/db/models/note_image.bob.go b/db/models/note_image.bob.go new file mode 100644 index 00000000..67fb14c6 --- /dev/null +++ b/db/models/note_image.bob.go @@ -0,0 +1,1502 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package models + +import ( + "context" + "fmt" + "io" + "time" + + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" + "github.com/google/uuid" + "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" +) + +// NoteImage is an object representing the database table. +type NoteImage struct { + Created time.Time `db:"created" ` + CreatorID int32 `db:"creator_id" ` + Deleted null.Val[time.Time] `db:"deleted" ` + DeletorID null.Val[int32] `db:"deletor_id" ` + OrganizationID int32 `db:"organization_id" ` + Version int32 `db:"version,pk" ` + UUID uuid.UUID `db:"uuid,pk" ` + + R noteImageR `db:"-" ` +} + +// NoteImageSlice is an alias for a slice of pointers to NoteImage. +// This should almost always be used instead of []*NoteImage. +type NoteImageSlice []*NoteImage + +// NoteImages contains methods to work with the note_image table +var NoteImages = psql.NewTablex[*NoteImage, NoteImageSlice, *NoteImageSetter]("", "note_image", buildNoteImageColumns("note_image")) + +// NoteImagesQuery is a query on the note_image table +type NoteImagesQuery = *psql.ViewQuery[*NoteImage, NoteImageSlice] + +// noteImageR is where relationships are stored. +type noteImageR struct { + CreatorUser *User // note_image.note_image_creator_id_fkey + DeletorUser *User // note_image.note_image_deletor_id_fkey + Organization *Organization // note_image.note_image_organization_id_fkey + NoteImageBreadcrumbs NoteImageBreadcrumbSlice // note_image_breadcrumb.note_image_breadcrumb_note_image_version_note_image_uuid_fkey + NoteImageData NoteImageDatumSlice // note_image_data.note_image_data_note_image_version_note_image_uuid_fkey +} + +func buildNoteImageColumns(alias string) noteImageColumns { + return noteImageColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "created", "creator_id", "deleted", "deletor_id", "organization_id", "version", "uuid", + ).WithParent("note_image"), + tableAlias: alias, + Created: psql.Quote(alias, "created"), + CreatorID: psql.Quote(alias, "creator_id"), + Deleted: psql.Quote(alias, "deleted"), + DeletorID: psql.Quote(alias, "deletor_id"), + OrganizationID: psql.Quote(alias, "organization_id"), + Version: psql.Quote(alias, "version"), + UUID: psql.Quote(alias, "uuid"), + } +} + +type noteImageColumns struct { + expr.ColumnsExpr + tableAlias string + Created psql.Expression + CreatorID psql.Expression + Deleted psql.Expression + DeletorID psql.Expression + OrganizationID psql.Expression + Version psql.Expression + UUID psql.Expression +} + +func (c noteImageColumns) Alias() string { + return c.tableAlias +} + +func (noteImageColumns) AliasedAs(alias string) noteImageColumns { + return buildNoteImageColumns(alias) +} + +// NoteImageSetter is used for insert/upsert/update operations +// All values are optional, and do not have to be set +// Generated columns are not included +type NoteImageSetter struct { + Created omit.Val[time.Time] `db:"created" ` + CreatorID omit.Val[int32] `db:"creator_id" ` + Deleted omitnull.Val[time.Time] `db:"deleted" ` + DeletorID omitnull.Val[int32] `db:"deletor_id" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Version omit.Val[int32] `db:"version,pk" ` + UUID omit.Val[uuid.UUID] `db:"uuid,pk" ` +} + +func (s NoteImageSetter) SetColumns() []string { + vals := make([]string, 0, 7) + if s.Created.IsValue() { + vals = append(vals, "created") + } + if s.CreatorID.IsValue() { + vals = append(vals, "creator_id") + } + if !s.Deleted.IsUnset() { + vals = append(vals, "deleted") + } + if !s.DeletorID.IsUnset() { + vals = append(vals, "deletor_id") + } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } + if s.Version.IsValue() { + vals = append(vals, "version") + } + if s.UUID.IsValue() { + vals = append(vals, "uuid") + } + return vals +} + +func (s NoteImageSetter) Overwrite(t *NoteImage) { + if s.Created.IsValue() { + t.Created = s.Created.MustGet() + } + if s.CreatorID.IsValue() { + t.CreatorID = s.CreatorID.MustGet() + } + if !s.Deleted.IsUnset() { + t.Deleted = s.Deleted.MustGetNull() + } + if !s.DeletorID.IsUnset() { + t.DeletorID = s.DeletorID.MustGetNull() + } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } + if s.Version.IsValue() { + t.Version = s.Version.MustGet() + } + if s.UUID.IsValue() { + t.UUID = s.UUID.MustGet() + } +} + +func (s *NoteImageSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return NoteImages.BeforeInsertHooks.RunHooks(ctx, exec, s) + }) + + q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { + vals := make([]bob.Expression, 7) + if s.Created.IsValue() { + vals[0] = psql.Arg(s.Created.MustGet()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if s.CreatorID.IsValue() { + vals[1] = psql.Arg(s.CreatorID.MustGet()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Deleted.IsUnset() { + vals[2] = psql.Arg(s.Deleted.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.DeletorID.IsUnset() { + vals[3] = psql.Arg(s.DeletorID.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[4] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if s.Version.IsValue() { + vals[5] = psql.Arg(s.Version.MustGet()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if s.UUID.IsValue() { + vals[6] = psql.Arg(s.UUID.MustGet()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s NoteImageSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s NoteImageSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 7) + + if s.Created.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + + if s.CreatorID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator_id")...), + psql.Arg(s.CreatorID), + }}) + } + + if !s.Deleted.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "deleted")...), + psql.Arg(s.Deleted), + }}) + } + + if !s.DeletorID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "deletor_id")...), + psql.Arg(s.DeletorID), + }}) + } + + if s.OrganizationID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "organization_id")...), + psql.Arg(s.OrganizationID), + }}) + } + + if s.Version.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "version")...), + psql.Arg(s.Version), + }}) + } + + if s.UUID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "uuid")...), + psql.Arg(s.UUID), + }}) + } + + return exprs +} + +// FindNoteImage retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindNoteImage(ctx context.Context, exec bob.Executor, VersionPK int32, UUIDPK uuid.UUID, cols ...string) (*NoteImage, error) { + if len(cols) == 0 { + return NoteImages.Query( + sm.Where(NoteImages.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Where(NoteImages.Columns.UUID.EQ(psql.Arg(UUIDPK))), + ).One(ctx, exec) + } + + return NoteImages.Query( + sm.Where(NoteImages.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Where(NoteImages.Columns.UUID.EQ(psql.Arg(UUIDPK))), + sm.Columns(NoteImages.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// NoteImageExists checks the presence of a single record by primary key +func NoteImageExists(ctx context.Context, exec bob.Executor, VersionPK int32, UUIDPK uuid.UUID) (bool, error) { + return NoteImages.Query( + sm.Where(NoteImages.Columns.Version.EQ(psql.Arg(VersionPK))), + sm.Where(NoteImages.Columns.UUID.EQ(psql.Arg(UUIDPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after NoteImage is retrieved from the database +func (o *NoteImage) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = NoteImages.AfterSelectHooks.RunHooks(ctx, exec, NoteImageSlice{o}) + case bob.QueryTypeInsert: + ctx, err = NoteImages.AfterInsertHooks.RunHooks(ctx, exec, NoteImageSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = NoteImages.AfterUpdateHooks.RunHooks(ctx, exec, NoteImageSlice{o}) + case bob.QueryTypeDelete: + ctx, err = NoteImages.AfterDeleteHooks.RunHooks(ctx, exec, NoteImageSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the NoteImage +func (o *NoteImage) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.Version, + o.UUID, + ) +} + +func (o *NoteImage) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("note_image", "version"), psql.Quote("note_image", "uuid")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { + return o.primaryKeyVals().WriteSQL(ctx, w, d, start) + })) +} + +// Update uses an executor to update the NoteImage +func (o *NoteImage) Update(ctx context.Context, exec bob.Executor, s *NoteImageSetter) error { + v, err := NoteImages.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 NoteImage record with an executor +func (o *NoteImage) Delete(ctx context.Context, exec bob.Executor) error { + _, err := NoteImages.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the NoteImage using the executor +func (o *NoteImage) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := NoteImages.Query( + sm.Where(NoteImages.Columns.Version.EQ(psql.Arg(o.Version))), + sm.Where(NoteImages.Columns.UUID.EQ(psql.Arg(o.UUID))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after NoteImageSlice is retrieved from the database +func (o NoteImageSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = NoteImages.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = NoteImages.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = NoteImages.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = NoteImages.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o NoteImageSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("note_image", "version"), psql.Quote("note_image", "uuid")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 NoteImageSlice) copyMatchingRows(from ...*NoteImage) { + for i, old := range o { + for _, new := range from { + if new.Version != old.Version { + continue + } + if new.UUID != old.UUID { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o NoteImageSlice) 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 NoteImages.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 *NoteImage: + o.copyMatchingRows(retrieved) + case []*NoteImage: + o.copyMatchingRows(retrieved...) + case NoteImageSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a NoteImage or a slice of NoteImage + // then run the AfterUpdateHooks on the slice + _, err = NoteImages.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o NoteImageSlice) 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 NoteImages.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 *NoteImage: + o.copyMatchingRows(retrieved) + case []*NoteImage: + o.copyMatchingRows(retrieved...) + case NoteImageSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a NoteImage or a slice of NoteImage + // then run the AfterDeleteHooks on the slice + _, err = NoteImages.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o NoteImageSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals NoteImageSetter) error { + if len(o) == 0 { + return nil + } + + _, err := NoteImages.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o NoteImageSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := NoteImages.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o NoteImageSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := NoteImages.Query(sm.Where(o.pkIN())).All(ctx, exec) + if err != nil { + return err + } + + o.copyMatchingRows(o2...) + + return nil +} + +// CreatorUser starts a query for related objects on user_ +func (o *NoteImage) CreatorUser(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery { + return Users.Query(append(mods, + sm.Where(Users.Columns.ID.EQ(psql.Arg(o.CreatorID))), + )...) +} + +func (os NoteImageSlice) CreatorUser(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery { + pkCreatorID := make(pgtypes.Array[int32], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkCreatorID = append(pkCreatorID, o.CreatorID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkCreatorID), "integer[]")), + )) + + return Users.Query(append(mods, + sm.Where(psql.Group(Users.Columns.ID).OP("IN", PKArgExpr)), + )...) +} + +// DeletorUser starts a query for related objects on user_ +func (o *NoteImage) DeletorUser(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery { + return Users.Query(append(mods, + sm.Where(Users.Columns.ID.EQ(psql.Arg(o.DeletorID))), + )...) +} + +func (os NoteImageSlice) DeletorUser(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery { + pkDeletorID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkDeletorID = append(pkDeletorID, o.DeletorID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkDeletorID), "integer[]")), + )) + + return Users.Query(append(mods, + sm.Where(psql.Group(Users.Columns.ID).OP("IN", PKArgExpr)), + )...) +} + +// Organization starts a query for related objects on organization +func (o *NoteImage) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os NoteImageSlice) 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)), + )...) +} + +// NoteImageBreadcrumbs starts a query for related objects on note_image_breadcrumb +func (o *NoteImage) NoteImageBreadcrumbs(mods ...bob.Mod[*dialect.SelectQuery]) NoteImageBreadcrumbsQuery { + return NoteImageBreadcrumbs.Query(append(mods, + sm.Where(NoteImageBreadcrumbs.Columns.NoteImageVersion.EQ(psql.Arg(o.Version))), sm.Where(NoteImageBreadcrumbs.Columns.NoteImageUUID.EQ(psql.Arg(o.UUID))), + )...) +} + +func (os NoteImageSlice) NoteImageBreadcrumbs(mods ...bob.Mod[*dialect.SelectQuery]) NoteImageBreadcrumbsQuery { + pkVersion := make(pgtypes.Array[int32], 0, len(os)) + + pkUUID := make(pgtypes.Array[uuid.UUID], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkVersion = append(pkVersion, o.Version) + pkUUID = append(pkUUID, o.UUID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkVersion), "integer[]")), + psql.F("unnest", psql.Cast(psql.Arg(pkUUID), "uuid[]")), + )) + + return NoteImageBreadcrumbs.Query(append(mods, + sm.Where(psql.Group(NoteImageBreadcrumbs.Columns.NoteImageVersion, NoteImageBreadcrumbs.Columns.NoteImageUUID).OP("IN", PKArgExpr)), + )...) +} + +// NoteImageData starts a query for related objects on note_image_data +func (o *NoteImage) NoteImageData(mods ...bob.Mod[*dialect.SelectQuery]) NoteImageDataQuery { + return NoteImageData.Query(append(mods, + sm.Where(NoteImageData.Columns.NoteImageVersion.EQ(psql.Arg(o.Version))), sm.Where(NoteImageData.Columns.NoteImageUUID.EQ(psql.Arg(o.UUID))), + )...) +} + +func (os NoteImageSlice) NoteImageData(mods ...bob.Mod[*dialect.SelectQuery]) NoteImageDataQuery { + pkVersion := make(pgtypes.Array[int32], 0, len(os)) + + pkUUID := make(pgtypes.Array[uuid.UUID], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkVersion = append(pkVersion, o.Version) + pkUUID = append(pkUUID, o.UUID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkVersion), "integer[]")), + psql.F("unnest", psql.Cast(psql.Arg(pkUUID), "uuid[]")), + )) + + return NoteImageData.Query(append(mods, + sm.Where(psql.Group(NoteImageData.Columns.NoteImageVersion, NoteImageData.Columns.NoteImageUUID).OP("IN", PKArgExpr)), + )...) +} + +func attachNoteImageCreatorUser0(ctx context.Context, exec bob.Executor, count int, noteImage0 *NoteImage, user1 *User) (*NoteImage, error) { + setter := &NoteImageSetter{ + CreatorID: omit.From(user1.ID), + } + + err := noteImage0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachNoteImageCreatorUser0: %w", err) + } + + return noteImage0, nil +} + +func (noteImage0 *NoteImage) InsertCreatorUser(ctx context.Context, exec bob.Executor, related *UserSetter) error { + var err error + + user1, err := Users.Insert(related).One(ctx, exec) + if err != nil { + return fmt.Errorf("inserting related objects: %w", err) + } + + _, err = attachNoteImageCreatorUser0(ctx, exec, 1, noteImage0, user1) + if err != nil { + return err + } + + noteImage0.R.CreatorUser = user1 + + user1.R.CreatorNoteImages = append(user1.R.CreatorNoteImages, noteImage0) + + return nil +} + +func (noteImage0 *NoteImage) AttachCreatorUser(ctx context.Context, exec bob.Executor, user1 *User) error { + var err error + + _, err = attachNoteImageCreatorUser0(ctx, exec, 1, noteImage0, user1) + if err != nil { + return err + } + + noteImage0.R.CreatorUser = user1 + + user1.R.CreatorNoteImages = append(user1.R.CreatorNoteImages, noteImage0) + + return nil +} + +func attachNoteImageDeletorUser0(ctx context.Context, exec bob.Executor, count int, noteImage0 *NoteImage, user1 *User) (*NoteImage, error) { + setter := &NoteImageSetter{ + DeletorID: omitnull.From(user1.ID), + } + + err := noteImage0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachNoteImageDeletorUser0: %w", err) + } + + return noteImage0, nil +} + +func (noteImage0 *NoteImage) InsertDeletorUser(ctx context.Context, exec bob.Executor, related *UserSetter) error { + var err error + + user1, err := Users.Insert(related).One(ctx, exec) + if err != nil { + return fmt.Errorf("inserting related objects: %w", err) + } + + _, err = attachNoteImageDeletorUser0(ctx, exec, 1, noteImage0, user1) + if err != nil { + return err + } + + noteImage0.R.DeletorUser = user1 + + user1.R.DeletorNoteImages = append(user1.R.DeletorNoteImages, noteImage0) + + return nil +} + +func (noteImage0 *NoteImage) AttachDeletorUser(ctx context.Context, exec bob.Executor, user1 *User) error { + var err error + + _, err = attachNoteImageDeletorUser0(ctx, exec, 1, noteImage0, user1) + if err != nil { + return err + } + + noteImage0.R.DeletorUser = user1 + + user1.R.DeletorNoteImages = append(user1.R.DeletorNoteImages, noteImage0) + + return nil +} + +func attachNoteImageOrganization0(ctx context.Context, exec bob.Executor, count int, noteImage0 *NoteImage, organization1 *Organization) (*NoteImage, error) { + setter := &NoteImageSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := noteImage0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachNoteImageOrganization0: %w", err) + } + + return noteImage0, nil +} + +func (noteImage0 *NoteImage) 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 = attachNoteImageOrganization0(ctx, exec, 1, noteImage0, organization1) + if err != nil { + return err + } + + noteImage0.R.Organization = organization1 + + organization1.R.NoteImages = append(organization1.R.NoteImages, noteImage0) + + return nil +} + +func (noteImage0 *NoteImage) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachNoteImageOrganization0(ctx, exec, 1, noteImage0, organization1) + if err != nil { + return err + } + + noteImage0.R.Organization = organization1 + + organization1.R.NoteImages = append(organization1.R.NoteImages, noteImage0) + + return nil +} + +func insertNoteImageNoteImageBreadcrumbs0(ctx context.Context, exec bob.Executor, noteImageBreadcrumbs1 []*NoteImageBreadcrumbSetter, noteImage0 *NoteImage) (NoteImageBreadcrumbSlice, error) { + for i := range noteImageBreadcrumbs1 { + noteImageBreadcrumbs1[i].NoteImageVersion = omit.From(noteImage0.Version) + noteImageBreadcrumbs1[i].NoteImageUUID = omit.From(noteImage0.UUID) + } + + ret, err := NoteImageBreadcrumbs.Insert(bob.ToMods(noteImageBreadcrumbs1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertNoteImageNoteImageBreadcrumbs0: %w", err) + } + + return ret, nil +} + +func attachNoteImageNoteImageBreadcrumbs0(ctx context.Context, exec bob.Executor, count int, noteImageBreadcrumbs1 NoteImageBreadcrumbSlice, noteImage0 *NoteImage) (NoteImageBreadcrumbSlice, error) { + setter := &NoteImageBreadcrumbSetter{ + NoteImageVersion: omit.From(noteImage0.Version), + NoteImageUUID: omit.From(noteImage0.UUID), + } + + err := noteImageBreadcrumbs1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachNoteImageNoteImageBreadcrumbs0: %w", err) + } + + return noteImageBreadcrumbs1, nil +} + +func (noteImage0 *NoteImage) InsertNoteImageBreadcrumbs(ctx context.Context, exec bob.Executor, related ...*NoteImageBreadcrumbSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + noteImageBreadcrumbs1, err := insertNoteImageNoteImageBreadcrumbs0(ctx, exec, related, noteImage0) + if err != nil { + return err + } + + noteImage0.R.NoteImageBreadcrumbs = append(noteImage0.R.NoteImageBreadcrumbs, noteImageBreadcrumbs1...) + + for _, rel := range noteImageBreadcrumbs1 { + rel.R.NoteImage = noteImage0 + } + return nil +} + +func (noteImage0 *NoteImage) AttachNoteImageBreadcrumbs(ctx context.Context, exec bob.Executor, related ...*NoteImageBreadcrumb) error { + if len(related) == 0 { + return nil + } + + var err error + noteImageBreadcrumbs1 := NoteImageBreadcrumbSlice(related) + + _, err = attachNoteImageNoteImageBreadcrumbs0(ctx, exec, len(related), noteImageBreadcrumbs1, noteImage0) + if err != nil { + return err + } + + noteImage0.R.NoteImageBreadcrumbs = append(noteImage0.R.NoteImageBreadcrumbs, noteImageBreadcrumbs1...) + + for _, rel := range related { + rel.R.NoteImage = noteImage0 + } + + return nil +} + +func insertNoteImageNoteImageData0(ctx context.Context, exec bob.Executor, noteImageData1 []*NoteImageDatumSetter, noteImage0 *NoteImage) (NoteImageDatumSlice, error) { + for i := range noteImageData1 { + noteImageData1[i].NoteImageVersion = omit.From(noteImage0.Version) + noteImageData1[i].NoteImageUUID = omit.From(noteImage0.UUID) + } + + ret, err := NoteImageData.Insert(bob.ToMods(noteImageData1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertNoteImageNoteImageData0: %w", err) + } + + return ret, nil +} + +func attachNoteImageNoteImageData0(ctx context.Context, exec bob.Executor, count int, noteImageData1 NoteImageDatumSlice, noteImage0 *NoteImage) (NoteImageDatumSlice, error) { + setter := &NoteImageDatumSetter{ + NoteImageVersion: omit.From(noteImage0.Version), + NoteImageUUID: omit.From(noteImage0.UUID), + } + + err := noteImageData1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachNoteImageNoteImageData0: %w", err) + } + + return noteImageData1, nil +} + +func (noteImage0 *NoteImage) InsertNoteImageData(ctx context.Context, exec bob.Executor, related ...*NoteImageDatumSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + noteImageData1, err := insertNoteImageNoteImageData0(ctx, exec, related, noteImage0) + if err != nil { + return err + } + + noteImage0.R.NoteImageData = append(noteImage0.R.NoteImageData, noteImageData1...) + + for _, rel := range noteImageData1 { + rel.R.NoteImage = noteImage0 + } + return nil +} + +func (noteImage0 *NoteImage) AttachNoteImageData(ctx context.Context, exec bob.Executor, related ...*NoteImageDatum) error { + if len(related) == 0 { + return nil + } + + var err error + noteImageData1 := NoteImageDatumSlice(related) + + _, err = attachNoteImageNoteImageData0(ctx, exec, len(related), noteImageData1, noteImage0) + if err != nil { + return err + } + + noteImage0.R.NoteImageData = append(noteImage0.R.NoteImageData, noteImageData1...) + + for _, rel := range related { + rel.R.NoteImage = noteImage0 + } + + return nil +} + +type noteImageWhere[Q psql.Filterable] struct { + Created psql.WhereMod[Q, time.Time] + CreatorID psql.WhereMod[Q, int32] + Deleted psql.WhereNullMod[Q, time.Time] + DeletorID psql.WhereNullMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] + Version psql.WhereMod[Q, int32] + UUID psql.WhereMod[Q, uuid.UUID] +} + +func (noteImageWhere[Q]) AliasedAs(alias string) noteImageWhere[Q] { + return buildNoteImageWhere[Q](buildNoteImageColumns(alias)) +} + +func buildNoteImageWhere[Q psql.Filterable](cols noteImageColumns) noteImageWhere[Q] { + return noteImageWhere[Q]{ + Created: psql.Where[Q, time.Time](cols.Created), + CreatorID: psql.Where[Q, int32](cols.CreatorID), + Deleted: psql.WhereNull[Q, time.Time](cols.Deleted), + DeletorID: psql.WhereNull[Q, int32](cols.DeletorID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + Version: psql.Where[Q, int32](cols.Version), + UUID: psql.Where[Q, uuid.UUID](cols.UUID), + } +} + +func (o *NoteImage) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "CreatorUser": + rel, ok := retrieved.(*User) + if !ok { + return fmt.Errorf("noteImage cannot load %T as %q", retrieved, name) + } + + o.R.CreatorUser = rel + + if rel != nil { + rel.R.CreatorNoteImages = NoteImageSlice{o} + } + return nil + case "DeletorUser": + rel, ok := retrieved.(*User) + if !ok { + return fmt.Errorf("noteImage cannot load %T as %q", retrieved, name) + } + + o.R.DeletorUser = rel + + if rel != nil { + rel.R.DeletorNoteImages = NoteImageSlice{o} + } + return nil + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("noteImage cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.NoteImages = NoteImageSlice{o} + } + return nil + case "NoteImageBreadcrumbs": + rels, ok := retrieved.(NoteImageBreadcrumbSlice) + if !ok { + return fmt.Errorf("noteImage cannot load %T as %q", retrieved, name) + } + + o.R.NoteImageBreadcrumbs = rels + + for _, rel := range rels { + if rel != nil { + rel.R.NoteImage = o + } + } + return nil + case "NoteImageData": + rels, ok := retrieved.(NoteImageDatumSlice) + if !ok { + return fmt.Errorf("noteImage cannot load %T as %q", retrieved, name) + } + + o.R.NoteImageData = rels + + for _, rel := range rels { + if rel != nil { + rel.R.NoteImage = o + } + } + return nil + default: + return fmt.Errorf("noteImage has no relationship %q", name) + } +} + +type noteImagePreloader struct { + CreatorUser func(...psql.PreloadOption) psql.Preloader + DeletorUser func(...psql.PreloadOption) psql.Preloader + Organization func(...psql.PreloadOption) psql.Preloader +} + +func buildNoteImagePreloader() noteImagePreloader { + return noteImagePreloader{ + CreatorUser: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*User, UserSlice](psql.PreloadRel{ + Name: "CreatorUser", + Sides: []psql.PreloadSide{ + { + From: NoteImages, + To: Users, + FromColumns: []string{"creator_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Users.Columns.Names(), opts...) + }, + DeletorUser: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*User, UserSlice](psql.PreloadRel{ + Name: "DeletorUser", + Sides: []psql.PreloadSide{ + { + From: NoteImages, + To: Users, + FromColumns: []string{"deletor_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Users.Columns.Names(), opts...) + }, + Organization: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{ + Name: "Organization", + Sides: []psql.PreloadSide{ + { + From: NoteImages, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + } +} + +type noteImageThenLoader[Q orm.Loadable] struct { + CreatorUser func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + DeletorUser func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + NoteImageBreadcrumbs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + NoteImageData func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildNoteImageThenLoader[Q orm.Loadable]() noteImageThenLoader[Q] { + type CreatorUserLoadInterface interface { + LoadCreatorUser(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type DeletorUserLoadInterface interface { + LoadDeletorUser(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type NoteImageBreadcrumbsLoadInterface interface { + LoadNoteImageBreadcrumbs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type NoteImageDataLoadInterface interface { + LoadNoteImageData(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return noteImageThenLoader[Q]{ + CreatorUser: thenLoadBuilder[Q]( + "CreatorUser", + func(ctx context.Context, exec bob.Executor, retrieved CreatorUserLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadCreatorUser(ctx, exec, mods...) + }, + ), + DeletorUser: thenLoadBuilder[Q]( + "DeletorUser", + func(ctx context.Context, exec bob.Executor, retrieved DeletorUserLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadDeletorUser(ctx, exec, mods...) + }, + ), + 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...) + }, + ), + NoteImageBreadcrumbs: thenLoadBuilder[Q]( + "NoteImageBreadcrumbs", + func(ctx context.Context, exec bob.Executor, retrieved NoteImageBreadcrumbsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadNoteImageBreadcrumbs(ctx, exec, mods...) + }, + ), + NoteImageData: thenLoadBuilder[Q]( + "NoteImageData", + func(ctx context.Context, exec bob.Executor, retrieved NoteImageDataLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadNoteImageData(ctx, exec, mods...) + }, + ), + } +} + +// LoadCreatorUser loads the noteImage's CreatorUser into the .R struct +func (o *NoteImage) LoadCreatorUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.CreatorUser = nil + + related, err := o.CreatorUser(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.CreatorNoteImages = NoteImageSlice{o} + + o.R.CreatorUser = related + return nil +} + +// LoadCreatorUser loads the noteImage's CreatorUser into the .R struct +func (os NoteImageSlice) LoadCreatorUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + users, err := os.CreatorUser(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range users { + + if !(o.CreatorID == rel.ID) { + continue + } + + rel.R.CreatorNoteImages = append(rel.R.CreatorNoteImages, o) + + o.R.CreatorUser = rel + break + } + } + + return nil +} + +// LoadDeletorUser loads the noteImage's DeletorUser into the .R struct +func (o *NoteImage) LoadDeletorUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.DeletorUser = nil + + related, err := o.DeletorUser(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.DeletorNoteImages = NoteImageSlice{o} + + o.R.DeletorUser = related + return nil +} + +// LoadDeletorUser loads the noteImage's DeletorUser into the .R struct +func (os NoteImageSlice) LoadDeletorUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + users, err := os.DeletorUser(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range users { + if !o.DeletorID.IsValue() { + continue + } + + if !(o.DeletorID.IsValue() && o.DeletorID.MustGet() == rel.ID) { + continue + } + + rel.R.DeletorNoteImages = append(rel.R.DeletorNoteImages, o) + + o.R.DeletorUser = rel + break + } + } + + return nil +} + +// LoadOrganization loads the noteImage's Organization into the .R struct +func (o *NoteImage) 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.NoteImages = NoteImageSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the noteImage's Organization into the .R struct +func (os NoteImageSlice) 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.NoteImages = append(rel.R.NoteImages, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +// LoadNoteImageBreadcrumbs loads the noteImage's NoteImageBreadcrumbs into the .R struct +func (o *NoteImage) LoadNoteImageBreadcrumbs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.NoteImageBreadcrumbs = nil + + related, err := o.NoteImageBreadcrumbs(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.NoteImage = o + } + + o.R.NoteImageBreadcrumbs = related + return nil +} + +// LoadNoteImageBreadcrumbs loads the noteImage's NoteImageBreadcrumbs into the .R struct +func (os NoteImageSlice) LoadNoteImageBreadcrumbs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + noteImageBreadcrumbs, err := os.NoteImageBreadcrumbs(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.NoteImageBreadcrumbs = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range noteImageBreadcrumbs { + + if !(o.Version == rel.NoteImageVersion) { + continue + } + + if !(o.UUID == rel.NoteImageUUID) { + continue + } + + rel.R.NoteImage = o + + o.R.NoteImageBreadcrumbs = append(o.R.NoteImageBreadcrumbs, rel) + } + } + + return nil +} + +// LoadNoteImageData loads the noteImage's NoteImageData into the .R struct +func (o *NoteImage) LoadNoteImageData(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.NoteImageData = nil + + related, err := o.NoteImageData(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.NoteImage = o + } + + o.R.NoteImageData = related + return nil +} + +// LoadNoteImageData loads the noteImage's NoteImageData into the .R struct +func (os NoteImageSlice) LoadNoteImageData(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + noteImageData, err := os.NoteImageData(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.NoteImageData = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range noteImageData { + + if !(o.Version == rel.NoteImageVersion) { + continue + } + + if !(o.UUID == rel.NoteImageUUID) { + continue + } + + rel.R.NoteImage = o + + o.R.NoteImageData = append(o.R.NoteImageData, rel) + } + } + + return nil +} + +type noteImageJoins[Q dialect.Joinable] struct { + typ string + CreatorUser modAs[Q, userColumns] + DeletorUser modAs[Q, userColumns] + Organization modAs[Q, organizationColumns] + NoteImageBreadcrumbs modAs[Q, noteImageBreadcrumbColumns] + NoteImageData modAs[Q, noteImageDatumColumns] +} + +func (j noteImageJoins[Q]) aliasedAs(alias string) noteImageJoins[Q] { + return buildNoteImageJoins[Q](buildNoteImageColumns(alias), j.typ) +} + +func buildNoteImageJoins[Q dialect.Joinable](cols noteImageColumns, typ string) noteImageJoins[Q] { + return noteImageJoins[Q]{ + typ: typ, + CreatorUser: modAs[Q, userColumns]{ + c: Users.Columns, + f: func(to userColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, Users.Name().As(to.Alias())).On( + to.ID.EQ(cols.CreatorID), + )) + } + + return mods + }, + }, + DeletorUser: modAs[Q, userColumns]{ + c: Users.Columns, + f: func(to userColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, Users.Name().As(to.Alias())).On( + to.ID.EQ(cols.DeletorID), + )) + } + + return mods + }, + }, + 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 + }, + }, + NoteImageBreadcrumbs: modAs[Q, noteImageBreadcrumbColumns]{ + c: NoteImageBreadcrumbs.Columns, + f: func(to noteImageBreadcrumbColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, NoteImageBreadcrumbs.Name().As(to.Alias())).On( + to.NoteImageVersion.EQ(cols.Version), to.NoteImageUUID.EQ(cols.UUID), + )) + } + + return mods + }, + }, + NoteImageData: modAs[Q, noteImageDatumColumns]{ + c: NoteImageData.Columns, + f: func(to noteImageDatumColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, NoteImageData.Name().As(to.Alias())).On( + to.NoteImageVersion.EQ(cols.Version), to.NoteImageUUID.EQ(cols.UUID), + )) + } + + return mods + }, + }, + } +} diff --git a/db/models/note_image_breadcrumb.bob.go b/db/models/note_image_breadcrumb.bob.go new file mode 100644 index 00000000..8c3d881d --- /dev/null +++ b/db/models/note_image_breadcrumb.bob.go @@ -0,0 +1,731 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package models + +import ( + "context" + "fmt" + "io" + "time" + + "github.com/aarondl/opt/omit" + "github.com/google/uuid" + "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" +) + +// NoteImageBreadcrumb is an object representing the database table. +type NoteImageBreadcrumb struct { + Cell string `db:"cell" ` + Created time.Time `db:"created" ` + ManuallySelected bool `db:"manually_selected" ` + NoteImageVersion int32 `db:"note_image_version,pk" ` + NoteImageUUID uuid.UUID `db:"note_image_uuid,pk" ` + Position int32 `db:"position,pk" ` + + R noteImageBreadcrumbR `db:"-" ` +} + +// NoteImageBreadcrumbSlice is an alias for a slice of pointers to NoteImageBreadcrumb. +// This should almost always be used instead of []*NoteImageBreadcrumb. +type NoteImageBreadcrumbSlice []*NoteImageBreadcrumb + +// NoteImageBreadcrumbs contains methods to work with the note_image_breadcrumb table +var NoteImageBreadcrumbs = psql.NewTablex[*NoteImageBreadcrumb, NoteImageBreadcrumbSlice, *NoteImageBreadcrumbSetter]("", "note_image_breadcrumb", buildNoteImageBreadcrumbColumns("note_image_breadcrumb")) + +// NoteImageBreadcrumbsQuery is a query on the note_image_breadcrumb table +type NoteImageBreadcrumbsQuery = *psql.ViewQuery[*NoteImageBreadcrumb, NoteImageBreadcrumbSlice] + +// noteImageBreadcrumbR is where relationships are stored. +type noteImageBreadcrumbR struct { + NoteImage *NoteImage // note_image_breadcrumb.note_image_breadcrumb_note_image_version_note_image_uuid_fkey +} + +func buildNoteImageBreadcrumbColumns(alias string) noteImageBreadcrumbColumns { + return noteImageBreadcrumbColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "cell", "created", "manually_selected", "note_image_version", "note_image_uuid", "position", + ).WithParent("note_image_breadcrumb"), + tableAlias: alias, + Cell: psql.Quote(alias, "cell"), + Created: psql.Quote(alias, "created"), + ManuallySelected: psql.Quote(alias, "manually_selected"), + NoteImageVersion: psql.Quote(alias, "note_image_version"), + NoteImageUUID: psql.Quote(alias, "note_image_uuid"), + Position: psql.Quote(alias, "position"), + } +} + +type noteImageBreadcrumbColumns struct { + expr.ColumnsExpr + tableAlias string + Cell psql.Expression + Created psql.Expression + ManuallySelected psql.Expression + NoteImageVersion psql.Expression + NoteImageUUID psql.Expression + Position psql.Expression +} + +func (c noteImageBreadcrumbColumns) Alias() string { + return c.tableAlias +} + +func (noteImageBreadcrumbColumns) AliasedAs(alias string) noteImageBreadcrumbColumns { + return buildNoteImageBreadcrumbColumns(alias) +} + +// NoteImageBreadcrumbSetter is used for insert/upsert/update operations +// All values are optional, and do not have to be set +// Generated columns are not included +type NoteImageBreadcrumbSetter struct { + Cell omit.Val[string] `db:"cell" ` + Created omit.Val[time.Time] `db:"created" ` + ManuallySelected omit.Val[bool] `db:"manually_selected" ` + NoteImageVersion omit.Val[int32] `db:"note_image_version,pk" ` + NoteImageUUID omit.Val[uuid.UUID] `db:"note_image_uuid,pk" ` + Position omit.Val[int32] `db:"position,pk" ` +} + +func (s NoteImageBreadcrumbSetter) SetColumns() []string { + vals := make([]string, 0, 6) + if s.Cell.IsValue() { + vals = append(vals, "cell") + } + if s.Created.IsValue() { + vals = append(vals, "created") + } + if s.ManuallySelected.IsValue() { + vals = append(vals, "manually_selected") + } + if s.NoteImageVersion.IsValue() { + vals = append(vals, "note_image_version") + } + if s.NoteImageUUID.IsValue() { + vals = append(vals, "note_image_uuid") + } + if s.Position.IsValue() { + vals = append(vals, "position") + } + return vals +} + +func (s NoteImageBreadcrumbSetter) Overwrite(t *NoteImageBreadcrumb) { + if s.Cell.IsValue() { + t.Cell = s.Cell.MustGet() + } + if s.Created.IsValue() { + t.Created = s.Created.MustGet() + } + if s.ManuallySelected.IsValue() { + t.ManuallySelected = s.ManuallySelected.MustGet() + } + if s.NoteImageVersion.IsValue() { + t.NoteImageVersion = s.NoteImageVersion.MustGet() + } + if s.NoteImageUUID.IsValue() { + t.NoteImageUUID = s.NoteImageUUID.MustGet() + } + if s.Position.IsValue() { + t.Position = s.Position.MustGet() + } +} + +func (s *NoteImageBreadcrumbSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return NoteImageBreadcrumbs.BeforeInsertHooks.RunHooks(ctx, exec, s) + }) + + q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { + vals := make([]bob.Expression, 6) + if s.Cell.IsValue() { + vals[0] = psql.Arg(s.Cell.MustGet()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if s.Created.IsValue() { + vals[1] = psql.Arg(s.Created.MustGet()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if s.ManuallySelected.IsValue() { + vals[2] = psql.Arg(s.ManuallySelected.MustGet()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if s.NoteImageVersion.IsValue() { + vals[3] = psql.Arg(s.NoteImageVersion.MustGet()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if s.NoteImageUUID.IsValue() { + vals[4] = psql.Arg(s.NoteImageUUID.MustGet()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if s.Position.IsValue() { + vals[5] = psql.Arg(s.Position.MustGet()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s NoteImageBreadcrumbSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s NoteImageBreadcrumbSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 6) + + if s.Cell.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "cell")...), + psql.Arg(s.Cell), + }}) + } + + if s.Created.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + + if s.ManuallySelected.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "manually_selected")...), + psql.Arg(s.ManuallySelected), + }}) + } + + if s.NoteImageVersion.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "note_image_version")...), + psql.Arg(s.NoteImageVersion), + }}) + } + + if s.NoteImageUUID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "note_image_uuid")...), + psql.Arg(s.NoteImageUUID), + }}) + } + + if s.Position.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "position")...), + psql.Arg(s.Position), + }}) + } + + return exprs +} + +// FindNoteImageBreadcrumb retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindNoteImageBreadcrumb(ctx context.Context, exec bob.Executor, NoteImageVersionPK int32, NoteImageUUIDPK uuid.UUID, PositionPK int32, cols ...string) (*NoteImageBreadcrumb, error) { + if len(cols) == 0 { + return NoteImageBreadcrumbs.Query( + sm.Where(NoteImageBreadcrumbs.Columns.NoteImageVersion.EQ(psql.Arg(NoteImageVersionPK))), + sm.Where(NoteImageBreadcrumbs.Columns.NoteImageUUID.EQ(psql.Arg(NoteImageUUIDPK))), + sm.Where(NoteImageBreadcrumbs.Columns.Position.EQ(psql.Arg(PositionPK))), + ).One(ctx, exec) + } + + return NoteImageBreadcrumbs.Query( + sm.Where(NoteImageBreadcrumbs.Columns.NoteImageVersion.EQ(psql.Arg(NoteImageVersionPK))), + sm.Where(NoteImageBreadcrumbs.Columns.NoteImageUUID.EQ(psql.Arg(NoteImageUUIDPK))), + sm.Where(NoteImageBreadcrumbs.Columns.Position.EQ(psql.Arg(PositionPK))), + sm.Columns(NoteImageBreadcrumbs.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// NoteImageBreadcrumbExists checks the presence of a single record by primary key +func NoteImageBreadcrumbExists(ctx context.Context, exec bob.Executor, NoteImageVersionPK int32, NoteImageUUIDPK uuid.UUID, PositionPK int32) (bool, error) { + return NoteImageBreadcrumbs.Query( + sm.Where(NoteImageBreadcrumbs.Columns.NoteImageVersion.EQ(psql.Arg(NoteImageVersionPK))), + sm.Where(NoteImageBreadcrumbs.Columns.NoteImageUUID.EQ(psql.Arg(NoteImageUUIDPK))), + sm.Where(NoteImageBreadcrumbs.Columns.Position.EQ(psql.Arg(PositionPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after NoteImageBreadcrumb is retrieved from the database +func (o *NoteImageBreadcrumb) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = NoteImageBreadcrumbs.AfterSelectHooks.RunHooks(ctx, exec, NoteImageBreadcrumbSlice{o}) + case bob.QueryTypeInsert: + ctx, err = NoteImageBreadcrumbs.AfterInsertHooks.RunHooks(ctx, exec, NoteImageBreadcrumbSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = NoteImageBreadcrumbs.AfterUpdateHooks.RunHooks(ctx, exec, NoteImageBreadcrumbSlice{o}) + case bob.QueryTypeDelete: + ctx, err = NoteImageBreadcrumbs.AfterDeleteHooks.RunHooks(ctx, exec, NoteImageBreadcrumbSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the NoteImageBreadcrumb +func (o *NoteImageBreadcrumb) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.NoteImageVersion, + o.NoteImageUUID, + o.Position, + ) +} + +func (o *NoteImageBreadcrumb) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("note_image_breadcrumb", "note_image_version"), psql.Quote("note_image_breadcrumb", "note_image_uuid"), psql.Quote("note_image_breadcrumb", "position")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { + return o.primaryKeyVals().WriteSQL(ctx, w, d, start) + })) +} + +// Update uses an executor to update the NoteImageBreadcrumb +func (o *NoteImageBreadcrumb) Update(ctx context.Context, exec bob.Executor, s *NoteImageBreadcrumbSetter) error { + v, err := NoteImageBreadcrumbs.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 NoteImageBreadcrumb record with an executor +func (o *NoteImageBreadcrumb) Delete(ctx context.Context, exec bob.Executor) error { + _, err := NoteImageBreadcrumbs.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the NoteImageBreadcrumb using the executor +func (o *NoteImageBreadcrumb) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := NoteImageBreadcrumbs.Query( + sm.Where(NoteImageBreadcrumbs.Columns.NoteImageVersion.EQ(psql.Arg(o.NoteImageVersion))), + sm.Where(NoteImageBreadcrumbs.Columns.NoteImageUUID.EQ(psql.Arg(o.NoteImageUUID))), + sm.Where(NoteImageBreadcrumbs.Columns.Position.EQ(psql.Arg(o.Position))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after NoteImageBreadcrumbSlice is retrieved from the database +func (o NoteImageBreadcrumbSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = NoteImageBreadcrumbs.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = NoteImageBreadcrumbs.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = NoteImageBreadcrumbs.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = NoteImageBreadcrumbs.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o NoteImageBreadcrumbSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("note_image_breadcrumb", "note_image_version"), psql.Quote("note_image_breadcrumb", "note_image_uuid"), psql.Quote("note_image_breadcrumb", "position")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 NoteImageBreadcrumbSlice) copyMatchingRows(from ...*NoteImageBreadcrumb) { + for i, old := range o { + for _, new := range from { + if new.NoteImageVersion != old.NoteImageVersion { + continue + } + if new.NoteImageUUID != old.NoteImageUUID { + continue + } + if new.Position != old.Position { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o NoteImageBreadcrumbSlice) 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 NoteImageBreadcrumbs.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 *NoteImageBreadcrumb: + o.copyMatchingRows(retrieved) + case []*NoteImageBreadcrumb: + o.copyMatchingRows(retrieved...) + case NoteImageBreadcrumbSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a NoteImageBreadcrumb or a slice of NoteImageBreadcrumb + // then run the AfterUpdateHooks on the slice + _, err = NoteImageBreadcrumbs.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o NoteImageBreadcrumbSlice) 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 NoteImageBreadcrumbs.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 *NoteImageBreadcrumb: + o.copyMatchingRows(retrieved) + case []*NoteImageBreadcrumb: + o.copyMatchingRows(retrieved...) + case NoteImageBreadcrumbSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a NoteImageBreadcrumb or a slice of NoteImageBreadcrumb + // then run the AfterDeleteHooks on the slice + _, err = NoteImageBreadcrumbs.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o NoteImageBreadcrumbSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals NoteImageBreadcrumbSetter) error { + if len(o) == 0 { + return nil + } + + _, err := NoteImageBreadcrumbs.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o NoteImageBreadcrumbSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := NoteImageBreadcrumbs.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o NoteImageBreadcrumbSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := NoteImageBreadcrumbs.Query(sm.Where(o.pkIN())).All(ctx, exec) + if err != nil { + return err + } + + o.copyMatchingRows(o2...) + + return nil +} + +// NoteImage starts a query for related objects on note_image +func (o *NoteImageBreadcrumb) NoteImage(mods ...bob.Mod[*dialect.SelectQuery]) NoteImagesQuery { + return NoteImages.Query(append(mods, + sm.Where(NoteImages.Columns.Version.EQ(psql.Arg(o.NoteImageVersion))), sm.Where(NoteImages.Columns.UUID.EQ(psql.Arg(o.NoteImageUUID))), + )...) +} + +func (os NoteImageBreadcrumbSlice) NoteImage(mods ...bob.Mod[*dialect.SelectQuery]) NoteImagesQuery { + pkNoteImageVersion := make(pgtypes.Array[int32], 0, len(os)) + + pkNoteImageUUID := make(pgtypes.Array[uuid.UUID], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkNoteImageVersion = append(pkNoteImageVersion, o.NoteImageVersion) + pkNoteImageUUID = append(pkNoteImageUUID, o.NoteImageUUID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkNoteImageVersion), "integer[]")), + psql.F("unnest", psql.Cast(psql.Arg(pkNoteImageUUID), "uuid[]")), + )) + + return NoteImages.Query(append(mods, + sm.Where(psql.Group(NoteImages.Columns.Version, NoteImages.Columns.UUID).OP("IN", PKArgExpr)), + )...) +} + +func attachNoteImageBreadcrumbNoteImage0(ctx context.Context, exec bob.Executor, count int, noteImageBreadcrumb0 *NoteImageBreadcrumb, noteImage1 *NoteImage) (*NoteImageBreadcrumb, error) { + setter := &NoteImageBreadcrumbSetter{ + NoteImageVersion: omit.From(noteImage1.Version), + NoteImageUUID: omit.From(noteImage1.UUID), + } + + err := noteImageBreadcrumb0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachNoteImageBreadcrumbNoteImage0: %w", err) + } + + return noteImageBreadcrumb0, nil +} + +func (noteImageBreadcrumb0 *NoteImageBreadcrumb) InsertNoteImage(ctx context.Context, exec bob.Executor, related *NoteImageSetter) error { + var err error + + noteImage1, err := NoteImages.Insert(related).One(ctx, exec) + if err != nil { + return fmt.Errorf("inserting related objects: %w", err) + } + + _, err = attachNoteImageBreadcrumbNoteImage0(ctx, exec, 1, noteImageBreadcrumb0, noteImage1) + if err != nil { + return err + } + + noteImageBreadcrumb0.R.NoteImage = noteImage1 + + noteImage1.R.NoteImageBreadcrumbs = append(noteImage1.R.NoteImageBreadcrumbs, noteImageBreadcrumb0) + + return nil +} + +func (noteImageBreadcrumb0 *NoteImageBreadcrumb) AttachNoteImage(ctx context.Context, exec bob.Executor, noteImage1 *NoteImage) error { + var err error + + _, err = attachNoteImageBreadcrumbNoteImage0(ctx, exec, 1, noteImageBreadcrumb0, noteImage1) + if err != nil { + return err + } + + noteImageBreadcrumb0.R.NoteImage = noteImage1 + + noteImage1.R.NoteImageBreadcrumbs = append(noteImage1.R.NoteImageBreadcrumbs, noteImageBreadcrumb0) + + return nil +} + +type noteImageBreadcrumbWhere[Q psql.Filterable] struct { + Cell psql.WhereMod[Q, string] + Created psql.WhereMod[Q, time.Time] + ManuallySelected psql.WhereMod[Q, bool] + NoteImageVersion psql.WhereMod[Q, int32] + NoteImageUUID psql.WhereMod[Q, uuid.UUID] + Position psql.WhereMod[Q, int32] +} + +func (noteImageBreadcrumbWhere[Q]) AliasedAs(alias string) noteImageBreadcrumbWhere[Q] { + return buildNoteImageBreadcrumbWhere[Q](buildNoteImageBreadcrumbColumns(alias)) +} + +func buildNoteImageBreadcrumbWhere[Q psql.Filterable](cols noteImageBreadcrumbColumns) noteImageBreadcrumbWhere[Q] { + return noteImageBreadcrumbWhere[Q]{ + Cell: psql.Where[Q, string](cols.Cell), + Created: psql.Where[Q, time.Time](cols.Created), + ManuallySelected: psql.Where[Q, bool](cols.ManuallySelected), + NoteImageVersion: psql.Where[Q, int32](cols.NoteImageVersion), + NoteImageUUID: psql.Where[Q, uuid.UUID](cols.NoteImageUUID), + Position: psql.Where[Q, int32](cols.Position), + } +} + +func (o *NoteImageBreadcrumb) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "NoteImage": + rel, ok := retrieved.(*NoteImage) + if !ok { + return fmt.Errorf("noteImageBreadcrumb cannot load %T as %q", retrieved, name) + } + + o.R.NoteImage = rel + + if rel != nil { + rel.R.NoteImageBreadcrumbs = NoteImageBreadcrumbSlice{o} + } + return nil + default: + return fmt.Errorf("noteImageBreadcrumb has no relationship %q", name) + } +} + +type noteImageBreadcrumbPreloader struct { + NoteImage func(...psql.PreloadOption) psql.Preloader +} + +func buildNoteImageBreadcrumbPreloader() noteImageBreadcrumbPreloader { + return noteImageBreadcrumbPreloader{ + NoteImage: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*NoteImage, NoteImageSlice](psql.PreloadRel{ + Name: "NoteImage", + Sides: []psql.PreloadSide{ + { + From: NoteImageBreadcrumbs, + To: NoteImages, + FromColumns: []string{"note_image_version", "note_image_uuid"}, + ToColumns: []string{"version", "uuid"}, + }, + }, + }, NoteImages.Columns.Names(), opts...) + }, + } +} + +type noteImageBreadcrumbThenLoader[Q orm.Loadable] struct { + NoteImage func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildNoteImageBreadcrumbThenLoader[Q orm.Loadable]() noteImageBreadcrumbThenLoader[Q] { + type NoteImageLoadInterface interface { + LoadNoteImage(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return noteImageBreadcrumbThenLoader[Q]{ + NoteImage: thenLoadBuilder[Q]( + "NoteImage", + func(ctx context.Context, exec bob.Executor, retrieved NoteImageLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadNoteImage(ctx, exec, mods...) + }, + ), + } +} + +// LoadNoteImage loads the noteImageBreadcrumb's NoteImage into the .R struct +func (o *NoteImageBreadcrumb) LoadNoteImage(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.NoteImage = nil + + related, err := o.NoteImage(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.NoteImageBreadcrumbs = NoteImageBreadcrumbSlice{o} + + o.R.NoteImage = related + return nil +} + +// LoadNoteImage loads the noteImageBreadcrumb's NoteImage into the .R struct +func (os NoteImageBreadcrumbSlice) LoadNoteImage(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + noteImages, err := os.NoteImage(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range noteImages { + + if !(o.NoteImageVersion == rel.Version) { + continue + } + + if !(o.NoteImageUUID == rel.UUID) { + continue + } + + rel.R.NoteImageBreadcrumbs = append(rel.R.NoteImageBreadcrumbs, o) + + o.R.NoteImage = rel + break + } + } + + return nil +} + +type noteImageBreadcrumbJoins[Q dialect.Joinable] struct { + typ string + NoteImage modAs[Q, noteImageColumns] +} + +func (j noteImageBreadcrumbJoins[Q]) aliasedAs(alias string) noteImageBreadcrumbJoins[Q] { + return buildNoteImageBreadcrumbJoins[Q](buildNoteImageBreadcrumbColumns(alias), j.typ) +} + +func buildNoteImageBreadcrumbJoins[Q dialect.Joinable](cols noteImageBreadcrumbColumns, typ string) noteImageBreadcrumbJoins[Q] { + return noteImageBreadcrumbJoins[Q]{ + typ: typ, + NoteImage: modAs[Q, noteImageColumns]{ + c: NoteImages.Columns, + f: func(to noteImageColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, NoteImages.Name().As(to.Alias())).On( + to.Version.EQ(cols.NoteImageVersion), to.UUID.EQ(cols.NoteImageUUID), + )) + } + + return mods + }, + }, + } +} diff --git a/db/models/note_image_data.bob.go b/db/models/note_image_data.bob.go new file mode 100644 index 00000000..2dee40f7 --- /dev/null +++ b/db/models/note_image_data.bob.go @@ -0,0 +1,682 @@ +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package models + +import ( + "context" + "fmt" + "io" + "time" + + enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" + "github.com/aarondl/opt/omit" + "github.com/google/uuid" + "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" +) + +// NoteImageDatum is an object representing the database table. +type NoteImageDatum struct { + Created time.Time `db:"created" ` + NoteImageVersion int32 `db:"note_image_version,pk" ` + NoteImageUUID uuid.UUID `db:"note_image_uuid,pk" ` + Type enums.Audiodatatype `db:"type_,pk" ` + + R noteImageDatumR `db:"-" ` +} + +// NoteImageDatumSlice is an alias for a slice of pointers to NoteImageDatum. +// This should almost always be used instead of []*NoteImageDatum. +type NoteImageDatumSlice []*NoteImageDatum + +// NoteImageData contains methods to work with the note_image_data table +var NoteImageData = psql.NewTablex[*NoteImageDatum, NoteImageDatumSlice, *NoteImageDatumSetter]("", "note_image_data", buildNoteImageDatumColumns("note_image_data")) + +// NoteImageDataQuery is a query on the note_image_data table +type NoteImageDataQuery = *psql.ViewQuery[*NoteImageDatum, NoteImageDatumSlice] + +// noteImageDatumR is where relationships are stored. +type noteImageDatumR struct { + NoteImage *NoteImage // note_image_data.note_image_data_note_image_version_note_image_uuid_fkey +} + +func buildNoteImageDatumColumns(alias string) noteImageDatumColumns { + return noteImageDatumColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "created", "note_image_version", "note_image_uuid", "type_", + ).WithParent("note_image_data"), + tableAlias: alias, + Created: psql.Quote(alias, "created"), + NoteImageVersion: psql.Quote(alias, "note_image_version"), + NoteImageUUID: psql.Quote(alias, "note_image_uuid"), + Type: psql.Quote(alias, "type_"), + } +} + +type noteImageDatumColumns struct { + expr.ColumnsExpr + tableAlias string + Created psql.Expression + NoteImageVersion psql.Expression + NoteImageUUID psql.Expression + Type psql.Expression +} + +func (c noteImageDatumColumns) Alias() string { + return c.tableAlias +} + +func (noteImageDatumColumns) AliasedAs(alias string) noteImageDatumColumns { + return buildNoteImageDatumColumns(alias) +} + +// NoteImageDatumSetter is used for insert/upsert/update operations +// All values are optional, and do not have to be set +// Generated columns are not included +type NoteImageDatumSetter struct { + Created omit.Val[time.Time] `db:"created" ` + NoteImageVersion omit.Val[int32] `db:"note_image_version,pk" ` + NoteImageUUID omit.Val[uuid.UUID] `db:"note_image_uuid,pk" ` + Type omit.Val[enums.Audiodatatype] `db:"type_,pk" ` +} + +func (s NoteImageDatumSetter) SetColumns() []string { + vals := make([]string, 0, 4) + if s.Created.IsValue() { + vals = append(vals, "created") + } + if s.NoteImageVersion.IsValue() { + vals = append(vals, "note_image_version") + } + if s.NoteImageUUID.IsValue() { + vals = append(vals, "note_image_uuid") + } + if s.Type.IsValue() { + vals = append(vals, "type_") + } + return vals +} + +func (s NoteImageDatumSetter) Overwrite(t *NoteImageDatum) { + if s.Created.IsValue() { + t.Created = s.Created.MustGet() + } + if s.NoteImageVersion.IsValue() { + t.NoteImageVersion = s.NoteImageVersion.MustGet() + } + if s.NoteImageUUID.IsValue() { + t.NoteImageUUID = s.NoteImageUUID.MustGet() + } + if s.Type.IsValue() { + t.Type = s.Type.MustGet() + } +} + +func (s *NoteImageDatumSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return NoteImageData.BeforeInsertHooks.RunHooks(ctx, exec, s) + }) + + q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { + vals := make([]bob.Expression, 4) + if s.Created.IsValue() { + vals[0] = psql.Arg(s.Created.MustGet()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if s.NoteImageVersion.IsValue() { + vals[1] = psql.Arg(s.NoteImageVersion.MustGet()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if s.NoteImageUUID.IsValue() { + vals[2] = psql.Arg(s.NoteImageUUID.MustGet()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if s.Type.IsValue() { + vals[3] = psql.Arg(s.Type.MustGet()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s NoteImageDatumSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s NoteImageDatumSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 4) + + if s.Created.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "created")...), + psql.Arg(s.Created), + }}) + } + + if s.NoteImageVersion.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "note_image_version")...), + psql.Arg(s.NoteImageVersion), + }}) + } + + if s.NoteImageUUID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "note_image_uuid")...), + psql.Arg(s.NoteImageUUID), + }}) + } + + if s.Type.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "type_")...), + psql.Arg(s.Type), + }}) + } + + return exprs +} + +// FindNoteImageDatum retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindNoteImageDatum(ctx context.Context, exec bob.Executor, NoteImageVersionPK int32, NoteImageUUIDPK uuid.UUID, TypePK enums.Audiodatatype, cols ...string) (*NoteImageDatum, error) { + if len(cols) == 0 { + return NoteImageData.Query( + sm.Where(NoteImageData.Columns.NoteImageVersion.EQ(psql.Arg(NoteImageVersionPK))), + sm.Where(NoteImageData.Columns.NoteImageUUID.EQ(psql.Arg(NoteImageUUIDPK))), + sm.Where(NoteImageData.Columns.Type.EQ(psql.Arg(TypePK))), + ).One(ctx, exec) + } + + return NoteImageData.Query( + sm.Where(NoteImageData.Columns.NoteImageVersion.EQ(psql.Arg(NoteImageVersionPK))), + sm.Where(NoteImageData.Columns.NoteImageUUID.EQ(psql.Arg(NoteImageUUIDPK))), + sm.Where(NoteImageData.Columns.Type.EQ(psql.Arg(TypePK))), + sm.Columns(NoteImageData.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// NoteImageDatumExists checks the presence of a single record by primary key +func NoteImageDatumExists(ctx context.Context, exec bob.Executor, NoteImageVersionPK int32, NoteImageUUIDPK uuid.UUID, TypePK enums.Audiodatatype) (bool, error) { + return NoteImageData.Query( + sm.Where(NoteImageData.Columns.NoteImageVersion.EQ(psql.Arg(NoteImageVersionPK))), + sm.Where(NoteImageData.Columns.NoteImageUUID.EQ(psql.Arg(NoteImageUUIDPK))), + sm.Where(NoteImageData.Columns.Type.EQ(psql.Arg(TypePK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after NoteImageDatum is retrieved from the database +func (o *NoteImageDatum) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = NoteImageData.AfterSelectHooks.RunHooks(ctx, exec, NoteImageDatumSlice{o}) + case bob.QueryTypeInsert: + ctx, err = NoteImageData.AfterInsertHooks.RunHooks(ctx, exec, NoteImageDatumSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = NoteImageData.AfterUpdateHooks.RunHooks(ctx, exec, NoteImageDatumSlice{o}) + case bob.QueryTypeDelete: + ctx, err = NoteImageData.AfterDeleteHooks.RunHooks(ctx, exec, NoteImageDatumSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the NoteImageDatum +func (o *NoteImageDatum) primaryKeyVals() bob.Expression { + return psql.ArgGroup( + o.NoteImageVersion, + o.NoteImageUUID, + o.Type, + ) +} + +func (o *NoteImageDatum) pkEQ() dialect.Expression { + return psql.Group(psql.Quote("note_image_data", "note_image_version"), psql.Quote("note_image_data", "note_image_uuid"), psql.Quote("note_image_data", "type_")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { + return o.primaryKeyVals().WriteSQL(ctx, w, d, start) + })) +} + +// Update uses an executor to update the NoteImageDatum +func (o *NoteImageDatum) Update(ctx context.Context, exec bob.Executor, s *NoteImageDatumSetter) error { + v, err := NoteImageData.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 NoteImageDatum record with an executor +func (o *NoteImageDatum) Delete(ctx context.Context, exec bob.Executor) error { + _, err := NoteImageData.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the NoteImageDatum using the executor +func (o *NoteImageDatum) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := NoteImageData.Query( + sm.Where(NoteImageData.Columns.NoteImageVersion.EQ(psql.Arg(o.NoteImageVersion))), + sm.Where(NoteImageData.Columns.NoteImageUUID.EQ(psql.Arg(o.NoteImageUUID))), + sm.Where(NoteImageData.Columns.Type.EQ(psql.Arg(o.Type))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after NoteImageDatumSlice is retrieved from the database +func (o NoteImageDatumSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = NoteImageData.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = NoteImageData.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = NoteImageData.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = NoteImageData.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o NoteImageDatumSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Group(psql.Quote("note_image_data", "note_image_version"), psql.Quote("note_image_data", "note_image_uuid"), psql.Quote("note_image_data", "type_")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, 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 NoteImageDatumSlice) copyMatchingRows(from ...*NoteImageDatum) { + for i, old := range o { + for _, new := range from { + if new.NoteImageVersion != old.NoteImageVersion { + continue + } + if new.NoteImageUUID != old.NoteImageUUID { + continue + } + if new.Type != old.Type { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o NoteImageDatumSlice) 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 NoteImageData.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 *NoteImageDatum: + o.copyMatchingRows(retrieved) + case []*NoteImageDatum: + o.copyMatchingRows(retrieved...) + case NoteImageDatumSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a NoteImageDatum or a slice of NoteImageDatum + // then run the AfterUpdateHooks on the slice + _, err = NoteImageData.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o NoteImageDatumSlice) 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 NoteImageData.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 *NoteImageDatum: + o.copyMatchingRows(retrieved) + case []*NoteImageDatum: + o.copyMatchingRows(retrieved...) + case NoteImageDatumSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a NoteImageDatum or a slice of NoteImageDatum + // then run the AfterDeleteHooks on the slice + _, err = NoteImageData.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o NoteImageDatumSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals NoteImageDatumSetter) error { + if len(o) == 0 { + return nil + } + + _, err := NoteImageData.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o NoteImageDatumSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := NoteImageData.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o NoteImageDatumSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := NoteImageData.Query(sm.Where(o.pkIN())).All(ctx, exec) + if err != nil { + return err + } + + o.copyMatchingRows(o2...) + + return nil +} + +// NoteImage starts a query for related objects on note_image +func (o *NoteImageDatum) NoteImage(mods ...bob.Mod[*dialect.SelectQuery]) NoteImagesQuery { + return NoteImages.Query(append(mods, + sm.Where(NoteImages.Columns.Version.EQ(psql.Arg(o.NoteImageVersion))), sm.Where(NoteImages.Columns.UUID.EQ(psql.Arg(o.NoteImageUUID))), + )...) +} + +func (os NoteImageDatumSlice) NoteImage(mods ...bob.Mod[*dialect.SelectQuery]) NoteImagesQuery { + pkNoteImageVersion := make(pgtypes.Array[int32], 0, len(os)) + + pkNoteImageUUID := make(pgtypes.Array[uuid.UUID], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkNoteImageVersion = append(pkNoteImageVersion, o.NoteImageVersion) + pkNoteImageUUID = append(pkNoteImageUUID, o.NoteImageUUID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkNoteImageVersion), "integer[]")), + psql.F("unnest", psql.Cast(psql.Arg(pkNoteImageUUID), "uuid[]")), + )) + + return NoteImages.Query(append(mods, + sm.Where(psql.Group(NoteImages.Columns.Version, NoteImages.Columns.UUID).OP("IN", PKArgExpr)), + )...) +} + +func attachNoteImageDatumNoteImage0(ctx context.Context, exec bob.Executor, count int, noteImageDatum0 *NoteImageDatum, noteImage1 *NoteImage) (*NoteImageDatum, error) { + setter := &NoteImageDatumSetter{ + NoteImageVersion: omit.From(noteImage1.Version), + NoteImageUUID: omit.From(noteImage1.UUID), + } + + err := noteImageDatum0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachNoteImageDatumNoteImage0: %w", err) + } + + return noteImageDatum0, nil +} + +func (noteImageDatum0 *NoteImageDatum) InsertNoteImage(ctx context.Context, exec bob.Executor, related *NoteImageSetter) error { + var err error + + noteImage1, err := NoteImages.Insert(related).One(ctx, exec) + if err != nil { + return fmt.Errorf("inserting related objects: %w", err) + } + + _, err = attachNoteImageDatumNoteImage0(ctx, exec, 1, noteImageDatum0, noteImage1) + if err != nil { + return err + } + + noteImageDatum0.R.NoteImage = noteImage1 + + noteImage1.R.NoteImageData = append(noteImage1.R.NoteImageData, noteImageDatum0) + + return nil +} + +func (noteImageDatum0 *NoteImageDatum) AttachNoteImage(ctx context.Context, exec bob.Executor, noteImage1 *NoteImage) error { + var err error + + _, err = attachNoteImageDatumNoteImage0(ctx, exec, 1, noteImageDatum0, noteImage1) + if err != nil { + return err + } + + noteImageDatum0.R.NoteImage = noteImage1 + + noteImage1.R.NoteImageData = append(noteImage1.R.NoteImageData, noteImageDatum0) + + return nil +} + +type noteImageDatumWhere[Q psql.Filterable] struct { + Created psql.WhereMod[Q, time.Time] + NoteImageVersion psql.WhereMod[Q, int32] + NoteImageUUID psql.WhereMod[Q, uuid.UUID] + Type psql.WhereMod[Q, enums.Audiodatatype] +} + +func (noteImageDatumWhere[Q]) AliasedAs(alias string) noteImageDatumWhere[Q] { + return buildNoteImageDatumWhere[Q](buildNoteImageDatumColumns(alias)) +} + +func buildNoteImageDatumWhere[Q psql.Filterable](cols noteImageDatumColumns) noteImageDatumWhere[Q] { + return noteImageDatumWhere[Q]{ + Created: psql.Where[Q, time.Time](cols.Created), + NoteImageVersion: psql.Where[Q, int32](cols.NoteImageVersion), + NoteImageUUID: psql.Where[Q, uuid.UUID](cols.NoteImageUUID), + Type: psql.Where[Q, enums.Audiodatatype](cols.Type), + } +} + +func (o *NoteImageDatum) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "NoteImage": + rel, ok := retrieved.(*NoteImage) + if !ok { + return fmt.Errorf("noteImageDatum cannot load %T as %q", retrieved, name) + } + + o.R.NoteImage = rel + + if rel != nil { + rel.R.NoteImageData = NoteImageDatumSlice{o} + } + return nil + default: + return fmt.Errorf("noteImageDatum has no relationship %q", name) + } +} + +type noteImageDatumPreloader struct { + NoteImage func(...psql.PreloadOption) psql.Preloader +} + +func buildNoteImageDatumPreloader() noteImageDatumPreloader { + return noteImageDatumPreloader{ + NoteImage: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*NoteImage, NoteImageSlice](psql.PreloadRel{ + Name: "NoteImage", + Sides: []psql.PreloadSide{ + { + From: NoteImageData, + To: NoteImages, + FromColumns: []string{"note_image_version", "note_image_uuid"}, + ToColumns: []string{"version", "uuid"}, + }, + }, + }, NoteImages.Columns.Names(), opts...) + }, + } +} + +type noteImageDatumThenLoader[Q orm.Loadable] struct { + NoteImage func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildNoteImageDatumThenLoader[Q orm.Loadable]() noteImageDatumThenLoader[Q] { + type NoteImageLoadInterface interface { + LoadNoteImage(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return noteImageDatumThenLoader[Q]{ + NoteImage: thenLoadBuilder[Q]( + "NoteImage", + func(ctx context.Context, exec bob.Executor, retrieved NoteImageLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadNoteImage(ctx, exec, mods...) + }, + ), + } +} + +// LoadNoteImage loads the noteImageDatum's NoteImage into the .R struct +func (o *NoteImageDatum) LoadNoteImage(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.NoteImage = nil + + related, err := o.NoteImage(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.NoteImageData = NoteImageDatumSlice{o} + + o.R.NoteImage = related + return nil +} + +// LoadNoteImage loads the noteImageDatum's NoteImage into the .R struct +func (os NoteImageDatumSlice) LoadNoteImage(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + noteImages, err := os.NoteImage(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range noteImages { + + if !(o.NoteImageVersion == rel.Version) { + continue + } + + if !(o.NoteImageUUID == rel.UUID) { + continue + } + + rel.R.NoteImageData = append(rel.R.NoteImageData, o) + + o.R.NoteImage = rel + break + } + } + + return nil +} + +type noteImageDatumJoins[Q dialect.Joinable] struct { + typ string + NoteImage modAs[Q, noteImageColumns] +} + +func (j noteImageDatumJoins[Q]) aliasedAs(alias string) noteImageDatumJoins[Q] { + return buildNoteImageDatumJoins[Q](buildNoteImageDatumColumns(alias), j.typ) +} + +func buildNoteImageDatumJoins[Q dialect.Joinable](cols noteImageDatumColumns, typ string) noteImageDatumJoins[Q] { + return noteImageDatumJoins[Q]{ + typ: typ, + NoteImage: modAs[Q, noteImageColumns]{ + c: NoteImages.Columns, + f: func(to noteImageColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, NoteImages.Name().As(to.Alias())).On( + to.Version.EQ(cols.NoteImageVersion), to.UUID.EQ(cols.NoteImageUUID), + )) + } + + return mods + }, + }, + } +} diff --git a/db/models/notification.bob.go b/db/models/notification.bob.go index 1c2defd8..9b4f1a33 100644 --- a/db/models/notification.bob.go +++ b/db/models/notification.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models diff --git a/db/models/oauth_token.bob.go b/db/models/oauth_token.bob.go index 680f3b56..54a9a7f1 100644 --- a/db/models/oauth_token.bob.go +++ b/db/models/oauth_token.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models diff --git a/db/models/organization.bob.go b/db/models/organization.bob.go index dc367b30..cdfb13a1 100644 --- a/db/models/organization.bob.go +++ b/db/models/organization.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models @@ -46,63 +46,38 @@ type OrganizationsQuery = *psql.ViewQuery[*Organization, OrganizationSlice] // organizationR is where relationships are stored. type organizationR struct { - FieldseekerSyncs FieldseekerSyncSlice // fieldseeker_sync.fieldseeker_sync_organization_id_fkey - FSContainerrelates FSContainerrelateSlice // fs_containerrelate.fs_containerrelate_organization_id_fkey - FSFieldscoutinglogs FSFieldscoutinglogSlice // fs_fieldscoutinglog.fs_fieldscoutinglog_organization_id_fkey - FSHabitatrelates FSHabitatrelateSlice // fs_habitatrelate.fs_habitatrelate_organization_id_fkey - FSInspectionsamples FSInspectionsampleSlice // fs_inspectionsample.fs_inspectionsample_organization_id_fkey - FSInspectionsampledetails FSInspectionsampledetailSlice // fs_inspectionsampledetail.fs_inspectionsampledetail_organization_id_fkey - FSLinelocations FSLinelocationSlice // fs_linelocation.fs_linelocation_organization_id_fkey - FSLocationtrackings FSLocationtrackingSlice // fs_locationtracking.fs_locationtracking_organization_id_fkey - FSMosquitoinspections FSMosquitoinspectionSlice // fs_mosquitoinspection.fs_mosquitoinspection_organization_id_fkey - FSPointlocations FSPointlocationSlice // fs_pointlocation.fs_pointlocation_organization_id_fkey - FSPolygonlocations FSPolygonlocationSlice // fs_polygonlocation.fs_polygonlocation_organization_id_fkey - FSPools FSPoolSlice // fs_pool.fs_pool_organization_id_fkey - FSPooldetails FSPooldetailSlice // fs_pooldetail.fs_pooldetail_organization_id_fkey - FSProposedtreatmentareas FSProposedtreatmentareaSlice // fs_proposedtreatmentarea.fs_proposedtreatmentarea_organization_id_fkey - FSQamosquitoinspections FSQamosquitoinspectionSlice // fs_qamosquitoinspection.fs_qamosquitoinspection_organization_id_fkey - FSRodentlocations FSRodentlocationSlice // fs_rodentlocation.fs_rodentlocation_organization_id_fkey - FSSamplecollections FSSamplecollectionSlice // fs_samplecollection.fs_samplecollection_organization_id_fkey - FSSamplelocations FSSamplelocationSlice // fs_samplelocation.fs_samplelocation_organization_id_fkey - FSServicerequests FSServicerequestSlice // fs_servicerequest.fs_servicerequest_organization_id_fkey - FSSpeciesabundances FSSpeciesabundanceSlice // fs_speciesabundance.fs_speciesabundance_organization_id_fkey - FSStormdrains FSStormdrainSlice // fs_stormdrain.fs_stormdrain_organization_id_fkey - FSTimecards FSTimecardSlice // fs_timecard.fs_timecard_organization_id_fkey - FSTrapdata FSTrapdatumSlice // fs_trapdata.fs_trapdata_organization_id_fkey - FSTraplocations FSTraplocationSlice // fs_traplocation.fs_traplocation_organization_id_fkey - FSTreatments FSTreatmentSlice // fs_treatment.fs_treatment_organization_id_fkey - 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 - HistoryInspectionsamples HistoryInspectionsampleSlice // history_inspectionsample.history_inspectionsample_organization_id_fkey - HistoryInspectionsampledetails HistoryInspectionsampledetailSlice // history_inspectionsampledetail.history_inspectionsampledetail_organization_id_fkey - HistoryLinelocations HistoryLinelocationSlice // history_linelocation.history_linelocation_organization_id_fkey - HistoryLocationtrackings HistoryLocationtrackingSlice // history_locationtracking.history_locationtracking_organization_id_fkey - HistoryMosquitoinspections HistoryMosquitoinspectionSlice // history_mosquitoinspection.history_mosquitoinspection_organization_id_fkey - HistoryPointlocations HistoryPointlocationSlice // history_pointlocation.history_pointlocation_organization_id_fkey - HistoryPolygonlocations HistoryPolygonlocationSlice // history_polygonlocation.history_polygonlocation_organization_id_fkey - HistoryPools HistoryPoolSlice // history_pool.history_pool_organization_id_fkey - HistoryPooldetails HistoryPooldetailSlice // history_pooldetail.history_pooldetail_organization_id_fkey - HistoryProposedtreatmentareas HistoryProposedtreatmentareaSlice // history_proposedtreatmentarea.history_proposedtreatmentarea_organization_id_fkey - HistoryQamosquitoinspections HistoryQamosquitoinspectionSlice // history_qamosquitoinspection.history_qamosquitoinspection_organization_id_fkey - HistoryRodentlocations HistoryRodentlocationSlice // history_rodentlocation.history_rodentlocation_organization_id_fkey - HistorySamplecollections HistorySamplecollectionSlice // history_samplecollection.history_samplecollection_organization_id_fkey - HistorySamplelocations HistorySamplelocationSlice // history_samplelocation.history_samplelocation_organization_id_fkey - HistoryServicerequests HistoryServicerequestSlice // history_servicerequest.history_servicerequest_organization_id_fkey - HistorySpeciesabundances HistorySpeciesabundanceSlice // history_speciesabundance.history_speciesabundance_organization_id_fkey - HistoryStormdrains HistoryStormdrainSlice // history_stormdrain.history_stormdrain_organization_id_fkey - HistoryTimecards HistoryTimecardSlice // history_timecard.history_timecard_organization_id_fkey - HistoryTrapdata HistoryTrapdatumSlice // history_trapdata.history_trapdata_organization_id_fkey - HistoryTraplocations HistoryTraplocationSlice // history_traplocation.history_traplocation_organization_id_fkey - HistoryTreatments HistoryTreatmentSlice // history_treatment.history_treatment_organization_id_fkey - HistoryTreatmentareas HistoryTreatmentareaSlice // history_treatmentarea.history_treatmentarea_organization_id_fkey - HistoryZones HistoryZoneSlice // history_zones.history_zones_organization_id_fkey - HistoryZones2s HistoryZones2Slice // history_zones2.history_zones2_organization_id_fkey - User UserSlice // user_.user__organization_id_fkey + Containerrelates FieldseekerContainerrelateSlice // fieldseeker.containerrelate.containerrelate_organization_id_fkey + Fieldscoutinglogs FieldseekerFieldscoutinglogSlice // fieldseeker.fieldscoutinglog.fieldscoutinglog_organization_id_fkey + Habitatrelates FieldseekerHabitatrelateSlice // fieldseeker.habitatrelate.habitatrelate_organization_id_fkey + Inspectionsamples FieldseekerInspectionsampleSlice // fieldseeker.inspectionsample.inspectionsample_organization_id_fkey + Inspectionsampledetails FieldseekerInspectionsampledetailSlice // fieldseeker.inspectionsampledetail.inspectionsampledetail_organization_id_fkey + Linelocations FieldseekerLinelocationSlice // fieldseeker.linelocation.linelocation_organization_id_fkey + Locationtrackings FieldseekerLocationtrackingSlice // fieldseeker.locationtracking.locationtracking_organization_id_fkey + Mosquitoinspections FieldseekerMosquitoinspectionSlice // fieldseeker.mosquitoinspection.mosquitoinspection_organization_id_fkey + Pointlocations FieldseekerPointlocationSlice // fieldseeker.pointlocation.pointlocation_organization_id_fkey + Polygonlocations FieldseekerPolygonlocationSlice // fieldseeker.polygonlocation.polygonlocation_organization_id_fkey + Pools FieldseekerPoolSlice // fieldseeker.pool.pool_organization_id_fkey + Pooldetails FieldseekerPooldetailSlice // fieldseeker.pooldetail.pooldetail_organization_id_fkey + Proposedtreatmentareas FieldseekerProposedtreatmentareaSlice // fieldseeker.proposedtreatmentarea.proposedtreatmentarea_organization_id_fkey + Qamosquitoinspections FieldseekerQamosquitoinspectionSlice // fieldseeker.qamosquitoinspection.qamosquitoinspection_organization_id_fkey + Rodentlocations FieldseekerRodentlocationSlice // fieldseeker.rodentlocation.rodentlocation_organization_id_fkey + Samplecollections FieldseekerSamplecollectionSlice // fieldseeker.samplecollection.samplecollection_organization_id_fkey + Samplelocations FieldseekerSamplelocationSlice // fieldseeker.samplelocation.samplelocation_organization_id_fkey + Servicerequests FieldseekerServicerequestSlice // fieldseeker.servicerequest.servicerequest_organization_id_fkey + Speciesabundances FieldseekerSpeciesabundanceSlice // fieldseeker.speciesabundance.speciesabundance_organization_id_fkey + Stormdrains FieldseekerStormdrainSlice // fieldseeker.stormdrain.stormdrain_organization_id_fkey + Timecards FieldseekerTimecardSlice // fieldseeker.timecard.timecard_organization_id_fkey + Trapdata FieldseekerTrapdatumSlice // fieldseeker.trapdata.trapdata_organization_id_fkey + Traplocations FieldseekerTraplocationSlice // fieldseeker.traplocation.traplocation_organization_id_fkey + Treatments FieldseekerTreatmentSlice // fieldseeker.treatment.treatment_organization_id_fkey + Treatmentareas FieldseekerTreatmentareaSlice // fieldseeker.treatmentarea.treatmentarea_organization_id_fkey + Zones FieldseekerZoneSlice // fieldseeker.zones.zones_organization_id_fkey + Zones2s FieldseekerZones2Slice // fieldseeker.zones2.zones2_organization_id_fkey + FieldseekerSyncs FieldseekerSyncSlice // fieldseeker_sync.fieldseeker_sync_organization_id_fkey + H3Aggregations H3AggregationSlice // h3_aggregation.h3_aggregation_organization_id_fkey + NoteAudios NoteAudioSlice // note_audio.note_audio_organization_id_fkey + NoteImages NoteImageSlice // note_image.note_image_organization_id_fkey + User UserSlice // user_.user__organization_id_fkey } func buildOrganizationColumns(alias string) organizationColumns { @@ -495,6 +470,654 @@ func (o OrganizationSlice) ReloadAll(ctx context.Context, exec bob.Executor) err return nil } +// Containerrelates starts a query for related objects on fieldseeker.containerrelate +func (o *Organization) Containerrelates(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerContainerrelatesQuery { + return FieldseekerContainerrelates.Query(append(mods, + sm.Where(FieldseekerContainerrelates.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Containerrelates(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerContainerrelatesQuery { + 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 FieldseekerContainerrelates.Query(append(mods, + sm.Where(psql.Group(FieldseekerContainerrelates.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Fieldscoutinglogs starts a query for related objects on fieldseeker.fieldscoutinglog +func (o *Organization) Fieldscoutinglogs(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerFieldscoutinglogsQuery { + return FieldseekerFieldscoutinglogs.Query(append(mods, + sm.Where(FieldseekerFieldscoutinglogs.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Fieldscoutinglogs(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerFieldscoutinglogsQuery { + 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 FieldseekerFieldscoutinglogs.Query(append(mods, + sm.Where(psql.Group(FieldseekerFieldscoutinglogs.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Habitatrelates starts a query for related objects on fieldseeker.habitatrelate +func (o *Organization) Habitatrelates(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerHabitatrelatesQuery { + return FieldseekerHabitatrelates.Query(append(mods, + sm.Where(FieldseekerHabitatrelates.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Habitatrelates(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerHabitatrelatesQuery { + 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 FieldseekerHabitatrelates.Query(append(mods, + sm.Where(psql.Group(FieldseekerHabitatrelates.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Inspectionsamples starts a query for related objects on fieldseeker.inspectionsample +func (o *Organization) Inspectionsamples(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerInspectionsamplesQuery { + return FieldseekerInspectionsamples.Query(append(mods, + sm.Where(FieldseekerInspectionsamples.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Inspectionsamples(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerInspectionsamplesQuery { + 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 FieldseekerInspectionsamples.Query(append(mods, + sm.Where(psql.Group(FieldseekerInspectionsamples.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Inspectionsampledetails starts a query for related objects on fieldseeker.inspectionsampledetail +func (o *Organization) Inspectionsampledetails(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerInspectionsampledetailsQuery { + return FieldseekerInspectionsampledetails.Query(append(mods, + sm.Where(FieldseekerInspectionsampledetails.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Inspectionsampledetails(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerInspectionsampledetailsQuery { + 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 FieldseekerInspectionsampledetails.Query(append(mods, + sm.Where(psql.Group(FieldseekerInspectionsampledetails.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Linelocations starts a query for related objects on fieldseeker.linelocation +func (o *Organization) Linelocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerLinelocationsQuery { + return FieldseekerLinelocations.Query(append(mods, + sm.Where(FieldseekerLinelocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Linelocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerLinelocationsQuery { + 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 FieldseekerLinelocations.Query(append(mods, + sm.Where(psql.Group(FieldseekerLinelocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Locationtrackings starts a query for related objects on fieldseeker.locationtracking +func (o *Organization) Locationtrackings(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerLocationtrackingsQuery { + return FieldseekerLocationtrackings.Query(append(mods, + sm.Where(FieldseekerLocationtrackings.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Locationtrackings(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerLocationtrackingsQuery { + 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 FieldseekerLocationtrackings.Query(append(mods, + sm.Where(psql.Group(FieldseekerLocationtrackings.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Mosquitoinspections starts a query for related objects on fieldseeker.mosquitoinspection +func (o *Organization) Mosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerMosquitoinspectionsQuery { + return FieldseekerMosquitoinspections.Query(append(mods, + sm.Where(FieldseekerMosquitoinspections.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Mosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerMosquitoinspectionsQuery { + 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 FieldseekerMosquitoinspections.Query(append(mods, + sm.Where(psql.Group(FieldseekerMosquitoinspections.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Pointlocations starts a query for related objects on fieldseeker.pointlocation +func (o *Organization) Pointlocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPointlocationsQuery { + return FieldseekerPointlocations.Query(append(mods, + sm.Where(FieldseekerPointlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Pointlocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPointlocationsQuery { + 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 FieldseekerPointlocations.Query(append(mods, + sm.Where(psql.Group(FieldseekerPointlocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Polygonlocations starts a query for related objects on fieldseeker.polygonlocation +func (o *Organization) Polygonlocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPolygonlocationsQuery { + return FieldseekerPolygonlocations.Query(append(mods, + sm.Where(FieldseekerPolygonlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Polygonlocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPolygonlocationsQuery { + 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 FieldseekerPolygonlocations.Query(append(mods, + sm.Where(psql.Group(FieldseekerPolygonlocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Pools starts a query for related objects on fieldseeker.pool +func (o *Organization) Pools(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPoolsQuery { + return FieldseekerPools.Query(append(mods, + sm.Where(FieldseekerPools.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Pools(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPoolsQuery { + 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 FieldseekerPools.Query(append(mods, + sm.Where(psql.Group(FieldseekerPools.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Pooldetails starts a query for related objects on fieldseeker.pooldetail +func (o *Organization) Pooldetails(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPooldetailsQuery { + return FieldseekerPooldetails.Query(append(mods, + sm.Where(FieldseekerPooldetails.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Pooldetails(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPooldetailsQuery { + 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 FieldseekerPooldetails.Query(append(mods, + sm.Where(psql.Group(FieldseekerPooldetails.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Proposedtreatmentareas starts a query for related objects on fieldseeker.proposedtreatmentarea +func (o *Organization) Proposedtreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerProposedtreatmentareasQuery { + return FieldseekerProposedtreatmentareas.Query(append(mods, + sm.Where(FieldseekerProposedtreatmentareas.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Proposedtreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerProposedtreatmentareasQuery { + 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 FieldseekerProposedtreatmentareas.Query(append(mods, + sm.Where(psql.Group(FieldseekerProposedtreatmentareas.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Qamosquitoinspections starts a query for related objects on fieldseeker.qamosquitoinspection +func (o *Organization) Qamosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerQamosquitoinspectionsQuery { + return FieldseekerQamosquitoinspections.Query(append(mods, + sm.Where(FieldseekerQamosquitoinspections.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Qamosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerQamosquitoinspectionsQuery { + 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 FieldseekerQamosquitoinspections.Query(append(mods, + sm.Where(psql.Group(FieldseekerQamosquitoinspections.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Rodentlocations starts a query for related objects on fieldseeker.rodentlocation +func (o *Organization) Rodentlocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerRodentlocationsQuery { + return FieldseekerRodentlocations.Query(append(mods, + sm.Where(FieldseekerRodentlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Rodentlocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerRodentlocationsQuery { + 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 FieldseekerRodentlocations.Query(append(mods, + sm.Where(psql.Group(FieldseekerRodentlocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Samplecollections starts a query for related objects on fieldseeker.samplecollection +func (o *Organization) Samplecollections(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSamplecollectionsQuery { + return FieldseekerSamplecollections.Query(append(mods, + sm.Where(FieldseekerSamplecollections.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Samplecollections(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSamplecollectionsQuery { + 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 FieldseekerSamplecollections.Query(append(mods, + sm.Where(psql.Group(FieldseekerSamplecollections.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Samplelocations starts a query for related objects on fieldseeker.samplelocation +func (o *Organization) Samplelocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSamplelocationsQuery { + return FieldseekerSamplelocations.Query(append(mods, + sm.Where(FieldseekerSamplelocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Samplelocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSamplelocationsQuery { + 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 FieldseekerSamplelocations.Query(append(mods, + sm.Where(psql.Group(FieldseekerSamplelocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Servicerequests starts a query for related objects on fieldseeker.servicerequest +func (o *Organization) Servicerequests(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerServicerequestsQuery { + return FieldseekerServicerequests.Query(append(mods, + sm.Where(FieldseekerServicerequests.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Servicerequests(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerServicerequestsQuery { + 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 FieldseekerServicerequests.Query(append(mods, + sm.Where(psql.Group(FieldseekerServicerequests.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Speciesabundances starts a query for related objects on fieldseeker.speciesabundance +func (o *Organization) Speciesabundances(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSpeciesabundancesQuery { + return FieldseekerSpeciesabundances.Query(append(mods, + sm.Where(FieldseekerSpeciesabundances.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Speciesabundances(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSpeciesabundancesQuery { + 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 FieldseekerSpeciesabundances.Query(append(mods, + sm.Where(psql.Group(FieldseekerSpeciesabundances.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Stormdrains starts a query for related objects on fieldseeker.stormdrain +func (o *Organization) Stormdrains(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerStormdrainsQuery { + return FieldseekerStormdrains.Query(append(mods, + sm.Where(FieldseekerStormdrains.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Stormdrains(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerStormdrainsQuery { + 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 FieldseekerStormdrains.Query(append(mods, + sm.Where(psql.Group(FieldseekerStormdrains.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Timecards starts a query for related objects on fieldseeker.timecard +func (o *Organization) Timecards(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTimecardsQuery { + return FieldseekerTimecards.Query(append(mods, + sm.Where(FieldseekerTimecards.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Timecards(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTimecardsQuery { + 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 FieldseekerTimecards.Query(append(mods, + sm.Where(psql.Group(FieldseekerTimecards.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Trapdata starts a query for related objects on fieldseeker.trapdata +func (o *Organization) Trapdata(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTrapdataQuery { + return FieldseekerTrapdata.Query(append(mods, + sm.Where(FieldseekerTrapdata.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Trapdata(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTrapdataQuery { + 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 FieldseekerTrapdata.Query(append(mods, + sm.Where(psql.Group(FieldseekerTrapdata.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Traplocations starts a query for related objects on fieldseeker.traplocation +func (o *Organization) Traplocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTraplocationsQuery { + return FieldseekerTraplocations.Query(append(mods, + sm.Where(FieldseekerTraplocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Traplocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTraplocationsQuery { + 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 FieldseekerTraplocations.Query(append(mods, + sm.Where(psql.Group(FieldseekerTraplocations.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Treatments starts a query for related objects on fieldseeker.treatment +func (o *Organization) Treatments(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTreatmentsQuery { + return FieldseekerTreatments.Query(append(mods, + sm.Where(FieldseekerTreatments.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Treatments(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTreatmentsQuery { + 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 FieldseekerTreatments.Query(append(mods, + sm.Where(psql.Group(FieldseekerTreatments.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Treatmentareas starts a query for related objects on fieldseeker.treatmentarea +func (o *Organization) Treatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTreatmentareasQuery { + return FieldseekerTreatmentareas.Query(append(mods, + sm.Where(FieldseekerTreatmentareas.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Treatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTreatmentareasQuery { + 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 FieldseekerTreatmentareas.Query(append(mods, + sm.Where(psql.Group(FieldseekerTreatmentareas.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Zones starts a query for related objects on fieldseeker.zones +func (o *Organization) Zones(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerZonesQuery { + return FieldseekerZones.Query(append(mods, + sm.Where(FieldseekerZones.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Zones(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerZonesQuery { + 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 FieldseekerZones.Query(append(mods, + sm.Where(psql.Group(FieldseekerZones.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + +// Zones2s starts a query for related objects on fieldseeker.zones2 +func (o *Organization) Zones2s(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerZones2sQuery { + return FieldseekerZones2s.Query(append(mods, + sm.Where(FieldseekerZones2s.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Zones2s(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerZones2sQuery { + 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 FieldseekerZones2s.Query(append(mods, + sm.Where(psql.Group(FieldseekerZones2s.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + // FieldseekerSyncs starts a query for related objects on fieldseeker_sync func (o *Organization) FieldseekerSyncs(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSyncsQuery { return FieldseekerSyncs.Query(append(mods, @@ -519,654 +1142,6 @@ func (os OrganizationSlice) FieldseekerSyncs(mods ...bob.Mod[*dialect.SelectQuer )...) } -// FSContainerrelates starts a query for related objects on fs_containerrelate -func (o *Organization) FSContainerrelates(mods ...bob.Mod[*dialect.SelectQuery]) FSContainerrelatesQuery { - return FSContainerrelates.Query(append(mods, - sm.Where(FSContainerrelates.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSContainerrelates(mods ...bob.Mod[*dialect.SelectQuery]) FSContainerrelatesQuery { - 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 FSContainerrelates.Query(append(mods, - sm.Where(psql.Group(FSContainerrelates.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSFieldscoutinglogs starts a query for related objects on fs_fieldscoutinglog -func (o *Organization) FSFieldscoutinglogs(mods ...bob.Mod[*dialect.SelectQuery]) FSFieldscoutinglogsQuery { - return FSFieldscoutinglogs.Query(append(mods, - sm.Where(FSFieldscoutinglogs.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSFieldscoutinglogs(mods ...bob.Mod[*dialect.SelectQuery]) FSFieldscoutinglogsQuery { - 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 FSFieldscoutinglogs.Query(append(mods, - sm.Where(psql.Group(FSFieldscoutinglogs.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSHabitatrelates starts a query for related objects on fs_habitatrelate -func (o *Organization) FSHabitatrelates(mods ...bob.Mod[*dialect.SelectQuery]) FSHabitatrelatesQuery { - return FSHabitatrelates.Query(append(mods, - sm.Where(FSHabitatrelates.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSHabitatrelates(mods ...bob.Mod[*dialect.SelectQuery]) FSHabitatrelatesQuery { - 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 FSHabitatrelates.Query(append(mods, - sm.Where(psql.Group(FSHabitatrelates.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSInspectionsamples starts a query for related objects on fs_inspectionsample -func (o *Organization) FSInspectionsamples(mods ...bob.Mod[*dialect.SelectQuery]) FSInspectionsamplesQuery { - return FSInspectionsamples.Query(append(mods, - sm.Where(FSInspectionsamples.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSInspectionsamples(mods ...bob.Mod[*dialect.SelectQuery]) FSInspectionsamplesQuery { - 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 FSInspectionsamples.Query(append(mods, - sm.Where(psql.Group(FSInspectionsamples.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSInspectionsampledetails starts a query for related objects on fs_inspectionsampledetail -func (o *Organization) FSInspectionsampledetails(mods ...bob.Mod[*dialect.SelectQuery]) FSInspectionsampledetailsQuery { - return FSInspectionsampledetails.Query(append(mods, - sm.Where(FSInspectionsampledetails.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSInspectionsampledetails(mods ...bob.Mod[*dialect.SelectQuery]) FSInspectionsampledetailsQuery { - 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 FSInspectionsampledetails.Query(append(mods, - sm.Where(psql.Group(FSInspectionsampledetails.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSLinelocations starts a query for related objects on fs_linelocation -func (o *Organization) FSLinelocations(mods ...bob.Mod[*dialect.SelectQuery]) FSLinelocationsQuery { - return FSLinelocations.Query(append(mods, - sm.Where(FSLinelocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSLinelocations(mods ...bob.Mod[*dialect.SelectQuery]) FSLinelocationsQuery { - 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 FSLinelocations.Query(append(mods, - sm.Where(psql.Group(FSLinelocations.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSLocationtrackings starts a query for related objects on fs_locationtracking -func (o *Organization) FSLocationtrackings(mods ...bob.Mod[*dialect.SelectQuery]) FSLocationtrackingsQuery { - return FSLocationtrackings.Query(append(mods, - sm.Where(FSLocationtrackings.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSLocationtrackings(mods ...bob.Mod[*dialect.SelectQuery]) FSLocationtrackingsQuery { - 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 FSLocationtrackings.Query(append(mods, - sm.Where(psql.Group(FSLocationtrackings.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSMosquitoinspections starts a query for related objects on fs_mosquitoinspection -func (o *Organization) FSMosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FSMosquitoinspectionsQuery { - return FSMosquitoinspections.Query(append(mods, - sm.Where(FSMosquitoinspections.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSMosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FSMosquitoinspectionsQuery { - 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 FSMosquitoinspections.Query(append(mods, - sm.Where(psql.Group(FSMosquitoinspections.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSPointlocations starts a query for related objects on fs_pointlocation -func (o *Organization) FSPointlocations(mods ...bob.Mod[*dialect.SelectQuery]) FSPointlocationsQuery { - return FSPointlocations.Query(append(mods, - sm.Where(FSPointlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSPointlocations(mods ...bob.Mod[*dialect.SelectQuery]) FSPointlocationsQuery { - 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 FSPointlocations.Query(append(mods, - sm.Where(psql.Group(FSPointlocations.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSPolygonlocations starts a query for related objects on fs_polygonlocation -func (o *Organization) FSPolygonlocations(mods ...bob.Mod[*dialect.SelectQuery]) FSPolygonlocationsQuery { - return FSPolygonlocations.Query(append(mods, - sm.Where(FSPolygonlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSPolygonlocations(mods ...bob.Mod[*dialect.SelectQuery]) FSPolygonlocationsQuery { - 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 FSPolygonlocations.Query(append(mods, - sm.Where(psql.Group(FSPolygonlocations.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSPools starts a query for related objects on fs_pool -func (o *Organization) FSPools(mods ...bob.Mod[*dialect.SelectQuery]) FSPoolsQuery { - return FSPools.Query(append(mods, - sm.Where(FSPools.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSPools(mods ...bob.Mod[*dialect.SelectQuery]) FSPoolsQuery { - 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 FSPools.Query(append(mods, - sm.Where(psql.Group(FSPools.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSPooldetails starts a query for related objects on fs_pooldetail -func (o *Organization) FSPooldetails(mods ...bob.Mod[*dialect.SelectQuery]) FSPooldetailsQuery { - return FSPooldetails.Query(append(mods, - sm.Where(FSPooldetails.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSPooldetails(mods ...bob.Mod[*dialect.SelectQuery]) FSPooldetailsQuery { - 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 FSPooldetails.Query(append(mods, - sm.Where(psql.Group(FSPooldetails.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSProposedtreatmentareas starts a query for related objects on fs_proposedtreatmentarea -func (o *Organization) FSProposedtreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FSProposedtreatmentareasQuery { - return FSProposedtreatmentareas.Query(append(mods, - sm.Where(FSProposedtreatmentareas.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSProposedtreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FSProposedtreatmentareasQuery { - 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 FSProposedtreatmentareas.Query(append(mods, - sm.Where(psql.Group(FSProposedtreatmentareas.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSQamosquitoinspections starts a query for related objects on fs_qamosquitoinspection -func (o *Organization) FSQamosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FSQamosquitoinspectionsQuery { - return FSQamosquitoinspections.Query(append(mods, - sm.Where(FSQamosquitoinspections.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSQamosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FSQamosquitoinspectionsQuery { - 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 FSQamosquitoinspections.Query(append(mods, - sm.Where(psql.Group(FSQamosquitoinspections.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSRodentlocations starts a query for related objects on fs_rodentlocation -func (o *Organization) FSRodentlocations(mods ...bob.Mod[*dialect.SelectQuery]) FSRodentlocationsQuery { - return FSRodentlocations.Query(append(mods, - sm.Where(FSRodentlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSRodentlocations(mods ...bob.Mod[*dialect.SelectQuery]) FSRodentlocationsQuery { - 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 FSRodentlocations.Query(append(mods, - sm.Where(psql.Group(FSRodentlocations.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSSamplecollections starts a query for related objects on fs_samplecollection -func (o *Organization) FSSamplecollections(mods ...bob.Mod[*dialect.SelectQuery]) FSSamplecollectionsQuery { - return FSSamplecollections.Query(append(mods, - sm.Where(FSSamplecollections.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSSamplecollections(mods ...bob.Mod[*dialect.SelectQuery]) FSSamplecollectionsQuery { - 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 FSSamplecollections.Query(append(mods, - sm.Where(psql.Group(FSSamplecollections.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSSamplelocations starts a query for related objects on fs_samplelocation -func (o *Organization) FSSamplelocations(mods ...bob.Mod[*dialect.SelectQuery]) FSSamplelocationsQuery { - return FSSamplelocations.Query(append(mods, - sm.Where(FSSamplelocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSSamplelocations(mods ...bob.Mod[*dialect.SelectQuery]) FSSamplelocationsQuery { - 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 FSSamplelocations.Query(append(mods, - sm.Where(psql.Group(FSSamplelocations.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSServicerequests starts a query for related objects on fs_servicerequest -func (o *Organization) FSServicerequests(mods ...bob.Mod[*dialect.SelectQuery]) FSServicerequestsQuery { - return FSServicerequests.Query(append(mods, - sm.Where(FSServicerequests.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSServicerequests(mods ...bob.Mod[*dialect.SelectQuery]) FSServicerequestsQuery { - 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 FSServicerequests.Query(append(mods, - sm.Where(psql.Group(FSServicerequests.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSSpeciesabundances starts a query for related objects on fs_speciesabundance -func (o *Organization) FSSpeciesabundances(mods ...bob.Mod[*dialect.SelectQuery]) FSSpeciesabundancesQuery { - return FSSpeciesabundances.Query(append(mods, - sm.Where(FSSpeciesabundances.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSSpeciesabundances(mods ...bob.Mod[*dialect.SelectQuery]) FSSpeciesabundancesQuery { - 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 FSSpeciesabundances.Query(append(mods, - sm.Where(psql.Group(FSSpeciesabundances.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSStormdrains starts a query for related objects on fs_stormdrain -func (o *Organization) FSStormdrains(mods ...bob.Mod[*dialect.SelectQuery]) FSStormdrainsQuery { - return FSStormdrains.Query(append(mods, - sm.Where(FSStormdrains.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSStormdrains(mods ...bob.Mod[*dialect.SelectQuery]) FSStormdrainsQuery { - 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 FSStormdrains.Query(append(mods, - sm.Where(psql.Group(FSStormdrains.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSTimecards starts a query for related objects on fs_timecard -func (o *Organization) FSTimecards(mods ...bob.Mod[*dialect.SelectQuery]) FSTimecardsQuery { - return FSTimecards.Query(append(mods, - sm.Where(FSTimecards.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSTimecards(mods ...bob.Mod[*dialect.SelectQuery]) FSTimecardsQuery { - 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 FSTimecards.Query(append(mods, - sm.Where(psql.Group(FSTimecards.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSTrapdata starts a query for related objects on fs_trapdata -func (o *Organization) FSTrapdata(mods ...bob.Mod[*dialect.SelectQuery]) FSTrapdataQuery { - return FSTrapdata.Query(append(mods, - sm.Where(FSTrapdata.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSTrapdata(mods ...bob.Mod[*dialect.SelectQuery]) FSTrapdataQuery { - 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 FSTrapdata.Query(append(mods, - sm.Where(psql.Group(FSTrapdata.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSTraplocations starts a query for related objects on fs_traplocation -func (o *Organization) FSTraplocations(mods ...bob.Mod[*dialect.SelectQuery]) FSTraplocationsQuery { - return FSTraplocations.Query(append(mods, - sm.Where(FSTraplocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSTraplocations(mods ...bob.Mod[*dialect.SelectQuery]) FSTraplocationsQuery { - 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 FSTraplocations.Query(append(mods, - sm.Where(psql.Group(FSTraplocations.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSTreatments starts a query for related objects on fs_treatment -func (o *Organization) FSTreatments(mods ...bob.Mod[*dialect.SelectQuery]) FSTreatmentsQuery { - return FSTreatments.Query(append(mods, - sm.Where(FSTreatments.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSTreatments(mods ...bob.Mod[*dialect.SelectQuery]) FSTreatmentsQuery { - 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 FSTreatments.Query(append(mods, - sm.Where(psql.Group(FSTreatments.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSTreatmentareas starts a query for related objects on fs_treatmentarea -func (o *Organization) FSTreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FSTreatmentareasQuery { - return FSTreatmentareas.Query(append(mods, - sm.Where(FSTreatmentareas.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSTreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FSTreatmentareasQuery { - 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 FSTreatmentareas.Query(append(mods, - sm.Where(psql.Group(FSTreatmentareas.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSZones starts a query for related objects on fs_zones -func (o *Organization) FSZones(mods ...bob.Mod[*dialect.SelectQuery]) FSZonesQuery { - return FSZones.Query(append(mods, - sm.Where(FSZones.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSZones(mods ...bob.Mod[*dialect.SelectQuery]) FSZonesQuery { - 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 FSZones.Query(append(mods, - sm.Where(psql.Group(FSZones.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// FSZones2s starts a query for related objects on fs_zones2 -func (o *Organization) FSZones2s(mods ...bob.Mod[*dialect.SelectQuery]) FSZones2sQuery { - return FSZones2s.Query(append(mods, - sm.Where(FSZones2s.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) FSZones2s(mods ...bob.Mod[*dialect.SelectQuery]) FSZones2sQuery { - 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 FSZones2s.Query(append(mods, - sm.Where(psql.Group(FSZones2s.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - // 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, @@ -1191,14 +1166,14 @@ func (os OrganizationSlice) H3Aggregations(mods ...bob.Mod[*dialect.SelectQuery] )...) } -// 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, - sm.Where(HistoryContainerrelates.Columns.OrganizationID.EQ(psql.Arg(o.ID))), +// NoteAudios starts a query for related objects on note_audio +func (o *Organization) NoteAudios(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudiosQuery { + return NoteAudios.Query(append(mods, + sm.Where(NoteAudios.Columns.OrganizationID.EQ(psql.Arg(o.ID))), )...) } -func (os OrganizationSlice) HistoryContainerrelates(mods ...bob.Mod[*dialect.SelectQuery]) HistoryContainerrelatesQuery { +func (os OrganizationSlice) NoteAudios(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudiosQuery { pkID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { @@ -1210,19 +1185,19 @@ func (os OrganizationSlice) HistoryContainerrelates(mods ...bob.Mod[*dialect.Sel psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")), )) - return HistoryContainerrelates.Query(append(mods, - sm.Where(psql.Group(HistoryContainerrelates.Columns.OrganizationID).OP("IN", PKArgExpr)), + return NoteAudios.Query(append(mods, + sm.Where(psql.Group(NoteAudios.Columns.OrganizationID).OP("IN", PKArgExpr)), )...) } -// HistoryFieldscoutinglogs starts a query for related objects on history_fieldscoutinglog -func (o *Organization) HistoryFieldscoutinglogs(mods ...bob.Mod[*dialect.SelectQuery]) HistoryFieldscoutinglogsQuery { - return HistoryFieldscoutinglogs.Query(append(mods, - sm.Where(HistoryFieldscoutinglogs.Columns.OrganizationID.EQ(psql.Arg(o.ID))), +// NoteImages starts a query for related objects on note_image +func (o *Organization) NoteImages(mods ...bob.Mod[*dialect.SelectQuery]) NoteImagesQuery { + return NoteImages.Query(append(mods, + sm.Where(NoteImages.Columns.OrganizationID.EQ(psql.Arg(o.ID))), )...) } -func (os OrganizationSlice) HistoryFieldscoutinglogs(mods ...bob.Mod[*dialect.SelectQuery]) HistoryFieldscoutinglogsQuery { +func (os OrganizationSlice) NoteImages(mods ...bob.Mod[*dialect.SelectQuery]) NoteImagesQuery { pkID := make(pgtypes.Array[int32], 0, len(os)) for _, o := range os { if o == nil { @@ -1234,608 +1209,8 @@ func (os OrganizationSlice) HistoryFieldscoutinglogs(mods ...bob.Mod[*dialect.Se psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")), )) - return HistoryFieldscoutinglogs.Query(append(mods, - sm.Where(psql.Group(HistoryFieldscoutinglogs.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryHabitatrelates starts a query for related objects on history_habitatrelate -func (o *Organization) HistoryHabitatrelates(mods ...bob.Mod[*dialect.SelectQuery]) HistoryHabitatrelatesQuery { - return HistoryHabitatrelates.Query(append(mods, - sm.Where(HistoryHabitatrelates.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryHabitatrelates(mods ...bob.Mod[*dialect.SelectQuery]) HistoryHabitatrelatesQuery { - 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 HistoryHabitatrelates.Query(append(mods, - sm.Where(psql.Group(HistoryHabitatrelates.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryInspectionsamples starts a query for related objects on history_inspectionsample -func (o *Organization) HistoryInspectionsamples(mods ...bob.Mod[*dialect.SelectQuery]) HistoryInspectionsamplesQuery { - return HistoryInspectionsamples.Query(append(mods, - sm.Where(HistoryInspectionsamples.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryInspectionsamples(mods ...bob.Mod[*dialect.SelectQuery]) HistoryInspectionsamplesQuery { - 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 HistoryInspectionsamples.Query(append(mods, - sm.Where(psql.Group(HistoryInspectionsamples.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryInspectionsampledetails starts a query for related objects on history_inspectionsampledetail -func (o *Organization) HistoryInspectionsampledetails(mods ...bob.Mod[*dialect.SelectQuery]) HistoryInspectionsampledetailsQuery { - return HistoryInspectionsampledetails.Query(append(mods, - sm.Where(HistoryInspectionsampledetails.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryInspectionsampledetails(mods ...bob.Mod[*dialect.SelectQuery]) HistoryInspectionsampledetailsQuery { - 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 HistoryInspectionsampledetails.Query(append(mods, - sm.Where(psql.Group(HistoryInspectionsampledetails.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryLinelocations starts a query for related objects on history_linelocation -func (o *Organization) HistoryLinelocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryLinelocationsQuery { - return HistoryLinelocations.Query(append(mods, - sm.Where(HistoryLinelocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryLinelocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryLinelocationsQuery { - 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 HistoryLinelocations.Query(append(mods, - sm.Where(psql.Group(HistoryLinelocations.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryLocationtrackings starts a query for related objects on history_locationtracking -func (o *Organization) HistoryLocationtrackings(mods ...bob.Mod[*dialect.SelectQuery]) HistoryLocationtrackingsQuery { - return HistoryLocationtrackings.Query(append(mods, - sm.Where(HistoryLocationtrackings.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryLocationtrackings(mods ...bob.Mod[*dialect.SelectQuery]) HistoryLocationtrackingsQuery { - 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 HistoryLocationtrackings.Query(append(mods, - sm.Where(psql.Group(HistoryLocationtrackings.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryMosquitoinspections starts a query for related objects on history_mosquitoinspection -func (o *Organization) HistoryMosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) HistoryMosquitoinspectionsQuery { - return HistoryMosquitoinspections.Query(append(mods, - sm.Where(HistoryMosquitoinspections.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryMosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) HistoryMosquitoinspectionsQuery { - 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 HistoryMosquitoinspections.Query(append(mods, - sm.Where(psql.Group(HistoryMosquitoinspections.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryPointlocations starts a query for related objects on history_pointlocation -func (o *Organization) HistoryPointlocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPointlocationsQuery { - return HistoryPointlocations.Query(append(mods, - sm.Where(HistoryPointlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryPointlocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPointlocationsQuery { - 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 HistoryPointlocations.Query(append(mods, - sm.Where(psql.Group(HistoryPointlocations.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryPolygonlocations starts a query for related objects on history_polygonlocation -func (o *Organization) HistoryPolygonlocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPolygonlocationsQuery { - return HistoryPolygonlocations.Query(append(mods, - sm.Where(HistoryPolygonlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryPolygonlocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPolygonlocationsQuery { - 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 HistoryPolygonlocations.Query(append(mods, - sm.Where(psql.Group(HistoryPolygonlocations.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryPools starts a query for related objects on history_pool -func (o *Organization) HistoryPools(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPoolsQuery { - return HistoryPools.Query(append(mods, - sm.Where(HistoryPools.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryPools(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPoolsQuery { - 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 HistoryPools.Query(append(mods, - sm.Where(psql.Group(HistoryPools.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryPooldetails starts a query for related objects on history_pooldetail -func (o *Organization) HistoryPooldetails(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPooldetailsQuery { - return HistoryPooldetails.Query(append(mods, - sm.Where(HistoryPooldetails.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryPooldetails(mods ...bob.Mod[*dialect.SelectQuery]) HistoryPooldetailsQuery { - 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 HistoryPooldetails.Query(append(mods, - sm.Where(psql.Group(HistoryPooldetails.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryProposedtreatmentareas starts a query for related objects on history_proposedtreatmentarea -func (o *Organization) HistoryProposedtreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) HistoryProposedtreatmentareasQuery { - return HistoryProposedtreatmentareas.Query(append(mods, - sm.Where(HistoryProposedtreatmentareas.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryProposedtreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) HistoryProposedtreatmentareasQuery { - 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 HistoryProposedtreatmentareas.Query(append(mods, - sm.Where(psql.Group(HistoryProposedtreatmentareas.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryQamosquitoinspections starts a query for related objects on history_qamosquitoinspection -func (o *Organization) HistoryQamosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) HistoryQamosquitoinspectionsQuery { - return HistoryQamosquitoinspections.Query(append(mods, - sm.Where(HistoryQamosquitoinspections.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryQamosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) HistoryQamosquitoinspectionsQuery { - 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 HistoryQamosquitoinspections.Query(append(mods, - sm.Where(psql.Group(HistoryQamosquitoinspections.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryRodentlocations starts a query for related objects on history_rodentlocation -func (o *Organization) HistoryRodentlocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryRodentlocationsQuery { - return HistoryRodentlocations.Query(append(mods, - sm.Where(HistoryRodentlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryRodentlocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryRodentlocationsQuery { - 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 HistoryRodentlocations.Query(append(mods, - sm.Where(psql.Group(HistoryRodentlocations.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistorySamplecollections starts a query for related objects on history_samplecollection -func (o *Organization) HistorySamplecollections(mods ...bob.Mod[*dialect.SelectQuery]) HistorySamplecollectionsQuery { - return HistorySamplecollections.Query(append(mods, - sm.Where(HistorySamplecollections.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistorySamplecollections(mods ...bob.Mod[*dialect.SelectQuery]) HistorySamplecollectionsQuery { - 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 HistorySamplecollections.Query(append(mods, - sm.Where(psql.Group(HistorySamplecollections.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistorySamplelocations starts a query for related objects on history_samplelocation -func (o *Organization) HistorySamplelocations(mods ...bob.Mod[*dialect.SelectQuery]) HistorySamplelocationsQuery { - return HistorySamplelocations.Query(append(mods, - sm.Where(HistorySamplelocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistorySamplelocations(mods ...bob.Mod[*dialect.SelectQuery]) HistorySamplelocationsQuery { - 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 HistorySamplelocations.Query(append(mods, - sm.Where(psql.Group(HistorySamplelocations.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryServicerequests starts a query for related objects on history_servicerequest -func (o *Organization) HistoryServicerequests(mods ...bob.Mod[*dialect.SelectQuery]) HistoryServicerequestsQuery { - return HistoryServicerequests.Query(append(mods, - sm.Where(HistoryServicerequests.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryServicerequests(mods ...bob.Mod[*dialect.SelectQuery]) HistoryServicerequestsQuery { - 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 HistoryServicerequests.Query(append(mods, - sm.Where(psql.Group(HistoryServicerequests.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistorySpeciesabundances starts a query for related objects on history_speciesabundance -func (o *Organization) HistorySpeciesabundances(mods ...bob.Mod[*dialect.SelectQuery]) HistorySpeciesabundancesQuery { - return HistorySpeciesabundances.Query(append(mods, - sm.Where(HistorySpeciesabundances.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistorySpeciesabundances(mods ...bob.Mod[*dialect.SelectQuery]) HistorySpeciesabundancesQuery { - 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 HistorySpeciesabundances.Query(append(mods, - sm.Where(psql.Group(HistorySpeciesabundances.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryStormdrains starts a query for related objects on history_stormdrain -func (o *Organization) HistoryStormdrains(mods ...bob.Mod[*dialect.SelectQuery]) HistoryStormdrainsQuery { - return HistoryStormdrains.Query(append(mods, - sm.Where(HistoryStormdrains.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryStormdrains(mods ...bob.Mod[*dialect.SelectQuery]) HistoryStormdrainsQuery { - 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 HistoryStormdrains.Query(append(mods, - sm.Where(psql.Group(HistoryStormdrains.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryTimecards starts a query for related objects on history_timecard -func (o *Organization) HistoryTimecards(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTimecardsQuery { - return HistoryTimecards.Query(append(mods, - sm.Where(HistoryTimecards.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryTimecards(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTimecardsQuery { - 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 HistoryTimecards.Query(append(mods, - sm.Where(psql.Group(HistoryTimecards.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryTrapdata starts a query for related objects on history_trapdata -func (o *Organization) HistoryTrapdata(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTrapdataQuery { - return HistoryTrapdata.Query(append(mods, - sm.Where(HistoryTrapdata.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryTrapdata(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTrapdataQuery { - 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 HistoryTrapdata.Query(append(mods, - sm.Where(psql.Group(HistoryTrapdata.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryTraplocations starts a query for related objects on history_traplocation -func (o *Organization) HistoryTraplocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTraplocationsQuery { - return HistoryTraplocations.Query(append(mods, - sm.Where(HistoryTraplocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryTraplocations(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTraplocationsQuery { - 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 HistoryTraplocations.Query(append(mods, - sm.Where(psql.Group(HistoryTraplocations.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryTreatments starts a query for related objects on history_treatment -func (o *Organization) HistoryTreatments(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTreatmentsQuery { - return HistoryTreatments.Query(append(mods, - sm.Where(HistoryTreatments.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryTreatments(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTreatmentsQuery { - 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 HistoryTreatments.Query(append(mods, - sm.Where(psql.Group(HistoryTreatments.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryTreatmentareas starts a query for related objects on history_treatmentarea -func (o *Organization) HistoryTreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTreatmentareasQuery { - return HistoryTreatmentareas.Query(append(mods, - sm.Where(HistoryTreatmentareas.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryTreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) HistoryTreatmentareasQuery { - 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 HistoryTreatmentareas.Query(append(mods, - sm.Where(psql.Group(HistoryTreatmentareas.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryZones starts a query for related objects on history_zones -func (o *Organization) HistoryZones(mods ...bob.Mod[*dialect.SelectQuery]) HistoryZonesQuery { - return HistoryZones.Query(append(mods, - sm.Where(HistoryZones.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryZones(mods ...bob.Mod[*dialect.SelectQuery]) HistoryZonesQuery { - 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 HistoryZones.Query(append(mods, - sm.Where(psql.Group(HistoryZones.Columns.OrganizationID).OP("IN", PKArgExpr)), - )...) -} - -// HistoryZones2s starts a query for related objects on history_zones2 -func (o *Organization) HistoryZones2s(mods ...bob.Mod[*dialect.SelectQuery]) HistoryZones2sQuery { - return HistoryZones2s.Query(append(mods, - sm.Where(HistoryZones2s.Columns.OrganizationID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os OrganizationSlice) HistoryZones2s(mods ...bob.Mod[*dialect.SelectQuery]) HistoryZones2sQuery { - 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 HistoryZones2s.Query(append(mods, - sm.Where(psql.Group(HistoryZones2s.Columns.OrganizationID).OP("IN", PKArgExpr)), + return NoteImages.Query(append(mods, + sm.Where(psql.Group(NoteImages.Columns.OrganizationID).OP("IN", PKArgExpr)), )...) } @@ -1863,6 +1238,1842 @@ func (os OrganizationSlice) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQue )...) } +func insertOrganizationContainerrelates0(ctx context.Context, exec bob.Executor, fieldseekerContainerrelates1 []*FieldseekerContainerrelateSetter, organization0 *Organization) (FieldseekerContainerrelateSlice, error) { + for i := range fieldseekerContainerrelates1 { + fieldseekerContainerrelates1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerContainerrelates.Insert(bob.ToMods(fieldseekerContainerrelates1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationContainerrelates0: %w", err) + } + + return ret, nil +} + +func attachOrganizationContainerrelates0(ctx context.Context, exec bob.Executor, count int, fieldseekerContainerrelates1 FieldseekerContainerrelateSlice, organization0 *Organization) (FieldseekerContainerrelateSlice, error) { + setter := &FieldseekerContainerrelateSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerContainerrelates1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationContainerrelates0: %w", err) + } + + return fieldseekerContainerrelates1, nil +} + +func (organization0 *Organization) InsertContainerrelates(ctx context.Context, exec bob.Executor, related ...*FieldseekerContainerrelateSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerContainerrelates1, err := insertOrganizationContainerrelates0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Containerrelates = append(organization0.R.Containerrelates, fieldseekerContainerrelates1...) + + for _, rel := range fieldseekerContainerrelates1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachContainerrelates(ctx context.Context, exec bob.Executor, related ...*FieldseekerContainerrelate) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerContainerrelates1 := FieldseekerContainerrelateSlice(related) + + _, err = attachOrganizationContainerrelates0(ctx, exec, len(related), fieldseekerContainerrelates1, organization0) + if err != nil { + return err + } + + organization0.R.Containerrelates = append(organization0.R.Containerrelates, fieldseekerContainerrelates1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationFieldscoutinglogs0(ctx context.Context, exec bob.Executor, fieldseekerFieldscoutinglogs1 []*FieldseekerFieldscoutinglogSetter, organization0 *Organization) (FieldseekerFieldscoutinglogSlice, error) { + for i := range fieldseekerFieldscoutinglogs1 { + fieldseekerFieldscoutinglogs1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerFieldscoutinglogs.Insert(bob.ToMods(fieldseekerFieldscoutinglogs1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFieldscoutinglogs0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFieldscoutinglogs0(ctx context.Context, exec bob.Executor, count int, fieldseekerFieldscoutinglogs1 FieldseekerFieldscoutinglogSlice, organization0 *Organization) (FieldseekerFieldscoutinglogSlice, error) { + setter := &FieldseekerFieldscoutinglogSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerFieldscoutinglogs1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFieldscoutinglogs0: %w", err) + } + + return fieldseekerFieldscoutinglogs1, nil +} + +func (organization0 *Organization) InsertFieldscoutinglogs(ctx context.Context, exec bob.Executor, related ...*FieldseekerFieldscoutinglogSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerFieldscoutinglogs1, err := insertOrganizationFieldscoutinglogs0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Fieldscoutinglogs = append(organization0.R.Fieldscoutinglogs, fieldseekerFieldscoutinglogs1...) + + for _, rel := range fieldseekerFieldscoutinglogs1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFieldscoutinglogs(ctx context.Context, exec bob.Executor, related ...*FieldseekerFieldscoutinglog) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerFieldscoutinglogs1 := FieldseekerFieldscoutinglogSlice(related) + + _, err = attachOrganizationFieldscoutinglogs0(ctx, exec, len(related), fieldseekerFieldscoutinglogs1, organization0) + if err != nil { + return err + } + + organization0.R.Fieldscoutinglogs = append(organization0.R.Fieldscoutinglogs, fieldseekerFieldscoutinglogs1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationHabitatrelates0(ctx context.Context, exec bob.Executor, fieldseekerHabitatrelates1 []*FieldseekerHabitatrelateSetter, organization0 *Organization) (FieldseekerHabitatrelateSlice, error) { + for i := range fieldseekerHabitatrelates1 { + fieldseekerHabitatrelates1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerHabitatrelates.Insert(bob.ToMods(fieldseekerHabitatrelates1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationHabitatrelates0: %w", err) + } + + return ret, nil +} + +func attachOrganizationHabitatrelates0(ctx context.Context, exec bob.Executor, count int, fieldseekerHabitatrelates1 FieldseekerHabitatrelateSlice, organization0 *Organization) (FieldseekerHabitatrelateSlice, error) { + setter := &FieldseekerHabitatrelateSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerHabitatrelates1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationHabitatrelates0: %w", err) + } + + return fieldseekerHabitatrelates1, nil +} + +func (organization0 *Organization) InsertHabitatrelates(ctx context.Context, exec bob.Executor, related ...*FieldseekerHabitatrelateSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerHabitatrelates1, err := insertOrganizationHabitatrelates0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Habitatrelates = append(organization0.R.Habitatrelates, fieldseekerHabitatrelates1...) + + for _, rel := range fieldseekerHabitatrelates1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachHabitatrelates(ctx context.Context, exec bob.Executor, related ...*FieldseekerHabitatrelate) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerHabitatrelates1 := FieldseekerHabitatrelateSlice(related) + + _, err = attachOrganizationHabitatrelates0(ctx, exec, len(related), fieldseekerHabitatrelates1, organization0) + if err != nil { + return err + } + + organization0.R.Habitatrelates = append(organization0.R.Habitatrelates, fieldseekerHabitatrelates1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationInspectionsamples0(ctx context.Context, exec bob.Executor, fieldseekerInspectionsamples1 []*FieldseekerInspectionsampleSetter, organization0 *Organization) (FieldseekerInspectionsampleSlice, error) { + for i := range fieldseekerInspectionsamples1 { + fieldseekerInspectionsamples1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerInspectionsamples.Insert(bob.ToMods(fieldseekerInspectionsamples1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationInspectionsamples0: %w", err) + } + + return ret, nil +} + +func attachOrganizationInspectionsamples0(ctx context.Context, exec bob.Executor, count int, fieldseekerInspectionsamples1 FieldseekerInspectionsampleSlice, organization0 *Organization) (FieldseekerInspectionsampleSlice, error) { + setter := &FieldseekerInspectionsampleSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerInspectionsamples1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationInspectionsamples0: %w", err) + } + + return fieldseekerInspectionsamples1, nil +} + +func (organization0 *Organization) InsertInspectionsamples(ctx context.Context, exec bob.Executor, related ...*FieldseekerInspectionsampleSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerInspectionsamples1, err := insertOrganizationInspectionsamples0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Inspectionsamples = append(organization0.R.Inspectionsamples, fieldseekerInspectionsamples1...) + + for _, rel := range fieldseekerInspectionsamples1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachInspectionsamples(ctx context.Context, exec bob.Executor, related ...*FieldseekerInspectionsample) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerInspectionsamples1 := FieldseekerInspectionsampleSlice(related) + + _, err = attachOrganizationInspectionsamples0(ctx, exec, len(related), fieldseekerInspectionsamples1, organization0) + if err != nil { + return err + } + + organization0.R.Inspectionsamples = append(organization0.R.Inspectionsamples, fieldseekerInspectionsamples1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationInspectionsampledetails0(ctx context.Context, exec bob.Executor, fieldseekerInspectionsampledetails1 []*FieldseekerInspectionsampledetailSetter, organization0 *Organization) (FieldseekerInspectionsampledetailSlice, error) { + for i := range fieldseekerInspectionsampledetails1 { + fieldseekerInspectionsampledetails1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerInspectionsampledetails.Insert(bob.ToMods(fieldseekerInspectionsampledetails1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationInspectionsampledetails0: %w", err) + } + + return ret, nil +} + +func attachOrganizationInspectionsampledetails0(ctx context.Context, exec bob.Executor, count int, fieldseekerInspectionsampledetails1 FieldseekerInspectionsampledetailSlice, organization0 *Organization) (FieldseekerInspectionsampledetailSlice, error) { + setter := &FieldseekerInspectionsampledetailSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerInspectionsampledetails1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationInspectionsampledetails0: %w", err) + } + + return fieldseekerInspectionsampledetails1, nil +} + +func (organization0 *Organization) InsertInspectionsampledetails(ctx context.Context, exec bob.Executor, related ...*FieldseekerInspectionsampledetailSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerInspectionsampledetails1, err := insertOrganizationInspectionsampledetails0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Inspectionsampledetails = append(organization0.R.Inspectionsampledetails, fieldseekerInspectionsampledetails1...) + + for _, rel := range fieldseekerInspectionsampledetails1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachInspectionsampledetails(ctx context.Context, exec bob.Executor, related ...*FieldseekerInspectionsampledetail) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerInspectionsampledetails1 := FieldseekerInspectionsampledetailSlice(related) + + _, err = attachOrganizationInspectionsampledetails0(ctx, exec, len(related), fieldseekerInspectionsampledetails1, organization0) + if err != nil { + return err + } + + organization0.R.Inspectionsampledetails = append(organization0.R.Inspectionsampledetails, fieldseekerInspectionsampledetails1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationLinelocations0(ctx context.Context, exec bob.Executor, fieldseekerLinelocations1 []*FieldseekerLinelocationSetter, organization0 *Organization) (FieldseekerLinelocationSlice, error) { + for i := range fieldseekerLinelocations1 { + fieldseekerLinelocations1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerLinelocations.Insert(bob.ToMods(fieldseekerLinelocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationLinelocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationLinelocations0(ctx context.Context, exec bob.Executor, count int, fieldseekerLinelocations1 FieldseekerLinelocationSlice, organization0 *Organization) (FieldseekerLinelocationSlice, error) { + setter := &FieldseekerLinelocationSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerLinelocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationLinelocations0: %w", err) + } + + return fieldseekerLinelocations1, nil +} + +func (organization0 *Organization) InsertLinelocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerLinelocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerLinelocations1, err := insertOrganizationLinelocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Linelocations = append(organization0.R.Linelocations, fieldseekerLinelocations1...) + + for _, rel := range fieldseekerLinelocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachLinelocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerLinelocation) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerLinelocations1 := FieldseekerLinelocationSlice(related) + + _, err = attachOrganizationLinelocations0(ctx, exec, len(related), fieldseekerLinelocations1, organization0) + if err != nil { + return err + } + + organization0.R.Linelocations = append(organization0.R.Linelocations, fieldseekerLinelocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationLocationtrackings0(ctx context.Context, exec bob.Executor, fieldseekerLocationtrackings1 []*FieldseekerLocationtrackingSetter, organization0 *Organization) (FieldseekerLocationtrackingSlice, error) { + for i := range fieldseekerLocationtrackings1 { + fieldseekerLocationtrackings1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerLocationtrackings.Insert(bob.ToMods(fieldseekerLocationtrackings1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationLocationtrackings0: %w", err) + } + + return ret, nil +} + +func attachOrganizationLocationtrackings0(ctx context.Context, exec bob.Executor, count int, fieldseekerLocationtrackings1 FieldseekerLocationtrackingSlice, organization0 *Organization) (FieldseekerLocationtrackingSlice, error) { + setter := &FieldseekerLocationtrackingSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerLocationtrackings1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationLocationtrackings0: %w", err) + } + + return fieldseekerLocationtrackings1, nil +} + +func (organization0 *Organization) InsertLocationtrackings(ctx context.Context, exec bob.Executor, related ...*FieldseekerLocationtrackingSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerLocationtrackings1, err := insertOrganizationLocationtrackings0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Locationtrackings = append(organization0.R.Locationtrackings, fieldseekerLocationtrackings1...) + + for _, rel := range fieldseekerLocationtrackings1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachLocationtrackings(ctx context.Context, exec bob.Executor, related ...*FieldseekerLocationtracking) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerLocationtrackings1 := FieldseekerLocationtrackingSlice(related) + + _, err = attachOrganizationLocationtrackings0(ctx, exec, len(related), fieldseekerLocationtrackings1, organization0) + if err != nil { + return err + } + + organization0.R.Locationtrackings = append(organization0.R.Locationtrackings, fieldseekerLocationtrackings1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationMosquitoinspections0(ctx context.Context, exec bob.Executor, fieldseekerMosquitoinspections1 []*FieldseekerMosquitoinspectionSetter, organization0 *Organization) (FieldseekerMosquitoinspectionSlice, error) { + for i := range fieldseekerMosquitoinspections1 { + fieldseekerMosquitoinspections1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerMosquitoinspections.Insert(bob.ToMods(fieldseekerMosquitoinspections1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationMosquitoinspections0: %w", err) + } + + return ret, nil +} + +func attachOrganizationMosquitoinspections0(ctx context.Context, exec bob.Executor, count int, fieldseekerMosquitoinspections1 FieldseekerMosquitoinspectionSlice, organization0 *Organization) (FieldseekerMosquitoinspectionSlice, error) { + setter := &FieldseekerMosquitoinspectionSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerMosquitoinspections1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationMosquitoinspections0: %w", err) + } + + return fieldseekerMosquitoinspections1, nil +} + +func (organization0 *Organization) InsertMosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FieldseekerMosquitoinspectionSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerMosquitoinspections1, err := insertOrganizationMosquitoinspections0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Mosquitoinspections = append(organization0.R.Mosquitoinspections, fieldseekerMosquitoinspections1...) + + for _, rel := range fieldseekerMosquitoinspections1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachMosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FieldseekerMosquitoinspection) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerMosquitoinspections1 := FieldseekerMosquitoinspectionSlice(related) + + _, err = attachOrganizationMosquitoinspections0(ctx, exec, len(related), fieldseekerMosquitoinspections1, organization0) + if err != nil { + return err + } + + organization0.R.Mosquitoinspections = append(organization0.R.Mosquitoinspections, fieldseekerMosquitoinspections1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationPointlocations0(ctx context.Context, exec bob.Executor, fieldseekerPointlocations1 []*FieldseekerPointlocationSetter, organization0 *Organization) (FieldseekerPointlocationSlice, error) { + for i := range fieldseekerPointlocations1 { + fieldseekerPointlocations1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerPointlocations.Insert(bob.ToMods(fieldseekerPointlocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationPointlocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationPointlocations0(ctx context.Context, exec bob.Executor, count int, fieldseekerPointlocations1 FieldseekerPointlocationSlice, organization0 *Organization) (FieldseekerPointlocationSlice, error) { + setter := &FieldseekerPointlocationSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerPointlocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationPointlocations0: %w", err) + } + + return fieldseekerPointlocations1, nil +} + +func (organization0 *Organization) InsertPointlocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerPointlocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerPointlocations1, err := insertOrganizationPointlocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Pointlocations = append(organization0.R.Pointlocations, fieldseekerPointlocations1...) + + for _, rel := range fieldseekerPointlocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachPointlocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerPointlocation) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerPointlocations1 := FieldseekerPointlocationSlice(related) + + _, err = attachOrganizationPointlocations0(ctx, exec, len(related), fieldseekerPointlocations1, organization0) + if err != nil { + return err + } + + organization0.R.Pointlocations = append(organization0.R.Pointlocations, fieldseekerPointlocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationPolygonlocations0(ctx context.Context, exec bob.Executor, fieldseekerPolygonlocations1 []*FieldseekerPolygonlocationSetter, organization0 *Organization) (FieldseekerPolygonlocationSlice, error) { + for i := range fieldseekerPolygonlocations1 { + fieldseekerPolygonlocations1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerPolygonlocations.Insert(bob.ToMods(fieldseekerPolygonlocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationPolygonlocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationPolygonlocations0(ctx context.Context, exec bob.Executor, count int, fieldseekerPolygonlocations1 FieldseekerPolygonlocationSlice, organization0 *Organization) (FieldseekerPolygonlocationSlice, error) { + setter := &FieldseekerPolygonlocationSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerPolygonlocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationPolygonlocations0: %w", err) + } + + return fieldseekerPolygonlocations1, nil +} + +func (organization0 *Organization) InsertPolygonlocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerPolygonlocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerPolygonlocations1, err := insertOrganizationPolygonlocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Polygonlocations = append(organization0.R.Polygonlocations, fieldseekerPolygonlocations1...) + + for _, rel := range fieldseekerPolygonlocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachPolygonlocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerPolygonlocation) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerPolygonlocations1 := FieldseekerPolygonlocationSlice(related) + + _, err = attachOrganizationPolygonlocations0(ctx, exec, len(related), fieldseekerPolygonlocations1, organization0) + if err != nil { + return err + } + + organization0.R.Polygonlocations = append(organization0.R.Polygonlocations, fieldseekerPolygonlocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationPools0(ctx context.Context, exec bob.Executor, fieldseekerPools1 []*FieldseekerPoolSetter, organization0 *Organization) (FieldseekerPoolSlice, error) { + for i := range fieldseekerPools1 { + fieldseekerPools1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerPools.Insert(bob.ToMods(fieldseekerPools1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationPools0: %w", err) + } + + return ret, nil +} + +func attachOrganizationPools0(ctx context.Context, exec bob.Executor, count int, fieldseekerPools1 FieldseekerPoolSlice, organization0 *Organization) (FieldseekerPoolSlice, error) { + setter := &FieldseekerPoolSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerPools1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationPools0: %w", err) + } + + return fieldseekerPools1, nil +} + +func (organization0 *Organization) InsertPools(ctx context.Context, exec bob.Executor, related ...*FieldseekerPoolSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerPools1, err := insertOrganizationPools0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Pools = append(organization0.R.Pools, fieldseekerPools1...) + + for _, rel := range fieldseekerPools1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachPools(ctx context.Context, exec bob.Executor, related ...*FieldseekerPool) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerPools1 := FieldseekerPoolSlice(related) + + _, err = attachOrganizationPools0(ctx, exec, len(related), fieldseekerPools1, organization0) + if err != nil { + return err + } + + organization0.R.Pools = append(organization0.R.Pools, fieldseekerPools1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationPooldetails0(ctx context.Context, exec bob.Executor, fieldseekerPooldetails1 []*FieldseekerPooldetailSetter, organization0 *Organization) (FieldseekerPooldetailSlice, error) { + for i := range fieldseekerPooldetails1 { + fieldseekerPooldetails1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerPooldetails.Insert(bob.ToMods(fieldseekerPooldetails1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationPooldetails0: %w", err) + } + + return ret, nil +} + +func attachOrganizationPooldetails0(ctx context.Context, exec bob.Executor, count int, fieldseekerPooldetails1 FieldseekerPooldetailSlice, organization0 *Organization) (FieldseekerPooldetailSlice, error) { + setter := &FieldseekerPooldetailSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerPooldetails1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationPooldetails0: %w", err) + } + + return fieldseekerPooldetails1, nil +} + +func (organization0 *Organization) InsertPooldetails(ctx context.Context, exec bob.Executor, related ...*FieldseekerPooldetailSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerPooldetails1, err := insertOrganizationPooldetails0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Pooldetails = append(organization0.R.Pooldetails, fieldseekerPooldetails1...) + + for _, rel := range fieldseekerPooldetails1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachPooldetails(ctx context.Context, exec bob.Executor, related ...*FieldseekerPooldetail) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerPooldetails1 := FieldseekerPooldetailSlice(related) + + _, err = attachOrganizationPooldetails0(ctx, exec, len(related), fieldseekerPooldetails1, organization0) + if err != nil { + return err + } + + organization0.R.Pooldetails = append(organization0.R.Pooldetails, fieldseekerPooldetails1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationProposedtreatmentareas0(ctx context.Context, exec bob.Executor, fieldseekerProposedtreatmentareas1 []*FieldseekerProposedtreatmentareaSetter, organization0 *Organization) (FieldseekerProposedtreatmentareaSlice, error) { + for i := range fieldseekerProposedtreatmentareas1 { + fieldseekerProposedtreatmentareas1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerProposedtreatmentareas.Insert(bob.ToMods(fieldseekerProposedtreatmentareas1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationProposedtreatmentareas0: %w", err) + } + + return ret, nil +} + +func attachOrganizationProposedtreatmentareas0(ctx context.Context, exec bob.Executor, count int, fieldseekerProposedtreatmentareas1 FieldseekerProposedtreatmentareaSlice, organization0 *Organization) (FieldseekerProposedtreatmentareaSlice, error) { + setter := &FieldseekerProposedtreatmentareaSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerProposedtreatmentareas1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationProposedtreatmentareas0: %w", err) + } + + return fieldseekerProposedtreatmentareas1, nil +} + +func (organization0 *Organization) InsertProposedtreatmentareas(ctx context.Context, exec bob.Executor, related ...*FieldseekerProposedtreatmentareaSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerProposedtreatmentareas1, err := insertOrganizationProposedtreatmentareas0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Proposedtreatmentareas = append(organization0.R.Proposedtreatmentareas, fieldseekerProposedtreatmentareas1...) + + for _, rel := range fieldseekerProposedtreatmentareas1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachProposedtreatmentareas(ctx context.Context, exec bob.Executor, related ...*FieldseekerProposedtreatmentarea) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerProposedtreatmentareas1 := FieldseekerProposedtreatmentareaSlice(related) + + _, err = attachOrganizationProposedtreatmentareas0(ctx, exec, len(related), fieldseekerProposedtreatmentareas1, organization0) + if err != nil { + return err + } + + organization0.R.Proposedtreatmentareas = append(organization0.R.Proposedtreatmentareas, fieldseekerProposedtreatmentareas1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationQamosquitoinspections0(ctx context.Context, exec bob.Executor, fieldseekerQamosquitoinspections1 []*FieldseekerQamosquitoinspectionSetter, organization0 *Organization) (FieldseekerQamosquitoinspectionSlice, error) { + for i := range fieldseekerQamosquitoinspections1 { + fieldseekerQamosquitoinspections1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerQamosquitoinspections.Insert(bob.ToMods(fieldseekerQamosquitoinspections1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationQamosquitoinspections0: %w", err) + } + + return ret, nil +} + +func attachOrganizationQamosquitoinspections0(ctx context.Context, exec bob.Executor, count int, fieldseekerQamosquitoinspections1 FieldseekerQamosquitoinspectionSlice, organization0 *Organization) (FieldseekerQamosquitoinspectionSlice, error) { + setter := &FieldseekerQamosquitoinspectionSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerQamosquitoinspections1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationQamosquitoinspections0: %w", err) + } + + return fieldseekerQamosquitoinspections1, nil +} + +func (organization0 *Organization) InsertQamosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FieldseekerQamosquitoinspectionSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerQamosquitoinspections1, err := insertOrganizationQamosquitoinspections0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Qamosquitoinspections = append(organization0.R.Qamosquitoinspections, fieldseekerQamosquitoinspections1...) + + for _, rel := range fieldseekerQamosquitoinspections1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachQamosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FieldseekerQamosquitoinspection) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerQamosquitoinspections1 := FieldseekerQamosquitoinspectionSlice(related) + + _, err = attachOrganizationQamosquitoinspections0(ctx, exec, len(related), fieldseekerQamosquitoinspections1, organization0) + if err != nil { + return err + } + + organization0.R.Qamosquitoinspections = append(organization0.R.Qamosquitoinspections, fieldseekerQamosquitoinspections1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationRodentlocations0(ctx context.Context, exec bob.Executor, fieldseekerRodentlocations1 []*FieldseekerRodentlocationSetter, organization0 *Organization) (FieldseekerRodentlocationSlice, error) { + for i := range fieldseekerRodentlocations1 { + fieldseekerRodentlocations1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerRodentlocations.Insert(bob.ToMods(fieldseekerRodentlocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationRodentlocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationRodentlocations0(ctx context.Context, exec bob.Executor, count int, fieldseekerRodentlocations1 FieldseekerRodentlocationSlice, organization0 *Organization) (FieldseekerRodentlocationSlice, error) { + setter := &FieldseekerRodentlocationSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerRodentlocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationRodentlocations0: %w", err) + } + + return fieldseekerRodentlocations1, nil +} + +func (organization0 *Organization) InsertRodentlocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerRodentlocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerRodentlocations1, err := insertOrganizationRodentlocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Rodentlocations = append(organization0.R.Rodentlocations, fieldseekerRodentlocations1...) + + for _, rel := range fieldseekerRodentlocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachRodentlocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerRodentlocation) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerRodentlocations1 := FieldseekerRodentlocationSlice(related) + + _, err = attachOrganizationRodentlocations0(ctx, exec, len(related), fieldseekerRodentlocations1, organization0) + if err != nil { + return err + } + + organization0.R.Rodentlocations = append(organization0.R.Rodentlocations, fieldseekerRodentlocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationSamplecollections0(ctx context.Context, exec bob.Executor, fieldseekerSamplecollections1 []*FieldseekerSamplecollectionSetter, organization0 *Organization) (FieldseekerSamplecollectionSlice, error) { + for i := range fieldseekerSamplecollections1 { + fieldseekerSamplecollections1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerSamplecollections.Insert(bob.ToMods(fieldseekerSamplecollections1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationSamplecollections0: %w", err) + } + + return ret, nil +} + +func attachOrganizationSamplecollections0(ctx context.Context, exec bob.Executor, count int, fieldseekerSamplecollections1 FieldseekerSamplecollectionSlice, organization0 *Organization) (FieldseekerSamplecollectionSlice, error) { + setter := &FieldseekerSamplecollectionSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerSamplecollections1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationSamplecollections0: %w", err) + } + + return fieldseekerSamplecollections1, nil +} + +func (organization0 *Organization) InsertSamplecollections(ctx context.Context, exec bob.Executor, related ...*FieldseekerSamplecollectionSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerSamplecollections1, err := insertOrganizationSamplecollections0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Samplecollections = append(organization0.R.Samplecollections, fieldseekerSamplecollections1...) + + for _, rel := range fieldseekerSamplecollections1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachSamplecollections(ctx context.Context, exec bob.Executor, related ...*FieldseekerSamplecollection) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerSamplecollections1 := FieldseekerSamplecollectionSlice(related) + + _, err = attachOrganizationSamplecollections0(ctx, exec, len(related), fieldseekerSamplecollections1, organization0) + if err != nil { + return err + } + + organization0.R.Samplecollections = append(organization0.R.Samplecollections, fieldseekerSamplecollections1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationSamplelocations0(ctx context.Context, exec bob.Executor, fieldseekerSamplelocations1 []*FieldseekerSamplelocationSetter, organization0 *Organization) (FieldseekerSamplelocationSlice, error) { + for i := range fieldseekerSamplelocations1 { + fieldseekerSamplelocations1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerSamplelocations.Insert(bob.ToMods(fieldseekerSamplelocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationSamplelocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationSamplelocations0(ctx context.Context, exec bob.Executor, count int, fieldseekerSamplelocations1 FieldseekerSamplelocationSlice, organization0 *Organization) (FieldseekerSamplelocationSlice, error) { + setter := &FieldseekerSamplelocationSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerSamplelocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationSamplelocations0: %w", err) + } + + return fieldseekerSamplelocations1, nil +} + +func (organization0 *Organization) InsertSamplelocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerSamplelocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerSamplelocations1, err := insertOrganizationSamplelocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Samplelocations = append(organization0.R.Samplelocations, fieldseekerSamplelocations1...) + + for _, rel := range fieldseekerSamplelocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachSamplelocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerSamplelocation) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerSamplelocations1 := FieldseekerSamplelocationSlice(related) + + _, err = attachOrganizationSamplelocations0(ctx, exec, len(related), fieldseekerSamplelocations1, organization0) + if err != nil { + return err + } + + organization0.R.Samplelocations = append(organization0.R.Samplelocations, fieldseekerSamplelocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationServicerequests0(ctx context.Context, exec bob.Executor, fieldseekerServicerequests1 []*FieldseekerServicerequestSetter, organization0 *Organization) (FieldseekerServicerequestSlice, error) { + for i := range fieldseekerServicerequests1 { + fieldseekerServicerequests1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerServicerequests.Insert(bob.ToMods(fieldseekerServicerequests1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationServicerequests0: %w", err) + } + + return ret, nil +} + +func attachOrganizationServicerequests0(ctx context.Context, exec bob.Executor, count int, fieldseekerServicerequests1 FieldseekerServicerequestSlice, organization0 *Organization) (FieldseekerServicerequestSlice, error) { + setter := &FieldseekerServicerequestSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerServicerequests1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationServicerequests0: %w", err) + } + + return fieldseekerServicerequests1, nil +} + +func (organization0 *Organization) InsertServicerequests(ctx context.Context, exec bob.Executor, related ...*FieldseekerServicerequestSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerServicerequests1, err := insertOrganizationServicerequests0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Servicerequests = append(organization0.R.Servicerequests, fieldseekerServicerequests1...) + + for _, rel := range fieldseekerServicerequests1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachServicerequests(ctx context.Context, exec bob.Executor, related ...*FieldseekerServicerequest) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerServicerequests1 := FieldseekerServicerequestSlice(related) + + _, err = attachOrganizationServicerequests0(ctx, exec, len(related), fieldseekerServicerequests1, organization0) + if err != nil { + return err + } + + organization0.R.Servicerequests = append(organization0.R.Servicerequests, fieldseekerServicerequests1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationSpeciesabundances0(ctx context.Context, exec bob.Executor, fieldseekerSpeciesabundances1 []*FieldseekerSpeciesabundanceSetter, organization0 *Organization) (FieldseekerSpeciesabundanceSlice, error) { + for i := range fieldseekerSpeciesabundances1 { + fieldseekerSpeciesabundances1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerSpeciesabundances.Insert(bob.ToMods(fieldseekerSpeciesabundances1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationSpeciesabundances0: %w", err) + } + + return ret, nil +} + +func attachOrganizationSpeciesabundances0(ctx context.Context, exec bob.Executor, count int, fieldseekerSpeciesabundances1 FieldseekerSpeciesabundanceSlice, organization0 *Organization) (FieldseekerSpeciesabundanceSlice, error) { + setter := &FieldseekerSpeciesabundanceSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerSpeciesabundances1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationSpeciesabundances0: %w", err) + } + + return fieldseekerSpeciesabundances1, nil +} + +func (organization0 *Organization) InsertSpeciesabundances(ctx context.Context, exec bob.Executor, related ...*FieldseekerSpeciesabundanceSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerSpeciesabundances1, err := insertOrganizationSpeciesabundances0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Speciesabundances = append(organization0.R.Speciesabundances, fieldseekerSpeciesabundances1...) + + for _, rel := range fieldseekerSpeciesabundances1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachSpeciesabundances(ctx context.Context, exec bob.Executor, related ...*FieldseekerSpeciesabundance) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerSpeciesabundances1 := FieldseekerSpeciesabundanceSlice(related) + + _, err = attachOrganizationSpeciesabundances0(ctx, exec, len(related), fieldseekerSpeciesabundances1, organization0) + if err != nil { + return err + } + + organization0.R.Speciesabundances = append(organization0.R.Speciesabundances, fieldseekerSpeciesabundances1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationStormdrains0(ctx context.Context, exec bob.Executor, fieldseekerStormdrains1 []*FieldseekerStormdrainSetter, organization0 *Organization) (FieldseekerStormdrainSlice, error) { + for i := range fieldseekerStormdrains1 { + fieldseekerStormdrains1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerStormdrains.Insert(bob.ToMods(fieldseekerStormdrains1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationStormdrains0: %w", err) + } + + return ret, nil +} + +func attachOrganizationStormdrains0(ctx context.Context, exec bob.Executor, count int, fieldseekerStormdrains1 FieldseekerStormdrainSlice, organization0 *Organization) (FieldseekerStormdrainSlice, error) { + setter := &FieldseekerStormdrainSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerStormdrains1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationStormdrains0: %w", err) + } + + return fieldseekerStormdrains1, nil +} + +func (organization0 *Organization) InsertStormdrains(ctx context.Context, exec bob.Executor, related ...*FieldseekerStormdrainSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerStormdrains1, err := insertOrganizationStormdrains0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Stormdrains = append(organization0.R.Stormdrains, fieldseekerStormdrains1...) + + for _, rel := range fieldseekerStormdrains1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachStormdrains(ctx context.Context, exec bob.Executor, related ...*FieldseekerStormdrain) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerStormdrains1 := FieldseekerStormdrainSlice(related) + + _, err = attachOrganizationStormdrains0(ctx, exec, len(related), fieldseekerStormdrains1, organization0) + if err != nil { + return err + } + + organization0.R.Stormdrains = append(organization0.R.Stormdrains, fieldseekerStormdrains1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationTimecards0(ctx context.Context, exec bob.Executor, fieldseekerTimecards1 []*FieldseekerTimecardSetter, organization0 *Organization) (FieldseekerTimecardSlice, error) { + for i := range fieldseekerTimecards1 { + fieldseekerTimecards1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerTimecards.Insert(bob.ToMods(fieldseekerTimecards1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationTimecards0: %w", err) + } + + return ret, nil +} + +func attachOrganizationTimecards0(ctx context.Context, exec bob.Executor, count int, fieldseekerTimecards1 FieldseekerTimecardSlice, organization0 *Organization) (FieldseekerTimecardSlice, error) { + setter := &FieldseekerTimecardSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerTimecards1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationTimecards0: %w", err) + } + + return fieldseekerTimecards1, nil +} + +func (organization0 *Organization) InsertTimecards(ctx context.Context, exec bob.Executor, related ...*FieldseekerTimecardSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerTimecards1, err := insertOrganizationTimecards0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Timecards = append(organization0.R.Timecards, fieldseekerTimecards1...) + + for _, rel := range fieldseekerTimecards1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachTimecards(ctx context.Context, exec bob.Executor, related ...*FieldseekerTimecard) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerTimecards1 := FieldseekerTimecardSlice(related) + + _, err = attachOrganizationTimecards0(ctx, exec, len(related), fieldseekerTimecards1, organization0) + if err != nil { + return err + } + + organization0.R.Timecards = append(organization0.R.Timecards, fieldseekerTimecards1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationTrapdata0(ctx context.Context, exec bob.Executor, fieldseekerTrapdata1 []*FieldseekerTrapdatumSetter, organization0 *Organization) (FieldseekerTrapdatumSlice, error) { + for i := range fieldseekerTrapdata1 { + fieldseekerTrapdata1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerTrapdata.Insert(bob.ToMods(fieldseekerTrapdata1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationTrapdata0: %w", err) + } + + return ret, nil +} + +func attachOrganizationTrapdata0(ctx context.Context, exec bob.Executor, count int, fieldseekerTrapdata1 FieldseekerTrapdatumSlice, organization0 *Organization) (FieldseekerTrapdatumSlice, error) { + setter := &FieldseekerTrapdatumSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerTrapdata1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationTrapdata0: %w", err) + } + + return fieldseekerTrapdata1, nil +} + +func (organization0 *Organization) InsertTrapdata(ctx context.Context, exec bob.Executor, related ...*FieldseekerTrapdatumSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerTrapdata1, err := insertOrganizationTrapdata0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Trapdata = append(organization0.R.Trapdata, fieldseekerTrapdata1...) + + for _, rel := range fieldseekerTrapdata1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachTrapdata(ctx context.Context, exec bob.Executor, related ...*FieldseekerTrapdatum) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerTrapdata1 := FieldseekerTrapdatumSlice(related) + + _, err = attachOrganizationTrapdata0(ctx, exec, len(related), fieldseekerTrapdata1, organization0) + if err != nil { + return err + } + + organization0.R.Trapdata = append(organization0.R.Trapdata, fieldseekerTrapdata1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationTraplocations0(ctx context.Context, exec bob.Executor, fieldseekerTraplocations1 []*FieldseekerTraplocationSetter, organization0 *Organization) (FieldseekerTraplocationSlice, error) { + for i := range fieldseekerTraplocations1 { + fieldseekerTraplocations1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerTraplocations.Insert(bob.ToMods(fieldseekerTraplocations1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationTraplocations0: %w", err) + } + + return ret, nil +} + +func attachOrganizationTraplocations0(ctx context.Context, exec bob.Executor, count int, fieldseekerTraplocations1 FieldseekerTraplocationSlice, organization0 *Organization) (FieldseekerTraplocationSlice, error) { + setter := &FieldseekerTraplocationSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerTraplocations1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationTraplocations0: %w", err) + } + + return fieldseekerTraplocations1, nil +} + +func (organization0 *Organization) InsertTraplocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerTraplocationSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerTraplocations1, err := insertOrganizationTraplocations0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Traplocations = append(organization0.R.Traplocations, fieldseekerTraplocations1...) + + for _, rel := range fieldseekerTraplocations1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachTraplocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerTraplocation) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerTraplocations1 := FieldseekerTraplocationSlice(related) + + _, err = attachOrganizationTraplocations0(ctx, exec, len(related), fieldseekerTraplocations1, organization0) + if err != nil { + return err + } + + organization0.R.Traplocations = append(organization0.R.Traplocations, fieldseekerTraplocations1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationTreatments0(ctx context.Context, exec bob.Executor, fieldseekerTreatments1 []*FieldseekerTreatmentSetter, organization0 *Organization) (FieldseekerTreatmentSlice, error) { + for i := range fieldseekerTreatments1 { + fieldseekerTreatments1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerTreatments.Insert(bob.ToMods(fieldseekerTreatments1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationTreatments0: %w", err) + } + + return ret, nil +} + +func attachOrganizationTreatments0(ctx context.Context, exec bob.Executor, count int, fieldseekerTreatments1 FieldseekerTreatmentSlice, organization0 *Organization) (FieldseekerTreatmentSlice, error) { + setter := &FieldseekerTreatmentSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerTreatments1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationTreatments0: %w", err) + } + + return fieldseekerTreatments1, nil +} + +func (organization0 *Organization) InsertTreatments(ctx context.Context, exec bob.Executor, related ...*FieldseekerTreatmentSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerTreatments1, err := insertOrganizationTreatments0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Treatments = append(organization0.R.Treatments, fieldseekerTreatments1...) + + for _, rel := range fieldseekerTreatments1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachTreatments(ctx context.Context, exec bob.Executor, related ...*FieldseekerTreatment) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerTreatments1 := FieldseekerTreatmentSlice(related) + + _, err = attachOrganizationTreatments0(ctx, exec, len(related), fieldseekerTreatments1, organization0) + if err != nil { + return err + } + + organization0.R.Treatments = append(organization0.R.Treatments, fieldseekerTreatments1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationTreatmentareas0(ctx context.Context, exec bob.Executor, fieldseekerTreatmentareas1 []*FieldseekerTreatmentareaSetter, organization0 *Organization) (FieldseekerTreatmentareaSlice, error) { + for i := range fieldseekerTreatmentareas1 { + fieldseekerTreatmentareas1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerTreatmentareas.Insert(bob.ToMods(fieldseekerTreatmentareas1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationTreatmentareas0: %w", err) + } + + return ret, nil +} + +func attachOrganizationTreatmentareas0(ctx context.Context, exec bob.Executor, count int, fieldseekerTreatmentareas1 FieldseekerTreatmentareaSlice, organization0 *Organization) (FieldseekerTreatmentareaSlice, error) { + setter := &FieldseekerTreatmentareaSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerTreatmentareas1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationTreatmentareas0: %w", err) + } + + return fieldseekerTreatmentareas1, nil +} + +func (organization0 *Organization) InsertTreatmentareas(ctx context.Context, exec bob.Executor, related ...*FieldseekerTreatmentareaSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerTreatmentareas1, err := insertOrganizationTreatmentareas0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Treatmentareas = append(organization0.R.Treatmentareas, fieldseekerTreatmentareas1...) + + for _, rel := range fieldseekerTreatmentareas1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachTreatmentareas(ctx context.Context, exec bob.Executor, related ...*FieldseekerTreatmentarea) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerTreatmentareas1 := FieldseekerTreatmentareaSlice(related) + + _, err = attachOrganizationTreatmentareas0(ctx, exec, len(related), fieldseekerTreatmentareas1, organization0) + if err != nil { + return err + } + + organization0.R.Treatmentareas = append(organization0.R.Treatmentareas, fieldseekerTreatmentareas1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationZones0(ctx context.Context, exec bob.Executor, fieldseekerZones1 []*FieldseekerZoneSetter, organization0 *Organization) (FieldseekerZoneSlice, error) { + for i := range fieldseekerZones1 { + fieldseekerZones1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerZones.Insert(bob.ToMods(fieldseekerZones1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationZones0: %w", err) + } + + return ret, nil +} + +func attachOrganizationZones0(ctx context.Context, exec bob.Executor, count int, fieldseekerZones1 FieldseekerZoneSlice, organization0 *Organization) (FieldseekerZoneSlice, error) { + setter := &FieldseekerZoneSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerZones1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationZones0: %w", err) + } + + return fieldseekerZones1, nil +} + +func (organization0 *Organization) InsertZones(ctx context.Context, exec bob.Executor, related ...*FieldseekerZoneSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerZones1, err := insertOrganizationZones0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Zones = append(organization0.R.Zones, fieldseekerZones1...) + + for _, rel := range fieldseekerZones1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachZones(ctx context.Context, exec bob.Executor, related ...*FieldseekerZone) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerZones1 := FieldseekerZoneSlice(related) + + _, err = attachOrganizationZones0(ctx, exec, len(related), fieldseekerZones1, organization0) + if err != nil { + return err + } + + organization0.R.Zones = append(organization0.R.Zones, fieldseekerZones1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + +func insertOrganizationZones2s0(ctx context.Context, exec bob.Executor, fieldseekerZones2s1 []*FieldseekerZones2Setter, organization0 *Organization) (FieldseekerZones2Slice, error) { + for i := range fieldseekerZones2s1 { + fieldseekerZones2s1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := FieldseekerZones2s.Insert(bob.ToMods(fieldseekerZones2s1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationZones2s0: %w", err) + } + + return ret, nil +} + +func attachOrganizationZones2s0(ctx context.Context, exec bob.Executor, count int, fieldseekerZones2s1 FieldseekerZones2Slice, organization0 *Organization) (FieldseekerZones2Slice, error) { + setter := &FieldseekerZones2Setter{ + OrganizationID: omit.From(organization0.ID), + } + + err := fieldseekerZones2s1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationZones2s0: %w", err) + } + + return fieldseekerZones2s1, nil +} + +func (organization0 *Organization) InsertZones2s(ctx context.Context, exec bob.Executor, related ...*FieldseekerZones2Setter) error { + if len(related) == 0 { + return nil + } + + var err error + + fieldseekerZones2s1, err := insertOrganizationZones2s0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Zones2s = append(organization0.R.Zones2s, fieldseekerZones2s1...) + + for _, rel := range fieldseekerZones2s1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachZones2s(ctx context.Context, exec bob.Executor, related ...*FieldseekerZones2) error { + if len(related) == 0 { + return nil + } + + var err error + fieldseekerZones2s1 := FieldseekerZones2Slice(related) + + _, err = attachOrganizationZones2s0(ctx, exec, len(related), fieldseekerZones2s1, organization0) + if err != nil { + return err + } + + organization0.R.Zones2s = append(organization0.R.Zones2s, fieldseekerZones2s1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + func insertOrganizationFieldseekerSyncs0(ctx context.Context, exec bob.Executor, fieldseekerSyncs1 []*FieldseekerSyncSetter, organization0 *Organization) (FieldseekerSyncSlice, error) { for i := range fieldseekerSyncs1 { fieldseekerSyncs1[i].OrganizationID = omit.From(organization0.ID) @@ -1931,1842 +3142,6 @@ func (organization0 *Organization) AttachFieldseekerSyncs(ctx context.Context, e return nil } -func insertOrganizationFSContainerrelates0(ctx context.Context, exec bob.Executor, fsContainerrelates1 []*FSContainerrelateSetter, organization0 *Organization) (FSContainerrelateSlice, error) { - for i := range fsContainerrelates1 { - fsContainerrelates1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSContainerrelates.Insert(bob.ToMods(fsContainerrelates1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSContainerrelates0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSContainerrelates0(ctx context.Context, exec bob.Executor, count int, fsContainerrelates1 FSContainerrelateSlice, organization0 *Organization) (FSContainerrelateSlice, error) { - setter := &FSContainerrelateSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsContainerrelates1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSContainerrelates0: %w", err) - } - - return fsContainerrelates1, nil -} - -func (organization0 *Organization) InsertFSContainerrelates(ctx context.Context, exec bob.Executor, related ...*FSContainerrelateSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsContainerrelates1, err := insertOrganizationFSContainerrelates0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSContainerrelates = append(organization0.R.FSContainerrelates, fsContainerrelates1...) - - for _, rel := range fsContainerrelates1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSContainerrelates(ctx context.Context, exec bob.Executor, related ...*FSContainerrelate) error { - if len(related) == 0 { - return nil - } - - var err error - fsContainerrelates1 := FSContainerrelateSlice(related) - - _, err = attachOrganizationFSContainerrelates0(ctx, exec, len(related), fsContainerrelates1, organization0) - if err != nil { - return err - } - - organization0.R.FSContainerrelates = append(organization0.R.FSContainerrelates, fsContainerrelates1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSFieldscoutinglogs0(ctx context.Context, exec bob.Executor, fsFieldscoutinglogs1 []*FSFieldscoutinglogSetter, organization0 *Organization) (FSFieldscoutinglogSlice, error) { - for i := range fsFieldscoutinglogs1 { - fsFieldscoutinglogs1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSFieldscoutinglogs.Insert(bob.ToMods(fsFieldscoutinglogs1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSFieldscoutinglogs0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSFieldscoutinglogs0(ctx context.Context, exec bob.Executor, count int, fsFieldscoutinglogs1 FSFieldscoutinglogSlice, organization0 *Organization) (FSFieldscoutinglogSlice, error) { - setter := &FSFieldscoutinglogSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsFieldscoutinglogs1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSFieldscoutinglogs0: %w", err) - } - - return fsFieldscoutinglogs1, nil -} - -func (organization0 *Organization) InsertFSFieldscoutinglogs(ctx context.Context, exec bob.Executor, related ...*FSFieldscoutinglogSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsFieldscoutinglogs1, err := insertOrganizationFSFieldscoutinglogs0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSFieldscoutinglogs = append(organization0.R.FSFieldscoutinglogs, fsFieldscoutinglogs1...) - - for _, rel := range fsFieldscoutinglogs1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSFieldscoutinglogs(ctx context.Context, exec bob.Executor, related ...*FSFieldscoutinglog) error { - if len(related) == 0 { - return nil - } - - var err error - fsFieldscoutinglogs1 := FSFieldscoutinglogSlice(related) - - _, err = attachOrganizationFSFieldscoutinglogs0(ctx, exec, len(related), fsFieldscoutinglogs1, organization0) - if err != nil { - return err - } - - organization0.R.FSFieldscoutinglogs = append(organization0.R.FSFieldscoutinglogs, fsFieldscoutinglogs1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSHabitatrelates0(ctx context.Context, exec bob.Executor, fsHabitatrelates1 []*FSHabitatrelateSetter, organization0 *Organization) (FSHabitatrelateSlice, error) { - for i := range fsHabitatrelates1 { - fsHabitatrelates1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSHabitatrelates.Insert(bob.ToMods(fsHabitatrelates1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSHabitatrelates0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSHabitatrelates0(ctx context.Context, exec bob.Executor, count int, fsHabitatrelates1 FSHabitatrelateSlice, organization0 *Organization) (FSHabitatrelateSlice, error) { - setter := &FSHabitatrelateSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsHabitatrelates1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSHabitatrelates0: %w", err) - } - - return fsHabitatrelates1, nil -} - -func (organization0 *Organization) InsertFSHabitatrelates(ctx context.Context, exec bob.Executor, related ...*FSHabitatrelateSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsHabitatrelates1, err := insertOrganizationFSHabitatrelates0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSHabitatrelates = append(organization0.R.FSHabitatrelates, fsHabitatrelates1...) - - for _, rel := range fsHabitatrelates1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSHabitatrelates(ctx context.Context, exec bob.Executor, related ...*FSHabitatrelate) error { - if len(related) == 0 { - return nil - } - - var err error - fsHabitatrelates1 := FSHabitatrelateSlice(related) - - _, err = attachOrganizationFSHabitatrelates0(ctx, exec, len(related), fsHabitatrelates1, organization0) - if err != nil { - return err - } - - organization0.R.FSHabitatrelates = append(organization0.R.FSHabitatrelates, fsHabitatrelates1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSInspectionsamples0(ctx context.Context, exec bob.Executor, fsInspectionsamples1 []*FSInspectionsampleSetter, organization0 *Organization) (FSInspectionsampleSlice, error) { - for i := range fsInspectionsamples1 { - fsInspectionsamples1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSInspectionsamples.Insert(bob.ToMods(fsInspectionsamples1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSInspectionsamples0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSInspectionsamples0(ctx context.Context, exec bob.Executor, count int, fsInspectionsamples1 FSInspectionsampleSlice, organization0 *Organization) (FSInspectionsampleSlice, error) { - setter := &FSInspectionsampleSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsInspectionsamples1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSInspectionsamples0: %w", err) - } - - return fsInspectionsamples1, nil -} - -func (organization0 *Organization) InsertFSInspectionsamples(ctx context.Context, exec bob.Executor, related ...*FSInspectionsampleSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsInspectionsamples1, err := insertOrganizationFSInspectionsamples0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSInspectionsamples = append(organization0.R.FSInspectionsamples, fsInspectionsamples1...) - - for _, rel := range fsInspectionsamples1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSInspectionsamples(ctx context.Context, exec bob.Executor, related ...*FSInspectionsample) error { - if len(related) == 0 { - return nil - } - - var err error - fsInspectionsamples1 := FSInspectionsampleSlice(related) - - _, err = attachOrganizationFSInspectionsamples0(ctx, exec, len(related), fsInspectionsamples1, organization0) - if err != nil { - return err - } - - organization0.R.FSInspectionsamples = append(organization0.R.FSInspectionsamples, fsInspectionsamples1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSInspectionsampledetails0(ctx context.Context, exec bob.Executor, fsInspectionsampledetails1 []*FSInspectionsampledetailSetter, organization0 *Organization) (FSInspectionsampledetailSlice, error) { - for i := range fsInspectionsampledetails1 { - fsInspectionsampledetails1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSInspectionsampledetails.Insert(bob.ToMods(fsInspectionsampledetails1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSInspectionsampledetails0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSInspectionsampledetails0(ctx context.Context, exec bob.Executor, count int, fsInspectionsampledetails1 FSInspectionsampledetailSlice, organization0 *Organization) (FSInspectionsampledetailSlice, error) { - setter := &FSInspectionsampledetailSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsInspectionsampledetails1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSInspectionsampledetails0: %w", err) - } - - return fsInspectionsampledetails1, nil -} - -func (organization0 *Organization) InsertFSInspectionsampledetails(ctx context.Context, exec bob.Executor, related ...*FSInspectionsampledetailSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsInspectionsampledetails1, err := insertOrganizationFSInspectionsampledetails0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSInspectionsampledetails = append(organization0.R.FSInspectionsampledetails, fsInspectionsampledetails1...) - - for _, rel := range fsInspectionsampledetails1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSInspectionsampledetails(ctx context.Context, exec bob.Executor, related ...*FSInspectionsampledetail) error { - if len(related) == 0 { - return nil - } - - var err error - fsInspectionsampledetails1 := FSInspectionsampledetailSlice(related) - - _, err = attachOrganizationFSInspectionsampledetails0(ctx, exec, len(related), fsInspectionsampledetails1, organization0) - if err != nil { - return err - } - - organization0.R.FSInspectionsampledetails = append(organization0.R.FSInspectionsampledetails, fsInspectionsampledetails1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSLinelocations0(ctx context.Context, exec bob.Executor, fsLinelocations1 []*FSLinelocationSetter, organization0 *Organization) (FSLinelocationSlice, error) { - for i := range fsLinelocations1 { - fsLinelocations1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSLinelocations.Insert(bob.ToMods(fsLinelocations1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSLinelocations0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSLinelocations0(ctx context.Context, exec bob.Executor, count int, fsLinelocations1 FSLinelocationSlice, organization0 *Organization) (FSLinelocationSlice, error) { - setter := &FSLinelocationSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsLinelocations1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSLinelocations0: %w", err) - } - - return fsLinelocations1, nil -} - -func (organization0 *Organization) InsertFSLinelocations(ctx context.Context, exec bob.Executor, related ...*FSLinelocationSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsLinelocations1, err := insertOrganizationFSLinelocations0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSLinelocations = append(organization0.R.FSLinelocations, fsLinelocations1...) - - for _, rel := range fsLinelocations1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSLinelocations(ctx context.Context, exec bob.Executor, related ...*FSLinelocation) error { - if len(related) == 0 { - return nil - } - - var err error - fsLinelocations1 := FSLinelocationSlice(related) - - _, err = attachOrganizationFSLinelocations0(ctx, exec, len(related), fsLinelocations1, organization0) - if err != nil { - return err - } - - organization0.R.FSLinelocations = append(organization0.R.FSLinelocations, fsLinelocations1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSLocationtrackings0(ctx context.Context, exec bob.Executor, fsLocationtrackings1 []*FSLocationtrackingSetter, organization0 *Organization) (FSLocationtrackingSlice, error) { - for i := range fsLocationtrackings1 { - fsLocationtrackings1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSLocationtrackings.Insert(bob.ToMods(fsLocationtrackings1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSLocationtrackings0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSLocationtrackings0(ctx context.Context, exec bob.Executor, count int, fsLocationtrackings1 FSLocationtrackingSlice, organization0 *Organization) (FSLocationtrackingSlice, error) { - setter := &FSLocationtrackingSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsLocationtrackings1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSLocationtrackings0: %w", err) - } - - return fsLocationtrackings1, nil -} - -func (organization0 *Organization) InsertFSLocationtrackings(ctx context.Context, exec bob.Executor, related ...*FSLocationtrackingSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsLocationtrackings1, err := insertOrganizationFSLocationtrackings0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSLocationtrackings = append(organization0.R.FSLocationtrackings, fsLocationtrackings1...) - - for _, rel := range fsLocationtrackings1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSLocationtrackings(ctx context.Context, exec bob.Executor, related ...*FSLocationtracking) error { - if len(related) == 0 { - return nil - } - - var err error - fsLocationtrackings1 := FSLocationtrackingSlice(related) - - _, err = attachOrganizationFSLocationtrackings0(ctx, exec, len(related), fsLocationtrackings1, organization0) - if err != nil { - return err - } - - organization0.R.FSLocationtrackings = append(organization0.R.FSLocationtrackings, fsLocationtrackings1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSMosquitoinspections0(ctx context.Context, exec bob.Executor, fsMosquitoinspections1 []*FSMosquitoinspectionSetter, organization0 *Organization) (FSMosquitoinspectionSlice, error) { - for i := range fsMosquitoinspections1 { - fsMosquitoinspections1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSMosquitoinspections.Insert(bob.ToMods(fsMosquitoinspections1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSMosquitoinspections0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSMosquitoinspections0(ctx context.Context, exec bob.Executor, count int, fsMosquitoinspections1 FSMosquitoinspectionSlice, organization0 *Organization) (FSMosquitoinspectionSlice, error) { - setter := &FSMosquitoinspectionSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsMosquitoinspections1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSMosquitoinspections0: %w", err) - } - - return fsMosquitoinspections1, nil -} - -func (organization0 *Organization) InsertFSMosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FSMosquitoinspectionSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsMosquitoinspections1, err := insertOrganizationFSMosquitoinspections0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSMosquitoinspections = append(organization0.R.FSMosquitoinspections, fsMosquitoinspections1...) - - for _, rel := range fsMosquitoinspections1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSMosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FSMosquitoinspection) error { - if len(related) == 0 { - return nil - } - - var err error - fsMosquitoinspections1 := FSMosquitoinspectionSlice(related) - - _, err = attachOrganizationFSMosquitoinspections0(ctx, exec, len(related), fsMosquitoinspections1, organization0) - if err != nil { - return err - } - - organization0.R.FSMosquitoinspections = append(organization0.R.FSMosquitoinspections, fsMosquitoinspections1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSPointlocations0(ctx context.Context, exec bob.Executor, fsPointlocations1 []*FSPointlocationSetter, organization0 *Organization) (FSPointlocationSlice, error) { - for i := range fsPointlocations1 { - fsPointlocations1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSPointlocations.Insert(bob.ToMods(fsPointlocations1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSPointlocations0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSPointlocations0(ctx context.Context, exec bob.Executor, count int, fsPointlocations1 FSPointlocationSlice, organization0 *Organization) (FSPointlocationSlice, error) { - setter := &FSPointlocationSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsPointlocations1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSPointlocations0: %w", err) - } - - return fsPointlocations1, nil -} - -func (organization0 *Organization) InsertFSPointlocations(ctx context.Context, exec bob.Executor, related ...*FSPointlocationSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsPointlocations1, err := insertOrganizationFSPointlocations0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSPointlocations = append(organization0.R.FSPointlocations, fsPointlocations1...) - - for _, rel := range fsPointlocations1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSPointlocations(ctx context.Context, exec bob.Executor, related ...*FSPointlocation) error { - if len(related) == 0 { - return nil - } - - var err error - fsPointlocations1 := FSPointlocationSlice(related) - - _, err = attachOrganizationFSPointlocations0(ctx, exec, len(related), fsPointlocations1, organization0) - if err != nil { - return err - } - - organization0.R.FSPointlocations = append(organization0.R.FSPointlocations, fsPointlocations1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSPolygonlocations0(ctx context.Context, exec bob.Executor, fsPolygonlocations1 []*FSPolygonlocationSetter, organization0 *Organization) (FSPolygonlocationSlice, error) { - for i := range fsPolygonlocations1 { - fsPolygonlocations1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSPolygonlocations.Insert(bob.ToMods(fsPolygonlocations1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSPolygonlocations0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSPolygonlocations0(ctx context.Context, exec bob.Executor, count int, fsPolygonlocations1 FSPolygonlocationSlice, organization0 *Organization) (FSPolygonlocationSlice, error) { - setter := &FSPolygonlocationSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsPolygonlocations1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSPolygonlocations0: %w", err) - } - - return fsPolygonlocations1, nil -} - -func (organization0 *Organization) InsertFSPolygonlocations(ctx context.Context, exec bob.Executor, related ...*FSPolygonlocationSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsPolygonlocations1, err := insertOrganizationFSPolygonlocations0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSPolygonlocations = append(organization0.R.FSPolygonlocations, fsPolygonlocations1...) - - for _, rel := range fsPolygonlocations1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSPolygonlocations(ctx context.Context, exec bob.Executor, related ...*FSPolygonlocation) error { - if len(related) == 0 { - return nil - } - - var err error - fsPolygonlocations1 := FSPolygonlocationSlice(related) - - _, err = attachOrganizationFSPolygonlocations0(ctx, exec, len(related), fsPolygonlocations1, organization0) - if err != nil { - return err - } - - organization0.R.FSPolygonlocations = append(organization0.R.FSPolygonlocations, fsPolygonlocations1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSPools0(ctx context.Context, exec bob.Executor, fsPools1 []*FSPoolSetter, organization0 *Organization) (FSPoolSlice, error) { - for i := range fsPools1 { - fsPools1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSPools.Insert(bob.ToMods(fsPools1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSPools0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSPools0(ctx context.Context, exec bob.Executor, count int, fsPools1 FSPoolSlice, organization0 *Organization) (FSPoolSlice, error) { - setter := &FSPoolSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsPools1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSPools0: %w", err) - } - - return fsPools1, nil -} - -func (organization0 *Organization) InsertFSPools(ctx context.Context, exec bob.Executor, related ...*FSPoolSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsPools1, err := insertOrganizationFSPools0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSPools = append(organization0.R.FSPools, fsPools1...) - - for _, rel := range fsPools1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSPools(ctx context.Context, exec bob.Executor, related ...*FSPool) error { - if len(related) == 0 { - return nil - } - - var err error - fsPools1 := FSPoolSlice(related) - - _, err = attachOrganizationFSPools0(ctx, exec, len(related), fsPools1, organization0) - if err != nil { - return err - } - - organization0.R.FSPools = append(organization0.R.FSPools, fsPools1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSPooldetails0(ctx context.Context, exec bob.Executor, fsPooldetails1 []*FSPooldetailSetter, organization0 *Organization) (FSPooldetailSlice, error) { - for i := range fsPooldetails1 { - fsPooldetails1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSPooldetails.Insert(bob.ToMods(fsPooldetails1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSPooldetails0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSPooldetails0(ctx context.Context, exec bob.Executor, count int, fsPooldetails1 FSPooldetailSlice, organization0 *Organization) (FSPooldetailSlice, error) { - setter := &FSPooldetailSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsPooldetails1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSPooldetails0: %w", err) - } - - return fsPooldetails1, nil -} - -func (organization0 *Organization) InsertFSPooldetails(ctx context.Context, exec bob.Executor, related ...*FSPooldetailSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsPooldetails1, err := insertOrganizationFSPooldetails0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSPooldetails = append(organization0.R.FSPooldetails, fsPooldetails1...) - - for _, rel := range fsPooldetails1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSPooldetails(ctx context.Context, exec bob.Executor, related ...*FSPooldetail) error { - if len(related) == 0 { - return nil - } - - var err error - fsPooldetails1 := FSPooldetailSlice(related) - - _, err = attachOrganizationFSPooldetails0(ctx, exec, len(related), fsPooldetails1, organization0) - if err != nil { - return err - } - - organization0.R.FSPooldetails = append(organization0.R.FSPooldetails, fsPooldetails1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSProposedtreatmentareas0(ctx context.Context, exec bob.Executor, fsProposedtreatmentareas1 []*FSProposedtreatmentareaSetter, organization0 *Organization) (FSProposedtreatmentareaSlice, error) { - for i := range fsProposedtreatmentareas1 { - fsProposedtreatmentareas1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSProposedtreatmentareas.Insert(bob.ToMods(fsProposedtreatmentareas1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSProposedtreatmentareas0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSProposedtreatmentareas0(ctx context.Context, exec bob.Executor, count int, fsProposedtreatmentareas1 FSProposedtreatmentareaSlice, organization0 *Organization) (FSProposedtreatmentareaSlice, error) { - setter := &FSProposedtreatmentareaSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsProposedtreatmentareas1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSProposedtreatmentareas0: %w", err) - } - - return fsProposedtreatmentareas1, nil -} - -func (organization0 *Organization) InsertFSProposedtreatmentareas(ctx context.Context, exec bob.Executor, related ...*FSProposedtreatmentareaSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsProposedtreatmentareas1, err := insertOrganizationFSProposedtreatmentareas0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSProposedtreatmentareas = append(organization0.R.FSProposedtreatmentareas, fsProposedtreatmentareas1...) - - for _, rel := range fsProposedtreatmentareas1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSProposedtreatmentareas(ctx context.Context, exec bob.Executor, related ...*FSProposedtreatmentarea) error { - if len(related) == 0 { - return nil - } - - var err error - fsProposedtreatmentareas1 := FSProposedtreatmentareaSlice(related) - - _, err = attachOrganizationFSProposedtreatmentareas0(ctx, exec, len(related), fsProposedtreatmentareas1, organization0) - if err != nil { - return err - } - - organization0.R.FSProposedtreatmentareas = append(organization0.R.FSProposedtreatmentareas, fsProposedtreatmentareas1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSQamosquitoinspections0(ctx context.Context, exec bob.Executor, fsQamosquitoinspections1 []*FSQamosquitoinspectionSetter, organization0 *Organization) (FSQamosquitoinspectionSlice, error) { - for i := range fsQamosquitoinspections1 { - fsQamosquitoinspections1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSQamosquitoinspections.Insert(bob.ToMods(fsQamosquitoinspections1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSQamosquitoinspections0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSQamosquitoinspections0(ctx context.Context, exec bob.Executor, count int, fsQamosquitoinspections1 FSQamosquitoinspectionSlice, organization0 *Organization) (FSQamosquitoinspectionSlice, error) { - setter := &FSQamosquitoinspectionSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsQamosquitoinspections1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSQamosquitoinspections0: %w", err) - } - - return fsQamosquitoinspections1, nil -} - -func (organization0 *Organization) InsertFSQamosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FSQamosquitoinspectionSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsQamosquitoinspections1, err := insertOrganizationFSQamosquitoinspections0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSQamosquitoinspections = append(organization0.R.FSQamosquitoinspections, fsQamosquitoinspections1...) - - for _, rel := range fsQamosquitoinspections1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSQamosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FSQamosquitoinspection) error { - if len(related) == 0 { - return nil - } - - var err error - fsQamosquitoinspections1 := FSQamosquitoinspectionSlice(related) - - _, err = attachOrganizationFSQamosquitoinspections0(ctx, exec, len(related), fsQamosquitoinspections1, organization0) - if err != nil { - return err - } - - organization0.R.FSQamosquitoinspections = append(organization0.R.FSQamosquitoinspections, fsQamosquitoinspections1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSRodentlocations0(ctx context.Context, exec bob.Executor, fsRodentlocations1 []*FSRodentlocationSetter, organization0 *Organization) (FSRodentlocationSlice, error) { - for i := range fsRodentlocations1 { - fsRodentlocations1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSRodentlocations.Insert(bob.ToMods(fsRodentlocations1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSRodentlocations0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSRodentlocations0(ctx context.Context, exec bob.Executor, count int, fsRodentlocations1 FSRodentlocationSlice, organization0 *Organization) (FSRodentlocationSlice, error) { - setter := &FSRodentlocationSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsRodentlocations1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSRodentlocations0: %w", err) - } - - return fsRodentlocations1, nil -} - -func (organization0 *Organization) InsertFSRodentlocations(ctx context.Context, exec bob.Executor, related ...*FSRodentlocationSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsRodentlocations1, err := insertOrganizationFSRodentlocations0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSRodentlocations = append(organization0.R.FSRodentlocations, fsRodentlocations1...) - - for _, rel := range fsRodentlocations1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSRodentlocations(ctx context.Context, exec bob.Executor, related ...*FSRodentlocation) error { - if len(related) == 0 { - return nil - } - - var err error - fsRodentlocations1 := FSRodentlocationSlice(related) - - _, err = attachOrganizationFSRodentlocations0(ctx, exec, len(related), fsRodentlocations1, organization0) - if err != nil { - return err - } - - organization0.R.FSRodentlocations = append(organization0.R.FSRodentlocations, fsRodentlocations1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSSamplecollections0(ctx context.Context, exec bob.Executor, fsSamplecollections1 []*FSSamplecollectionSetter, organization0 *Organization) (FSSamplecollectionSlice, error) { - for i := range fsSamplecollections1 { - fsSamplecollections1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSSamplecollections.Insert(bob.ToMods(fsSamplecollections1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSSamplecollections0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSSamplecollections0(ctx context.Context, exec bob.Executor, count int, fsSamplecollections1 FSSamplecollectionSlice, organization0 *Organization) (FSSamplecollectionSlice, error) { - setter := &FSSamplecollectionSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsSamplecollections1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSSamplecollections0: %w", err) - } - - return fsSamplecollections1, nil -} - -func (organization0 *Organization) InsertFSSamplecollections(ctx context.Context, exec bob.Executor, related ...*FSSamplecollectionSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsSamplecollections1, err := insertOrganizationFSSamplecollections0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSSamplecollections = append(organization0.R.FSSamplecollections, fsSamplecollections1...) - - for _, rel := range fsSamplecollections1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSSamplecollections(ctx context.Context, exec bob.Executor, related ...*FSSamplecollection) error { - if len(related) == 0 { - return nil - } - - var err error - fsSamplecollections1 := FSSamplecollectionSlice(related) - - _, err = attachOrganizationFSSamplecollections0(ctx, exec, len(related), fsSamplecollections1, organization0) - if err != nil { - return err - } - - organization0.R.FSSamplecollections = append(organization0.R.FSSamplecollections, fsSamplecollections1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSSamplelocations0(ctx context.Context, exec bob.Executor, fsSamplelocations1 []*FSSamplelocationSetter, organization0 *Organization) (FSSamplelocationSlice, error) { - for i := range fsSamplelocations1 { - fsSamplelocations1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSSamplelocations.Insert(bob.ToMods(fsSamplelocations1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSSamplelocations0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSSamplelocations0(ctx context.Context, exec bob.Executor, count int, fsSamplelocations1 FSSamplelocationSlice, organization0 *Organization) (FSSamplelocationSlice, error) { - setter := &FSSamplelocationSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsSamplelocations1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSSamplelocations0: %w", err) - } - - return fsSamplelocations1, nil -} - -func (organization0 *Organization) InsertFSSamplelocations(ctx context.Context, exec bob.Executor, related ...*FSSamplelocationSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsSamplelocations1, err := insertOrganizationFSSamplelocations0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSSamplelocations = append(organization0.R.FSSamplelocations, fsSamplelocations1...) - - for _, rel := range fsSamplelocations1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSSamplelocations(ctx context.Context, exec bob.Executor, related ...*FSSamplelocation) error { - if len(related) == 0 { - return nil - } - - var err error - fsSamplelocations1 := FSSamplelocationSlice(related) - - _, err = attachOrganizationFSSamplelocations0(ctx, exec, len(related), fsSamplelocations1, organization0) - if err != nil { - return err - } - - organization0.R.FSSamplelocations = append(organization0.R.FSSamplelocations, fsSamplelocations1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSServicerequests0(ctx context.Context, exec bob.Executor, fsServicerequests1 []*FSServicerequestSetter, organization0 *Organization) (FSServicerequestSlice, error) { - for i := range fsServicerequests1 { - fsServicerequests1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSServicerequests.Insert(bob.ToMods(fsServicerequests1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSServicerequests0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSServicerequests0(ctx context.Context, exec bob.Executor, count int, fsServicerequests1 FSServicerequestSlice, organization0 *Organization) (FSServicerequestSlice, error) { - setter := &FSServicerequestSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsServicerequests1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSServicerequests0: %w", err) - } - - return fsServicerequests1, nil -} - -func (organization0 *Organization) InsertFSServicerequests(ctx context.Context, exec bob.Executor, related ...*FSServicerequestSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsServicerequests1, err := insertOrganizationFSServicerequests0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSServicerequests = append(organization0.R.FSServicerequests, fsServicerequests1...) - - for _, rel := range fsServicerequests1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSServicerequests(ctx context.Context, exec bob.Executor, related ...*FSServicerequest) error { - if len(related) == 0 { - return nil - } - - var err error - fsServicerequests1 := FSServicerequestSlice(related) - - _, err = attachOrganizationFSServicerequests0(ctx, exec, len(related), fsServicerequests1, organization0) - if err != nil { - return err - } - - organization0.R.FSServicerequests = append(organization0.R.FSServicerequests, fsServicerequests1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSSpeciesabundances0(ctx context.Context, exec bob.Executor, fsSpeciesabundances1 []*FSSpeciesabundanceSetter, organization0 *Organization) (FSSpeciesabundanceSlice, error) { - for i := range fsSpeciesabundances1 { - fsSpeciesabundances1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSSpeciesabundances.Insert(bob.ToMods(fsSpeciesabundances1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSSpeciesabundances0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSSpeciesabundances0(ctx context.Context, exec bob.Executor, count int, fsSpeciesabundances1 FSSpeciesabundanceSlice, organization0 *Organization) (FSSpeciesabundanceSlice, error) { - setter := &FSSpeciesabundanceSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsSpeciesabundances1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSSpeciesabundances0: %w", err) - } - - return fsSpeciesabundances1, nil -} - -func (organization0 *Organization) InsertFSSpeciesabundances(ctx context.Context, exec bob.Executor, related ...*FSSpeciesabundanceSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsSpeciesabundances1, err := insertOrganizationFSSpeciesabundances0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSSpeciesabundances = append(organization0.R.FSSpeciesabundances, fsSpeciesabundances1...) - - for _, rel := range fsSpeciesabundances1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSSpeciesabundances(ctx context.Context, exec bob.Executor, related ...*FSSpeciesabundance) error { - if len(related) == 0 { - return nil - } - - var err error - fsSpeciesabundances1 := FSSpeciesabundanceSlice(related) - - _, err = attachOrganizationFSSpeciesabundances0(ctx, exec, len(related), fsSpeciesabundances1, organization0) - if err != nil { - return err - } - - organization0.R.FSSpeciesabundances = append(organization0.R.FSSpeciesabundances, fsSpeciesabundances1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSStormdrains0(ctx context.Context, exec bob.Executor, fsStormdrains1 []*FSStormdrainSetter, organization0 *Organization) (FSStormdrainSlice, error) { - for i := range fsStormdrains1 { - fsStormdrains1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSStormdrains.Insert(bob.ToMods(fsStormdrains1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSStormdrains0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSStormdrains0(ctx context.Context, exec bob.Executor, count int, fsStormdrains1 FSStormdrainSlice, organization0 *Organization) (FSStormdrainSlice, error) { - setter := &FSStormdrainSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsStormdrains1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSStormdrains0: %w", err) - } - - return fsStormdrains1, nil -} - -func (organization0 *Organization) InsertFSStormdrains(ctx context.Context, exec bob.Executor, related ...*FSStormdrainSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsStormdrains1, err := insertOrganizationFSStormdrains0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSStormdrains = append(organization0.R.FSStormdrains, fsStormdrains1...) - - for _, rel := range fsStormdrains1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSStormdrains(ctx context.Context, exec bob.Executor, related ...*FSStormdrain) error { - if len(related) == 0 { - return nil - } - - var err error - fsStormdrains1 := FSStormdrainSlice(related) - - _, err = attachOrganizationFSStormdrains0(ctx, exec, len(related), fsStormdrains1, organization0) - if err != nil { - return err - } - - organization0.R.FSStormdrains = append(organization0.R.FSStormdrains, fsStormdrains1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSTimecards0(ctx context.Context, exec bob.Executor, fsTimecards1 []*FSTimecardSetter, organization0 *Organization) (FSTimecardSlice, error) { - for i := range fsTimecards1 { - fsTimecards1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSTimecards.Insert(bob.ToMods(fsTimecards1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSTimecards0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSTimecards0(ctx context.Context, exec bob.Executor, count int, fsTimecards1 FSTimecardSlice, organization0 *Organization) (FSTimecardSlice, error) { - setter := &FSTimecardSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsTimecards1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSTimecards0: %w", err) - } - - return fsTimecards1, nil -} - -func (organization0 *Organization) InsertFSTimecards(ctx context.Context, exec bob.Executor, related ...*FSTimecardSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsTimecards1, err := insertOrganizationFSTimecards0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSTimecards = append(organization0.R.FSTimecards, fsTimecards1...) - - for _, rel := range fsTimecards1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSTimecards(ctx context.Context, exec bob.Executor, related ...*FSTimecard) error { - if len(related) == 0 { - return nil - } - - var err error - fsTimecards1 := FSTimecardSlice(related) - - _, err = attachOrganizationFSTimecards0(ctx, exec, len(related), fsTimecards1, organization0) - if err != nil { - return err - } - - organization0.R.FSTimecards = append(organization0.R.FSTimecards, fsTimecards1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSTrapdata0(ctx context.Context, exec bob.Executor, fsTrapdata1 []*FSTrapdatumSetter, organization0 *Organization) (FSTrapdatumSlice, error) { - for i := range fsTrapdata1 { - fsTrapdata1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSTrapdata.Insert(bob.ToMods(fsTrapdata1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSTrapdata0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSTrapdata0(ctx context.Context, exec bob.Executor, count int, fsTrapdata1 FSTrapdatumSlice, organization0 *Organization) (FSTrapdatumSlice, error) { - setter := &FSTrapdatumSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsTrapdata1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSTrapdata0: %w", err) - } - - return fsTrapdata1, nil -} - -func (organization0 *Organization) InsertFSTrapdata(ctx context.Context, exec bob.Executor, related ...*FSTrapdatumSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsTrapdata1, err := insertOrganizationFSTrapdata0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSTrapdata = append(organization0.R.FSTrapdata, fsTrapdata1...) - - for _, rel := range fsTrapdata1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSTrapdata(ctx context.Context, exec bob.Executor, related ...*FSTrapdatum) error { - if len(related) == 0 { - return nil - } - - var err error - fsTrapdata1 := FSTrapdatumSlice(related) - - _, err = attachOrganizationFSTrapdata0(ctx, exec, len(related), fsTrapdata1, organization0) - if err != nil { - return err - } - - organization0.R.FSTrapdata = append(organization0.R.FSTrapdata, fsTrapdata1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSTraplocations0(ctx context.Context, exec bob.Executor, fsTraplocations1 []*FSTraplocationSetter, organization0 *Organization) (FSTraplocationSlice, error) { - for i := range fsTraplocations1 { - fsTraplocations1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSTraplocations.Insert(bob.ToMods(fsTraplocations1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSTraplocations0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSTraplocations0(ctx context.Context, exec bob.Executor, count int, fsTraplocations1 FSTraplocationSlice, organization0 *Organization) (FSTraplocationSlice, error) { - setter := &FSTraplocationSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsTraplocations1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSTraplocations0: %w", err) - } - - return fsTraplocations1, nil -} - -func (organization0 *Organization) InsertFSTraplocations(ctx context.Context, exec bob.Executor, related ...*FSTraplocationSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsTraplocations1, err := insertOrganizationFSTraplocations0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSTraplocations = append(organization0.R.FSTraplocations, fsTraplocations1...) - - for _, rel := range fsTraplocations1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSTraplocations(ctx context.Context, exec bob.Executor, related ...*FSTraplocation) error { - if len(related) == 0 { - return nil - } - - var err error - fsTraplocations1 := FSTraplocationSlice(related) - - _, err = attachOrganizationFSTraplocations0(ctx, exec, len(related), fsTraplocations1, organization0) - if err != nil { - return err - } - - organization0.R.FSTraplocations = append(organization0.R.FSTraplocations, fsTraplocations1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSTreatments0(ctx context.Context, exec bob.Executor, fsTreatments1 []*FSTreatmentSetter, organization0 *Organization) (FSTreatmentSlice, error) { - for i := range fsTreatments1 { - fsTreatments1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSTreatments.Insert(bob.ToMods(fsTreatments1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSTreatments0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSTreatments0(ctx context.Context, exec bob.Executor, count int, fsTreatments1 FSTreatmentSlice, organization0 *Organization) (FSTreatmentSlice, error) { - setter := &FSTreatmentSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsTreatments1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSTreatments0: %w", err) - } - - return fsTreatments1, nil -} - -func (organization0 *Organization) InsertFSTreatments(ctx context.Context, exec bob.Executor, related ...*FSTreatmentSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsTreatments1, err := insertOrganizationFSTreatments0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSTreatments = append(organization0.R.FSTreatments, fsTreatments1...) - - for _, rel := range fsTreatments1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSTreatments(ctx context.Context, exec bob.Executor, related ...*FSTreatment) error { - if len(related) == 0 { - return nil - } - - var err error - fsTreatments1 := FSTreatmentSlice(related) - - _, err = attachOrganizationFSTreatments0(ctx, exec, len(related), fsTreatments1, organization0) - if err != nil { - return err - } - - organization0.R.FSTreatments = append(organization0.R.FSTreatments, fsTreatments1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSTreatmentareas0(ctx context.Context, exec bob.Executor, fsTreatmentareas1 []*FSTreatmentareaSetter, organization0 *Organization) (FSTreatmentareaSlice, error) { - for i := range fsTreatmentareas1 { - fsTreatmentareas1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSTreatmentareas.Insert(bob.ToMods(fsTreatmentareas1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSTreatmentareas0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSTreatmentareas0(ctx context.Context, exec bob.Executor, count int, fsTreatmentareas1 FSTreatmentareaSlice, organization0 *Organization) (FSTreatmentareaSlice, error) { - setter := &FSTreatmentareaSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsTreatmentareas1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSTreatmentareas0: %w", err) - } - - return fsTreatmentareas1, nil -} - -func (organization0 *Organization) InsertFSTreatmentareas(ctx context.Context, exec bob.Executor, related ...*FSTreatmentareaSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsTreatmentareas1, err := insertOrganizationFSTreatmentareas0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSTreatmentareas = append(organization0.R.FSTreatmentareas, fsTreatmentareas1...) - - for _, rel := range fsTreatmentareas1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSTreatmentareas(ctx context.Context, exec bob.Executor, related ...*FSTreatmentarea) error { - if len(related) == 0 { - return nil - } - - var err error - fsTreatmentareas1 := FSTreatmentareaSlice(related) - - _, err = attachOrganizationFSTreatmentareas0(ctx, exec, len(related), fsTreatmentareas1, organization0) - if err != nil { - return err - } - - organization0.R.FSTreatmentareas = append(organization0.R.FSTreatmentareas, fsTreatmentareas1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSZones0(ctx context.Context, exec bob.Executor, fsZones1 []*FSZoneSetter, organization0 *Organization) (FSZoneSlice, error) { - for i := range fsZones1 { - fsZones1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSZones.Insert(bob.ToMods(fsZones1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSZones0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSZones0(ctx context.Context, exec bob.Executor, count int, fsZones1 FSZoneSlice, organization0 *Organization) (FSZoneSlice, error) { - setter := &FSZoneSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsZones1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSZones0: %w", err) - } - - return fsZones1, nil -} - -func (organization0 *Organization) InsertFSZones(ctx context.Context, exec bob.Executor, related ...*FSZoneSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsZones1, err := insertOrganizationFSZones0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSZones = append(organization0.R.FSZones, fsZones1...) - - for _, rel := range fsZones1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSZones(ctx context.Context, exec bob.Executor, related ...*FSZone) error { - if len(related) == 0 { - return nil - } - - var err error - fsZones1 := FSZoneSlice(related) - - _, err = attachOrganizationFSZones0(ctx, exec, len(related), fsZones1, organization0) - if err != nil { - return err - } - - organization0.R.FSZones = append(organization0.R.FSZones, fsZones1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationFSZones2s0(ctx context.Context, exec bob.Executor, fsZones2s1 []*FSZones2Setter, organization0 *Organization) (FSZones2Slice, error) { - for i := range fsZones2s1 { - fsZones2s1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := FSZones2s.Insert(bob.ToMods(fsZones2s1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationFSZones2s0: %w", err) - } - - return ret, nil -} - -func attachOrganizationFSZones2s0(ctx context.Context, exec bob.Executor, count int, fsZones2s1 FSZones2Slice, organization0 *Organization) (FSZones2Slice, error) { - setter := &FSZones2Setter{ - OrganizationID: omit.From(organization0.ID), - } - - err := fsZones2s1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationFSZones2s0: %w", err) - } - - return fsZones2s1, nil -} - -func (organization0 *Organization) InsertFSZones2s(ctx context.Context, exec bob.Executor, related ...*FSZones2Setter) error { - if len(related) == 0 { - return nil - } - - var err error - - fsZones2s1, err := insertOrganizationFSZones2s0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.FSZones2s = append(organization0.R.FSZones2s, fsZones2s1...) - - for _, rel := range fsZones2s1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachFSZones2s(ctx context.Context, exec bob.Executor, related ...*FSZones2) error { - if len(related) == 0 { - return nil - } - - var err error - fsZones2s1 := FSZones2Slice(related) - - _, err = attachOrganizationFSZones2s0(ctx, exec, len(related), fsZones2s1, organization0) - if err != nil { - return err - } - - organization0.R.FSZones2s = append(organization0.R.FSZones2s, fsZones2s1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - 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) @@ -3835,66 +3210,66 @@ func (organization0 *Organization) AttachH3Aggregations(ctx context.Context, exe 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) +func insertOrganizationNoteAudios0(ctx context.Context, exec bob.Executor, noteAudios1 []*NoteAudioSetter, organization0 *Organization) (NoteAudioSlice, error) { + for i := range noteAudios1 { + noteAudios1[i].OrganizationID = omit.From(organization0.ID) } - ret, err := HistoryContainerrelates.Insert(bob.ToMods(historyContainerrelates1...)).All(ctx, exec) + ret, err := NoteAudios.Insert(bob.ToMods(noteAudios1...)).All(ctx, exec) if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryContainerrelates0: %w", err) + return ret, fmt.Errorf("insertOrganizationNoteAudios0: %w", err) } return ret, nil } -func attachOrganizationHistoryContainerrelates0(ctx context.Context, exec bob.Executor, count int, historyContainerrelates1 HistoryContainerrelateSlice, organization0 *Organization) (HistoryContainerrelateSlice, error) { - setter := &HistoryContainerrelateSetter{ +func attachOrganizationNoteAudios0(ctx context.Context, exec bob.Executor, count int, noteAudios1 NoteAudioSlice, organization0 *Organization) (NoteAudioSlice, error) { + setter := &NoteAudioSetter{ OrganizationID: omit.From(organization0.ID), } - err := historyContainerrelates1.UpdateAll(ctx, exec, *setter) + err := noteAudios1.UpdateAll(ctx, exec, *setter) if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryContainerrelates0: %w", err) + return nil, fmt.Errorf("attachOrganizationNoteAudios0: %w", err) } - return historyContainerrelates1, nil + return noteAudios1, nil } -func (organization0 *Organization) InsertHistoryContainerrelates(ctx context.Context, exec bob.Executor, related ...*HistoryContainerrelateSetter) error { +func (organization0 *Organization) InsertNoteAudios(ctx context.Context, exec bob.Executor, related ...*NoteAudioSetter) error { if len(related) == 0 { return nil } var err error - historyContainerrelates1, err := insertOrganizationHistoryContainerrelates0(ctx, exec, related, organization0) + noteAudios1, err := insertOrganizationNoteAudios0(ctx, exec, related, organization0) if err != nil { return err } - organization0.R.HistoryContainerrelates = append(organization0.R.HistoryContainerrelates, historyContainerrelates1...) + organization0.R.NoteAudios = append(organization0.R.NoteAudios, noteAudios1...) - for _, rel := range historyContainerrelates1 { + for _, rel := range noteAudios1 { rel.R.Organization = organization0 } return nil } -func (organization0 *Organization) AttachHistoryContainerrelates(ctx context.Context, exec bob.Executor, related ...*HistoryContainerrelate) error { +func (organization0 *Organization) AttachNoteAudios(ctx context.Context, exec bob.Executor, related ...*NoteAudio) error { if len(related) == 0 { return nil } var err error - historyContainerrelates1 := HistoryContainerrelateSlice(related) + noteAudios1 := NoteAudioSlice(related) - _, err = attachOrganizationHistoryContainerrelates0(ctx, exec, len(related), historyContainerrelates1, organization0) + _, err = attachOrganizationNoteAudios0(ctx, exec, len(related), noteAudios1, organization0) if err != nil { return err } - organization0.R.HistoryContainerrelates = append(organization0.R.HistoryContainerrelates, historyContainerrelates1...) + organization0.R.NoteAudios = append(organization0.R.NoteAudios, noteAudios1...) for _, rel := range related { rel.R.Organization = organization0 @@ -3903,1766 +3278,66 @@ func (organization0 *Organization) AttachHistoryContainerrelates(ctx context.Con return nil } -func insertOrganizationHistoryFieldscoutinglogs0(ctx context.Context, exec bob.Executor, historyFieldscoutinglogs1 []*HistoryFieldscoutinglogSetter, organization0 *Organization) (HistoryFieldscoutinglogSlice, error) { - for i := range historyFieldscoutinglogs1 { - historyFieldscoutinglogs1[i].OrganizationID = omit.From(organization0.ID) +func insertOrganizationNoteImages0(ctx context.Context, exec bob.Executor, noteImages1 []*NoteImageSetter, organization0 *Organization) (NoteImageSlice, error) { + for i := range noteImages1 { + noteImages1[i].OrganizationID = omit.From(organization0.ID) } - ret, err := HistoryFieldscoutinglogs.Insert(bob.ToMods(historyFieldscoutinglogs1...)).All(ctx, exec) + ret, err := NoteImages.Insert(bob.ToMods(noteImages1...)).All(ctx, exec) if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryFieldscoutinglogs0: %w", err) + return ret, fmt.Errorf("insertOrganizationNoteImages0: %w", err) } return ret, nil } -func attachOrganizationHistoryFieldscoutinglogs0(ctx context.Context, exec bob.Executor, count int, historyFieldscoutinglogs1 HistoryFieldscoutinglogSlice, organization0 *Organization) (HistoryFieldscoutinglogSlice, error) { - setter := &HistoryFieldscoutinglogSetter{ +func attachOrganizationNoteImages0(ctx context.Context, exec bob.Executor, count int, noteImages1 NoteImageSlice, organization0 *Organization) (NoteImageSlice, error) { + setter := &NoteImageSetter{ OrganizationID: omit.From(organization0.ID), } - err := historyFieldscoutinglogs1.UpdateAll(ctx, exec, *setter) + err := noteImages1.UpdateAll(ctx, exec, *setter) if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryFieldscoutinglogs0: %w", err) + return nil, fmt.Errorf("attachOrganizationNoteImages0: %w", err) } - return historyFieldscoutinglogs1, nil + return noteImages1, nil } -func (organization0 *Organization) InsertHistoryFieldscoutinglogs(ctx context.Context, exec bob.Executor, related ...*HistoryFieldscoutinglogSetter) error { +func (organization0 *Organization) InsertNoteImages(ctx context.Context, exec bob.Executor, related ...*NoteImageSetter) error { if len(related) == 0 { return nil } var err error - historyFieldscoutinglogs1, err := insertOrganizationHistoryFieldscoutinglogs0(ctx, exec, related, organization0) + noteImages1, err := insertOrganizationNoteImages0(ctx, exec, related, organization0) if err != nil { return err } - organization0.R.HistoryFieldscoutinglogs = append(organization0.R.HistoryFieldscoutinglogs, historyFieldscoutinglogs1...) + organization0.R.NoteImages = append(organization0.R.NoteImages, noteImages1...) - for _, rel := range historyFieldscoutinglogs1 { + for _, rel := range noteImages1 { rel.R.Organization = organization0 } return nil } -func (organization0 *Organization) AttachHistoryFieldscoutinglogs(ctx context.Context, exec bob.Executor, related ...*HistoryFieldscoutinglog) error { +func (organization0 *Organization) AttachNoteImages(ctx context.Context, exec bob.Executor, related ...*NoteImage) error { if len(related) == 0 { return nil } var err error - historyFieldscoutinglogs1 := HistoryFieldscoutinglogSlice(related) + noteImages1 := NoteImageSlice(related) - _, err = attachOrganizationHistoryFieldscoutinglogs0(ctx, exec, len(related), historyFieldscoutinglogs1, organization0) + _, err = attachOrganizationNoteImages0(ctx, exec, len(related), noteImages1, organization0) if err != nil { return err } - organization0.R.HistoryFieldscoutinglogs = append(organization0.R.HistoryFieldscoutinglogs, historyFieldscoutinglogs1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryHabitatrelates0(ctx context.Context, exec bob.Executor, historyHabitatrelates1 []*HistoryHabitatrelateSetter, organization0 *Organization) (HistoryHabitatrelateSlice, error) { - for i := range historyHabitatrelates1 { - historyHabitatrelates1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryHabitatrelates.Insert(bob.ToMods(historyHabitatrelates1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryHabitatrelates0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryHabitatrelates0(ctx context.Context, exec bob.Executor, count int, historyHabitatrelates1 HistoryHabitatrelateSlice, organization0 *Organization) (HistoryHabitatrelateSlice, error) { - setter := &HistoryHabitatrelateSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyHabitatrelates1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryHabitatrelates0: %w", err) - } - - return historyHabitatrelates1, nil -} - -func (organization0 *Organization) InsertHistoryHabitatrelates(ctx context.Context, exec bob.Executor, related ...*HistoryHabitatrelateSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyHabitatrelates1, err := insertOrganizationHistoryHabitatrelates0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryHabitatrelates = append(organization0.R.HistoryHabitatrelates, historyHabitatrelates1...) - - for _, rel := range historyHabitatrelates1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryHabitatrelates(ctx context.Context, exec bob.Executor, related ...*HistoryHabitatrelate) error { - if len(related) == 0 { - return nil - } - - var err error - historyHabitatrelates1 := HistoryHabitatrelateSlice(related) - - _, err = attachOrganizationHistoryHabitatrelates0(ctx, exec, len(related), historyHabitatrelates1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryHabitatrelates = append(organization0.R.HistoryHabitatrelates, historyHabitatrelates1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryInspectionsamples0(ctx context.Context, exec bob.Executor, historyInspectionsamples1 []*HistoryInspectionsampleSetter, organization0 *Organization) (HistoryInspectionsampleSlice, error) { - for i := range historyInspectionsamples1 { - historyInspectionsamples1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryInspectionsamples.Insert(bob.ToMods(historyInspectionsamples1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryInspectionsamples0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryInspectionsamples0(ctx context.Context, exec bob.Executor, count int, historyInspectionsamples1 HistoryInspectionsampleSlice, organization0 *Organization) (HistoryInspectionsampleSlice, error) { - setter := &HistoryInspectionsampleSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyInspectionsamples1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryInspectionsamples0: %w", err) - } - - return historyInspectionsamples1, nil -} - -func (organization0 *Organization) InsertHistoryInspectionsamples(ctx context.Context, exec bob.Executor, related ...*HistoryInspectionsampleSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyInspectionsamples1, err := insertOrganizationHistoryInspectionsamples0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryInspectionsamples = append(organization0.R.HistoryInspectionsamples, historyInspectionsamples1...) - - for _, rel := range historyInspectionsamples1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryInspectionsamples(ctx context.Context, exec bob.Executor, related ...*HistoryInspectionsample) error { - if len(related) == 0 { - return nil - } - - var err error - historyInspectionsamples1 := HistoryInspectionsampleSlice(related) - - _, err = attachOrganizationHistoryInspectionsamples0(ctx, exec, len(related), historyInspectionsamples1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryInspectionsamples = append(organization0.R.HistoryInspectionsamples, historyInspectionsamples1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryInspectionsampledetails0(ctx context.Context, exec bob.Executor, historyInspectionsampledetails1 []*HistoryInspectionsampledetailSetter, organization0 *Organization) (HistoryInspectionsampledetailSlice, error) { - for i := range historyInspectionsampledetails1 { - historyInspectionsampledetails1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryInspectionsampledetails.Insert(bob.ToMods(historyInspectionsampledetails1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryInspectionsampledetails0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryInspectionsampledetails0(ctx context.Context, exec bob.Executor, count int, historyInspectionsampledetails1 HistoryInspectionsampledetailSlice, organization0 *Organization) (HistoryInspectionsampledetailSlice, error) { - setter := &HistoryInspectionsampledetailSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyInspectionsampledetails1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryInspectionsampledetails0: %w", err) - } - - return historyInspectionsampledetails1, nil -} - -func (organization0 *Organization) InsertHistoryInspectionsampledetails(ctx context.Context, exec bob.Executor, related ...*HistoryInspectionsampledetailSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyInspectionsampledetails1, err := insertOrganizationHistoryInspectionsampledetails0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryInspectionsampledetails = append(organization0.R.HistoryInspectionsampledetails, historyInspectionsampledetails1...) - - for _, rel := range historyInspectionsampledetails1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryInspectionsampledetails(ctx context.Context, exec bob.Executor, related ...*HistoryInspectionsampledetail) error { - if len(related) == 0 { - return nil - } - - var err error - historyInspectionsampledetails1 := HistoryInspectionsampledetailSlice(related) - - _, err = attachOrganizationHistoryInspectionsampledetails0(ctx, exec, len(related), historyInspectionsampledetails1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryInspectionsampledetails = append(organization0.R.HistoryInspectionsampledetails, historyInspectionsampledetails1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryLinelocations0(ctx context.Context, exec bob.Executor, historyLinelocations1 []*HistoryLinelocationSetter, organization0 *Organization) (HistoryLinelocationSlice, error) { - for i := range historyLinelocations1 { - historyLinelocations1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryLinelocations.Insert(bob.ToMods(historyLinelocations1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryLinelocations0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryLinelocations0(ctx context.Context, exec bob.Executor, count int, historyLinelocations1 HistoryLinelocationSlice, organization0 *Organization) (HistoryLinelocationSlice, error) { - setter := &HistoryLinelocationSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyLinelocations1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryLinelocations0: %w", err) - } - - return historyLinelocations1, nil -} - -func (organization0 *Organization) InsertHistoryLinelocations(ctx context.Context, exec bob.Executor, related ...*HistoryLinelocationSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyLinelocations1, err := insertOrganizationHistoryLinelocations0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryLinelocations = append(organization0.R.HistoryLinelocations, historyLinelocations1...) - - for _, rel := range historyLinelocations1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryLinelocations(ctx context.Context, exec bob.Executor, related ...*HistoryLinelocation) error { - if len(related) == 0 { - return nil - } - - var err error - historyLinelocations1 := HistoryLinelocationSlice(related) - - _, err = attachOrganizationHistoryLinelocations0(ctx, exec, len(related), historyLinelocations1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryLinelocations = append(organization0.R.HistoryLinelocations, historyLinelocations1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryLocationtrackings0(ctx context.Context, exec bob.Executor, historyLocationtrackings1 []*HistoryLocationtrackingSetter, organization0 *Organization) (HistoryLocationtrackingSlice, error) { - for i := range historyLocationtrackings1 { - historyLocationtrackings1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryLocationtrackings.Insert(bob.ToMods(historyLocationtrackings1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryLocationtrackings0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryLocationtrackings0(ctx context.Context, exec bob.Executor, count int, historyLocationtrackings1 HistoryLocationtrackingSlice, organization0 *Organization) (HistoryLocationtrackingSlice, error) { - setter := &HistoryLocationtrackingSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyLocationtrackings1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryLocationtrackings0: %w", err) - } - - return historyLocationtrackings1, nil -} - -func (organization0 *Organization) InsertHistoryLocationtrackings(ctx context.Context, exec bob.Executor, related ...*HistoryLocationtrackingSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyLocationtrackings1, err := insertOrganizationHistoryLocationtrackings0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryLocationtrackings = append(organization0.R.HistoryLocationtrackings, historyLocationtrackings1...) - - for _, rel := range historyLocationtrackings1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryLocationtrackings(ctx context.Context, exec bob.Executor, related ...*HistoryLocationtracking) error { - if len(related) == 0 { - return nil - } - - var err error - historyLocationtrackings1 := HistoryLocationtrackingSlice(related) - - _, err = attachOrganizationHistoryLocationtrackings0(ctx, exec, len(related), historyLocationtrackings1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryLocationtrackings = append(organization0.R.HistoryLocationtrackings, historyLocationtrackings1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryMosquitoinspections0(ctx context.Context, exec bob.Executor, historyMosquitoinspections1 []*HistoryMosquitoinspectionSetter, organization0 *Organization) (HistoryMosquitoinspectionSlice, error) { - for i := range historyMosquitoinspections1 { - historyMosquitoinspections1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryMosquitoinspections.Insert(bob.ToMods(historyMosquitoinspections1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryMosquitoinspections0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryMosquitoinspections0(ctx context.Context, exec bob.Executor, count int, historyMosquitoinspections1 HistoryMosquitoinspectionSlice, organization0 *Organization) (HistoryMosquitoinspectionSlice, error) { - setter := &HistoryMosquitoinspectionSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyMosquitoinspections1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryMosquitoinspections0: %w", err) - } - - return historyMosquitoinspections1, nil -} - -func (organization0 *Organization) InsertHistoryMosquitoinspections(ctx context.Context, exec bob.Executor, related ...*HistoryMosquitoinspectionSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyMosquitoinspections1, err := insertOrganizationHistoryMosquitoinspections0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryMosquitoinspections = append(organization0.R.HistoryMosquitoinspections, historyMosquitoinspections1...) - - for _, rel := range historyMosquitoinspections1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryMosquitoinspections(ctx context.Context, exec bob.Executor, related ...*HistoryMosquitoinspection) error { - if len(related) == 0 { - return nil - } - - var err error - historyMosquitoinspections1 := HistoryMosquitoinspectionSlice(related) - - _, err = attachOrganizationHistoryMosquitoinspections0(ctx, exec, len(related), historyMosquitoinspections1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryMosquitoinspections = append(organization0.R.HistoryMosquitoinspections, historyMosquitoinspections1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryPointlocations0(ctx context.Context, exec bob.Executor, historyPointlocations1 []*HistoryPointlocationSetter, organization0 *Organization) (HistoryPointlocationSlice, error) { - for i := range historyPointlocations1 { - historyPointlocations1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryPointlocations.Insert(bob.ToMods(historyPointlocations1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryPointlocations0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryPointlocations0(ctx context.Context, exec bob.Executor, count int, historyPointlocations1 HistoryPointlocationSlice, organization0 *Organization) (HistoryPointlocationSlice, error) { - setter := &HistoryPointlocationSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyPointlocations1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryPointlocations0: %w", err) - } - - return historyPointlocations1, nil -} - -func (organization0 *Organization) InsertHistoryPointlocations(ctx context.Context, exec bob.Executor, related ...*HistoryPointlocationSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyPointlocations1, err := insertOrganizationHistoryPointlocations0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryPointlocations = append(organization0.R.HistoryPointlocations, historyPointlocations1...) - - for _, rel := range historyPointlocations1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryPointlocations(ctx context.Context, exec bob.Executor, related ...*HistoryPointlocation) error { - if len(related) == 0 { - return nil - } - - var err error - historyPointlocations1 := HistoryPointlocationSlice(related) - - _, err = attachOrganizationHistoryPointlocations0(ctx, exec, len(related), historyPointlocations1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryPointlocations = append(organization0.R.HistoryPointlocations, historyPointlocations1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryPolygonlocations0(ctx context.Context, exec bob.Executor, historyPolygonlocations1 []*HistoryPolygonlocationSetter, organization0 *Organization) (HistoryPolygonlocationSlice, error) { - for i := range historyPolygonlocations1 { - historyPolygonlocations1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryPolygonlocations.Insert(bob.ToMods(historyPolygonlocations1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryPolygonlocations0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryPolygonlocations0(ctx context.Context, exec bob.Executor, count int, historyPolygonlocations1 HistoryPolygonlocationSlice, organization0 *Organization) (HistoryPolygonlocationSlice, error) { - setter := &HistoryPolygonlocationSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyPolygonlocations1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryPolygonlocations0: %w", err) - } - - return historyPolygonlocations1, nil -} - -func (organization0 *Organization) InsertHistoryPolygonlocations(ctx context.Context, exec bob.Executor, related ...*HistoryPolygonlocationSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyPolygonlocations1, err := insertOrganizationHistoryPolygonlocations0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryPolygonlocations = append(organization0.R.HistoryPolygonlocations, historyPolygonlocations1...) - - for _, rel := range historyPolygonlocations1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryPolygonlocations(ctx context.Context, exec bob.Executor, related ...*HistoryPolygonlocation) error { - if len(related) == 0 { - return nil - } - - var err error - historyPolygonlocations1 := HistoryPolygonlocationSlice(related) - - _, err = attachOrganizationHistoryPolygonlocations0(ctx, exec, len(related), historyPolygonlocations1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryPolygonlocations = append(organization0.R.HistoryPolygonlocations, historyPolygonlocations1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryPools0(ctx context.Context, exec bob.Executor, historyPools1 []*HistoryPoolSetter, organization0 *Organization) (HistoryPoolSlice, error) { - for i := range historyPools1 { - historyPools1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryPools.Insert(bob.ToMods(historyPools1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryPools0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryPools0(ctx context.Context, exec bob.Executor, count int, historyPools1 HistoryPoolSlice, organization0 *Organization) (HistoryPoolSlice, error) { - setter := &HistoryPoolSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyPools1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryPools0: %w", err) - } - - return historyPools1, nil -} - -func (organization0 *Organization) InsertHistoryPools(ctx context.Context, exec bob.Executor, related ...*HistoryPoolSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyPools1, err := insertOrganizationHistoryPools0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryPools = append(organization0.R.HistoryPools, historyPools1...) - - for _, rel := range historyPools1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryPools(ctx context.Context, exec bob.Executor, related ...*HistoryPool) error { - if len(related) == 0 { - return nil - } - - var err error - historyPools1 := HistoryPoolSlice(related) - - _, err = attachOrganizationHistoryPools0(ctx, exec, len(related), historyPools1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryPools = append(organization0.R.HistoryPools, historyPools1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryPooldetails0(ctx context.Context, exec bob.Executor, historyPooldetails1 []*HistoryPooldetailSetter, organization0 *Organization) (HistoryPooldetailSlice, error) { - for i := range historyPooldetails1 { - historyPooldetails1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryPooldetails.Insert(bob.ToMods(historyPooldetails1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryPooldetails0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryPooldetails0(ctx context.Context, exec bob.Executor, count int, historyPooldetails1 HistoryPooldetailSlice, organization0 *Organization) (HistoryPooldetailSlice, error) { - setter := &HistoryPooldetailSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyPooldetails1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryPooldetails0: %w", err) - } - - return historyPooldetails1, nil -} - -func (organization0 *Organization) InsertHistoryPooldetails(ctx context.Context, exec bob.Executor, related ...*HistoryPooldetailSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyPooldetails1, err := insertOrganizationHistoryPooldetails0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryPooldetails = append(organization0.R.HistoryPooldetails, historyPooldetails1...) - - for _, rel := range historyPooldetails1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryPooldetails(ctx context.Context, exec bob.Executor, related ...*HistoryPooldetail) error { - if len(related) == 0 { - return nil - } - - var err error - historyPooldetails1 := HistoryPooldetailSlice(related) - - _, err = attachOrganizationHistoryPooldetails0(ctx, exec, len(related), historyPooldetails1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryPooldetails = append(organization0.R.HistoryPooldetails, historyPooldetails1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryProposedtreatmentareas0(ctx context.Context, exec bob.Executor, historyProposedtreatmentareas1 []*HistoryProposedtreatmentareaSetter, organization0 *Organization) (HistoryProposedtreatmentareaSlice, error) { - for i := range historyProposedtreatmentareas1 { - historyProposedtreatmentareas1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryProposedtreatmentareas.Insert(bob.ToMods(historyProposedtreatmentareas1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryProposedtreatmentareas0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryProposedtreatmentareas0(ctx context.Context, exec bob.Executor, count int, historyProposedtreatmentareas1 HistoryProposedtreatmentareaSlice, organization0 *Organization) (HistoryProposedtreatmentareaSlice, error) { - setter := &HistoryProposedtreatmentareaSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyProposedtreatmentareas1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryProposedtreatmentareas0: %w", err) - } - - return historyProposedtreatmentareas1, nil -} - -func (organization0 *Organization) InsertHistoryProposedtreatmentareas(ctx context.Context, exec bob.Executor, related ...*HistoryProposedtreatmentareaSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyProposedtreatmentareas1, err := insertOrganizationHistoryProposedtreatmentareas0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryProposedtreatmentareas = append(organization0.R.HistoryProposedtreatmentareas, historyProposedtreatmentareas1...) - - for _, rel := range historyProposedtreatmentareas1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryProposedtreatmentareas(ctx context.Context, exec bob.Executor, related ...*HistoryProposedtreatmentarea) error { - if len(related) == 0 { - return nil - } - - var err error - historyProposedtreatmentareas1 := HistoryProposedtreatmentareaSlice(related) - - _, err = attachOrganizationHistoryProposedtreatmentareas0(ctx, exec, len(related), historyProposedtreatmentareas1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryProposedtreatmentareas = append(organization0.R.HistoryProposedtreatmentareas, historyProposedtreatmentareas1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryQamosquitoinspections0(ctx context.Context, exec bob.Executor, historyQamosquitoinspections1 []*HistoryQamosquitoinspectionSetter, organization0 *Organization) (HistoryQamosquitoinspectionSlice, error) { - for i := range historyQamosquitoinspections1 { - historyQamosquitoinspections1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryQamosquitoinspections.Insert(bob.ToMods(historyQamosquitoinspections1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryQamosquitoinspections0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryQamosquitoinspections0(ctx context.Context, exec bob.Executor, count int, historyQamosquitoinspections1 HistoryQamosquitoinspectionSlice, organization0 *Organization) (HistoryQamosquitoinspectionSlice, error) { - setter := &HistoryQamosquitoinspectionSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyQamosquitoinspections1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryQamosquitoinspections0: %w", err) - } - - return historyQamosquitoinspections1, nil -} - -func (organization0 *Organization) InsertHistoryQamosquitoinspections(ctx context.Context, exec bob.Executor, related ...*HistoryQamosquitoinspectionSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyQamosquitoinspections1, err := insertOrganizationHistoryQamosquitoinspections0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryQamosquitoinspections = append(organization0.R.HistoryQamosquitoinspections, historyQamosquitoinspections1...) - - for _, rel := range historyQamosquitoinspections1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryQamosquitoinspections(ctx context.Context, exec bob.Executor, related ...*HistoryQamosquitoinspection) error { - if len(related) == 0 { - return nil - } - - var err error - historyQamosquitoinspections1 := HistoryQamosquitoinspectionSlice(related) - - _, err = attachOrganizationHistoryQamosquitoinspections0(ctx, exec, len(related), historyQamosquitoinspections1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryQamosquitoinspections = append(organization0.R.HistoryQamosquitoinspections, historyQamosquitoinspections1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryRodentlocations0(ctx context.Context, exec bob.Executor, historyRodentlocations1 []*HistoryRodentlocationSetter, organization0 *Organization) (HistoryRodentlocationSlice, error) { - for i := range historyRodentlocations1 { - historyRodentlocations1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryRodentlocations.Insert(bob.ToMods(historyRodentlocations1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryRodentlocations0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryRodentlocations0(ctx context.Context, exec bob.Executor, count int, historyRodentlocations1 HistoryRodentlocationSlice, organization0 *Organization) (HistoryRodentlocationSlice, error) { - setter := &HistoryRodentlocationSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyRodentlocations1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryRodentlocations0: %w", err) - } - - return historyRodentlocations1, nil -} - -func (organization0 *Organization) InsertHistoryRodentlocations(ctx context.Context, exec bob.Executor, related ...*HistoryRodentlocationSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyRodentlocations1, err := insertOrganizationHistoryRodentlocations0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryRodentlocations = append(organization0.R.HistoryRodentlocations, historyRodentlocations1...) - - for _, rel := range historyRodentlocations1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryRodentlocations(ctx context.Context, exec bob.Executor, related ...*HistoryRodentlocation) error { - if len(related) == 0 { - return nil - } - - var err error - historyRodentlocations1 := HistoryRodentlocationSlice(related) - - _, err = attachOrganizationHistoryRodentlocations0(ctx, exec, len(related), historyRodentlocations1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryRodentlocations = append(organization0.R.HistoryRodentlocations, historyRodentlocations1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistorySamplecollections0(ctx context.Context, exec bob.Executor, historySamplecollections1 []*HistorySamplecollectionSetter, organization0 *Organization) (HistorySamplecollectionSlice, error) { - for i := range historySamplecollections1 { - historySamplecollections1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistorySamplecollections.Insert(bob.ToMods(historySamplecollections1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistorySamplecollections0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistorySamplecollections0(ctx context.Context, exec bob.Executor, count int, historySamplecollections1 HistorySamplecollectionSlice, organization0 *Organization) (HistorySamplecollectionSlice, error) { - setter := &HistorySamplecollectionSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historySamplecollections1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistorySamplecollections0: %w", err) - } - - return historySamplecollections1, nil -} - -func (organization0 *Organization) InsertHistorySamplecollections(ctx context.Context, exec bob.Executor, related ...*HistorySamplecollectionSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historySamplecollections1, err := insertOrganizationHistorySamplecollections0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistorySamplecollections = append(organization0.R.HistorySamplecollections, historySamplecollections1...) - - for _, rel := range historySamplecollections1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistorySamplecollections(ctx context.Context, exec bob.Executor, related ...*HistorySamplecollection) error { - if len(related) == 0 { - return nil - } - - var err error - historySamplecollections1 := HistorySamplecollectionSlice(related) - - _, err = attachOrganizationHistorySamplecollections0(ctx, exec, len(related), historySamplecollections1, organization0) - if err != nil { - return err - } - - organization0.R.HistorySamplecollections = append(organization0.R.HistorySamplecollections, historySamplecollections1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistorySamplelocations0(ctx context.Context, exec bob.Executor, historySamplelocations1 []*HistorySamplelocationSetter, organization0 *Organization) (HistorySamplelocationSlice, error) { - for i := range historySamplelocations1 { - historySamplelocations1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistorySamplelocations.Insert(bob.ToMods(historySamplelocations1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistorySamplelocations0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistorySamplelocations0(ctx context.Context, exec bob.Executor, count int, historySamplelocations1 HistorySamplelocationSlice, organization0 *Organization) (HistorySamplelocationSlice, error) { - setter := &HistorySamplelocationSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historySamplelocations1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistorySamplelocations0: %w", err) - } - - return historySamplelocations1, nil -} - -func (organization0 *Organization) InsertHistorySamplelocations(ctx context.Context, exec bob.Executor, related ...*HistorySamplelocationSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historySamplelocations1, err := insertOrganizationHistorySamplelocations0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistorySamplelocations = append(organization0.R.HistorySamplelocations, historySamplelocations1...) - - for _, rel := range historySamplelocations1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistorySamplelocations(ctx context.Context, exec bob.Executor, related ...*HistorySamplelocation) error { - if len(related) == 0 { - return nil - } - - var err error - historySamplelocations1 := HistorySamplelocationSlice(related) - - _, err = attachOrganizationHistorySamplelocations0(ctx, exec, len(related), historySamplelocations1, organization0) - if err != nil { - return err - } - - organization0.R.HistorySamplelocations = append(organization0.R.HistorySamplelocations, historySamplelocations1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryServicerequests0(ctx context.Context, exec bob.Executor, historyServicerequests1 []*HistoryServicerequestSetter, organization0 *Organization) (HistoryServicerequestSlice, error) { - for i := range historyServicerequests1 { - historyServicerequests1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryServicerequests.Insert(bob.ToMods(historyServicerequests1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryServicerequests0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryServicerequests0(ctx context.Context, exec bob.Executor, count int, historyServicerequests1 HistoryServicerequestSlice, organization0 *Organization) (HistoryServicerequestSlice, error) { - setter := &HistoryServicerequestSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyServicerequests1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryServicerequests0: %w", err) - } - - return historyServicerequests1, nil -} - -func (organization0 *Organization) InsertHistoryServicerequests(ctx context.Context, exec bob.Executor, related ...*HistoryServicerequestSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyServicerequests1, err := insertOrganizationHistoryServicerequests0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryServicerequests = append(organization0.R.HistoryServicerequests, historyServicerequests1...) - - for _, rel := range historyServicerequests1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryServicerequests(ctx context.Context, exec bob.Executor, related ...*HistoryServicerequest) error { - if len(related) == 0 { - return nil - } - - var err error - historyServicerequests1 := HistoryServicerequestSlice(related) - - _, err = attachOrganizationHistoryServicerequests0(ctx, exec, len(related), historyServicerequests1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryServicerequests = append(organization0.R.HistoryServicerequests, historyServicerequests1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistorySpeciesabundances0(ctx context.Context, exec bob.Executor, historySpeciesabundances1 []*HistorySpeciesabundanceSetter, organization0 *Organization) (HistorySpeciesabundanceSlice, error) { - for i := range historySpeciesabundances1 { - historySpeciesabundances1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistorySpeciesabundances.Insert(bob.ToMods(historySpeciesabundances1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistorySpeciesabundances0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistorySpeciesabundances0(ctx context.Context, exec bob.Executor, count int, historySpeciesabundances1 HistorySpeciesabundanceSlice, organization0 *Organization) (HistorySpeciesabundanceSlice, error) { - setter := &HistorySpeciesabundanceSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historySpeciesabundances1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistorySpeciesabundances0: %w", err) - } - - return historySpeciesabundances1, nil -} - -func (organization0 *Organization) InsertHistorySpeciesabundances(ctx context.Context, exec bob.Executor, related ...*HistorySpeciesabundanceSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historySpeciesabundances1, err := insertOrganizationHistorySpeciesabundances0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistorySpeciesabundances = append(organization0.R.HistorySpeciesabundances, historySpeciesabundances1...) - - for _, rel := range historySpeciesabundances1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistorySpeciesabundances(ctx context.Context, exec bob.Executor, related ...*HistorySpeciesabundance) error { - if len(related) == 0 { - return nil - } - - var err error - historySpeciesabundances1 := HistorySpeciesabundanceSlice(related) - - _, err = attachOrganizationHistorySpeciesabundances0(ctx, exec, len(related), historySpeciesabundances1, organization0) - if err != nil { - return err - } - - organization0.R.HistorySpeciesabundances = append(organization0.R.HistorySpeciesabundances, historySpeciesabundances1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryStormdrains0(ctx context.Context, exec bob.Executor, historyStormdrains1 []*HistoryStormdrainSetter, organization0 *Organization) (HistoryStormdrainSlice, error) { - for i := range historyStormdrains1 { - historyStormdrains1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryStormdrains.Insert(bob.ToMods(historyStormdrains1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryStormdrains0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryStormdrains0(ctx context.Context, exec bob.Executor, count int, historyStormdrains1 HistoryStormdrainSlice, organization0 *Organization) (HistoryStormdrainSlice, error) { - setter := &HistoryStormdrainSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyStormdrains1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryStormdrains0: %w", err) - } - - return historyStormdrains1, nil -} - -func (organization0 *Organization) InsertHistoryStormdrains(ctx context.Context, exec bob.Executor, related ...*HistoryStormdrainSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyStormdrains1, err := insertOrganizationHistoryStormdrains0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryStormdrains = append(organization0.R.HistoryStormdrains, historyStormdrains1...) - - for _, rel := range historyStormdrains1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryStormdrains(ctx context.Context, exec bob.Executor, related ...*HistoryStormdrain) error { - if len(related) == 0 { - return nil - } - - var err error - historyStormdrains1 := HistoryStormdrainSlice(related) - - _, err = attachOrganizationHistoryStormdrains0(ctx, exec, len(related), historyStormdrains1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryStormdrains = append(organization0.R.HistoryStormdrains, historyStormdrains1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryTimecards0(ctx context.Context, exec bob.Executor, historyTimecards1 []*HistoryTimecardSetter, organization0 *Organization) (HistoryTimecardSlice, error) { - for i := range historyTimecards1 { - historyTimecards1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryTimecards.Insert(bob.ToMods(historyTimecards1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryTimecards0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryTimecards0(ctx context.Context, exec bob.Executor, count int, historyTimecards1 HistoryTimecardSlice, organization0 *Organization) (HistoryTimecardSlice, error) { - setter := &HistoryTimecardSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyTimecards1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryTimecards0: %w", err) - } - - return historyTimecards1, nil -} - -func (organization0 *Organization) InsertHistoryTimecards(ctx context.Context, exec bob.Executor, related ...*HistoryTimecardSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyTimecards1, err := insertOrganizationHistoryTimecards0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryTimecards = append(organization0.R.HistoryTimecards, historyTimecards1...) - - for _, rel := range historyTimecards1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryTimecards(ctx context.Context, exec bob.Executor, related ...*HistoryTimecard) error { - if len(related) == 0 { - return nil - } - - var err error - historyTimecards1 := HistoryTimecardSlice(related) - - _, err = attachOrganizationHistoryTimecards0(ctx, exec, len(related), historyTimecards1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryTimecards = append(organization0.R.HistoryTimecards, historyTimecards1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryTrapdata0(ctx context.Context, exec bob.Executor, historyTrapdata1 []*HistoryTrapdatumSetter, organization0 *Organization) (HistoryTrapdatumSlice, error) { - for i := range historyTrapdata1 { - historyTrapdata1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryTrapdata.Insert(bob.ToMods(historyTrapdata1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryTrapdata0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryTrapdata0(ctx context.Context, exec bob.Executor, count int, historyTrapdata1 HistoryTrapdatumSlice, organization0 *Organization) (HistoryTrapdatumSlice, error) { - setter := &HistoryTrapdatumSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyTrapdata1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryTrapdata0: %w", err) - } - - return historyTrapdata1, nil -} - -func (organization0 *Organization) InsertHistoryTrapdata(ctx context.Context, exec bob.Executor, related ...*HistoryTrapdatumSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyTrapdata1, err := insertOrganizationHistoryTrapdata0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryTrapdata = append(organization0.R.HistoryTrapdata, historyTrapdata1...) - - for _, rel := range historyTrapdata1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryTrapdata(ctx context.Context, exec bob.Executor, related ...*HistoryTrapdatum) error { - if len(related) == 0 { - return nil - } - - var err error - historyTrapdata1 := HistoryTrapdatumSlice(related) - - _, err = attachOrganizationHistoryTrapdata0(ctx, exec, len(related), historyTrapdata1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryTrapdata = append(organization0.R.HistoryTrapdata, historyTrapdata1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryTraplocations0(ctx context.Context, exec bob.Executor, historyTraplocations1 []*HistoryTraplocationSetter, organization0 *Organization) (HistoryTraplocationSlice, error) { - for i := range historyTraplocations1 { - historyTraplocations1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryTraplocations.Insert(bob.ToMods(historyTraplocations1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryTraplocations0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryTraplocations0(ctx context.Context, exec bob.Executor, count int, historyTraplocations1 HistoryTraplocationSlice, organization0 *Organization) (HistoryTraplocationSlice, error) { - setter := &HistoryTraplocationSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyTraplocations1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryTraplocations0: %w", err) - } - - return historyTraplocations1, nil -} - -func (organization0 *Organization) InsertHistoryTraplocations(ctx context.Context, exec bob.Executor, related ...*HistoryTraplocationSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyTraplocations1, err := insertOrganizationHistoryTraplocations0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryTraplocations = append(organization0.R.HistoryTraplocations, historyTraplocations1...) - - for _, rel := range historyTraplocations1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryTraplocations(ctx context.Context, exec bob.Executor, related ...*HistoryTraplocation) error { - if len(related) == 0 { - return nil - } - - var err error - historyTraplocations1 := HistoryTraplocationSlice(related) - - _, err = attachOrganizationHistoryTraplocations0(ctx, exec, len(related), historyTraplocations1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryTraplocations = append(organization0.R.HistoryTraplocations, historyTraplocations1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryTreatments0(ctx context.Context, exec bob.Executor, historyTreatments1 []*HistoryTreatmentSetter, organization0 *Organization) (HistoryTreatmentSlice, error) { - for i := range historyTreatments1 { - historyTreatments1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryTreatments.Insert(bob.ToMods(historyTreatments1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryTreatments0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryTreatments0(ctx context.Context, exec bob.Executor, count int, historyTreatments1 HistoryTreatmentSlice, organization0 *Organization) (HistoryTreatmentSlice, error) { - setter := &HistoryTreatmentSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyTreatments1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryTreatments0: %w", err) - } - - return historyTreatments1, nil -} - -func (organization0 *Organization) InsertHistoryTreatments(ctx context.Context, exec bob.Executor, related ...*HistoryTreatmentSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyTreatments1, err := insertOrganizationHistoryTreatments0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryTreatments = append(organization0.R.HistoryTreatments, historyTreatments1...) - - for _, rel := range historyTreatments1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryTreatments(ctx context.Context, exec bob.Executor, related ...*HistoryTreatment) error { - if len(related) == 0 { - return nil - } - - var err error - historyTreatments1 := HistoryTreatmentSlice(related) - - _, err = attachOrganizationHistoryTreatments0(ctx, exec, len(related), historyTreatments1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryTreatments = append(organization0.R.HistoryTreatments, historyTreatments1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryTreatmentareas0(ctx context.Context, exec bob.Executor, historyTreatmentareas1 []*HistoryTreatmentareaSetter, organization0 *Organization) (HistoryTreatmentareaSlice, error) { - for i := range historyTreatmentareas1 { - historyTreatmentareas1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryTreatmentareas.Insert(bob.ToMods(historyTreatmentareas1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryTreatmentareas0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryTreatmentareas0(ctx context.Context, exec bob.Executor, count int, historyTreatmentareas1 HistoryTreatmentareaSlice, organization0 *Organization) (HistoryTreatmentareaSlice, error) { - setter := &HistoryTreatmentareaSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyTreatmentareas1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryTreatmentareas0: %w", err) - } - - return historyTreatmentareas1, nil -} - -func (organization0 *Organization) InsertHistoryTreatmentareas(ctx context.Context, exec bob.Executor, related ...*HistoryTreatmentareaSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyTreatmentareas1, err := insertOrganizationHistoryTreatmentareas0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryTreatmentareas = append(organization0.R.HistoryTreatmentareas, historyTreatmentareas1...) - - for _, rel := range historyTreatmentareas1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryTreatmentareas(ctx context.Context, exec bob.Executor, related ...*HistoryTreatmentarea) error { - if len(related) == 0 { - return nil - } - - var err error - historyTreatmentareas1 := HistoryTreatmentareaSlice(related) - - _, err = attachOrganizationHistoryTreatmentareas0(ctx, exec, len(related), historyTreatmentareas1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryTreatmentareas = append(organization0.R.HistoryTreatmentareas, historyTreatmentareas1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryZones0(ctx context.Context, exec bob.Executor, historyZones1 []*HistoryZoneSetter, organization0 *Organization) (HistoryZoneSlice, error) { - for i := range historyZones1 { - historyZones1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryZones.Insert(bob.ToMods(historyZones1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryZones0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryZones0(ctx context.Context, exec bob.Executor, count int, historyZones1 HistoryZoneSlice, organization0 *Organization) (HistoryZoneSlice, error) { - setter := &HistoryZoneSetter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyZones1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryZones0: %w", err) - } - - return historyZones1, nil -} - -func (organization0 *Organization) InsertHistoryZones(ctx context.Context, exec bob.Executor, related ...*HistoryZoneSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyZones1, err := insertOrganizationHistoryZones0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryZones = append(organization0.R.HistoryZones, historyZones1...) - - for _, rel := range historyZones1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryZones(ctx context.Context, exec bob.Executor, related ...*HistoryZone) error { - if len(related) == 0 { - return nil - } - - var err error - historyZones1 := HistoryZoneSlice(related) - - _, err = attachOrganizationHistoryZones0(ctx, exec, len(related), historyZones1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryZones = append(organization0.R.HistoryZones, historyZones1...) - - for _, rel := range related { - rel.R.Organization = organization0 - } - - return nil -} - -func insertOrganizationHistoryZones2s0(ctx context.Context, exec bob.Executor, historyZones2s1 []*HistoryZones2Setter, organization0 *Organization) (HistoryZones2Slice, error) { - for i := range historyZones2s1 { - historyZones2s1[i].OrganizationID = omit.From(organization0.ID) - } - - ret, err := HistoryZones2s.Insert(bob.ToMods(historyZones2s1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertOrganizationHistoryZones2s0: %w", err) - } - - return ret, nil -} - -func attachOrganizationHistoryZones2s0(ctx context.Context, exec bob.Executor, count int, historyZones2s1 HistoryZones2Slice, organization0 *Organization) (HistoryZones2Slice, error) { - setter := &HistoryZones2Setter{ - OrganizationID: omit.From(organization0.ID), - } - - err := historyZones2s1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachOrganizationHistoryZones2s0: %w", err) - } - - return historyZones2s1, nil -} - -func (organization0 *Organization) InsertHistoryZones2s(ctx context.Context, exec bob.Executor, related ...*HistoryZones2Setter) error { - if len(related) == 0 { - return nil - } - - var err error - - historyZones2s1, err := insertOrganizationHistoryZones2s0(ctx, exec, related, organization0) - if err != nil { - return err - } - - organization0.R.HistoryZones2s = append(organization0.R.HistoryZones2s, historyZones2s1...) - - for _, rel := range historyZones2s1 { - rel.R.Organization = organization0 - } - return nil -} - -func (organization0 *Organization) AttachHistoryZones2s(ctx context.Context, exec bob.Executor, related ...*HistoryZones2) error { - if len(related) == 0 { - return nil - } - - var err error - historyZones2s1 := HistoryZones2Slice(related) - - _, err = attachOrganizationHistoryZones2s0(ctx, exec, len(related), historyZones2s1, organization0) - if err != nil { - return err - } - - organization0.R.HistoryZones2s = append(organization0.R.HistoryZones2s, historyZones2s1...) + organization0.R.NoteImages = append(organization0.R.NoteImages, noteImages1...) for _, rel := range related { rel.R.Organization = organization0 @@ -5767,6 +3442,384 @@ func (o *Organization) Preload(name string, retrieved any) error { } switch name { + case "Containerrelates": + rels, ok := retrieved.(FieldseekerContainerrelateSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Containerrelates = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Fieldscoutinglogs": + rels, ok := retrieved.(FieldseekerFieldscoutinglogSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Fieldscoutinglogs = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Habitatrelates": + rels, ok := retrieved.(FieldseekerHabitatrelateSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Habitatrelates = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Inspectionsamples": + rels, ok := retrieved.(FieldseekerInspectionsampleSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Inspectionsamples = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Inspectionsampledetails": + rels, ok := retrieved.(FieldseekerInspectionsampledetailSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Inspectionsampledetails = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Linelocations": + rels, ok := retrieved.(FieldseekerLinelocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Linelocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Locationtrackings": + rels, ok := retrieved.(FieldseekerLocationtrackingSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Locationtrackings = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Mosquitoinspections": + rels, ok := retrieved.(FieldseekerMosquitoinspectionSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Mosquitoinspections = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Pointlocations": + rels, ok := retrieved.(FieldseekerPointlocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Pointlocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Polygonlocations": + rels, ok := retrieved.(FieldseekerPolygonlocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Polygonlocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Pools": + rels, ok := retrieved.(FieldseekerPoolSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Pools = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Pooldetails": + rels, ok := retrieved.(FieldseekerPooldetailSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Pooldetails = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Proposedtreatmentareas": + rels, ok := retrieved.(FieldseekerProposedtreatmentareaSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Proposedtreatmentareas = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Qamosquitoinspections": + rels, ok := retrieved.(FieldseekerQamosquitoinspectionSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Qamosquitoinspections = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Rodentlocations": + rels, ok := retrieved.(FieldseekerRodentlocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Rodentlocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Samplecollections": + rels, ok := retrieved.(FieldseekerSamplecollectionSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Samplecollections = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Samplelocations": + rels, ok := retrieved.(FieldseekerSamplelocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Samplelocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Servicerequests": + rels, ok := retrieved.(FieldseekerServicerequestSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Servicerequests = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Speciesabundances": + rels, ok := retrieved.(FieldseekerSpeciesabundanceSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Speciesabundances = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Stormdrains": + rels, ok := retrieved.(FieldseekerStormdrainSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Stormdrains = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Timecards": + rels, ok := retrieved.(FieldseekerTimecardSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Timecards = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Trapdata": + rels, ok := retrieved.(FieldseekerTrapdatumSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Trapdata = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Traplocations": + rels, ok := retrieved.(FieldseekerTraplocationSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Traplocations = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Treatments": + rels, ok := retrieved.(FieldseekerTreatmentSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Treatments = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Treatmentareas": + rels, ok := retrieved.(FieldseekerTreatmentareaSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Treatmentareas = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Zones": + rels, ok := retrieved.(FieldseekerZoneSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Zones = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "Zones2s": + rels, ok := retrieved.(FieldseekerZones2Slice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Zones2s = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil case "FieldseekerSyncs": rels, ok := retrieved.(FieldseekerSyncSlice) if !ok { @@ -5775,384 +3828,6 @@ func (o *Organization) Preload(name string, retrieved any) error { o.R.FieldseekerSyncs = rels - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSContainerrelates": - rels, ok := retrieved.(FSContainerrelateSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSContainerrelates = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSFieldscoutinglogs": - rels, ok := retrieved.(FSFieldscoutinglogSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSFieldscoutinglogs = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSHabitatrelates": - rels, ok := retrieved.(FSHabitatrelateSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSHabitatrelates = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSInspectionsamples": - rels, ok := retrieved.(FSInspectionsampleSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSInspectionsamples = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSInspectionsampledetails": - rels, ok := retrieved.(FSInspectionsampledetailSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSInspectionsampledetails = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSLinelocations": - rels, ok := retrieved.(FSLinelocationSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSLinelocations = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSLocationtrackings": - rels, ok := retrieved.(FSLocationtrackingSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSLocationtrackings = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSMosquitoinspections": - rels, ok := retrieved.(FSMosquitoinspectionSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSMosquitoinspections = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSPointlocations": - rels, ok := retrieved.(FSPointlocationSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSPointlocations = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSPolygonlocations": - rels, ok := retrieved.(FSPolygonlocationSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSPolygonlocations = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSPools": - rels, ok := retrieved.(FSPoolSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSPools = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSPooldetails": - rels, ok := retrieved.(FSPooldetailSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSPooldetails = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSProposedtreatmentareas": - rels, ok := retrieved.(FSProposedtreatmentareaSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSProposedtreatmentareas = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSQamosquitoinspections": - rels, ok := retrieved.(FSQamosquitoinspectionSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSQamosquitoinspections = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSRodentlocations": - rels, ok := retrieved.(FSRodentlocationSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSRodentlocations = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSSamplecollections": - rels, ok := retrieved.(FSSamplecollectionSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSSamplecollections = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSSamplelocations": - rels, ok := retrieved.(FSSamplelocationSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSSamplelocations = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSServicerequests": - rels, ok := retrieved.(FSServicerequestSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSServicerequests = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSSpeciesabundances": - rels, ok := retrieved.(FSSpeciesabundanceSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSSpeciesabundances = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSStormdrains": - rels, ok := retrieved.(FSStormdrainSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSStormdrains = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSTimecards": - rels, ok := retrieved.(FSTimecardSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSTimecards = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSTrapdata": - rels, ok := retrieved.(FSTrapdatumSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSTrapdata = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSTraplocations": - rels, ok := retrieved.(FSTraplocationSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSTraplocations = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSTreatments": - rels, ok := retrieved.(FSTreatmentSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSTreatments = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSTreatmentareas": - rels, ok := retrieved.(FSTreatmentareaSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSTreatmentareas = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSZones": - rels, ok := retrieved.(FSZoneSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSZones = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "FSZones2s": - rels, ok := retrieved.(FSZones2Slice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.FSZones2s = rels - for _, rel := range rels { if rel != nil { rel.R.Organization = o @@ -6173,13 +3848,13 @@ func (o *Organization) Preload(name string, retrieved any) error { } } return nil - case "HistoryContainerrelates": - rels, ok := retrieved.(HistoryContainerrelateSlice) + case "NoteAudios": + rels, ok := retrieved.(NoteAudioSlice) if !ok { return fmt.Errorf("organization cannot load %T as %q", retrieved, name) } - o.R.HistoryContainerrelates = rels + o.R.NoteAudios = rels for _, rel := range rels { if rel != nil { @@ -6187,363 +3862,13 @@ func (o *Organization) Preload(name string, retrieved any) error { } } return nil - case "HistoryFieldscoutinglogs": - rels, ok := retrieved.(HistoryFieldscoutinglogSlice) + case "NoteImages": + rels, ok := retrieved.(NoteImageSlice) if !ok { return fmt.Errorf("organization cannot load %T as %q", retrieved, name) } - o.R.HistoryFieldscoutinglogs = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryHabitatrelates": - rels, ok := retrieved.(HistoryHabitatrelateSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryHabitatrelates = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryInspectionsamples": - rels, ok := retrieved.(HistoryInspectionsampleSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryInspectionsamples = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryInspectionsampledetails": - rels, ok := retrieved.(HistoryInspectionsampledetailSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryInspectionsampledetails = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryLinelocations": - rels, ok := retrieved.(HistoryLinelocationSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryLinelocations = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryLocationtrackings": - rels, ok := retrieved.(HistoryLocationtrackingSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryLocationtrackings = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryMosquitoinspections": - rels, ok := retrieved.(HistoryMosquitoinspectionSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryMosquitoinspections = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryPointlocations": - rels, ok := retrieved.(HistoryPointlocationSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryPointlocations = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryPolygonlocations": - rels, ok := retrieved.(HistoryPolygonlocationSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryPolygonlocations = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryPools": - rels, ok := retrieved.(HistoryPoolSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryPools = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryPooldetails": - rels, ok := retrieved.(HistoryPooldetailSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryPooldetails = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryProposedtreatmentareas": - rels, ok := retrieved.(HistoryProposedtreatmentareaSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryProposedtreatmentareas = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryQamosquitoinspections": - rels, ok := retrieved.(HistoryQamosquitoinspectionSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryQamosquitoinspections = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryRodentlocations": - rels, ok := retrieved.(HistoryRodentlocationSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryRodentlocations = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistorySamplecollections": - rels, ok := retrieved.(HistorySamplecollectionSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistorySamplecollections = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistorySamplelocations": - rels, ok := retrieved.(HistorySamplelocationSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistorySamplelocations = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryServicerequests": - rels, ok := retrieved.(HistoryServicerequestSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryServicerequests = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistorySpeciesabundances": - rels, ok := retrieved.(HistorySpeciesabundanceSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistorySpeciesabundances = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryStormdrains": - rels, ok := retrieved.(HistoryStormdrainSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryStormdrains = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryTimecards": - rels, ok := retrieved.(HistoryTimecardSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryTimecards = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryTrapdata": - rels, ok := retrieved.(HistoryTrapdatumSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryTrapdata = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryTraplocations": - rels, ok := retrieved.(HistoryTraplocationSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryTraplocations = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryTreatments": - rels, ok := retrieved.(HistoryTreatmentSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryTreatments = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryTreatmentareas": - rels, ok := retrieved.(HistoryTreatmentareaSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryTreatmentareas = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryZones": - rels, ok := retrieved.(HistoryZoneSlice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryZones = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Organization = o - } - } - return nil - case "HistoryZones2s": - rels, ok := retrieved.(HistoryZones2Slice) - if !ok { - return fmt.Errorf("organization cannot load %T as %q", retrieved, name) - } - - o.R.HistoryZones2s = rels + o.R.NoteImages = rels for _, rel := range rels { if rel != nil { @@ -6577,573 +3902,323 @@ func buildOrganizationPreloader() organizationPreloader { } type organizationThenLoader[Q orm.Loadable] struct { - FieldseekerSyncs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSContainerrelates func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSFieldscoutinglogs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSHabitatrelates func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSInspectionsamples func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSInspectionsampledetails func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSLinelocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSLocationtrackings func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSMosquitoinspections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSPointlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSPolygonlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSPools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSPooldetails func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSProposedtreatmentareas func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSQamosquitoinspections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSRodentlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSSamplecollections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSSamplelocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSServicerequests func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSSpeciesabundances func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSStormdrains func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSTimecards func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSTrapdata func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSTraplocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FSTreatments func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - 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] - HistoryInspectionsamples func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryInspectionsampledetails func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryLinelocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryLocationtrackings func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryMosquitoinspections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryPointlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryPolygonlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryPools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryPooldetails func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryProposedtreatmentareas func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryQamosquitoinspections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryRodentlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistorySamplecollections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistorySamplelocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryServicerequests func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistorySpeciesabundances func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryStormdrains func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryTimecards func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryTrapdata func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryTraplocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryTreatments func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryTreatmentareas func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryZones func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - HistoryZones2s func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - User func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Containerrelates func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Fieldscoutinglogs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Habitatrelates func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Inspectionsamples func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Inspectionsampledetails func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Linelocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Locationtrackings func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Mosquitoinspections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Pointlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Polygonlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Pools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Pooldetails func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Proposedtreatmentareas func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Qamosquitoinspections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Rodentlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Samplecollections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Samplelocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Servicerequests func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Speciesabundances func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Stormdrains func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Timecards func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Trapdata func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Traplocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Treatments func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Treatmentareas func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Zones func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Zones2s func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FieldseekerSyncs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + H3Aggregations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + NoteAudios func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + NoteImages func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + User func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] } func buildOrganizationThenLoader[Q orm.Loadable]() organizationThenLoader[Q] { + type ContainerrelatesLoadInterface interface { + LoadContainerrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FieldscoutinglogsLoadInterface interface { + LoadFieldscoutinglogs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type HabitatrelatesLoadInterface interface { + LoadHabitatrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type InspectionsamplesLoadInterface interface { + LoadInspectionsamples(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type InspectionsampledetailsLoadInterface interface { + LoadInspectionsampledetails(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type LinelocationsLoadInterface interface { + LoadLinelocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type LocationtrackingsLoadInterface interface { + LoadLocationtrackings(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type MosquitoinspectionsLoadInterface interface { + LoadMosquitoinspections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type PointlocationsLoadInterface interface { + LoadPointlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type PolygonlocationsLoadInterface interface { + LoadPolygonlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type PoolsLoadInterface interface { + LoadPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type PooldetailsLoadInterface interface { + LoadPooldetails(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type ProposedtreatmentareasLoadInterface interface { + LoadProposedtreatmentareas(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type QamosquitoinspectionsLoadInterface interface { + LoadQamosquitoinspections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type RodentlocationsLoadInterface interface { + LoadRodentlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type SamplecollectionsLoadInterface interface { + LoadSamplecollections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type SamplelocationsLoadInterface interface { + LoadSamplelocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type ServicerequestsLoadInterface interface { + LoadServicerequests(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type SpeciesabundancesLoadInterface interface { + LoadSpeciesabundances(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type StormdrainsLoadInterface interface { + LoadStormdrains(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type TimecardsLoadInterface interface { + LoadTimecards(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type TrapdataLoadInterface interface { + LoadTrapdata(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type TraplocationsLoadInterface interface { + LoadTraplocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type TreatmentsLoadInterface interface { + LoadTreatments(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type TreatmentareasLoadInterface interface { + LoadTreatmentareas(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type ZonesLoadInterface interface { + LoadZones(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type Zones2sLoadInterface interface { + LoadZones2s(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } type FieldseekerSyncsLoadInterface interface { LoadFieldseekerSyncs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } - type FSContainerrelatesLoadInterface interface { - LoadFSContainerrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSFieldscoutinglogsLoadInterface interface { - LoadFSFieldscoutinglogs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSHabitatrelatesLoadInterface interface { - LoadFSHabitatrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSInspectionsamplesLoadInterface interface { - LoadFSInspectionsamples(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSInspectionsampledetailsLoadInterface interface { - LoadFSInspectionsampledetails(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSLinelocationsLoadInterface interface { - LoadFSLinelocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSLocationtrackingsLoadInterface interface { - LoadFSLocationtrackings(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSMosquitoinspectionsLoadInterface interface { - LoadFSMosquitoinspections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSPointlocationsLoadInterface interface { - LoadFSPointlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSPolygonlocationsLoadInterface interface { - LoadFSPolygonlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSPoolsLoadInterface interface { - LoadFSPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSPooldetailsLoadInterface interface { - LoadFSPooldetails(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSProposedtreatmentareasLoadInterface interface { - LoadFSProposedtreatmentareas(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSQamosquitoinspectionsLoadInterface interface { - LoadFSQamosquitoinspections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSRodentlocationsLoadInterface interface { - LoadFSRodentlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSSamplecollectionsLoadInterface interface { - LoadFSSamplecollections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSSamplelocationsLoadInterface interface { - LoadFSSamplelocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSServicerequestsLoadInterface interface { - LoadFSServicerequests(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSSpeciesabundancesLoadInterface interface { - LoadFSSpeciesabundances(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSStormdrainsLoadInterface interface { - LoadFSStormdrains(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSTimecardsLoadInterface interface { - LoadFSTimecards(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSTrapdataLoadInterface interface { - LoadFSTrapdata(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSTraplocationsLoadInterface interface { - LoadFSTraplocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSTreatmentsLoadInterface interface { - LoadFSTreatments(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSTreatmentareasLoadInterface interface { - LoadFSTreatmentareas(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FSZonesLoadInterface interface { - LoadFSZones(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - 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 + type NoteAudiosLoadInterface interface { + LoadNoteAudios(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } - type HistoryFieldscoutinglogsLoadInterface interface { - LoadHistoryFieldscoutinglogs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryHabitatrelatesLoadInterface interface { - LoadHistoryHabitatrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryInspectionsamplesLoadInterface interface { - LoadHistoryInspectionsamples(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryInspectionsampledetailsLoadInterface interface { - LoadHistoryInspectionsampledetails(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryLinelocationsLoadInterface interface { - LoadHistoryLinelocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryLocationtrackingsLoadInterface interface { - LoadHistoryLocationtrackings(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryMosquitoinspectionsLoadInterface interface { - LoadHistoryMosquitoinspections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryPointlocationsLoadInterface interface { - LoadHistoryPointlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryPolygonlocationsLoadInterface interface { - LoadHistoryPolygonlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryPoolsLoadInterface interface { - LoadHistoryPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryPooldetailsLoadInterface interface { - LoadHistoryPooldetails(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryProposedtreatmentareasLoadInterface interface { - LoadHistoryProposedtreatmentareas(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryQamosquitoinspectionsLoadInterface interface { - LoadHistoryQamosquitoinspections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryRodentlocationsLoadInterface interface { - LoadHistoryRodentlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistorySamplecollectionsLoadInterface interface { - LoadHistorySamplecollections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistorySamplelocationsLoadInterface interface { - LoadHistorySamplelocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryServicerequestsLoadInterface interface { - LoadHistoryServicerequests(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistorySpeciesabundancesLoadInterface interface { - LoadHistorySpeciesabundances(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryStormdrainsLoadInterface interface { - LoadHistoryStormdrains(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryTimecardsLoadInterface interface { - LoadHistoryTimecards(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryTrapdataLoadInterface interface { - LoadHistoryTrapdata(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryTraplocationsLoadInterface interface { - LoadHistoryTraplocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryTreatmentsLoadInterface interface { - LoadHistoryTreatments(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryTreatmentareasLoadInterface interface { - LoadHistoryTreatmentareas(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryZonesLoadInterface interface { - LoadHistoryZones(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HistoryZones2sLoadInterface interface { - LoadHistoryZones2s(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + type NoteImagesLoadInterface interface { + LoadNoteImages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type UserLoadInterface interface { LoadUser(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } return organizationThenLoader[Q]{ + Containerrelates: thenLoadBuilder[Q]( + "Containerrelates", + func(ctx context.Context, exec bob.Executor, retrieved ContainerrelatesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadContainerrelates(ctx, exec, mods...) + }, + ), + Fieldscoutinglogs: thenLoadBuilder[Q]( + "Fieldscoutinglogs", + func(ctx context.Context, exec bob.Executor, retrieved FieldscoutinglogsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFieldscoutinglogs(ctx, exec, mods...) + }, + ), + Habitatrelates: thenLoadBuilder[Q]( + "Habitatrelates", + func(ctx context.Context, exec bob.Executor, retrieved HabitatrelatesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadHabitatrelates(ctx, exec, mods...) + }, + ), + Inspectionsamples: thenLoadBuilder[Q]( + "Inspectionsamples", + func(ctx context.Context, exec bob.Executor, retrieved InspectionsamplesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadInspectionsamples(ctx, exec, mods...) + }, + ), + Inspectionsampledetails: thenLoadBuilder[Q]( + "Inspectionsampledetails", + func(ctx context.Context, exec bob.Executor, retrieved InspectionsampledetailsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadInspectionsampledetails(ctx, exec, mods...) + }, + ), + Linelocations: thenLoadBuilder[Q]( + "Linelocations", + func(ctx context.Context, exec bob.Executor, retrieved LinelocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadLinelocations(ctx, exec, mods...) + }, + ), + Locationtrackings: thenLoadBuilder[Q]( + "Locationtrackings", + func(ctx context.Context, exec bob.Executor, retrieved LocationtrackingsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadLocationtrackings(ctx, exec, mods...) + }, + ), + Mosquitoinspections: thenLoadBuilder[Q]( + "Mosquitoinspections", + func(ctx context.Context, exec bob.Executor, retrieved MosquitoinspectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadMosquitoinspections(ctx, exec, mods...) + }, + ), + Pointlocations: thenLoadBuilder[Q]( + "Pointlocations", + func(ctx context.Context, exec bob.Executor, retrieved PointlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadPointlocations(ctx, exec, mods...) + }, + ), + Polygonlocations: thenLoadBuilder[Q]( + "Polygonlocations", + func(ctx context.Context, exec bob.Executor, retrieved PolygonlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadPolygonlocations(ctx, exec, mods...) + }, + ), + Pools: thenLoadBuilder[Q]( + "Pools", + func(ctx context.Context, exec bob.Executor, retrieved PoolsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadPools(ctx, exec, mods...) + }, + ), + Pooldetails: thenLoadBuilder[Q]( + "Pooldetails", + func(ctx context.Context, exec bob.Executor, retrieved PooldetailsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadPooldetails(ctx, exec, mods...) + }, + ), + Proposedtreatmentareas: thenLoadBuilder[Q]( + "Proposedtreatmentareas", + func(ctx context.Context, exec bob.Executor, retrieved ProposedtreatmentareasLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadProposedtreatmentareas(ctx, exec, mods...) + }, + ), + Qamosquitoinspections: thenLoadBuilder[Q]( + "Qamosquitoinspections", + func(ctx context.Context, exec bob.Executor, retrieved QamosquitoinspectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadQamosquitoinspections(ctx, exec, mods...) + }, + ), + Rodentlocations: thenLoadBuilder[Q]( + "Rodentlocations", + func(ctx context.Context, exec bob.Executor, retrieved RodentlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadRodentlocations(ctx, exec, mods...) + }, + ), + Samplecollections: thenLoadBuilder[Q]( + "Samplecollections", + func(ctx context.Context, exec bob.Executor, retrieved SamplecollectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadSamplecollections(ctx, exec, mods...) + }, + ), + Samplelocations: thenLoadBuilder[Q]( + "Samplelocations", + func(ctx context.Context, exec bob.Executor, retrieved SamplelocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadSamplelocations(ctx, exec, mods...) + }, + ), + Servicerequests: thenLoadBuilder[Q]( + "Servicerequests", + func(ctx context.Context, exec bob.Executor, retrieved ServicerequestsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadServicerequests(ctx, exec, mods...) + }, + ), + Speciesabundances: thenLoadBuilder[Q]( + "Speciesabundances", + func(ctx context.Context, exec bob.Executor, retrieved SpeciesabundancesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadSpeciesabundances(ctx, exec, mods...) + }, + ), + Stormdrains: thenLoadBuilder[Q]( + "Stormdrains", + func(ctx context.Context, exec bob.Executor, retrieved StormdrainsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadStormdrains(ctx, exec, mods...) + }, + ), + Timecards: thenLoadBuilder[Q]( + "Timecards", + func(ctx context.Context, exec bob.Executor, retrieved TimecardsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadTimecards(ctx, exec, mods...) + }, + ), + Trapdata: thenLoadBuilder[Q]( + "Trapdata", + func(ctx context.Context, exec bob.Executor, retrieved TrapdataLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadTrapdata(ctx, exec, mods...) + }, + ), + Traplocations: thenLoadBuilder[Q]( + "Traplocations", + func(ctx context.Context, exec bob.Executor, retrieved TraplocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadTraplocations(ctx, exec, mods...) + }, + ), + Treatments: thenLoadBuilder[Q]( + "Treatments", + func(ctx context.Context, exec bob.Executor, retrieved TreatmentsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadTreatments(ctx, exec, mods...) + }, + ), + Treatmentareas: thenLoadBuilder[Q]( + "Treatmentareas", + func(ctx context.Context, exec bob.Executor, retrieved TreatmentareasLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadTreatmentareas(ctx, exec, mods...) + }, + ), + Zones: thenLoadBuilder[Q]( + "Zones", + func(ctx context.Context, exec bob.Executor, retrieved ZonesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadZones(ctx, exec, mods...) + }, + ), + Zones2s: thenLoadBuilder[Q]( + "Zones2s", + func(ctx context.Context, exec bob.Executor, retrieved Zones2sLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadZones2s(ctx, exec, mods...) + }, + ), FieldseekerSyncs: thenLoadBuilder[Q]( "FieldseekerSyncs", func(ctx context.Context, exec bob.Executor, retrieved FieldseekerSyncsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadFieldseekerSyncs(ctx, exec, mods...) }, ), - FSContainerrelates: thenLoadBuilder[Q]( - "FSContainerrelates", - func(ctx context.Context, exec bob.Executor, retrieved FSContainerrelatesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSContainerrelates(ctx, exec, mods...) - }, - ), - FSFieldscoutinglogs: thenLoadBuilder[Q]( - "FSFieldscoutinglogs", - func(ctx context.Context, exec bob.Executor, retrieved FSFieldscoutinglogsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSFieldscoutinglogs(ctx, exec, mods...) - }, - ), - FSHabitatrelates: thenLoadBuilder[Q]( - "FSHabitatrelates", - func(ctx context.Context, exec bob.Executor, retrieved FSHabitatrelatesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSHabitatrelates(ctx, exec, mods...) - }, - ), - FSInspectionsamples: thenLoadBuilder[Q]( - "FSInspectionsamples", - func(ctx context.Context, exec bob.Executor, retrieved FSInspectionsamplesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSInspectionsamples(ctx, exec, mods...) - }, - ), - FSInspectionsampledetails: thenLoadBuilder[Q]( - "FSInspectionsampledetails", - func(ctx context.Context, exec bob.Executor, retrieved FSInspectionsampledetailsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSInspectionsampledetails(ctx, exec, mods...) - }, - ), - FSLinelocations: thenLoadBuilder[Q]( - "FSLinelocations", - func(ctx context.Context, exec bob.Executor, retrieved FSLinelocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSLinelocations(ctx, exec, mods...) - }, - ), - FSLocationtrackings: thenLoadBuilder[Q]( - "FSLocationtrackings", - func(ctx context.Context, exec bob.Executor, retrieved FSLocationtrackingsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSLocationtrackings(ctx, exec, mods...) - }, - ), - FSMosquitoinspections: thenLoadBuilder[Q]( - "FSMosquitoinspections", - func(ctx context.Context, exec bob.Executor, retrieved FSMosquitoinspectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSMosquitoinspections(ctx, exec, mods...) - }, - ), - FSPointlocations: thenLoadBuilder[Q]( - "FSPointlocations", - func(ctx context.Context, exec bob.Executor, retrieved FSPointlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSPointlocations(ctx, exec, mods...) - }, - ), - FSPolygonlocations: thenLoadBuilder[Q]( - "FSPolygonlocations", - func(ctx context.Context, exec bob.Executor, retrieved FSPolygonlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSPolygonlocations(ctx, exec, mods...) - }, - ), - FSPools: thenLoadBuilder[Q]( - "FSPools", - func(ctx context.Context, exec bob.Executor, retrieved FSPoolsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSPools(ctx, exec, mods...) - }, - ), - FSPooldetails: thenLoadBuilder[Q]( - "FSPooldetails", - func(ctx context.Context, exec bob.Executor, retrieved FSPooldetailsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSPooldetails(ctx, exec, mods...) - }, - ), - FSProposedtreatmentareas: thenLoadBuilder[Q]( - "FSProposedtreatmentareas", - func(ctx context.Context, exec bob.Executor, retrieved FSProposedtreatmentareasLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSProposedtreatmentareas(ctx, exec, mods...) - }, - ), - FSQamosquitoinspections: thenLoadBuilder[Q]( - "FSQamosquitoinspections", - func(ctx context.Context, exec bob.Executor, retrieved FSQamosquitoinspectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSQamosquitoinspections(ctx, exec, mods...) - }, - ), - FSRodentlocations: thenLoadBuilder[Q]( - "FSRodentlocations", - func(ctx context.Context, exec bob.Executor, retrieved FSRodentlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSRodentlocations(ctx, exec, mods...) - }, - ), - FSSamplecollections: thenLoadBuilder[Q]( - "FSSamplecollections", - func(ctx context.Context, exec bob.Executor, retrieved FSSamplecollectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSSamplecollections(ctx, exec, mods...) - }, - ), - FSSamplelocations: thenLoadBuilder[Q]( - "FSSamplelocations", - func(ctx context.Context, exec bob.Executor, retrieved FSSamplelocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSSamplelocations(ctx, exec, mods...) - }, - ), - FSServicerequests: thenLoadBuilder[Q]( - "FSServicerequests", - func(ctx context.Context, exec bob.Executor, retrieved FSServicerequestsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSServicerequests(ctx, exec, mods...) - }, - ), - FSSpeciesabundances: thenLoadBuilder[Q]( - "FSSpeciesabundances", - func(ctx context.Context, exec bob.Executor, retrieved FSSpeciesabundancesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSSpeciesabundances(ctx, exec, mods...) - }, - ), - FSStormdrains: thenLoadBuilder[Q]( - "FSStormdrains", - func(ctx context.Context, exec bob.Executor, retrieved FSStormdrainsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSStormdrains(ctx, exec, mods...) - }, - ), - FSTimecards: thenLoadBuilder[Q]( - "FSTimecards", - func(ctx context.Context, exec bob.Executor, retrieved FSTimecardsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSTimecards(ctx, exec, mods...) - }, - ), - FSTrapdata: thenLoadBuilder[Q]( - "FSTrapdata", - func(ctx context.Context, exec bob.Executor, retrieved FSTrapdataLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSTrapdata(ctx, exec, mods...) - }, - ), - FSTraplocations: thenLoadBuilder[Q]( - "FSTraplocations", - func(ctx context.Context, exec bob.Executor, retrieved FSTraplocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSTraplocations(ctx, exec, mods...) - }, - ), - FSTreatments: thenLoadBuilder[Q]( - "FSTreatments", - func(ctx context.Context, exec bob.Executor, retrieved FSTreatmentsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSTreatments(ctx, exec, mods...) - }, - ), - FSTreatmentareas: thenLoadBuilder[Q]( - "FSTreatmentareas", - func(ctx context.Context, exec bob.Executor, retrieved FSTreatmentareasLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSTreatmentareas(ctx, exec, mods...) - }, - ), - FSZones: thenLoadBuilder[Q]( - "FSZones", - func(ctx context.Context, exec bob.Executor, retrieved FSZonesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadFSZones(ctx, exec, mods...) - }, - ), - FSZones2s: thenLoadBuilder[Q]( - "FSZones2s", - func(ctx context.Context, exec bob.Executor, retrieved FSZones2sLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - 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 { - return retrieved.LoadHistoryContainerrelates(ctx, exec, mods...) + NoteAudios: thenLoadBuilder[Q]( + "NoteAudios", + func(ctx context.Context, exec bob.Executor, retrieved NoteAudiosLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadNoteAudios(ctx, exec, mods...) }, ), - HistoryFieldscoutinglogs: thenLoadBuilder[Q]( - "HistoryFieldscoutinglogs", - func(ctx context.Context, exec bob.Executor, retrieved HistoryFieldscoutinglogsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryFieldscoutinglogs(ctx, exec, mods...) - }, - ), - HistoryHabitatrelates: thenLoadBuilder[Q]( - "HistoryHabitatrelates", - func(ctx context.Context, exec bob.Executor, retrieved HistoryHabitatrelatesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryHabitatrelates(ctx, exec, mods...) - }, - ), - HistoryInspectionsamples: thenLoadBuilder[Q]( - "HistoryInspectionsamples", - func(ctx context.Context, exec bob.Executor, retrieved HistoryInspectionsamplesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryInspectionsamples(ctx, exec, mods...) - }, - ), - HistoryInspectionsampledetails: thenLoadBuilder[Q]( - "HistoryInspectionsampledetails", - func(ctx context.Context, exec bob.Executor, retrieved HistoryInspectionsampledetailsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryInspectionsampledetails(ctx, exec, mods...) - }, - ), - HistoryLinelocations: thenLoadBuilder[Q]( - "HistoryLinelocations", - func(ctx context.Context, exec bob.Executor, retrieved HistoryLinelocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryLinelocations(ctx, exec, mods...) - }, - ), - HistoryLocationtrackings: thenLoadBuilder[Q]( - "HistoryLocationtrackings", - func(ctx context.Context, exec bob.Executor, retrieved HistoryLocationtrackingsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryLocationtrackings(ctx, exec, mods...) - }, - ), - HistoryMosquitoinspections: thenLoadBuilder[Q]( - "HistoryMosquitoinspections", - func(ctx context.Context, exec bob.Executor, retrieved HistoryMosquitoinspectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryMosquitoinspections(ctx, exec, mods...) - }, - ), - HistoryPointlocations: thenLoadBuilder[Q]( - "HistoryPointlocations", - func(ctx context.Context, exec bob.Executor, retrieved HistoryPointlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryPointlocations(ctx, exec, mods...) - }, - ), - HistoryPolygonlocations: thenLoadBuilder[Q]( - "HistoryPolygonlocations", - func(ctx context.Context, exec bob.Executor, retrieved HistoryPolygonlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryPolygonlocations(ctx, exec, mods...) - }, - ), - HistoryPools: thenLoadBuilder[Q]( - "HistoryPools", - func(ctx context.Context, exec bob.Executor, retrieved HistoryPoolsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryPools(ctx, exec, mods...) - }, - ), - HistoryPooldetails: thenLoadBuilder[Q]( - "HistoryPooldetails", - func(ctx context.Context, exec bob.Executor, retrieved HistoryPooldetailsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryPooldetails(ctx, exec, mods...) - }, - ), - HistoryProposedtreatmentareas: thenLoadBuilder[Q]( - "HistoryProposedtreatmentareas", - func(ctx context.Context, exec bob.Executor, retrieved HistoryProposedtreatmentareasLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryProposedtreatmentareas(ctx, exec, mods...) - }, - ), - HistoryQamosquitoinspections: thenLoadBuilder[Q]( - "HistoryQamosquitoinspections", - func(ctx context.Context, exec bob.Executor, retrieved HistoryQamosquitoinspectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryQamosquitoinspections(ctx, exec, mods...) - }, - ), - HistoryRodentlocations: thenLoadBuilder[Q]( - "HistoryRodentlocations", - func(ctx context.Context, exec bob.Executor, retrieved HistoryRodentlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryRodentlocations(ctx, exec, mods...) - }, - ), - HistorySamplecollections: thenLoadBuilder[Q]( - "HistorySamplecollections", - func(ctx context.Context, exec bob.Executor, retrieved HistorySamplecollectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistorySamplecollections(ctx, exec, mods...) - }, - ), - HistorySamplelocations: thenLoadBuilder[Q]( - "HistorySamplelocations", - func(ctx context.Context, exec bob.Executor, retrieved HistorySamplelocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistorySamplelocations(ctx, exec, mods...) - }, - ), - HistoryServicerequests: thenLoadBuilder[Q]( - "HistoryServicerequests", - func(ctx context.Context, exec bob.Executor, retrieved HistoryServicerequestsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryServicerequests(ctx, exec, mods...) - }, - ), - HistorySpeciesabundances: thenLoadBuilder[Q]( - "HistorySpeciesabundances", - func(ctx context.Context, exec bob.Executor, retrieved HistorySpeciesabundancesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistorySpeciesabundances(ctx, exec, mods...) - }, - ), - HistoryStormdrains: thenLoadBuilder[Q]( - "HistoryStormdrains", - func(ctx context.Context, exec bob.Executor, retrieved HistoryStormdrainsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryStormdrains(ctx, exec, mods...) - }, - ), - HistoryTimecards: thenLoadBuilder[Q]( - "HistoryTimecards", - func(ctx context.Context, exec bob.Executor, retrieved HistoryTimecardsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryTimecards(ctx, exec, mods...) - }, - ), - HistoryTrapdata: thenLoadBuilder[Q]( - "HistoryTrapdata", - func(ctx context.Context, exec bob.Executor, retrieved HistoryTrapdataLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryTrapdata(ctx, exec, mods...) - }, - ), - HistoryTraplocations: thenLoadBuilder[Q]( - "HistoryTraplocations", - func(ctx context.Context, exec bob.Executor, retrieved HistoryTraplocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryTraplocations(ctx, exec, mods...) - }, - ), - HistoryTreatments: thenLoadBuilder[Q]( - "HistoryTreatments", - func(ctx context.Context, exec bob.Executor, retrieved HistoryTreatmentsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryTreatments(ctx, exec, mods...) - }, - ), - HistoryTreatmentareas: thenLoadBuilder[Q]( - "HistoryTreatmentareas", - func(ctx context.Context, exec bob.Executor, retrieved HistoryTreatmentareasLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryTreatmentareas(ctx, exec, mods...) - }, - ), - HistoryZones: thenLoadBuilder[Q]( - "HistoryZones", - func(ctx context.Context, exec bob.Executor, retrieved HistoryZonesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryZones(ctx, exec, mods...) - }, - ), - HistoryZones2s: thenLoadBuilder[Q]( - "HistoryZones2s", - func(ctx context.Context, exec bob.Executor, retrieved HistoryZones2sLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadHistoryZones2s(ctx, exec, mods...) + NoteImages: thenLoadBuilder[Q]( + "NoteImages", + func(ctx context.Context, exec bob.Executor, retrieved NoteImagesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadNoteImages(ctx, exec, mods...) }, ), User: thenLoadBuilder[Q]( @@ -7155,6 +4230,1653 @@ func buildOrganizationThenLoader[Q orm.Loadable]() organizationThenLoader[Q] { } } +// LoadContainerrelates loads the organization's Containerrelates into the .R struct +func (o *Organization) LoadContainerrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Containerrelates = nil + + related, err := o.Containerrelates(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Containerrelates = related + return nil +} + +// LoadContainerrelates loads the organization's Containerrelates into the .R struct +func (os OrganizationSlice) LoadContainerrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerContainerrelates, err := os.Containerrelates(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Containerrelates = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerContainerrelates { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Containerrelates = append(o.R.Containerrelates, rel) + } + } + + return nil +} + +// LoadFieldscoutinglogs loads the organization's Fieldscoutinglogs into the .R struct +func (o *Organization) LoadFieldscoutinglogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Fieldscoutinglogs = nil + + related, err := o.Fieldscoutinglogs(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Fieldscoutinglogs = related + return nil +} + +// LoadFieldscoutinglogs loads the organization's Fieldscoutinglogs into the .R struct +func (os OrganizationSlice) LoadFieldscoutinglogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerFieldscoutinglogs, err := os.Fieldscoutinglogs(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Fieldscoutinglogs = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerFieldscoutinglogs { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Fieldscoutinglogs = append(o.R.Fieldscoutinglogs, rel) + } + } + + return nil +} + +// LoadHabitatrelates loads the organization's Habitatrelates into the .R struct +func (o *Organization) LoadHabitatrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Habitatrelates = nil + + related, err := o.Habitatrelates(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Habitatrelates = related + return nil +} + +// LoadHabitatrelates loads the organization's Habitatrelates into the .R struct +func (os OrganizationSlice) LoadHabitatrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerHabitatrelates, err := os.Habitatrelates(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Habitatrelates = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerHabitatrelates { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Habitatrelates = append(o.R.Habitatrelates, rel) + } + } + + return nil +} + +// LoadInspectionsamples loads the organization's Inspectionsamples into the .R struct +func (o *Organization) LoadInspectionsamples(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Inspectionsamples = nil + + related, err := o.Inspectionsamples(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Inspectionsamples = related + return nil +} + +// LoadInspectionsamples loads the organization's Inspectionsamples into the .R struct +func (os OrganizationSlice) LoadInspectionsamples(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerInspectionsamples, err := os.Inspectionsamples(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Inspectionsamples = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerInspectionsamples { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Inspectionsamples = append(o.R.Inspectionsamples, rel) + } + } + + return nil +} + +// LoadInspectionsampledetails loads the organization's Inspectionsampledetails into the .R struct +func (o *Organization) LoadInspectionsampledetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Inspectionsampledetails = nil + + related, err := o.Inspectionsampledetails(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Inspectionsampledetails = related + return nil +} + +// LoadInspectionsampledetails loads the organization's Inspectionsampledetails into the .R struct +func (os OrganizationSlice) LoadInspectionsampledetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerInspectionsampledetails, err := os.Inspectionsampledetails(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Inspectionsampledetails = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerInspectionsampledetails { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Inspectionsampledetails = append(o.R.Inspectionsampledetails, rel) + } + } + + return nil +} + +// LoadLinelocations loads the organization's Linelocations into the .R struct +func (o *Organization) LoadLinelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Linelocations = nil + + related, err := o.Linelocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Linelocations = related + return nil +} + +// LoadLinelocations loads the organization's Linelocations into the .R struct +func (os OrganizationSlice) LoadLinelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerLinelocations, err := os.Linelocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Linelocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerLinelocations { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Linelocations = append(o.R.Linelocations, rel) + } + } + + return nil +} + +// LoadLocationtrackings loads the organization's Locationtrackings into the .R struct +func (o *Organization) LoadLocationtrackings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Locationtrackings = nil + + related, err := o.Locationtrackings(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Locationtrackings = related + return nil +} + +// LoadLocationtrackings loads the organization's Locationtrackings into the .R struct +func (os OrganizationSlice) LoadLocationtrackings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerLocationtrackings, err := os.Locationtrackings(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Locationtrackings = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerLocationtrackings { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Locationtrackings = append(o.R.Locationtrackings, rel) + } + } + + return nil +} + +// LoadMosquitoinspections loads the organization's Mosquitoinspections into the .R struct +func (o *Organization) LoadMosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Mosquitoinspections = nil + + related, err := o.Mosquitoinspections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Mosquitoinspections = related + return nil +} + +// LoadMosquitoinspections loads the organization's Mosquitoinspections into the .R struct +func (os OrganizationSlice) LoadMosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerMosquitoinspections, err := os.Mosquitoinspections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Mosquitoinspections = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerMosquitoinspections { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Mosquitoinspections = append(o.R.Mosquitoinspections, rel) + } + } + + return nil +} + +// LoadPointlocations loads the organization's Pointlocations into the .R struct +func (o *Organization) LoadPointlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Pointlocations = nil + + related, err := o.Pointlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Pointlocations = related + return nil +} + +// LoadPointlocations loads the organization's Pointlocations into the .R struct +func (os OrganizationSlice) LoadPointlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerPointlocations, err := os.Pointlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Pointlocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerPointlocations { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Pointlocations = append(o.R.Pointlocations, rel) + } + } + + return nil +} + +// LoadPolygonlocations loads the organization's Polygonlocations into the .R struct +func (o *Organization) LoadPolygonlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Polygonlocations = nil + + related, err := o.Polygonlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Polygonlocations = related + return nil +} + +// LoadPolygonlocations loads the organization's Polygonlocations into the .R struct +func (os OrganizationSlice) LoadPolygonlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerPolygonlocations, err := os.Polygonlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Polygonlocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerPolygonlocations { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Polygonlocations = append(o.R.Polygonlocations, rel) + } + } + + return nil +} + +// LoadPools loads the organization's Pools into the .R struct +func (o *Organization) LoadPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Pools = nil + + related, err := o.Pools(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Pools = related + return nil +} + +// LoadPools loads the organization's Pools into the .R struct +func (os OrganizationSlice) LoadPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerPools, err := os.Pools(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Pools = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerPools { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Pools = append(o.R.Pools, rel) + } + } + + return nil +} + +// LoadPooldetails loads the organization's Pooldetails into the .R struct +func (o *Organization) LoadPooldetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Pooldetails = nil + + related, err := o.Pooldetails(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Pooldetails = related + return nil +} + +// LoadPooldetails loads the organization's Pooldetails into the .R struct +func (os OrganizationSlice) LoadPooldetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerPooldetails, err := os.Pooldetails(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Pooldetails = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerPooldetails { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Pooldetails = append(o.R.Pooldetails, rel) + } + } + + return nil +} + +// LoadProposedtreatmentareas loads the organization's Proposedtreatmentareas into the .R struct +func (o *Organization) LoadProposedtreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Proposedtreatmentareas = nil + + related, err := o.Proposedtreatmentareas(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Proposedtreatmentareas = related + return nil +} + +// LoadProposedtreatmentareas loads the organization's Proposedtreatmentareas into the .R struct +func (os OrganizationSlice) LoadProposedtreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerProposedtreatmentareas, err := os.Proposedtreatmentareas(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Proposedtreatmentareas = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerProposedtreatmentareas { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Proposedtreatmentareas = append(o.R.Proposedtreatmentareas, rel) + } + } + + return nil +} + +// LoadQamosquitoinspections loads the organization's Qamosquitoinspections into the .R struct +func (o *Organization) LoadQamosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Qamosquitoinspections = nil + + related, err := o.Qamosquitoinspections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Qamosquitoinspections = related + return nil +} + +// LoadQamosquitoinspections loads the organization's Qamosquitoinspections into the .R struct +func (os OrganizationSlice) LoadQamosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerQamosquitoinspections, err := os.Qamosquitoinspections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Qamosquitoinspections = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerQamosquitoinspections { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Qamosquitoinspections = append(o.R.Qamosquitoinspections, rel) + } + } + + return nil +} + +// LoadRodentlocations loads the organization's Rodentlocations into the .R struct +func (o *Organization) LoadRodentlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Rodentlocations = nil + + related, err := o.Rodentlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Rodentlocations = related + return nil +} + +// LoadRodentlocations loads the organization's Rodentlocations into the .R struct +func (os OrganizationSlice) LoadRodentlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerRodentlocations, err := os.Rodentlocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Rodentlocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerRodentlocations { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Rodentlocations = append(o.R.Rodentlocations, rel) + } + } + + return nil +} + +// LoadSamplecollections loads the organization's Samplecollections into the .R struct +func (o *Organization) LoadSamplecollections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Samplecollections = nil + + related, err := o.Samplecollections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Samplecollections = related + return nil +} + +// LoadSamplecollections loads the organization's Samplecollections into the .R struct +func (os OrganizationSlice) LoadSamplecollections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerSamplecollections, err := os.Samplecollections(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Samplecollections = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerSamplecollections { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Samplecollections = append(o.R.Samplecollections, rel) + } + } + + return nil +} + +// LoadSamplelocations loads the organization's Samplelocations into the .R struct +func (o *Organization) LoadSamplelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Samplelocations = nil + + related, err := o.Samplelocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Samplelocations = related + return nil +} + +// LoadSamplelocations loads the organization's Samplelocations into the .R struct +func (os OrganizationSlice) LoadSamplelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerSamplelocations, err := os.Samplelocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Samplelocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerSamplelocations { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Samplelocations = append(o.R.Samplelocations, rel) + } + } + + return nil +} + +// LoadServicerequests loads the organization's Servicerequests into the .R struct +func (o *Organization) LoadServicerequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Servicerequests = nil + + related, err := o.Servicerequests(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Servicerequests = related + return nil +} + +// LoadServicerequests loads the organization's Servicerequests into the .R struct +func (os OrganizationSlice) LoadServicerequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerServicerequests, err := os.Servicerequests(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Servicerequests = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerServicerequests { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Servicerequests = append(o.R.Servicerequests, rel) + } + } + + return nil +} + +// LoadSpeciesabundances loads the organization's Speciesabundances into the .R struct +func (o *Organization) LoadSpeciesabundances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Speciesabundances = nil + + related, err := o.Speciesabundances(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Speciesabundances = related + return nil +} + +// LoadSpeciesabundances loads the organization's Speciesabundances into the .R struct +func (os OrganizationSlice) LoadSpeciesabundances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerSpeciesabundances, err := os.Speciesabundances(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Speciesabundances = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerSpeciesabundances { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Speciesabundances = append(o.R.Speciesabundances, rel) + } + } + + return nil +} + +// LoadStormdrains loads the organization's Stormdrains into the .R struct +func (o *Organization) LoadStormdrains(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Stormdrains = nil + + related, err := o.Stormdrains(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Stormdrains = related + return nil +} + +// LoadStormdrains loads the organization's Stormdrains into the .R struct +func (os OrganizationSlice) LoadStormdrains(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerStormdrains, err := os.Stormdrains(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Stormdrains = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerStormdrains { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Stormdrains = append(o.R.Stormdrains, rel) + } + } + + return nil +} + +// LoadTimecards loads the organization's Timecards into the .R struct +func (o *Organization) LoadTimecards(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Timecards = nil + + related, err := o.Timecards(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Timecards = related + return nil +} + +// LoadTimecards loads the organization's Timecards into the .R struct +func (os OrganizationSlice) LoadTimecards(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerTimecards, err := os.Timecards(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Timecards = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerTimecards { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Timecards = append(o.R.Timecards, rel) + } + } + + return nil +} + +// LoadTrapdata loads the organization's Trapdata into the .R struct +func (o *Organization) LoadTrapdata(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Trapdata = nil + + related, err := o.Trapdata(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Trapdata = related + return nil +} + +// LoadTrapdata loads the organization's Trapdata into the .R struct +func (os OrganizationSlice) LoadTrapdata(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerTrapdata, err := os.Trapdata(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Trapdata = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerTrapdata { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Trapdata = append(o.R.Trapdata, rel) + } + } + + return nil +} + +// LoadTraplocations loads the organization's Traplocations into the .R struct +func (o *Organization) LoadTraplocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Traplocations = nil + + related, err := o.Traplocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Traplocations = related + return nil +} + +// LoadTraplocations loads the organization's Traplocations into the .R struct +func (os OrganizationSlice) LoadTraplocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerTraplocations, err := os.Traplocations(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Traplocations = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerTraplocations { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Traplocations = append(o.R.Traplocations, rel) + } + } + + return nil +} + +// LoadTreatments loads the organization's Treatments into the .R struct +func (o *Organization) LoadTreatments(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Treatments = nil + + related, err := o.Treatments(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Treatments = related + return nil +} + +// LoadTreatments loads the organization's Treatments into the .R struct +func (os OrganizationSlice) LoadTreatments(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerTreatments, err := os.Treatments(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Treatments = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerTreatments { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Treatments = append(o.R.Treatments, rel) + } + } + + return nil +} + +// LoadTreatmentareas loads the organization's Treatmentareas into the .R struct +func (o *Organization) LoadTreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Treatmentareas = nil + + related, err := o.Treatmentareas(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Treatmentareas = related + return nil +} + +// LoadTreatmentareas loads the organization's Treatmentareas into the .R struct +func (os OrganizationSlice) LoadTreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerTreatmentareas, err := os.Treatmentareas(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Treatmentareas = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerTreatmentareas { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Treatmentareas = append(o.R.Treatmentareas, rel) + } + } + + return nil +} + +// LoadZones loads the organization's Zones into the .R struct +func (o *Organization) LoadZones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Zones = nil + + related, err := o.Zones(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Zones = related + return nil +} + +// LoadZones loads the organization's Zones into the .R struct +func (os OrganizationSlice) LoadZones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerZones, err := os.Zones(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Zones = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerZones { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Zones = append(o.R.Zones, rel) + } + } + + return nil +} + +// LoadZones2s loads the organization's Zones2s into the .R struct +func (o *Organization) LoadZones2s(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Zones2s = nil + + related, err := o.Zones2s(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Zones2s = related + return nil +} + +// LoadZones2s loads the organization's Zones2s into the .R struct +func (os OrganizationSlice) LoadZones2s(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + fieldseekerZones2s, err := os.Zones2s(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Zones2s = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range fieldseekerZones2s { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Zones2s = append(o.R.Zones2s, rel) + } + } + + return nil +} + // LoadFieldseekerSyncs loads the organization's FieldseekerSyncs into the .R struct func (o *Organization) LoadFieldseekerSyncs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { @@ -7216,1653 +5938,6 @@ func (os OrganizationSlice) LoadFieldseekerSyncs(ctx context.Context, exec bob.E return nil } -// LoadFSContainerrelates loads the organization's FSContainerrelates into the .R struct -func (o *Organization) LoadFSContainerrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSContainerrelates = nil - - related, err := o.FSContainerrelates(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSContainerrelates = related - return nil -} - -// LoadFSContainerrelates loads the organization's FSContainerrelates into the .R struct -func (os OrganizationSlice) LoadFSContainerrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsContainerrelates, err := os.FSContainerrelates(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSContainerrelates = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsContainerrelates { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSContainerrelates = append(o.R.FSContainerrelates, rel) - } - } - - return nil -} - -// LoadFSFieldscoutinglogs loads the organization's FSFieldscoutinglogs into the .R struct -func (o *Organization) LoadFSFieldscoutinglogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSFieldscoutinglogs = nil - - related, err := o.FSFieldscoutinglogs(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSFieldscoutinglogs = related - return nil -} - -// LoadFSFieldscoutinglogs loads the organization's FSFieldscoutinglogs into the .R struct -func (os OrganizationSlice) LoadFSFieldscoutinglogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsFieldscoutinglogs, err := os.FSFieldscoutinglogs(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSFieldscoutinglogs = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsFieldscoutinglogs { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSFieldscoutinglogs = append(o.R.FSFieldscoutinglogs, rel) - } - } - - return nil -} - -// LoadFSHabitatrelates loads the organization's FSHabitatrelates into the .R struct -func (o *Organization) LoadFSHabitatrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSHabitatrelates = nil - - related, err := o.FSHabitatrelates(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSHabitatrelates = related - return nil -} - -// LoadFSHabitatrelates loads the organization's FSHabitatrelates into the .R struct -func (os OrganizationSlice) LoadFSHabitatrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsHabitatrelates, err := os.FSHabitatrelates(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSHabitatrelates = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsHabitatrelates { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSHabitatrelates = append(o.R.FSHabitatrelates, rel) - } - } - - return nil -} - -// LoadFSInspectionsamples loads the organization's FSInspectionsamples into the .R struct -func (o *Organization) LoadFSInspectionsamples(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSInspectionsamples = nil - - related, err := o.FSInspectionsamples(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSInspectionsamples = related - return nil -} - -// LoadFSInspectionsamples loads the organization's FSInspectionsamples into the .R struct -func (os OrganizationSlice) LoadFSInspectionsamples(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsInspectionsamples, err := os.FSInspectionsamples(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSInspectionsamples = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsInspectionsamples { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSInspectionsamples = append(o.R.FSInspectionsamples, rel) - } - } - - return nil -} - -// LoadFSInspectionsampledetails loads the organization's FSInspectionsampledetails into the .R struct -func (o *Organization) LoadFSInspectionsampledetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSInspectionsampledetails = nil - - related, err := o.FSInspectionsampledetails(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSInspectionsampledetails = related - return nil -} - -// LoadFSInspectionsampledetails loads the organization's FSInspectionsampledetails into the .R struct -func (os OrganizationSlice) LoadFSInspectionsampledetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsInspectionsampledetails, err := os.FSInspectionsampledetails(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSInspectionsampledetails = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsInspectionsampledetails { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSInspectionsampledetails = append(o.R.FSInspectionsampledetails, rel) - } - } - - return nil -} - -// LoadFSLinelocations loads the organization's FSLinelocations into the .R struct -func (o *Organization) LoadFSLinelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSLinelocations = nil - - related, err := o.FSLinelocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSLinelocations = related - return nil -} - -// LoadFSLinelocations loads the organization's FSLinelocations into the .R struct -func (os OrganizationSlice) LoadFSLinelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsLinelocations, err := os.FSLinelocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSLinelocations = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsLinelocations { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSLinelocations = append(o.R.FSLinelocations, rel) - } - } - - return nil -} - -// LoadFSLocationtrackings loads the organization's FSLocationtrackings into the .R struct -func (o *Organization) LoadFSLocationtrackings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSLocationtrackings = nil - - related, err := o.FSLocationtrackings(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSLocationtrackings = related - return nil -} - -// LoadFSLocationtrackings loads the organization's FSLocationtrackings into the .R struct -func (os OrganizationSlice) LoadFSLocationtrackings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsLocationtrackings, err := os.FSLocationtrackings(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSLocationtrackings = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsLocationtrackings { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSLocationtrackings = append(o.R.FSLocationtrackings, rel) - } - } - - return nil -} - -// LoadFSMosquitoinspections loads the organization's FSMosquitoinspections into the .R struct -func (o *Organization) LoadFSMosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSMosquitoinspections = nil - - related, err := o.FSMosquitoinspections(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSMosquitoinspections = related - return nil -} - -// LoadFSMosquitoinspections loads the organization's FSMosquitoinspections into the .R struct -func (os OrganizationSlice) LoadFSMosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsMosquitoinspections, err := os.FSMosquitoinspections(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSMosquitoinspections = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsMosquitoinspections { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSMosquitoinspections = append(o.R.FSMosquitoinspections, rel) - } - } - - return nil -} - -// LoadFSPointlocations loads the organization's FSPointlocations into the .R struct -func (o *Organization) LoadFSPointlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSPointlocations = nil - - related, err := o.FSPointlocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSPointlocations = related - return nil -} - -// LoadFSPointlocations loads the organization's FSPointlocations into the .R struct -func (os OrganizationSlice) LoadFSPointlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsPointlocations, err := os.FSPointlocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSPointlocations = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsPointlocations { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSPointlocations = append(o.R.FSPointlocations, rel) - } - } - - return nil -} - -// LoadFSPolygonlocations loads the organization's FSPolygonlocations into the .R struct -func (o *Organization) LoadFSPolygonlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSPolygonlocations = nil - - related, err := o.FSPolygonlocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSPolygonlocations = related - return nil -} - -// LoadFSPolygonlocations loads the organization's FSPolygonlocations into the .R struct -func (os OrganizationSlice) LoadFSPolygonlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsPolygonlocations, err := os.FSPolygonlocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSPolygonlocations = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsPolygonlocations { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSPolygonlocations = append(o.R.FSPolygonlocations, rel) - } - } - - return nil -} - -// LoadFSPools loads the organization's FSPools into the .R struct -func (o *Organization) LoadFSPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSPools = nil - - related, err := o.FSPools(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSPools = related - return nil -} - -// LoadFSPools loads the organization's FSPools into the .R struct -func (os OrganizationSlice) LoadFSPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsPools, err := os.FSPools(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSPools = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsPools { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSPools = append(o.R.FSPools, rel) - } - } - - return nil -} - -// LoadFSPooldetails loads the organization's FSPooldetails into the .R struct -func (o *Organization) LoadFSPooldetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSPooldetails = nil - - related, err := o.FSPooldetails(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSPooldetails = related - return nil -} - -// LoadFSPooldetails loads the organization's FSPooldetails into the .R struct -func (os OrganizationSlice) LoadFSPooldetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsPooldetails, err := os.FSPooldetails(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSPooldetails = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsPooldetails { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSPooldetails = append(o.R.FSPooldetails, rel) - } - } - - return nil -} - -// LoadFSProposedtreatmentareas loads the organization's FSProposedtreatmentareas into the .R struct -func (o *Organization) LoadFSProposedtreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSProposedtreatmentareas = nil - - related, err := o.FSProposedtreatmentareas(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSProposedtreatmentareas = related - return nil -} - -// LoadFSProposedtreatmentareas loads the organization's FSProposedtreatmentareas into the .R struct -func (os OrganizationSlice) LoadFSProposedtreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsProposedtreatmentareas, err := os.FSProposedtreatmentareas(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSProposedtreatmentareas = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsProposedtreatmentareas { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSProposedtreatmentareas = append(o.R.FSProposedtreatmentareas, rel) - } - } - - return nil -} - -// LoadFSQamosquitoinspections loads the organization's FSQamosquitoinspections into the .R struct -func (o *Organization) LoadFSQamosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSQamosquitoinspections = nil - - related, err := o.FSQamosquitoinspections(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSQamosquitoinspections = related - return nil -} - -// LoadFSQamosquitoinspections loads the organization's FSQamosquitoinspections into the .R struct -func (os OrganizationSlice) LoadFSQamosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsQamosquitoinspections, err := os.FSQamosquitoinspections(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSQamosquitoinspections = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsQamosquitoinspections { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSQamosquitoinspections = append(o.R.FSQamosquitoinspections, rel) - } - } - - return nil -} - -// LoadFSRodentlocations loads the organization's FSRodentlocations into the .R struct -func (o *Organization) LoadFSRodentlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSRodentlocations = nil - - related, err := o.FSRodentlocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSRodentlocations = related - return nil -} - -// LoadFSRodentlocations loads the organization's FSRodentlocations into the .R struct -func (os OrganizationSlice) LoadFSRodentlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsRodentlocations, err := os.FSRodentlocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSRodentlocations = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsRodentlocations { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSRodentlocations = append(o.R.FSRodentlocations, rel) - } - } - - return nil -} - -// LoadFSSamplecollections loads the organization's FSSamplecollections into the .R struct -func (o *Organization) LoadFSSamplecollections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSSamplecollections = nil - - related, err := o.FSSamplecollections(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSSamplecollections = related - return nil -} - -// LoadFSSamplecollections loads the organization's FSSamplecollections into the .R struct -func (os OrganizationSlice) LoadFSSamplecollections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsSamplecollections, err := os.FSSamplecollections(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSSamplecollections = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsSamplecollections { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSSamplecollections = append(o.R.FSSamplecollections, rel) - } - } - - return nil -} - -// LoadFSSamplelocations loads the organization's FSSamplelocations into the .R struct -func (o *Organization) LoadFSSamplelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSSamplelocations = nil - - related, err := o.FSSamplelocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSSamplelocations = related - return nil -} - -// LoadFSSamplelocations loads the organization's FSSamplelocations into the .R struct -func (os OrganizationSlice) LoadFSSamplelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsSamplelocations, err := os.FSSamplelocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSSamplelocations = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsSamplelocations { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSSamplelocations = append(o.R.FSSamplelocations, rel) - } - } - - return nil -} - -// LoadFSServicerequests loads the organization's FSServicerequests into the .R struct -func (o *Organization) LoadFSServicerequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSServicerequests = nil - - related, err := o.FSServicerequests(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSServicerequests = related - return nil -} - -// LoadFSServicerequests loads the organization's FSServicerequests into the .R struct -func (os OrganizationSlice) LoadFSServicerequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsServicerequests, err := os.FSServicerequests(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSServicerequests = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsServicerequests { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSServicerequests = append(o.R.FSServicerequests, rel) - } - } - - return nil -} - -// LoadFSSpeciesabundances loads the organization's FSSpeciesabundances into the .R struct -func (o *Organization) LoadFSSpeciesabundances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSSpeciesabundances = nil - - related, err := o.FSSpeciesabundances(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSSpeciesabundances = related - return nil -} - -// LoadFSSpeciesabundances loads the organization's FSSpeciesabundances into the .R struct -func (os OrganizationSlice) LoadFSSpeciesabundances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsSpeciesabundances, err := os.FSSpeciesabundances(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSSpeciesabundances = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsSpeciesabundances { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSSpeciesabundances = append(o.R.FSSpeciesabundances, rel) - } - } - - return nil -} - -// LoadFSStormdrains loads the organization's FSStormdrains into the .R struct -func (o *Organization) LoadFSStormdrains(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSStormdrains = nil - - related, err := o.FSStormdrains(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSStormdrains = related - return nil -} - -// LoadFSStormdrains loads the organization's FSStormdrains into the .R struct -func (os OrganizationSlice) LoadFSStormdrains(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsStormdrains, err := os.FSStormdrains(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSStormdrains = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsStormdrains { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSStormdrains = append(o.R.FSStormdrains, rel) - } - } - - return nil -} - -// LoadFSTimecards loads the organization's FSTimecards into the .R struct -func (o *Organization) LoadFSTimecards(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSTimecards = nil - - related, err := o.FSTimecards(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSTimecards = related - return nil -} - -// LoadFSTimecards loads the organization's FSTimecards into the .R struct -func (os OrganizationSlice) LoadFSTimecards(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsTimecards, err := os.FSTimecards(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSTimecards = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsTimecards { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSTimecards = append(o.R.FSTimecards, rel) - } - } - - return nil -} - -// LoadFSTrapdata loads the organization's FSTrapdata into the .R struct -func (o *Organization) LoadFSTrapdata(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSTrapdata = nil - - related, err := o.FSTrapdata(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSTrapdata = related - return nil -} - -// LoadFSTrapdata loads the organization's FSTrapdata into the .R struct -func (os OrganizationSlice) LoadFSTrapdata(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsTrapdata, err := os.FSTrapdata(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSTrapdata = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsTrapdata { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSTrapdata = append(o.R.FSTrapdata, rel) - } - } - - return nil -} - -// LoadFSTraplocations loads the organization's FSTraplocations into the .R struct -func (o *Organization) LoadFSTraplocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSTraplocations = nil - - related, err := o.FSTraplocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSTraplocations = related - return nil -} - -// LoadFSTraplocations loads the organization's FSTraplocations into the .R struct -func (os OrganizationSlice) LoadFSTraplocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsTraplocations, err := os.FSTraplocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSTraplocations = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsTraplocations { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSTraplocations = append(o.R.FSTraplocations, rel) - } - } - - return nil -} - -// LoadFSTreatments loads the organization's FSTreatments into the .R struct -func (o *Organization) LoadFSTreatments(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSTreatments = nil - - related, err := o.FSTreatments(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSTreatments = related - return nil -} - -// LoadFSTreatments loads the organization's FSTreatments into the .R struct -func (os OrganizationSlice) LoadFSTreatments(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsTreatments, err := os.FSTreatments(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSTreatments = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsTreatments { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSTreatments = append(o.R.FSTreatments, rel) - } - } - - return nil -} - -// LoadFSTreatmentareas loads the organization's FSTreatmentareas into the .R struct -func (o *Organization) LoadFSTreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSTreatmentareas = nil - - related, err := o.FSTreatmentareas(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSTreatmentareas = related - return nil -} - -// LoadFSTreatmentareas loads the organization's FSTreatmentareas into the .R struct -func (os OrganizationSlice) LoadFSTreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsTreatmentareas, err := os.FSTreatmentareas(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSTreatmentareas = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsTreatmentareas { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSTreatmentareas = append(o.R.FSTreatmentareas, rel) - } - } - - return nil -} - -// LoadFSZones loads the organization's FSZones into the .R struct -func (o *Organization) LoadFSZones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSZones = nil - - related, err := o.FSZones(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSZones = related - return nil -} - -// LoadFSZones loads the organization's FSZones into the .R struct -func (os OrganizationSlice) LoadFSZones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsZones, err := os.FSZones(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSZones = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsZones { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSZones = append(o.R.FSZones, rel) - } - } - - return nil -} - -// LoadFSZones2s loads the organization's FSZones2s into the .R struct -func (o *Organization) LoadFSZones2s(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.FSZones2s = nil - - related, err := o.FSZones2s(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.FSZones2s = related - return nil -} - -// LoadFSZones2s loads the organization's FSZones2s into the .R struct -func (os OrganizationSlice) LoadFSZones2s(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - fsZones2s, err := os.FSZones2s(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.FSZones2s = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range fsZones2s { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.FSZones2s = append(o.R.FSZones2s, rel) - } - } - - 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 { @@ -8924,16 +5999,16 @@ func (os OrganizationSlice) LoadH3Aggregations(ctx context.Context, exec bob.Exe 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 { +// LoadNoteAudios loads the organization's NoteAudios into the .R struct +func (o *Organization) LoadNoteAudios(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship - o.R.HistoryContainerrelates = nil + o.R.NoteAudios = nil - related, err := o.HistoryContainerrelates(mods...).All(ctx, exec) + related, err := o.NoteAudios(mods...).All(ctx, exec) if err != nil { return err } @@ -8942,17 +6017,17 @@ func (o *Organization) LoadHistoryContainerrelates(ctx context.Context, exec bob rel.R.Organization = o } - o.R.HistoryContainerrelates = related + o.R.NoteAudios = related return nil } -// LoadHistoryContainerrelates loads the organization's HistoryContainerrelates into the .R struct -func (os OrganizationSlice) LoadHistoryContainerrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { +// LoadNoteAudios loads the organization's NoteAudios into the .R struct +func (os OrganizationSlice) LoadNoteAudios(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } - historyContainerrelates, err := os.HistoryContainerrelates(mods...).All(ctx, exec) + noteAudios, err := os.NoteAudios(mods...).All(ctx, exec) if err != nil { return err } @@ -8962,7 +6037,7 @@ func (os OrganizationSlice) LoadHistoryContainerrelates(ctx context.Context, exe continue } - o.R.HistoryContainerrelates = nil + o.R.NoteAudios = nil } for _, o := range os { @@ -8970,7 +6045,7 @@ func (os OrganizationSlice) LoadHistoryContainerrelates(ctx context.Context, exe continue } - for _, rel := range historyContainerrelates { + for _, rel := range noteAudios { if !(o.ID == rel.OrganizationID) { continue @@ -8978,23 +6053,23 @@ func (os OrganizationSlice) LoadHistoryContainerrelates(ctx context.Context, exe rel.R.Organization = o - o.R.HistoryContainerrelates = append(o.R.HistoryContainerrelates, rel) + o.R.NoteAudios = append(o.R.NoteAudios, rel) } } return nil } -// LoadHistoryFieldscoutinglogs loads the organization's HistoryFieldscoutinglogs into the .R struct -func (o *Organization) LoadHistoryFieldscoutinglogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { +// LoadNoteImages loads the organization's NoteImages into the .R struct +func (o *Organization) LoadNoteImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship - o.R.HistoryFieldscoutinglogs = nil + o.R.NoteImages = nil - related, err := o.HistoryFieldscoutinglogs(mods...).All(ctx, exec) + related, err := o.NoteImages(mods...).All(ctx, exec) if err != nil { return err } @@ -9003,17 +6078,17 @@ func (o *Organization) LoadHistoryFieldscoutinglogs(ctx context.Context, exec bo rel.R.Organization = o } - o.R.HistoryFieldscoutinglogs = related + o.R.NoteImages = related return nil } -// LoadHistoryFieldscoutinglogs loads the organization's HistoryFieldscoutinglogs into the .R struct -func (os OrganizationSlice) LoadHistoryFieldscoutinglogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { +// LoadNoteImages loads the organization's NoteImages into the .R struct +func (os OrganizationSlice) LoadNoteImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } - historyFieldscoutinglogs, err := os.HistoryFieldscoutinglogs(mods...).All(ctx, exec) + noteImages, err := os.NoteImages(mods...).All(ctx, exec) if err != nil { return err } @@ -9023,7 +6098,7 @@ func (os OrganizationSlice) LoadHistoryFieldscoutinglogs(ctx context.Context, ex continue } - o.R.HistoryFieldscoutinglogs = nil + o.R.NoteImages = nil } for _, o := range os { @@ -9031,7 +6106,7 @@ func (os OrganizationSlice) LoadHistoryFieldscoutinglogs(ctx context.Context, ex continue } - for _, rel := range historyFieldscoutinglogs { + for _, rel := range noteImages { if !(o.ID == rel.OrganizationID) { continue @@ -9039,1532 +6114,7 @@ func (os OrganizationSlice) LoadHistoryFieldscoutinglogs(ctx context.Context, ex rel.R.Organization = o - o.R.HistoryFieldscoutinglogs = append(o.R.HistoryFieldscoutinglogs, rel) - } - } - - return nil -} - -// LoadHistoryHabitatrelates loads the organization's HistoryHabitatrelates into the .R struct -func (o *Organization) LoadHistoryHabitatrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryHabitatrelates = nil - - related, err := o.HistoryHabitatrelates(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryHabitatrelates = related - return nil -} - -// LoadHistoryHabitatrelates loads the organization's HistoryHabitatrelates into the .R struct -func (os OrganizationSlice) LoadHistoryHabitatrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyHabitatrelates, err := os.HistoryHabitatrelates(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryHabitatrelates = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyHabitatrelates { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryHabitatrelates = append(o.R.HistoryHabitatrelates, rel) - } - } - - return nil -} - -// LoadHistoryInspectionsamples loads the organization's HistoryInspectionsamples into the .R struct -func (o *Organization) LoadHistoryInspectionsamples(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryInspectionsamples = nil - - related, err := o.HistoryInspectionsamples(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryInspectionsamples = related - return nil -} - -// LoadHistoryInspectionsamples loads the organization's HistoryInspectionsamples into the .R struct -func (os OrganizationSlice) LoadHistoryInspectionsamples(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyInspectionsamples, err := os.HistoryInspectionsamples(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryInspectionsamples = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyInspectionsamples { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryInspectionsamples = append(o.R.HistoryInspectionsamples, rel) - } - } - - return nil -} - -// LoadHistoryInspectionsampledetails loads the organization's HistoryInspectionsampledetails into the .R struct -func (o *Organization) LoadHistoryInspectionsampledetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryInspectionsampledetails = nil - - related, err := o.HistoryInspectionsampledetails(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryInspectionsampledetails = related - return nil -} - -// LoadHistoryInspectionsampledetails loads the organization's HistoryInspectionsampledetails into the .R struct -func (os OrganizationSlice) LoadHistoryInspectionsampledetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyInspectionsampledetails, err := os.HistoryInspectionsampledetails(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryInspectionsampledetails = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyInspectionsampledetails { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryInspectionsampledetails = append(o.R.HistoryInspectionsampledetails, rel) - } - } - - return nil -} - -// LoadHistoryLinelocations loads the organization's HistoryLinelocations into the .R struct -func (o *Organization) LoadHistoryLinelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryLinelocations = nil - - related, err := o.HistoryLinelocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryLinelocations = related - return nil -} - -// LoadHistoryLinelocations loads the organization's HistoryLinelocations into the .R struct -func (os OrganizationSlice) LoadHistoryLinelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyLinelocations, err := os.HistoryLinelocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryLinelocations = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyLinelocations { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryLinelocations = append(o.R.HistoryLinelocations, rel) - } - } - - return nil -} - -// LoadHistoryLocationtrackings loads the organization's HistoryLocationtrackings into the .R struct -func (o *Organization) LoadHistoryLocationtrackings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryLocationtrackings = nil - - related, err := o.HistoryLocationtrackings(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryLocationtrackings = related - return nil -} - -// LoadHistoryLocationtrackings loads the organization's HistoryLocationtrackings into the .R struct -func (os OrganizationSlice) LoadHistoryLocationtrackings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyLocationtrackings, err := os.HistoryLocationtrackings(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryLocationtrackings = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyLocationtrackings { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryLocationtrackings = append(o.R.HistoryLocationtrackings, rel) - } - } - - return nil -} - -// LoadHistoryMosquitoinspections loads the organization's HistoryMosquitoinspections into the .R struct -func (o *Organization) LoadHistoryMosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryMosquitoinspections = nil - - related, err := o.HistoryMosquitoinspections(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryMosquitoinspections = related - return nil -} - -// LoadHistoryMosquitoinspections loads the organization's HistoryMosquitoinspections into the .R struct -func (os OrganizationSlice) LoadHistoryMosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyMosquitoinspections, err := os.HistoryMosquitoinspections(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryMosquitoinspections = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyMosquitoinspections { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryMosquitoinspections = append(o.R.HistoryMosquitoinspections, rel) - } - } - - return nil -} - -// LoadHistoryPointlocations loads the organization's HistoryPointlocations into the .R struct -func (o *Organization) LoadHistoryPointlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryPointlocations = nil - - related, err := o.HistoryPointlocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryPointlocations = related - return nil -} - -// LoadHistoryPointlocations loads the organization's HistoryPointlocations into the .R struct -func (os OrganizationSlice) LoadHistoryPointlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyPointlocations, err := os.HistoryPointlocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryPointlocations = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyPointlocations { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryPointlocations = append(o.R.HistoryPointlocations, rel) - } - } - - return nil -} - -// LoadHistoryPolygonlocations loads the organization's HistoryPolygonlocations into the .R struct -func (o *Organization) LoadHistoryPolygonlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryPolygonlocations = nil - - related, err := o.HistoryPolygonlocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryPolygonlocations = related - return nil -} - -// LoadHistoryPolygonlocations loads the organization's HistoryPolygonlocations into the .R struct -func (os OrganizationSlice) LoadHistoryPolygonlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyPolygonlocations, err := os.HistoryPolygonlocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryPolygonlocations = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyPolygonlocations { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryPolygonlocations = append(o.R.HistoryPolygonlocations, rel) - } - } - - return nil -} - -// LoadHistoryPools loads the organization's HistoryPools into the .R struct -func (o *Organization) LoadHistoryPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryPools = nil - - related, err := o.HistoryPools(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryPools = related - return nil -} - -// LoadHistoryPools loads the organization's HistoryPools into the .R struct -func (os OrganizationSlice) LoadHistoryPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyPools, err := os.HistoryPools(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryPools = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyPools { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryPools = append(o.R.HistoryPools, rel) - } - } - - return nil -} - -// LoadHistoryPooldetails loads the organization's HistoryPooldetails into the .R struct -func (o *Organization) LoadHistoryPooldetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryPooldetails = nil - - related, err := o.HistoryPooldetails(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryPooldetails = related - return nil -} - -// LoadHistoryPooldetails loads the organization's HistoryPooldetails into the .R struct -func (os OrganizationSlice) LoadHistoryPooldetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyPooldetails, err := os.HistoryPooldetails(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryPooldetails = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyPooldetails { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryPooldetails = append(o.R.HistoryPooldetails, rel) - } - } - - return nil -} - -// LoadHistoryProposedtreatmentareas loads the organization's HistoryProposedtreatmentareas into the .R struct -func (o *Organization) LoadHistoryProposedtreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryProposedtreatmentareas = nil - - related, err := o.HistoryProposedtreatmentareas(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryProposedtreatmentareas = related - return nil -} - -// LoadHistoryProposedtreatmentareas loads the organization's HistoryProposedtreatmentareas into the .R struct -func (os OrganizationSlice) LoadHistoryProposedtreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyProposedtreatmentareas, err := os.HistoryProposedtreatmentareas(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryProposedtreatmentareas = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyProposedtreatmentareas { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryProposedtreatmentareas = append(o.R.HistoryProposedtreatmentareas, rel) - } - } - - return nil -} - -// LoadHistoryQamosquitoinspections loads the organization's HistoryQamosquitoinspections into the .R struct -func (o *Organization) LoadHistoryQamosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryQamosquitoinspections = nil - - related, err := o.HistoryQamosquitoinspections(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryQamosquitoinspections = related - return nil -} - -// LoadHistoryQamosquitoinspections loads the organization's HistoryQamosquitoinspections into the .R struct -func (os OrganizationSlice) LoadHistoryQamosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyQamosquitoinspections, err := os.HistoryQamosquitoinspections(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryQamosquitoinspections = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyQamosquitoinspections { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryQamosquitoinspections = append(o.R.HistoryQamosquitoinspections, rel) - } - } - - return nil -} - -// LoadHistoryRodentlocations loads the organization's HistoryRodentlocations into the .R struct -func (o *Organization) LoadHistoryRodentlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryRodentlocations = nil - - related, err := o.HistoryRodentlocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryRodentlocations = related - return nil -} - -// LoadHistoryRodentlocations loads the organization's HistoryRodentlocations into the .R struct -func (os OrganizationSlice) LoadHistoryRodentlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyRodentlocations, err := os.HistoryRodentlocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryRodentlocations = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyRodentlocations { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryRodentlocations = append(o.R.HistoryRodentlocations, rel) - } - } - - return nil -} - -// LoadHistorySamplecollections loads the organization's HistorySamplecollections into the .R struct -func (o *Organization) LoadHistorySamplecollections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistorySamplecollections = nil - - related, err := o.HistorySamplecollections(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistorySamplecollections = related - return nil -} - -// LoadHistorySamplecollections loads the organization's HistorySamplecollections into the .R struct -func (os OrganizationSlice) LoadHistorySamplecollections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historySamplecollections, err := os.HistorySamplecollections(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistorySamplecollections = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historySamplecollections { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistorySamplecollections = append(o.R.HistorySamplecollections, rel) - } - } - - return nil -} - -// LoadHistorySamplelocations loads the organization's HistorySamplelocations into the .R struct -func (o *Organization) LoadHistorySamplelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistorySamplelocations = nil - - related, err := o.HistorySamplelocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistorySamplelocations = related - return nil -} - -// LoadHistorySamplelocations loads the organization's HistorySamplelocations into the .R struct -func (os OrganizationSlice) LoadHistorySamplelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historySamplelocations, err := os.HistorySamplelocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistorySamplelocations = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historySamplelocations { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistorySamplelocations = append(o.R.HistorySamplelocations, rel) - } - } - - return nil -} - -// LoadHistoryServicerequests loads the organization's HistoryServicerequests into the .R struct -func (o *Organization) LoadHistoryServicerequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryServicerequests = nil - - related, err := o.HistoryServicerequests(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryServicerequests = related - return nil -} - -// LoadHistoryServicerequests loads the organization's HistoryServicerequests into the .R struct -func (os OrganizationSlice) LoadHistoryServicerequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyServicerequests, err := os.HistoryServicerequests(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryServicerequests = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyServicerequests { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryServicerequests = append(o.R.HistoryServicerequests, rel) - } - } - - return nil -} - -// LoadHistorySpeciesabundances loads the organization's HistorySpeciesabundances into the .R struct -func (o *Organization) LoadHistorySpeciesabundances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistorySpeciesabundances = nil - - related, err := o.HistorySpeciesabundances(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistorySpeciesabundances = related - return nil -} - -// LoadHistorySpeciesabundances loads the organization's HistorySpeciesabundances into the .R struct -func (os OrganizationSlice) LoadHistorySpeciesabundances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historySpeciesabundances, err := os.HistorySpeciesabundances(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistorySpeciesabundances = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historySpeciesabundances { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistorySpeciesabundances = append(o.R.HistorySpeciesabundances, rel) - } - } - - return nil -} - -// LoadHistoryStormdrains loads the organization's HistoryStormdrains into the .R struct -func (o *Organization) LoadHistoryStormdrains(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryStormdrains = nil - - related, err := o.HistoryStormdrains(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryStormdrains = related - return nil -} - -// LoadHistoryStormdrains loads the organization's HistoryStormdrains into the .R struct -func (os OrganizationSlice) LoadHistoryStormdrains(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyStormdrains, err := os.HistoryStormdrains(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryStormdrains = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyStormdrains { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryStormdrains = append(o.R.HistoryStormdrains, rel) - } - } - - return nil -} - -// LoadHistoryTimecards loads the organization's HistoryTimecards into the .R struct -func (o *Organization) LoadHistoryTimecards(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryTimecards = nil - - related, err := o.HistoryTimecards(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryTimecards = related - return nil -} - -// LoadHistoryTimecards loads the organization's HistoryTimecards into the .R struct -func (os OrganizationSlice) LoadHistoryTimecards(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyTimecards, err := os.HistoryTimecards(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryTimecards = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyTimecards { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryTimecards = append(o.R.HistoryTimecards, rel) - } - } - - return nil -} - -// LoadHistoryTrapdata loads the organization's HistoryTrapdata into the .R struct -func (o *Organization) LoadHistoryTrapdata(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryTrapdata = nil - - related, err := o.HistoryTrapdata(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryTrapdata = related - return nil -} - -// LoadHistoryTrapdata loads the organization's HistoryTrapdata into the .R struct -func (os OrganizationSlice) LoadHistoryTrapdata(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyTrapdata, err := os.HistoryTrapdata(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryTrapdata = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyTrapdata { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryTrapdata = append(o.R.HistoryTrapdata, rel) - } - } - - return nil -} - -// LoadHistoryTraplocations loads the organization's HistoryTraplocations into the .R struct -func (o *Organization) LoadHistoryTraplocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryTraplocations = nil - - related, err := o.HistoryTraplocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryTraplocations = related - return nil -} - -// LoadHistoryTraplocations loads the organization's HistoryTraplocations into the .R struct -func (os OrganizationSlice) LoadHistoryTraplocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyTraplocations, err := os.HistoryTraplocations(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryTraplocations = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyTraplocations { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryTraplocations = append(o.R.HistoryTraplocations, rel) - } - } - - return nil -} - -// LoadHistoryTreatments loads the organization's HistoryTreatments into the .R struct -func (o *Organization) LoadHistoryTreatments(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryTreatments = nil - - related, err := o.HistoryTreatments(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryTreatments = related - return nil -} - -// LoadHistoryTreatments loads the organization's HistoryTreatments into the .R struct -func (os OrganizationSlice) LoadHistoryTreatments(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyTreatments, err := os.HistoryTreatments(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryTreatments = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyTreatments { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryTreatments = append(o.R.HistoryTreatments, rel) - } - } - - return nil -} - -// LoadHistoryTreatmentareas loads the organization's HistoryTreatmentareas into the .R struct -func (o *Organization) LoadHistoryTreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryTreatmentareas = nil - - related, err := o.HistoryTreatmentareas(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryTreatmentareas = related - return nil -} - -// LoadHistoryTreatmentareas loads the organization's HistoryTreatmentareas into the .R struct -func (os OrganizationSlice) LoadHistoryTreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyTreatmentareas, err := os.HistoryTreatmentareas(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryTreatmentareas = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyTreatmentareas { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryTreatmentareas = append(o.R.HistoryTreatmentareas, rel) - } - } - - return nil -} - -// LoadHistoryZones loads the organization's HistoryZones into the .R struct -func (o *Organization) LoadHistoryZones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryZones = nil - - related, err := o.HistoryZones(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryZones = related - return nil -} - -// LoadHistoryZones loads the organization's HistoryZones into the .R struct -func (os OrganizationSlice) LoadHistoryZones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyZones, err := os.HistoryZones(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryZones = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyZones { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryZones = append(o.R.HistoryZones, rel) - } - } - - return nil -} - -// LoadHistoryZones2s loads the organization's HistoryZones2s into the .R struct -func (o *Organization) LoadHistoryZones2s(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.HistoryZones2s = nil - - related, err := o.HistoryZones2s(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Organization = o - } - - o.R.HistoryZones2s = related - return nil -} - -// LoadHistoryZones2s loads the organization's HistoryZones2s into the .R struct -func (os OrganizationSlice) LoadHistoryZones2s(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - historyZones2s, err := os.HistoryZones2s(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.HistoryZones2s = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range historyZones2s { - - if !(o.ID == rel.OrganizationID) { - continue - } - - rel.R.Organization = o - - o.R.HistoryZones2s = append(o.R.HistoryZones2s, rel) + o.R.NoteImages = append(o.R.NoteImages, rel) } } @@ -10636,64 +6186,39 @@ func (os OrganizationSlice) LoadUser(ctx context.Context, exec bob.Executor, mod } type organizationJoins[Q dialect.Joinable] struct { - typ string - FieldseekerSyncs modAs[Q, fieldseekerSyncColumns] - FSContainerrelates modAs[Q, fsContainerrelateColumns] - FSFieldscoutinglogs modAs[Q, fsFieldscoutinglogColumns] - FSHabitatrelates modAs[Q, fsHabitatrelateColumns] - FSInspectionsamples modAs[Q, fsInspectionsampleColumns] - FSInspectionsampledetails modAs[Q, fsInspectionsampledetailColumns] - FSLinelocations modAs[Q, fsLinelocationColumns] - FSLocationtrackings modAs[Q, fsLocationtrackingColumns] - FSMosquitoinspections modAs[Q, fsMosquitoinspectionColumns] - FSPointlocations modAs[Q, fsPointlocationColumns] - FSPolygonlocations modAs[Q, fsPolygonlocationColumns] - FSPools modAs[Q, fsPoolColumns] - FSPooldetails modAs[Q, fsPooldetailColumns] - FSProposedtreatmentareas modAs[Q, fsProposedtreatmentareaColumns] - FSQamosquitoinspections modAs[Q, fsQamosquitoinspectionColumns] - FSRodentlocations modAs[Q, fsRodentlocationColumns] - FSSamplecollections modAs[Q, fsSamplecollectionColumns] - FSSamplelocations modAs[Q, fsSamplelocationColumns] - FSServicerequests modAs[Q, fsServicerequestColumns] - FSSpeciesabundances modAs[Q, fsSpeciesabundanceColumns] - FSStormdrains modAs[Q, fsStormdrainColumns] - FSTimecards modAs[Q, fsTimecardColumns] - FSTrapdata modAs[Q, fsTrapdatumColumns] - FSTraplocations modAs[Q, fsTraplocationColumns] - FSTreatments modAs[Q, fsTreatmentColumns] - 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] - HistoryInspectionsamples modAs[Q, historyInspectionsampleColumns] - HistoryInspectionsampledetails modAs[Q, historyInspectionsampledetailColumns] - HistoryLinelocations modAs[Q, historyLinelocationColumns] - HistoryLocationtrackings modAs[Q, historyLocationtrackingColumns] - HistoryMosquitoinspections modAs[Q, historyMosquitoinspectionColumns] - HistoryPointlocations modAs[Q, historyPointlocationColumns] - HistoryPolygonlocations modAs[Q, historyPolygonlocationColumns] - HistoryPools modAs[Q, historyPoolColumns] - HistoryPooldetails modAs[Q, historyPooldetailColumns] - HistoryProposedtreatmentareas modAs[Q, historyProposedtreatmentareaColumns] - HistoryQamosquitoinspections modAs[Q, historyQamosquitoinspectionColumns] - HistoryRodentlocations modAs[Q, historyRodentlocationColumns] - HistorySamplecollections modAs[Q, historySamplecollectionColumns] - HistorySamplelocations modAs[Q, historySamplelocationColumns] - HistoryServicerequests modAs[Q, historyServicerequestColumns] - HistorySpeciesabundances modAs[Q, historySpeciesabundanceColumns] - HistoryStormdrains modAs[Q, historyStormdrainColumns] - HistoryTimecards modAs[Q, historyTimecardColumns] - HistoryTrapdata modAs[Q, historyTrapdatumColumns] - HistoryTraplocations modAs[Q, historyTraplocationColumns] - HistoryTreatments modAs[Q, historyTreatmentColumns] - HistoryTreatmentareas modAs[Q, historyTreatmentareaColumns] - HistoryZones modAs[Q, historyZoneColumns] - HistoryZones2s modAs[Q, historyZones2Columns] - User modAs[Q, userColumns] + typ string + Containerrelates modAs[Q, fieldseekerContainerrelateColumns] + Fieldscoutinglogs modAs[Q, fieldseekerFieldscoutinglogColumns] + Habitatrelates modAs[Q, fieldseekerHabitatrelateColumns] + Inspectionsamples modAs[Q, fieldseekerInspectionsampleColumns] + Inspectionsampledetails modAs[Q, fieldseekerInspectionsampledetailColumns] + Linelocations modAs[Q, fieldseekerLinelocationColumns] + Locationtrackings modAs[Q, fieldseekerLocationtrackingColumns] + Mosquitoinspections modAs[Q, fieldseekerMosquitoinspectionColumns] + Pointlocations modAs[Q, fieldseekerPointlocationColumns] + Polygonlocations modAs[Q, fieldseekerPolygonlocationColumns] + Pools modAs[Q, fieldseekerPoolColumns] + Pooldetails modAs[Q, fieldseekerPooldetailColumns] + Proposedtreatmentareas modAs[Q, fieldseekerProposedtreatmentareaColumns] + Qamosquitoinspections modAs[Q, fieldseekerQamosquitoinspectionColumns] + Rodentlocations modAs[Q, fieldseekerRodentlocationColumns] + Samplecollections modAs[Q, fieldseekerSamplecollectionColumns] + Samplelocations modAs[Q, fieldseekerSamplelocationColumns] + Servicerequests modAs[Q, fieldseekerServicerequestColumns] + Speciesabundances modAs[Q, fieldseekerSpeciesabundanceColumns] + Stormdrains modAs[Q, fieldseekerStormdrainColumns] + Timecards modAs[Q, fieldseekerTimecardColumns] + Trapdata modAs[Q, fieldseekerTrapdatumColumns] + Traplocations modAs[Q, fieldseekerTraplocationColumns] + Treatments modAs[Q, fieldseekerTreatmentColumns] + Treatmentareas modAs[Q, fieldseekerTreatmentareaColumns] + Zones modAs[Q, fieldseekerZoneColumns] + Zones2s modAs[Q, fieldseekerZones2Columns] + FieldseekerSyncs modAs[Q, fieldseekerSyncColumns] + H3Aggregations modAs[Q, h3AggregationColumns] + NoteAudios modAs[Q, noteAudioColumns] + NoteImages modAs[Q, noteImageColumns] + User modAs[Q, userColumns] } func (j organizationJoins[Q]) aliasedAs(alias string) organizationJoins[Q] { @@ -10703,6 +6228,384 @@ func (j organizationJoins[Q]) aliasedAs(alias string) organizationJoins[Q] { func buildOrganizationJoins[Q dialect.Joinable](cols organizationColumns, typ string) organizationJoins[Q] { return organizationJoins[Q]{ typ: typ, + Containerrelates: modAs[Q, fieldseekerContainerrelateColumns]{ + c: FieldseekerContainerrelates.Columns, + f: func(to fieldseekerContainerrelateColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerContainerrelates.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Fieldscoutinglogs: modAs[Q, fieldseekerFieldscoutinglogColumns]{ + c: FieldseekerFieldscoutinglogs.Columns, + f: func(to fieldseekerFieldscoutinglogColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerFieldscoutinglogs.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Habitatrelates: modAs[Q, fieldseekerHabitatrelateColumns]{ + c: FieldseekerHabitatrelates.Columns, + f: func(to fieldseekerHabitatrelateColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerHabitatrelates.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Inspectionsamples: modAs[Q, fieldseekerInspectionsampleColumns]{ + c: FieldseekerInspectionsamples.Columns, + f: func(to fieldseekerInspectionsampleColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerInspectionsamples.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Inspectionsampledetails: modAs[Q, fieldseekerInspectionsampledetailColumns]{ + c: FieldseekerInspectionsampledetails.Columns, + f: func(to fieldseekerInspectionsampledetailColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerInspectionsampledetails.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Linelocations: modAs[Q, fieldseekerLinelocationColumns]{ + c: FieldseekerLinelocations.Columns, + f: func(to fieldseekerLinelocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerLinelocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Locationtrackings: modAs[Q, fieldseekerLocationtrackingColumns]{ + c: FieldseekerLocationtrackings.Columns, + f: func(to fieldseekerLocationtrackingColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerLocationtrackings.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Mosquitoinspections: modAs[Q, fieldseekerMosquitoinspectionColumns]{ + c: FieldseekerMosquitoinspections.Columns, + f: func(to fieldseekerMosquitoinspectionColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerMosquitoinspections.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Pointlocations: modAs[Q, fieldseekerPointlocationColumns]{ + c: FieldseekerPointlocations.Columns, + f: func(to fieldseekerPointlocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerPointlocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Polygonlocations: modAs[Q, fieldseekerPolygonlocationColumns]{ + c: FieldseekerPolygonlocations.Columns, + f: func(to fieldseekerPolygonlocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerPolygonlocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Pools: modAs[Q, fieldseekerPoolColumns]{ + c: FieldseekerPools.Columns, + f: func(to fieldseekerPoolColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerPools.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Pooldetails: modAs[Q, fieldseekerPooldetailColumns]{ + c: FieldseekerPooldetails.Columns, + f: func(to fieldseekerPooldetailColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerPooldetails.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Proposedtreatmentareas: modAs[Q, fieldseekerProposedtreatmentareaColumns]{ + c: FieldseekerProposedtreatmentareas.Columns, + f: func(to fieldseekerProposedtreatmentareaColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerProposedtreatmentareas.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Qamosquitoinspections: modAs[Q, fieldseekerQamosquitoinspectionColumns]{ + c: FieldseekerQamosquitoinspections.Columns, + f: func(to fieldseekerQamosquitoinspectionColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerQamosquitoinspections.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Rodentlocations: modAs[Q, fieldseekerRodentlocationColumns]{ + c: FieldseekerRodentlocations.Columns, + f: func(to fieldseekerRodentlocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerRodentlocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Samplecollections: modAs[Q, fieldseekerSamplecollectionColumns]{ + c: FieldseekerSamplecollections.Columns, + f: func(to fieldseekerSamplecollectionColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerSamplecollections.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Samplelocations: modAs[Q, fieldseekerSamplelocationColumns]{ + c: FieldseekerSamplelocations.Columns, + f: func(to fieldseekerSamplelocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerSamplelocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Servicerequests: modAs[Q, fieldseekerServicerequestColumns]{ + c: FieldseekerServicerequests.Columns, + f: func(to fieldseekerServicerequestColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerServicerequests.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Speciesabundances: modAs[Q, fieldseekerSpeciesabundanceColumns]{ + c: FieldseekerSpeciesabundances.Columns, + f: func(to fieldseekerSpeciesabundanceColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerSpeciesabundances.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Stormdrains: modAs[Q, fieldseekerStormdrainColumns]{ + c: FieldseekerStormdrains.Columns, + f: func(to fieldseekerStormdrainColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerStormdrains.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Timecards: modAs[Q, fieldseekerTimecardColumns]{ + c: FieldseekerTimecards.Columns, + f: func(to fieldseekerTimecardColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerTimecards.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Trapdata: modAs[Q, fieldseekerTrapdatumColumns]{ + c: FieldseekerTrapdata.Columns, + f: func(to fieldseekerTrapdatumColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerTrapdata.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Traplocations: modAs[Q, fieldseekerTraplocationColumns]{ + c: FieldseekerTraplocations.Columns, + f: func(to fieldseekerTraplocationColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerTraplocations.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Treatments: modAs[Q, fieldseekerTreatmentColumns]{ + c: FieldseekerTreatments.Columns, + f: func(to fieldseekerTreatmentColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerTreatments.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Treatmentareas: modAs[Q, fieldseekerTreatmentareaColumns]{ + c: FieldseekerTreatmentareas.Columns, + f: func(to fieldseekerTreatmentareaColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerTreatmentareas.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Zones: modAs[Q, fieldseekerZoneColumns]{ + c: FieldseekerZones.Columns, + f: func(to fieldseekerZoneColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerZones.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, + Zones2s: modAs[Q, fieldseekerZones2Columns]{ + c: FieldseekerZones2s.Columns, + f: func(to fieldseekerZones2Columns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, FieldseekerZones2s.Name().As(to.Alias())).On( + to.OrganizationID.EQ(cols.ID), + )) + } + + return mods + }, + }, FieldseekerSyncs: modAs[Q, fieldseekerSyncColumns]{ c: FieldseekerSyncs.Columns, f: func(to fieldseekerSyncColumns) bob.Mod[Q] { @@ -10717,384 +6620,6 @@ func buildOrganizationJoins[Q dialect.Joinable](cols organizationColumns, typ st return mods }, }, - FSContainerrelates: modAs[Q, fsContainerrelateColumns]{ - c: FSContainerrelates.Columns, - f: func(to fsContainerrelateColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSContainerrelates.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSFieldscoutinglogs: modAs[Q, fsFieldscoutinglogColumns]{ - c: FSFieldscoutinglogs.Columns, - f: func(to fsFieldscoutinglogColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSFieldscoutinglogs.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSHabitatrelates: modAs[Q, fsHabitatrelateColumns]{ - c: FSHabitatrelates.Columns, - f: func(to fsHabitatrelateColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSHabitatrelates.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSInspectionsamples: modAs[Q, fsInspectionsampleColumns]{ - c: FSInspectionsamples.Columns, - f: func(to fsInspectionsampleColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSInspectionsamples.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSInspectionsampledetails: modAs[Q, fsInspectionsampledetailColumns]{ - c: FSInspectionsampledetails.Columns, - f: func(to fsInspectionsampledetailColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSInspectionsampledetails.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSLinelocations: modAs[Q, fsLinelocationColumns]{ - c: FSLinelocations.Columns, - f: func(to fsLinelocationColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSLinelocations.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSLocationtrackings: modAs[Q, fsLocationtrackingColumns]{ - c: FSLocationtrackings.Columns, - f: func(to fsLocationtrackingColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSLocationtrackings.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSMosquitoinspections: modAs[Q, fsMosquitoinspectionColumns]{ - c: FSMosquitoinspections.Columns, - f: func(to fsMosquitoinspectionColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSMosquitoinspections.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSPointlocations: modAs[Q, fsPointlocationColumns]{ - c: FSPointlocations.Columns, - f: func(to fsPointlocationColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSPointlocations.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSPolygonlocations: modAs[Q, fsPolygonlocationColumns]{ - c: FSPolygonlocations.Columns, - f: func(to fsPolygonlocationColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSPolygonlocations.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSPools: modAs[Q, fsPoolColumns]{ - c: FSPools.Columns, - f: func(to fsPoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSPools.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSPooldetails: modAs[Q, fsPooldetailColumns]{ - c: FSPooldetails.Columns, - f: func(to fsPooldetailColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSPooldetails.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSProposedtreatmentareas: modAs[Q, fsProposedtreatmentareaColumns]{ - c: FSProposedtreatmentareas.Columns, - f: func(to fsProposedtreatmentareaColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSProposedtreatmentareas.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSQamosquitoinspections: modAs[Q, fsQamosquitoinspectionColumns]{ - c: FSQamosquitoinspections.Columns, - f: func(to fsQamosquitoinspectionColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSQamosquitoinspections.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSRodentlocations: modAs[Q, fsRodentlocationColumns]{ - c: FSRodentlocations.Columns, - f: func(to fsRodentlocationColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSRodentlocations.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSSamplecollections: modAs[Q, fsSamplecollectionColumns]{ - c: FSSamplecollections.Columns, - f: func(to fsSamplecollectionColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSSamplecollections.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSSamplelocations: modAs[Q, fsSamplelocationColumns]{ - c: FSSamplelocations.Columns, - f: func(to fsSamplelocationColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSSamplelocations.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSServicerequests: modAs[Q, fsServicerequestColumns]{ - c: FSServicerequests.Columns, - f: func(to fsServicerequestColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSServicerequests.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSSpeciesabundances: modAs[Q, fsSpeciesabundanceColumns]{ - c: FSSpeciesabundances.Columns, - f: func(to fsSpeciesabundanceColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSSpeciesabundances.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSStormdrains: modAs[Q, fsStormdrainColumns]{ - c: FSStormdrains.Columns, - f: func(to fsStormdrainColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSStormdrains.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSTimecards: modAs[Q, fsTimecardColumns]{ - c: FSTimecards.Columns, - f: func(to fsTimecardColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSTimecards.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSTrapdata: modAs[Q, fsTrapdatumColumns]{ - c: FSTrapdata.Columns, - f: func(to fsTrapdatumColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSTrapdata.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSTraplocations: modAs[Q, fsTraplocationColumns]{ - c: FSTraplocations.Columns, - f: func(to fsTraplocationColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSTraplocations.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSTreatments: modAs[Q, fsTreatmentColumns]{ - c: FSTreatments.Columns, - f: func(to fsTreatmentColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSTreatments.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSTreatmentareas: modAs[Q, fsTreatmentareaColumns]{ - c: FSTreatmentareas.Columns, - f: func(to fsTreatmentareaColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSTreatmentareas.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSZones: modAs[Q, fsZoneColumns]{ - c: FSZones.Columns, - f: func(to fsZoneColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSZones.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FSZones2s: modAs[Q, fsZones2Columns]{ - c: FSZones2s.Columns, - f: func(to fsZones2Columns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FSZones2s.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, H3Aggregations: modAs[Q, h3AggregationColumns]{ c: H3Aggregations.Columns, f: func(to h3AggregationColumns) bob.Mod[Q] { @@ -11109,13 +6634,13 @@ func buildOrganizationJoins[Q dialect.Joinable](cols organizationColumns, typ st return mods }, }, - HistoryContainerrelates: modAs[Q, historyContainerrelateColumns]{ - c: HistoryContainerrelates.Columns, - f: func(to historyContainerrelateColumns) bob.Mod[Q] { + NoteAudios: modAs[Q, noteAudioColumns]{ + c: NoteAudios.Columns, + f: func(to noteAudioColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { - mods = append(mods, dialect.Join[Q](typ, HistoryContainerrelates.Name().As(to.Alias())).On( + mods = append(mods, dialect.Join[Q](typ, NoteAudios.Name().As(to.Alias())).On( to.OrganizationID.EQ(cols.ID), )) } @@ -11123,363 +6648,13 @@ func buildOrganizationJoins[Q dialect.Joinable](cols organizationColumns, typ st return mods }, }, - HistoryFieldscoutinglogs: modAs[Q, historyFieldscoutinglogColumns]{ - c: HistoryFieldscoutinglogs.Columns, - f: func(to historyFieldscoutinglogColumns) bob.Mod[Q] { + NoteImages: modAs[Q, noteImageColumns]{ + c: NoteImages.Columns, + f: func(to noteImageColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { - mods = append(mods, dialect.Join[Q](typ, HistoryFieldscoutinglogs.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryHabitatrelates: modAs[Q, historyHabitatrelateColumns]{ - c: HistoryHabitatrelates.Columns, - f: func(to historyHabitatrelateColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryHabitatrelates.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryInspectionsamples: modAs[Q, historyInspectionsampleColumns]{ - c: HistoryInspectionsamples.Columns, - f: func(to historyInspectionsampleColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryInspectionsamples.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryInspectionsampledetails: modAs[Q, historyInspectionsampledetailColumns]{ - c: HistoryInspectionsampledetails.Columns, - f: func(to historyInspectionsampledetailColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryInspectionsampledetails.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryLinelocations: modAs[Q, historyLinelocationColumns]{ - c: HistoryLinelocations.Columns, - f: func(to historyLinelocationColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryLinelocations.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryLocationtrackings: modAs[Q, historyLocationtrackingColumns]{ - c: HistoryLocationtrackings.Columns, - f: func(to historyLocationtrackingColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryLocationtrackings.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryMosquitoinspections: modAs[Q, historyMosquitoinspectionColumns]{ - c: HistoryMosquitoinspections.Columns, - f: func(to historyMosquitoinspectionColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryMosquitoinspections.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryPointlocations: modAs[Q, historyPointlocationColumns]{ - c: HistoryPointlocations.Columns, - f: func(to historyPointlocationColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryPointlocations.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryPolygonlocations: modAs[Q, historyPolygonlocationColumns]{ - c: HistoryPolygonlocations.Columns, - f: func(to historyPolygonlocationColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryPolygonlocations.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryPools: modAs[Q, historyPoolColumns]{ - c: HistoryPools.Columns, - f: func(to historyPoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryPools.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryPooldetails: modAs[Q, historyPooldetailColumns]{ - c: HistoryPooldetails.Columns, - f: func(to historyPooldetailColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryPooldetails.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryProposedtreatmentareas: modAs[Q, historyProposedtreatmentareaColumns]{ - c: HistoryProposedtreatmentareas.Columns, - f: func(to historyProposedtreatmentareaColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryProposedtreatmentareas.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryQamosquitoinspections: modAs[Q, historyQamosquitoinspectionColumns]{ - c: HistoryQamosquitoinspections.Columns, - f: func(to historyQamosquitoinspectionColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryQamosquitoinspections.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryRodentlocations: modAs[Q, historyRodentlocationColumns]{ - c: HistoryRodentlocations.Columns, - f: func(to historyRodentlocationColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryRodentlocations.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistorySamplecollections: modAs[Q, historySamplecollectionColumns]{ - c: HistorySamplecollections.Columns, - f: func(to historySamplecollectionColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistorySamplecollections.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistorySamplelocations: modAs[Q, historySamplelocationColumns]{ - c: HistorySamplelocations.Columns, - f: func(to historySamplelocationColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistorySamplelocations.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryServicerequests: modAs[Q, historyServicerequestColumns]{ - c: HistoryServicerequests.Columns, - f: func(to historyServicerequestColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryServicerequests.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistorySpeciesabundances: modAs[Q, historySpeciesabundanceColumns]{ - c: HistorySpeciesabundances.Columns, - f: func(to historySpeciesabundanceColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistorySpeciesabundances.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryStormdrains: modAs[Q, historyStormdrainColumns]{ - c: HistoryStormdrains.Columns, - f: func(to historyStormdrainColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryStormdrains.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryTimecards: modAs[Q, historyTimecardColumns]{ - c: HistoryTimecards.Columns, - f: func(to historyTimecardColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryTimecards.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryTrapdata: modAs[Q, historyTrapdatumColumns]{ - c: HistoryTrapdata.Columns, - f: func(to historyTrapdatumColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryTrapdata.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryTraplocations: modAs[Q, historyTraplocationColumns]{ - c: HistoryTraplocations.Columns, - f: func(to historyTraplocationColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryTraplocations.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryTreatments: modAs[Q, historyTreatmentColumns]{ - c: HistoryTreatments.Columns, - f: func(to historyTreatmentColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryTreatments.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryTreatmentareas: modAs[Q, historyTreatmentareaColumns]{ - c: HistoryTreatmentareas.Columns, - f: func(to historyTreatmentareaColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryTreatmentareas.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryZones: modAs[Q, historyZoneColumns]{ - c: HistoryZones.Columns, - f: func(to historyZoneColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryZones.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - HistoryZones2s: modAs[Q, historyZones2Columns]{ - c: HistoryZones2s.Columns, - f: func(to historyZones2Columns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, HistoryZones2s.Name().As(to.Alias())).On( + mods = append(mods, dialect.Join[Q](typ, NoteImages.Name().As(to.Alias())).On( to.OrganizationID.EQ(cols.ID), )) } diff --git a/db/models/raster_columns.bob.go b/db/models/raster_columns.bob.go index 49e61ded..c3d42d76 100644 --- a/db/models/raster_columns.bob.go +++ b/db/models/raster_columns.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models diff --git a/db/models/raster_overviews.bob.go b/db/models/raster_overviews.bob.go index 61325aa1..f2bbaffd 100644 --- a/db/models/raster_overviews.bob.go +++ b/db/models/raster_overviews.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models diff --git a/db/models/sessions.bob.go b/db/models/sessions.bob.go index 0133e1b9..6e79fdf3 100644 --- a/db/models/sessions.bob.go +++ b/db/models/sessions.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models diff --git a/db/models/spatial_ref_sys.bob.go b/db/models/spatial_ref_sys.bob.go index 30bc74b2..992354fb 100644 --- a/db/models/spatial_ref_sys.bob.go +++ b/db/models/spatial_ref_sys.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models diff --git a/db/models/user_.bob.go b/db/models/user_.bob.go index 007f951b..796fa543 100644 --- a/db/models/user_.bob.go +++ b/db/models/user_.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models @@ -55,6 +55,10 @@ type UsersQuery = *psql.ViewQuery[*User, UserSlice] // userR is where relationships are stored. type userR struct { + CreatorNoteAudios NoteAudioSlice // note_audio.note_audio_creator_id_fkey + DeletorNoteAudios NoteAudioSlice // note_audio.note_audio_deletor_id_fkey + CreatorNoteImages NoteImageSlice // note_image.note_image_creator_id_fkey + DeletorNoteImages NoteImageSlice // note_image.note_image_deletor_id_fkey UserNotifications NotificationSlice // notification.notification_user_id_fkey UserOauthTokens OauthTokenSlice // oauth_token.oauth_token_user_id_fkey Organization *Organization // user_.user__organization_id_fkey @@ -604,6 +608,102 @@ func (o UserSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { return nil } +// CreatorNoteAudios starts a query for related objects on note_audio +func (o *User) CreatorNoteAudios(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudiosQuery { + return NoteAudios.Query(append(mods, + sm.Where(NoteAudios.Columns.CreatorID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os UserSlice) CreatorNoteAudios(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudiosQuery { + 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 NoteAudios.Query(append(mods, + sm.Where(psql.Group(NoteAudios.Columns.CreatorID).OP("IN", PKArgExpr)), + )...) +} + +// DeletorNoteAudios starts a query for related objects on note_audio +func (o *User) DeletorNoteAudios(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudiosQuery { + return NoteAudios.Query(append(mods, + sm.Where(NoteAudios.Columns.DeletorID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os UserSlice) DeletorNoteAudios(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudiosQuery { + 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 NoteAudios.Query(append(mods, + sm.Where(psql.Group(NoteAudios.Columns.DeletorID).OP("IN", PKArgExpr)), + )...) +} + +// CreatorNoteImages starts a query for related objects on note_image +func (o *User) CreatorNoteImages(mods ...bob.Mod[*dialect.SelectQuery]) NoteImagesQuery { + return NoteImages.Query(append(mods, + sm.Where(NoteImages.Columns.CreatorID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os UserSlice) CreatorNoteImages(mods ...bob.Mod[*dialect.SelectQuery]) NoteImagesQuery { + 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 NoteImages.Query(append(mods, + sm.Where(psql.Group(NoteImages.Columns.CreatorID).OP("IN", PKArgExpr)), + )...) +} + +// DeletorNoteImages starts a query for related objects on note_image +func (o *User) DeletorNoteImages(mods ...bob.Mod[*dialect.SelectQuery]) NoteImagesQuery { + return NoteImages.Query(append(mods, + sm.Where(NoteImages.Columns.DeletorID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os UserSlice) DeletorNoteImages(mods ...bob.Mod[*dialect.SelectQuery]) NoteImagesQuery { + 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 NoteImages.Query(append(mods, + sm.Where(psql.Group(NoteImages.Columns.DeletorID).OP("IN", PKArgExpr)), + )...) +} + // UserNotifications starts a query for related objects on notification func (o *User) UserNotifications(mods ...bob.Mod[*dialect.SelectQuery]) NotificationsQuery { return Notifications.Query(append(mods, @@ -676,6 +776,278 @@ func (os UserSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Organiza )...) } +func insertUserCreatorNoteAudios0(ctx context.Context, exec bob.Executor, noteAudios1 []*NoteAudioSetter, user0 *User) (NoteAudioSlice, error) { + for i := range noteAudios1 { + noteAudios1[i].CreatorID = omit.From(user0.ID) + } + + ret, err := NoteAudios.Insert(bob.ToMods(noteAudios1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertUserCreatorNoteAudios0: %w", err) + } + + return ret, nil +} + +func attachUserCreatorNoteAudios0(ctx context.Context, exec bob.Executor, count int, noteAudios1 NoteAudioSlice, user0 *User) (NoteAudioSlice, error) { + setter := &NoteAudioSetter{ + CreatorID: omit.From(user0.ID), + } + + err := noteAudios1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachUserCreatorNoteAudios0: %w", err) + } + + return noteAudios1, nil +} + +func (user0 *User) InsertCreatorNoteAudios(ctx context.Context, exec bob.Executor, related ...*NoteAudioSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + noteAudios1, err := insertUserCreatorNoteAudios0(ctx, exec, related, user0) + if err != nil { + return err + } + + user0.R.CreatorNoteAudios = append(user0.R.CreatorNoteAudios, noteAudios1...) + + for _, rel := range noteAudios1 { + rel.R.CreatorUser = user0 + } + return nil +} + +func (user0 *User) AttachCreatorNoteAudios(ctx context.Context, exec bob.Executor, related ...*NoteAudio) error { + if len(related) == 0 { + return nil + } + + var err error + noteAudios1 := NoteAudioSlice(related) + + _, err = attachUserCreatorNoteAudios0(ctx, exec, len(related), noteAudios1, user0) + if err != nil { + return err + } + + user0.R.CreatorNoteAudios = append(user0.R.CreatorNoteAudios, noteAudios1...) + + for _, rel := range related { + rel.R.CreatorUser = user0 + } + + return nil +} + +func insertUserDeletorNoteAudios0(ctx context.Context, exec bob.Executor, noteAudios1 []*NoteAudioSetter, user0 *User) (NoteAudioSlice, error) { + for i := range noteAudios1 { + noteAudios1[i].DeletorID = omitnull.From(user0.ID) + } + + ret, err := NoteAudios.Insert(bob.ToMods(noteAudios1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertUserDeletorNoteAudios0: %w", err) + } + + return ret, nil +} + +func attachUserDeletorNoteAudios0(ctx context.Context, exec bob.Executor, count int, noteAudios1 NoteAudioSlice, user0 *User) (NoteAudioSlice, error) { + setter := &NoteAudioSetter{ + DeletorID: omitnull.From(user0.ID), + } + + err := noteAudios1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachUserDeletorNoteAudios0: %w", err) + } + + return noteAudios1, nil +} + +func (user0 *User) InsertDeletorNoteAudios(ctx context.Context, exec bob.Executor, related ...*NoteAudioSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + noteAudios1, err := insertUserDeletorNoteAudios0(ctx, exec, related, user0) + if err != nil { + return err + } + + user0.R.DeletorNoteAudios = append(user0.R.DeletorNoteAudios, noteAudios1...) + + for _, rel := range noteAudios1 { + rel.R.DeletorUser = user0 + } + return nil +} + +func (user0 *User) AttachDeletorNoteAudios(ctx context.Context, exec bob.Executor, related ...*NoteAudio) error { + if len(related) == 0 { + return nil + } + + var err error + noteAudios1 := NoteAudioSlice(related) + + _, err = attachUserDeletorNoteAudios0(ctx, exec, len(related), noteAudios1, user0) + if err != nil { + return err + } + + user0.R.DeletorNoteAudios = append(user0.R.DeletorNoteAudios, noteAudios1...) + + for _, rel := range related { + rel.R.DeletorUser = user0 + } + + return nil +} + +func insertUserCreatorNoteImages0(ctx context.Context, exec bob.Executor, noteImages1 []*NoteImageSetter, user0 *User) (NoteImageSlice, error) { + for i := range noteImages1 { + noteImages1[i].CreatorID = omit.From(user0.ID) + } + + ret, err := NoteImages.Insert(bob.ToMods(noteImages1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertUserCreatorNoteImages0: %w", err) + } + + return ret, nil +} + +func attachUserCreatorNoteImages0(ctx context.Context, exec bob.Executor, count int, noteImages1 NoteImageSlice, user0 *User) (NoteImageSlice, error) { + setter := &NoteImageSetter{ + CreatorID: omit.From(user0.ID), + } + + err := noteImages1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachUserCreatorNoteImages0: %w", err) + } + + return noteImages1, nil +} + +func (user0 *User) InsertCreatorNoteImages(ctx context.Context, exec bob.Executor, related ...*NoteImageSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + noteImages1, err := insertUserCreatorNoteImages0(ctx, exec, related, user0) + if err != nil { + return err + } + + user0.R.CreatorNoteImages = append(user0.R.CreatorNoteImages, noteImages1...) + + for _, rel := range noteImages1 { + rel.R.CreatorUser = user0 + } + return nil +} + +func (user0 *User) AttachCreatorNoteImages(ctx context.Context, exec bob.Executor, related ...*NoteImage) error { + if len(related) == 0 { + return nil + } + + var err error + noteImages1 := NoteImageSlice(related) + + _, err = attachUserCreatorNoteImages0(ctx, exec, len(related), noteImages1, user0) + if err != nil { + return err + } + + user0.R.CreatorNoteImages = append(user0.R.CreatorNoteImages, noteImages1...) + + for _, rel := range related { + rel.R.CreatorUser = user0 + } + + return nil +} + +func insertUserDeletorNoteImages0(ctx context.Context, exec bob.Executor, noteImages1 []*NoteImageSetter, user0 *User) (NoteImageSlice, error) { + for i := range noteImages1 { + noteImages1[i].DeletorID = omitnull.From(user0.ID) + } + + ret, err := NoteImages.Insert(bob.ToMods(noteImages1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertUserDeletorNoteImages0: %w", err) + } + + return ret, nil +} + +func attachUserDeletorNoteImages0(ctx context.Context, exec bob.Executor, count int, noteImages1 NoteImageSlice, user0 *User) (NoteImageSlice, error) { + setter := &NoteImageSetter{ + DeletorID: omitnull.From(user0.ID), + } + + err := noteImages1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachUserDeletorNoteImages0: %w", err) + } + + return noteImages1, nil +} + +func (user0 *User) InsertDeletorNoteImages(ctx context.Context, exec bob.Executor, related ...*NoteImageSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + noteImages1, err := insertUserDeletorNoteImages0(ctx, exec, related, user0) + if err != nil { + return err + } + + user0.R.DeletorNoteImages = append(user0.R.DeletorNoteImages, noteImages1...) + + for _, rel := range noteImages1 { + rel.R.DeletorUser = user0 + } + return nil +} + +func (user0 *User) AttachDeletorNoteImages(ctx context.Context, exec bob.Executor, related ...*NoteImage) error { + if len(related) == 0 { + return nil + } + + var err error + noteImages1 := NoteImageSlice(related) + + _, err = attachUserDeletorNoteImages0(ctx, exec, len(related), noteImages1, user0) + if err != nil { + return err + } + + user0.R.DeletorNoteImages = append(user0.R.DeletorNoteImages, noteImages1...) + + for _, rel := range related { + rel.R.DeletorUser = user0 + } + + return nil +} + func insertUserUserNotifications0(ctx context.Context, exec bob.Executor, notifications1 []*NotificationSetter, user0 *User) (NotificationSlice, error) { for i := range notifications1 { notifications1[i].UserID = omit.From(user0.ID) @@ -902,6 +1274,62 @@ func (o *User) Preload(name string, retrieved any) error { } switch name { + case "CreatorNoteAudios": + rels, ok := retrieved.(NoteAudioSlice) + if !ok { + return fmt.Errorf("user cannot load %T as %q", retrieved, name) + } + + o.R.CreatorNoteAudios = rels + + for _, rel := range rels { + if rel != nil { + rel.R.CreatorUser = o + } + } + return nil + case "DeletorNoteAudios": + rels, ok := retrieved.(NoteAudioSlice) + if !ok { + return fmt.Errorf("user cannot load %T as %q", retrieved, name) + } + + o.R.DeletorNoteAudios = rels + + for _, rel := range rels { + if rel != nil { + rel.R.DeletorUser = o + } + } + return nil + case "CreatorNoteImages": + rels, ok := retrieved.(NoteImageSlice) + if !ok { + return fmt.Errorf("user cannot load %T as %q", retrieved, name) + } + + o.R.CreatorNoteImages = rels + + for _, rel := range rels { + if rel != nil { + rel.R.CreatorUser = o + } + } + return nil + case "DeletorNoteImages": + rels, ok := retrieved.(NoteImageSlice) + if !ok { + return fmt.Errorf("user cannot load %T as %q", retrieved, name) + } + + o.R.DeletorNoteImages = rels + + for _, rel := range rels { + if rel != nil { + rel.R.DeletorUser = o + } + } + return nil case "UserNotifications": rels, ok := retrieved.(NotificationSlice) if !ok { @@ -970,12 +1398,28 @@ func buildUserPreloader() userPreloader { } type userThenLoader[Q orm.Loadable] struct { + CreatorNoteAudios func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + DeletorNoteAudios func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + CreatorNoteImages func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + DeletorNoteImages func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] UserNotifications func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] UserOauthTokens func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] } func buildUserThenLoader[Q orm.Loadable]() userThenLoader[Q] { + type CreatorNoteAudiosLoadInterface interface { + LoadCreatorNoteAudios(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type DeletorNoteAudiosLoadInterface interface { + LoadDeletorNoteAudios(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type CreatorNoteImagesLoadInterface interface { + LoadCreatorNoteImages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type DeletorNoteImagesLoadInterface interface { + LoadDeletorNoteImages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } type UserNotificationsLoadInterface interface { LoadUserNotifications(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } @@ -987,6 +1431,30 @@ func buildUserThenLoader[Q orm.Loadable]() userThenLoader[Q] { } return userThenLoader[Q]{ + CreatorNoteAudios: thenLoadBuilder[Q]( + "CreatorNoteAudios", + func(ctx context.Context, exec bob.Executor, retrieved CreatorNoteAudiosLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadCreatorNoteAudios(ctx, exec, mods...) + }, + ), + DeletorNoteAudios: thenLoadBuilder[Q]( + "DeletorNoteAudios", + func(ctx context.Context, exec bob.Executor, retrieved DeletorNoteAudiosLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadDeletorNoteAudios(ctx, exec, mods...) + }, + ), + CreatorNoteImages: thenLoadBuilder[Q]( + "CreatorNoteImages", + func(ctx context.Context, exec bob.Executor, retrieved CreatorNoteImagesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadCreatorNoteImages(ctx, exec, mods...) + }, + ), + DeletorNoteImages: thenLoadBuilder[Q]( + "DeletorNoteImages", + func(ctx context.Context, exec bob.Executor, retrieved DeletorNoteImagesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadDeletorNoteImages(ctx, exec, mods...) + }, + ), UserNotifications: thenLoadBuilder[Q]( "UserNotifications", func(ctx context.Context, exec bob.Executor, retrieved UserNotificationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { @@ -1008,6 +1476,256 @@ func buildUserThenLoader[Q orm.Loadable]() userThenLoader[Q] { } } +// LoadCreatorNoteAudios loads the user's CreatorNoteAudios into the .R struct +func (o *User) LoadCreatorNoteAudios(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.CreatorNoteAudios = nil + + related, err := o.CreatorNoteAudios(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.CreatorUser = o + } + + o.R.CreatorNoteAudios = related + return nil +} + +// LoadCreatorNoteAudios loads the user's CreatorNoteAudios into the .R struct +func (os UserSlice) LoadCreatorNoteAudios(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + noteAudios, err := os.CreatorNoteAudios(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.CreatorNoteAudios = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range noteAudios { + + if !(o.ID == rel.CreatorID) { + continue + } + + rel.R.CreatorUser = o + + o.R.CreatorNoteAudios = append(o.R.CreatorNoteAudios, rel) + } + } + + return nil +} + +// LoadDeletorNoteAudios loads the user's DeletorNoteAudios into the .R struct +func (o *User) LoadDeletorNoteAudios(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.DeletorNoteAudios = nil + + related, err := o.DeletorNoteAudios(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.DeletorUser = o + } + + o.R.DeletorNoteAudios = related + return nil +} + +// LoadDeletorNoteAudios loads the user's DeletorNoteAudios into the .R struct +func (os UserSlice) LoadDeletorNoteAudios(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + noteAudios, err := os.DeletorNoteAudios(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.DeletorNoteAudios = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range noteAudios { + + if !rel.DeletorID.IsValue() { + continue + } + if !(rel.DeletorID.IsValue() && o.ID == rel.DeletorID.MustGet()) { + continue + } + + rel.R.DeletorUser = o + + o.R.DeletorNoteAudios = append(o.R.DeletorNoteAudios, rel) + } + } + + return nil +} + +// LoadCreatorNoteImages loads the user's CreatorNoteImages into the .R struct +func (o *User) LoadCreatorNoteImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.CreatorNoteImages = nil + + related, err := o.CreatorNoteImages(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.CreatorUser = o + } + + o.R.CreatorNoteImages = related + return nil +} + +// LoadCreatorNoteImages loads the user's CreatorNoteImages into the .R struct +func (os UserSlice) LoadCreatorNoteImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + noteImages, err := os.CreatorNoteImages(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.CreatorNoteImages = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range noteImages { + + if !(o.ID == rel.CreatorID) { + continue + } + + rel.R.CreatorUser = o + + o.R.CreatorNoteImages = append(o.R.CreatorNoteImages, rel) + } + } + + return nil +} + +// LoadDeletorNoteImages loads the user's DeletorNoteImages into the .R struct +func (o *User) LoadDeletorNoteImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.DeletorNoteImages = nil + + related, err := o.DeletorNoteImages(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.DeletorUser = o + } + + o.R.DeletorNoteImages = related + return nil +} + +// LoadDeletorNoteImages loads the user's DeletorNoteImages into the .R struct +func (os UserSlice) LoadDeletorNoteImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + noteImages, err := os.DeletorNoteImages(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.DeletorNoteImages = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range noteImages { + + if !rel.DeletorID.IsValue() { + continue + } + if !(rel.DeletorID.IsValue() && o.ID == rel.DeletorID.MustGet()) { + continue + } + + rel.R.DeletorUser = o + + o.R.DeletorNoteImages = append(o.R.DeletorNoteImages, rel) + } + } + + return nil +} + // LoadUserNotifications loads the user's UserNotifications into the .R struct func (o *User) LoadUserNotifications(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { @@ -1187,6 +1905,10 @@ func (os UserSlice) LoadOrganization(ctx context.Context, exec bob.Executor, mod type userJoins[Q dialect.Joinable] struct { typ string + CreatorNoteAudios modAs[Q, noteAudioColumns] + DeletorNoteAudios modAs[Q, noteAudioColumns] + CreatorNoteImages modAs[Q, noteImageColumns] + DeletorNoteImages modAs[Q, noteImageColumns] UserNotifications modAs[Q, notificationColumns] UserOauthTokens modAs[Q, oauthTokenColumns] Organization modAs[Q, organizationColumns] @@ -1199,6 +1921,62 @@ func (j userJoins[Q]) aliasedAs(alias string) userJoins[Q] { func buildUserJoins[Q dialect.Joinable](cols userColumns, typ string) userJoins[Q] { return userJoins[Q]{ typ: typ, + CreatorNoteAudios: modAs[Q, noteAudioColumns]{ + c: NoteAudios.Columns, + f: func(to noteAudioColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, NoteAudios.Name().As(to.Alias())).On( + to.CreatorID.EQ(cols.ID), + )) + } + + return mods + }, + }, + DeletorNoteAudios: modAs[Q, noteAudioColumns]{ + c: NoteAudios.Columns, + f: func(to noteAudioColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, NoteAudios.Name().As(to.Alias())).On( + to.DeletorID.EQ(cols.ID), + )) + } + + return mods + }, + }, + CreatorNoteImages: modAs[Q, noteImageColumns]{ + c: NoteImages.Columns, + f: func(to noteImageColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, NoteImages.Name().As(to.Alias())).On( + to.CreatorID.EQ(cols.ID), + )) + } + + return mods + }, + }, + DeletorNoteImages: modAs[Q, noteImageColumns]{ + c: NoteImages.Columns, + f: func(to noteImageColumns) bob.Mod[Q] { + mods := make(mods.QueryMods[Q], 0, 1) + + { + mods = append(mods, dialect.Join[Q](typ, NoteImages.Name().As(to.Alias())).On( + to.DeletorID.EQ(cols.ID), + )) + } + + return mods + }, + }, UserNotifications: modAs[Q, notificationColumns]{ c: Notifications.Columns, f: func(to notificationColumns) bob.Mod[Q] { diff --git a/db/sql/oauth_by_user_id.bob.go b/db/sql/oauth_by_user_id.bob.go index 619ba4c7..d3298e80 100644 --- a/db/sql/oauth_by_user_id.bob.go +++ b/db/sql/oauth_by_user_id.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package sql diff --git a/db/sql/oauth_by_user_id.bob.sql b/db/sql/oauth_by_user_id.bob.sql index 76f94998..7e7f884e 100644 --- a/db/sql/oauth_by_user_id.bob.sql +++ b/db/sql/oauth_by_user_id.bob.sql @@ -1,4 +1,4 @@ --- Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +-- Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. -- This file is meant to be re-generated in place and/or deleted at any time. -- OauthTokenByUserId diff --git a/db/sql/oauth_by_user_id.bob_test.go b/db/sql/oauth_by_user_id.bob_test.go index e21fdddf..5b885919 100644 --- a/db/sql/oauth_by_user_id.bob_test.go +++ b/db/sql/oauth_by_user_id.bob_test.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package sql diff --git a/db/sql/org_by_oauth_id.bob.go b/db/sql/org_by_oauth_id.bob.go index 99af84da..9a88848a 100644 --- a/db/sql/org_by_oauth_id.bob.go +++ b/db/sql/org_by_oauth_id.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package sql diff --git a/db/sql/org_by_oauth_id.bob.sql b/db/sql/org_by_oauth_id.bob.sql index c0ce798f..31662979 100644 --- a/db/sql/org_by_oauth_id.bob.sql +++ b/db/sql/org_by_oauth_id.bob.sql @@ -1,4 +1,4 @@ --- Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +-- Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. -- This file is meant to be re-generated in place and/or deleted at any time. -- OrgByOauthId diff --git a/db/sql/org_by_oauth_id.bob_test.go b/db/sql/org_by_oauth_id.bob_test.go index 949f4581..71df0297 100644 --- a/db/sql/org_by_oauth_id.bob_test.go +++ b/db/sql/org_by_oauth_id.bob_test.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package sql diff --git a/db/sql/test_utils.bob_test.go b/db/sql/test_utils.bob_test.go index f3f01caf..0132aabe 100644 --- a/db/sql/test_utils.bob_test.go +++ b/db/sql/test_utils.bob_test.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package sql @@ -9,8 +9,8 @@ import ( "time" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" + "github.com/google/uuid" "github.com/jaswdr/faker/v2" - "github.com/shopspring/decimal" "github.com/stephenafamo/bob" pg_query "github.com/wasilibs/go-pgquery" ) @@ -29,37 +29,6 @@ func formatQuery(s string) (string, error) { var defaultFaker = faker.New() -func random_decimal_Decimal(f *faker.Faker, limits ...string) decimal.Decimal { - if f == nil { - f = &defaultFaker - } - - var precision int64 = 7 - var scale int64 = 3 - - if len(limits) > 0 { - precision, _ = strconv.ParseInt(limits[0], 10, 32) - } - - if len(limits) > 1 { - scale, _ = strconv.ParseInt(limits[1], 10, 32) - } - - baseVal := f.Float32(10, -1, 1) - for baseVal == -1 || baseVal == 0 || baseVal == 1 { - baseVal = f.Float32(10, -1, 1) - } - - precisionDecimal, _ := decimal.NewFromInt(10).PowInt32(int32(precision)) - val := decimal. - NewFromFloat32(baseVal). - Mul(precisionDecimal). - Shift(int32(-1 * scale)). - RoundDown(int32(scale)) - - return val -} - func random_enums_Arcgislicensetype(f *faker.Faker, limits ...string) enums.Arcgislicensetype { if f == nil { f = &defaultFaker @@ -122,3 +91,11 @@ func random_time_Time(f *faker.Faker, limits ...string) time.Time { max := time.Now().Add(year) return f.Time().TimeBetween(min, max) } + +func random_uuid_UUID(f *faker.Faker, limits ...string) uuid.UUID { + if f == nil { + f = &defaultFaker + } + + return uuid.New() +} diff --git a/db/sql/trapcount_by_location_id.bob.go b/db/sql/trapcount_by_location_id.bob.go index 74a4c868..2778ae5f 100644 --- a/db/sql/trapcount_by_location_id.bob.go +++ b/db/sql/trapcount_by_location_id.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package sql @@ -8,9 +8,10 @@ import ( _ "embed" "io" "iter" + "time" "github.com/aarondl/opt/null" - "github.com/shopspring/decimal" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -22,11 +23,11 @@ import ( //go:embed trapcount_by_location_id.bob.sql var formattedQueries_trapcount_by_location_id string -var trapCountByLocationIDSQL = formattedQueries_trapcount_by_location_id[194:626] +var trapCountByLocationIDSQL = formattedQueries_trapcount_by_location_id[194:644] type TrapCountByLocationIDQuery = orm.ModQuery[*dialect.SelectQuery, trapCountByLocationID, TrapCountByLocationIDRow, []TrapCountByLocationIDRow, trapCountByLocationIDTransformer] -func TrapCountByLocationID(OrganizationID int32, LocID []string) *TrapCountByLocationIDQuery { +func TrapCountByLocationID(OrganizationID int32, LocID []uuid.UUID) *TrapCountByLocationIDQuery { var expressionTypArgs trapCountByLocationID expressionTypArgs.OrganizationID = psql.Arg(OrganizationID) @@ -57,19 +58,19 @@ func TrapCountByLocationID(OrganizationID int32, LocID []string) *TrapCountByLoc }, Mod: bob.ModFunc[*dialect.SelectQuery](func(q *dialect.SelectQuery) { q.AppendSelect(expressionTypArgs.subExpr(12, 223)) - q.SetTable(expressionTypArgs.subExpr(234, 318)) - q.AppendWhere(expressionTypArgs.subExpr(330, 379)) - q.AppendGroup(expressionTypArgs.subExpr(394, 432)) + q.SetTable(expressionTypArgs.subExpr(234, 336)) + q.AppendWhere(expressionTypArgs.subExpr(348, 397)) + q.AppendGroup(expressionTypArgs.subExpr(412, 450)) }), } } type TrapCountByLocationIDRow = struct { - TrapdataGlobalid string `db:"trapdata_globalid"` - TrapdataEnddate null.Val[int64] `db:"trapdata_enddate"` - TotalFemales decimal.Decimal `db:"total_females"` - TotalMales int64 `db:"total_males"` - Total decimal.Decimal `db:"total"` + TrapdataGlobalid null.Val[uuid.UUID] `db:"trapdata_globalid"` + TrapdataEnddate null.Val[time.Time] `db:"trapdata_enddate"` + TotalFemales int64 `db:"total_females"` + TotalMales int64 `db:"total_males"` + Total int64 `db:"total"` } type trapCountByLocationIDTransformer = bob.SliceTransformer[TrapCountByLocationIDRow, []TrapCountByLocationIDRow] @@ -83,8 +84,8 @@ func (o trapCountByLocationID) args() iter.Seq[orm.ArgWithPosition] { return func(yield func(arg orm.ArgWithPosition) bool) { if !yield(orm.ArgWithPosition{ Name: "organizationID", - Start: 351, - Stop: 353, + Start: 369, + Stop: 371, Expression: o.OrganizationID, }) { return @@ -92,8 +93,8 @@ func (o trapCountByLocationID) args() iter.Seq[orm.ArgWithPosition] { if !yield(orm.ArgWithPosition{ Name: "locID", - Start: 376, - Stop: 378, + Start: 394, + Stop: 396, Expression: o.LocID, }) { return diff --git a/db/sql/trapcount_by_location_id.bob.sql b/db/sql/trapcount_by_location_id.bob.sql index 9536108f..9a80f07c 100644 --- a/db/sql/trapcount_by_location_id.bob.sql +++ b/db/sql/trapcount_by_location_id.bob.sql @@ -1,4 +1,4 @@ --- Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +-- Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. -- This file is meant to be re-generated in place and/or deleted at any time. -- TrapCountByLocationID @@ -9,9 +9,9 @@ SELECT COALESCE(SUM(sa.males), 0) AS total_males, COALESCE(SUM(sa.total), 0) AS total FROM - fs_trapdata td + fieldseeker.trapdata td LEFT JOIN - fs_speciesabundance sa ON td.globalid = sa.trapdata_id + fieldseeker.speciesabundance sa ON td.globalid = sa.trapdata_id WHERE td.organization_id = $1 AND td.loc_id IN ($2) diff --git a/db/sql/trapcount_by_location_id.bob_test.go b/db/sql/trapcount_by_location_id.bob_test.go index 3d57050d..15c6b960 100644 --- a/db/sql/trapcount_by_location_id.bob_test.go +++ b/db/sql/trapcount_by_location_id.bob_test.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package sql @@ -19,7 +19,7 @@ func TestTrapCountByLocationID(t *testing.T) { t.Run("Base", func(t *testing.T) { var sb strings.Builder - query := TrapCountByLocationID(random_int32(nil), []string{random_string(nil)}) + query := TrapCountByLocationID(random_int32(nil), []uuid.UUID{random_uuid_UUID(nil)}) if _, err := query.WriteQuery(t.Context(), &sb, 1); err != nil { t.Fatal(err) @@ -33,7 +33,7 @@ func TestTrapCountByLocationID(t *testing.T) { t.Run("Mod", func(t *testing.T) { var sb strings.Builder - query := TrapCountByLocationID(random_int32(nil), []string{random_string(nil)}) + query := TrapCountByLocationID(random_int32(nil), []uuid.UUID{random_uuid_UUID(nil)}) if _, err := psql.Select(query).WriteQuery(t.Context(), &sb, 1); err != nil { t.Fatal(err) @@ -68,7 +68,7 @@ func TestTrapCountByLocationID(t *testing.T) { } }() - query, args, err := bob.Build(ctxTx, psql.Select(TrapCountByLocationID(random_int32(nil), []string{random_string(nil)}))) + query, args, err := bob.Build(ctxTx, psql.Select(TrapCountByLocationID(random_int32(nil), []uuid.UUID{random_uuid_UUID(nil)}))) if err != nil { t.Fatal(err) } diff --git a/db/sql/trapcount_by_location_id.sql b/db/sql/trapcount_by_location_id.sql index 0b0bbc58..79ff816b 100644 --- a/db/sql/trapcount_by_location_id.sql +++ b/db/sql/trapcount_by_location_id.sql @@ -6,9 +6,9 @@ SELECT COALESCE(SUM(sa.males), 0) AS total_males, COALESCE(SUM(sa.total), 0) AS total FROM - fs_trapdata td + fieldseeker.trapdata td LEFT JOIN - fs_speciesabundance sa ON td.globalid = sa.trapdata_id + fieldseeker.speciesabundance sa ON td.globalid = sa.trapdata_id WHERE td.organization_id = $1 AND td.loc_id IN ($2) diff --git a/db/sql/trapdata_by_location_id_recent.bob.go b/db/sql/trapdata_by_location_id_recent.bob.go index 81d4136e..d9c55b85 100644 --- a/db/sql/trapdata_by_location_id_recent.bob.go +++ b/db/sql/trapdata_by_location_id_recent.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package sql @@ -8,7 +8,9 @@ import ( _ "embed" "io" "iter" + "time" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -20,11 +22,11 @@ import ( //go:embed trapdata_by_location_id_recent.bob.sql var formattedQueries_trapdata_by_location_id_recent string -var trapDataByLocationIDRecentSQL = formattedQueries_trapdata_by_location_id_recent[199:489] +var trapDataByLocationIDRecentSQL = formattedQueries_trapdata_by_location_id_recent[199:498] type TrapDataByLocationIDRecentQuery = orm.ModQuery[*dialect.SelectQuery, trapDataByLocationIDRecent, TrapDataByLocationIDRecentRow, []TrapDataByLocationIDRecentRow, trapDataByLocationIDRecentTransformer] -func TrapDataByLocationIDRecent(OrganizationID int32, LocID []string) *TrapDataByLocationIDRecentQuery { +func TrapDataByLocationIDRecent(OrganizationID int32, LocID []uuid.UUID) *TrapDataByLocationIDRecentQuery { var expressionTypArgs trapDataByLocationIDRecent expressionTypArgs.OrganizationID = psql.Arg(OrganizationID) @@ -53,17 +55,17 @@ func TrapDataByLocationIDRecent(OrganizationID int32, LocID []string) *TrapDataB }, Mod: bob.ModFunc[*dialect.SelectQuery](func(q *dialect.SelectQuery) { q.AppendSelect(expressionTypArgs.subExpr(7, 36)) - q.SetTable(expressionTypArgs.subExpr(42, 244)) - q.AppendWhere(expressionTypArgs.subExpr(251, 264)) - q.CombinedOrder.AppendOrder(expressionTypArgs.subExpr(274, 290)) + q.SetTable(expressionTypArgs.subExpr(42, 253)) + q.AppendWhere(expressionTypArgs.subExpr(260, 273)) + q.CombinedOrder.AppendOrder(expressionTypArgs.subExpr(283, 299)) }), } } type TrapDataByLocationIDRecentRow = struct { - Enddatetime int64 `db:"enddatetime"` - Globalid string `db:"globalid"` - LocID string `db:"loc_id"` + Enddatetime time.Time `db:"enddatetime"` + Globalid uuid.UUID `db:"globalid"` + LocID uuid.UUID `db:"loc_id"` } type trapDataByLocationIDRecentTransformer = bob.SliceTransformer[TrapDataByLocationIDRecentRow, []TrapDataByLocationIDRecentRow] @@ -77,8 +79,8 @@ func (o trapDataByLocationIDRecent) args() iter.Seq[orm.ArgWithPosition] { return func(yield func(arg orm.ArgWithPosition) bool) { if !yield(orm.ArgWithPosition{ Name: "organizationID", - Start: 207, - Stop: 209, + Start: 216, + Stop: 218, Expression: o.OrganizationID, }) { return @@ -86,8 +88,8 @@ func (o trapDataByLocationIDRecent) args() iter.Seq[orm.ArgWithPosition] { if !yield(orm.ArgWithPosition{ Name: "locID", - Start: 227, - Stop: 229, + Start: 236, + Stop: 238, Expression: o.LocID, }) { return diff --git a/db/sql/trapdata_by_location_id_recent.bob.sql b/db/sql/trapdata_by_location_id_recent.bob.sql index a4e4eadf..da1f5594 100644 --- a/db/sql/trapdata_by_location_id_recent.bob.sql +++ b/db/sql/trapdata_by_location_id_recent.bob.sql @@ -1,4 +1,4 @@ --- Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +-- Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. -- This file is meant to be re-generated in place and/or deleted at any time. -- TrapDataByLocationIDRecent @@ -6,7 +6,7 @@ SELECT enddatetime, globalid, loc_id FROM ( SELECT enddatetime, globalid, loc_id, ROW_NUMBER() OVER (PARTITION BY loc_id ORDER BY enddatetime DESC) as row_num - FROM fs_trapdata + FROM fieldseeker.trapdata WHERE organization_id = $1 AND loc_id IN ($2) diff --git a/db/sql/trapdata_by_location_id_recent.bob_test.go b/db/sql/trapdata_by_location_id_recent.bob_test.go index 281cea2a..5d0597b9 100644 --- a/db/sql/trapdata_by_location_id_recent.bob_test.go +++ b/db/sql/trapdata_by_location_id_recent.bob_test.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package sql @@ -19,7 +19,7 @@ func TestTrapDataByLocationIDRecent(t *testing.T) { t.Run("Base", func(t *testing.T) { var sb strings.Builder - query := TrapDataByLocationIDRecent(random_int32(nil), []string{random_string(nil)}) + query := TrapDataByLocationIDRecent(random_int32(nil), []uuid.UUID{random_uuid_UUID(nil)}) if _, err := query.WriteQuery(t.Context(), &sb, 1); err != nil { t.Fatal(err) @@ -33,7 +33,7 @@ func TestTrapDataByLocationIDRecent(t *testing.T) { t.Run("Mod", func(t *testing.T) { var sb strings.Builder - query := TrapDataByLocationIDRecent(random_int32(nil), []string{random_string(nil)}) + query := TrapDataByLocationIDRecent(random_int32(nil), []uuid.UUID{random_uuid_UUID(nil)}) if _, err := psql.Select(query).WriteQuery(t.Context(), &sb, 1); err != nil { t.Fatal(err) @@ -68,7 +68,7 @@ func TestTrapDataByLocationIDRecent(t *testing.T) { } }() - query, args, err := bob.Build(ctxTx, psql.Select(TrapDataByLocationIDRecent(random_int32(nil), []string{random_string(nil)}))) + query, args, err := bob.Build(ctxTx, psql.Select(TrapDataByLocationIDRecent(random_int32(nil), []uuid.UUID{random_uuid_UUID(nil)}))) if err != nil { t.Fatal(err) } diff --git a/db/sql/trapdata_by_location_id_recent.sql b/db/sql/trapdata_by_location_id_recent.sql index e3d9afb6..db902f9e 100644 --- a/db/sql/trapdata_by_location_id_recent.sql +++ b/db/sql/trapdata_by_location_id_recent.sql @@ -3,7 +3,7 @@ SELECT enddatetime, globalid, loc_id FROM ( SELECT enddatetime, globalid, loc_id, ROW_NUMBER() OVER (PARTITION BY loc_id ORDER BY enddatetime DESC) as row_num - FROM fs_trapdata + FROM fieldseeker.trapdata WHERE organization_id = $1 AND loc_id IN ($2) diff --git a/db/sql/traplocation_by_source_id.bob.go b/db/sql/traplocation_by_source_id.bob.go index 45863018..42d93c84 100644 --- a/db/sql/traplocation_by_source_id.bob.go +++ b/db/sql/traplocation_by_source_id.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package sql @@ -9,6 +9,8 @@ import ( "io" "iter" + "github.com/aarondl/opt/null" + "github.com/google/uuid" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql" "github.com/stephenafamo/bob/dialect/psql/dialect" @@ -19,11 +21,11 @@ import ( //go:embed traplocation_by_source_id.bob.sql var formattedQueries_traplocation_by_source_id string -var trapLocationBySourceIDSQL = formattedQueries_traplocation_by_source_id[195:446] +var trapLocationBySourceIDSQL = formattedQueries_traplocation_by_source_id[195:488] type TrapLocationBySourceIDQuery = orm.ModQuery[*dialect.SelectQuery, trapLocationBySourceID, TrapLocationBySourceIDRow, []TrapLocationBySourceIDRow, trapLocationBySourceIDTransformer] -func TrapLocationBySourceID(OrganizationID int32, Globalid string) *TrapLocationBySourceIDQuery { +func TrapLocationBySourceID(OrganizationID int32, Globalid uuid.UUID) *TrapLocationBySourceIDQuery { var expressionTypArgs trapLocationBySourceID expressionTypArgs.OrganizationID = psql.Arg(OrganizationID) @@ -51,17 +53,17 @@ func TrapLocationBySourceID(OrganizationID int32, Globalid string) *TrapLocation }, Mod: bob.ModFunc[*dialect.SelectQuery](func(q *dialect.SelectQuery) { q.CombinedLimit.SetLimit(psql.Raw("4")) - q.AppendSelect(expressionTypArgs.subExpr(9, 90)) - q.SetTable(expressionTypArgs.subExpr(98, 148)) - q.AppendWhere(expressionTypArgs.subExpr(157, 202)) - q.CombinedOrder.AppendOrder(expressionTypArgs.subExpr(214, 243)) + q.AppendSelect(expressionTypArgs.subExpr(9, 102)) + q.SetTable(expressionTypArgs.subExpr(110, 178)) + q.AppendWhere(expressionTypArgs.subExpr(187, 232)) + q.CombinedOrder.AppendOrder(expressionTypArgs.subExpr(244, 285)) }), } } type TrapLocationBySourceIDRow = struct { - TrapLocationGlobalid string `db:"trap_location_globalid"` - Distance string `db:"distance"` + TrapLocationGlobalid null.Val[uuid.UUID] `db:"trap_location_globalid"` + Distance string `db:"distance"` } type trapLocationBySourceIDTransformer = bob.SliceTransformer[TrapLocationBySourceIDRow, []TrapLocationBySourceIDRow] @@ -75,8 +77,8 @@ func (o trapLocationBySourceID) args() iter.Seq[orm.ArgWithPosition] { return func(yield func(arg orm.ArgWithPosition) bool) { if !yield(orm.ArgWithPosition{ Name: "organizationID", - Start: 178, - Stop: 180, + Start: 208, + Stop: 210, Expression: o.OrganizationID, }) { return @@ -84,8 +86,8 @@ func (o trapLocationBySourceID) args() iter.Seq[orm.ArgWithPosition] { if !yield(orm.ArgWithPosition{ Name: "globalid", - Start: 200, - Stop: 202, + Start: 230, + Stop: 232, Expression: o.Globalid, }) { return diff --git a/db/sql/traplocation_by_source_id.bob.sql b/db/sql/traplocation_by_source_id.bob.sql index 779c9e2a..1e6a4a16 100644 --- a/db/sql/traplocation_by_source_id.bob.sql +++ b/db/sql/traplocation_by_source_id.bob.sql @@ -1,17 +1,17 @@ --- Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +-- Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. -- This file is meant to be re-generated in place and/or deleted at any time. -- TrapLocationBySourceID SELECT tl.globalid AS trap_location_globalid, - ST_Distance(pl.geom, tl.geom) AS distance + ST_Distance(pl.geospatial, tl.geospatial) AS distance FROM - fs_pointlocation pl + fieldseeker.pointlocation pl CROSS JOIN - fs_traplocation tl + fieldseeker.traplocation tl WHERE tl.organization_id = $1 AND pl.globalid = $2 ORDER BY - ST_Distance(pl.geom, tl.geom) + ST_Distance(pl.geospatial, tl.geospatial) LIMIT 4; diff --git a/db/sql/traplocation_by_source_id.bob_test.go b/db/sql/traplocation_by_source_id.bob_test.go index 73451247..fa21895b 100644 --- a/db/sql/traplocation_by_source_id.bob_test.go +++ b/db/sql/traplocation_by_source_id.bob_test.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package sql @@ -19,7 +19,7 @@ func TestTrapLocationBySourceID(t *testing.T) { t.Run("Base", func(t *testing.T) { var sb strings.Builder - query := TrapLocationBySourceID(random_int32(nil), random_string(nil)) + query := TrapLocationBySourceID(random_int32(nil), random_uuid_UUID(nil)) if _, err := query.WriteQuery(t.Context(), &sb, 1); err != nil { t.Fatal(err) @@ -33,7 +33,7 @@ func TestTrapLocationBySourceID(t *testing.T) { t.Run("Mod", func(t *testing.T) { var sb strings.Builder - query := TrapLocationBySourceID(random_int32(nil), random_string(nil)) + query := TrapLocationBySourceID(random_int32(nil), random_uuid_UUID(nil)) if _, err := psql.Select(query).WriteQuery(t.Context(), &sb, 1); err != nil { t.Fatal(err) @@ -68,7 +68,7 @@ func TestTrapLocationBySourceID(t *testing.T) { } }() - query, args, err := bob.Build(ctxTx, psql.Select(TrapLocationBySourceID(random_int32(nil), random_string(nil)))) + query, args, err := bob.Build(ctxTx, psql.Select(TrapLocationBySourceID(random_int32(nil), random_uuid_UUID(nil)))) if err != nil { t.Fatal(err) } diff --git a/db/sql/traplocation_by_source_id.sql b/db/sql/traplocation_by_source_id.sql index 0cfdf89a..20f2cf17 100644 --- a/db/sql/traplocation_by_source_id.sql +++ b/db/sql/traplocation_by_source_id.sql @@ -1,14 +1,14 @@ -- TrapLocationBySourceID SELECT tl.globalid AS trap_location_globalid, - ST_Distance(pl.geom, tl.geom) AS distance + ST_Distance(pl.geospatial, tl.geospatial) AS distance FROM - fs_pointlocation pl + fieldseeker.pointlocation pl CROSS JOIN - fs_traplocation tl + fieldseeker.traplocation tl WHERE tl.organization_id = $1 AND pl.globalid = $2 ORDER BY - ST_Distance(pl.geom, tl.geom) + ST_Distance(pl.geospatial, tl.geospatial) LIMIT 4 diff --git a/db/sql/update_oauth_org.bob.go b/db/sql/update_oauth_org.bob.go index f8c582b2..52617838 100644 --- a/db/sql/update_oauth_org.bob.go +++ b/db/sql/update_oauth_org.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package sql diff --git a/db/sql/update_oauth_org.bob.sql b/db/sql/update_oauth_org.bob.sql index 1a2687ce..ea72c135 100644 --- a/db/sql/update_oauth_org.bob.sql +++ b/db/sql/update_oauth_org.bob.sql @@ -1,4 +1,4 @@ --- Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +-- Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. -- This file is meant to be re-generated in place and/or deleted at any time. -- UpdateOauthTokenOrg diff --git a/db/sql/update_oauth_org.bob_test.go b/db/sql/update_oauth_org.bob_test.go index 805dd051..b08fc71e 100644 --- a/db/sql/update_oauth_org.bob_test.go +++ b/db/sql/update_oauth_org.bob_test.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package sql diff --git a/db/sql/user_by_username.bob.go b/db/sql/user_by_username.bob.go index 86ad70f3..77659943 100644 --- a/db/sql/user_by_username.bob.go +++ b/db/sql/user_by_username.bob.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package sql diff --git a/db/sql/user_by_username.bob.sql b/db/sql/user_by_username.bob.sql index 7bb4c579..15d608a4 100644 --- a/db/sql/user_by_username.bob.sql +++ b/db/sql/user_by_username.bob.sql @@ -1,4 +1,4 @@ --- Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +-- Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. -- This file is meant to be re-generated in place and/or deleted at any time. -- UserByUsername diff --git a/db/sql/user_by_username.bob_test.go b/db/sql/user_by_username.bob_test.go index 38ebd58f..865af892 100644 --- a/db/sql/user_by_username.bob_test.go +++ b/db/sql/user_by_username.bob_test.go @@ -1,4 +1,4 @@ -// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT. +// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package sql diff --git a/endpoint.go b/endpoint.go index d3ae4a85..48f7e874 100644 --- a/endpoint.go +++ b/endpoint.go @@ -12,6 +12,7 @@ import ( "github.com/Gleipnir-Technology/nidus-sync/auth" "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/go-chi/chi/v5" + "github.com/google/uuid" "github.com/rs/zerolog/log" "github.com/skip2/go-qrcode" ) @@ -173,11 +174,16 @@ func getSignup(w http.ResponseWriter, r *http.Request) { } func getSource(w http.ResponseWriter, r *http.Request, u *models.User) { - globalid := chi.URLParam(r, "globalid") - if globalid == "" { + globalid_s := chi.URLParam(r, "globalid") + if globalid_s == "" { respondError(w, "No globalid provided", nil, http.StatusBadRequest) return } + globalid, err := uuid.Parse(globalid_s) + if err != nil { + respondError(w, "globalid is not a UUID", nil, http.StatusBadRequest) + return + } htmlSource(w, r, u, globalid) } diff --git a/geometry.go b/geometry.go new file mode 100644 index 00000000..53351928 --- /dev/null +++ b/geometry.go @@ -0,0 +1,26 @@ +package main +import ( + "encoding/json" + "errors" + //"fmt" + + "github.com/stephenafamo/bob/types" + "github.com/uber/h3-go/v4" +) +func getPoint(geom types.JSON[json.RawMessage]) (h3.LatLng, error) { + /* + I need to figure out how to convert from the weird bob + type of types.JSON[json.RawMessage] to a X/Y coordinate to + here, but I need an Internet connection to do that effectively. + */ + return h3.LatLng{}, errors.New("need to implement this") + /* + msg, err := geom.Value() + if err != nil { + return h3.LatLng{}, fmt.Errorf("Can't get underlying JSON value: %w", err) + } + x := msg.Get("x") + y := msg.Get("y") + return h3.NewLatLng(x, y), nil + */ +} diff --git a/html.go b/html.go index a3b9219b..283a2b66 100644 --- a/html.go +++ b/html.go @@ -18,6 +18,7 @@ import ( "github.com/Gleipnir-Technology/nidus-sync/db" "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/Gleipnir-Technology/nidus-sync/db/sql" + "github.com/google/uuid" "github.com/aarondl/opt/null" "github.com/rs/zerolog/log" "github.com/stephenafamo/bob" @@ -75,7 +76,7 @@ var components = [...]string{"header", "map"} var templatesByFilename = make(map[string]BuiltTemplate, 0) type BreedingSourceSummary struct { - ID string + ID uuid.UUID Type string LastInspected *time.Time LastTreated *time.Time @@ -164,10 +165,10 @@ type ContentSource struct { } type Inspection struct { Action string - Date time.Time + Date *time.Time Notes string Location string - LocationID string + LocationID uuid.UUID } type Link struct { Href string @@ -321,22 +322,22 @@ func htmlDashboard(ctx context.Context, w http.ResponseWriter, user *models.User } else { lastSync = &sync.Created } - inspectionCount, err := org.FSMosquitoinspections().Count(ctx, db.PGInstance.BobDB) + inspectionCount, err := org.Mosquitoinspections().Count(ctx, db.PGInstance.BobDB) if err != nil { respondError(w, "Failed to get inspection count", err, http.StatusInternalServerError) return } - sourceCount, err := org.FSPointlocations().Count(ctx, db.PGInstance.BobDB) + sourceCount, err := org.Pointlocations().Count(ctx, db.PGInstance.BobDB) if err != nil { respondError(w, "Failed to get source count", err, http.StatusInternalServerError) return } - serviceCount, err := org.FSServicerequests().Count(ctx, db.PGInstance.BobDB) + serviceCount, err := org.Servicerequests().Count(ctx, db.PGInstance.BobDB) if err != nil { respondError(w, "Failed to get service count", err, http.StatusInternalServerError) return } - recentRequests, err := org.FSServicerequests(sm.OrderBy("creationdate").Desc(), sm.Limit(10)).All(ctx, db.PGInstance.BobDB) + recentRequests, err := org.Servicerequests(sm.OrderBy("creationdate").Desc(), sm.Limit(10)).All(ctx, db.PGInstance.BobDB) if err != nil { respondError(w, "Failed to get recent service", err, http.StatusInternalServerError) return @@ -345,7 +346,7 @@ func htmlDashboard(ctx context.Context, w http.ResponseWriter, user *models.User requests := make([]ServiceRequestSummary, 0) for _, r := range recentRequests { requests = append(requests, ServiceRequestSummary{ - Date: time.UnixMilli(r.Creationdate.MustGet()), + Date: r.Creationdate.MustGet(), Location: r.Reqaddr1.MustGet(), Status: "Completed", }) @@ -432,7 +433,7 @@ func htmlSignup(w http.ResponseWriter, path string) { renderOrError(w, signup, data) } -func htmlSource(w http.ResponseWriter, r *http.Request, user *models.User, id string) { +func htmlSource(w http.ResponseWriter, r *http.Request, user *models.User, id uuid.UUID) { org, err := user.Organization().One(r.Context(), db.PGInstance.BobDB) if err != nil { respondError(w, "Failed to get org", err, http.StatusInternalServerError) @@ -729,16 +730,16 @@ func timeSince(t *time.Time) string { } } -func trapsBySource(ctx context.Context, org *models.Organization, sourceID string) ([]TrapNearby, error) { +func trapsBySource(ctx context.Context, org *models.Organization, sourceID uuid.UUID) ([]TrapNearby, error) { locations, err := sql.TrapLocationBySourceID(org.ID, sourceID).All(ctx, db.PGInstance.BobDB) if err != nil { return nil, fmt.Errorf("Failed to query rows: %w", err) } - location_ids := make([]string, 0) + location_ids := make([]uuid.UUID, 0) var args []bob.Expression for _, location := range locations { - location_ids = append(location_ids, location.TrapLocationGlobalid) + location_ids = append(location_ids, location.TrapLocationGlobalid.MustGet()) args = append(args, psql.Arg(location.TrapLocationGlobalid)) } /* @@ -819,11 +820,11 @@ func renderOrError(w http.ResponseWriter, template *BuiltTemplate, context inter buf.WriteTo(w) } -func treatmentsBySource(ctx context.Context, org *models.Organization, sourceID string) ([]Treatment, error) { +func treatmentsBySource(ctx context.Context, org *models.Organization, sourceID uuid.UUID) ([]Treatment, error) { var results []Treatment - rows, err := org.FSTreatments( + rows, err := org.Treatments( sm.Where( - models.FSTreatments.Columns.Pointlocid.EQ(psql.Arg(sourceID)), + models.FieldseekerTreatments.Columns.Pointlocid.EQ(psql.Arg(sourceID)), ), sm.OrderBy("enddatetime").Desc(), ).All(ctx, db.PGInstance.BobDB) @@ -841,7 +842,7 @@ func treatmentsByCell(ctx context.Context, org *models.Organization, c h3.Cell) return results, fmt.Errorf("Failed to get cell boundary: %w", err) } geom_query := gisStatement(boundary) - rows, err := org.FSTreatments( + rows, err := org.Treatments( sm.Where( psql.F("ST_Within", "geom", geom_query), ), @@ -861,7 +862,7 @@ func inspectionsByCell(ctx context.Context, org *models.Organization, c h3.Cell) return results, fmt.Errorf("Failed to get cell boundary: %w", err) } geom_query := gisStatement(boundary) - rows, err := org.FSMosquitoinspections( + rows, err := org.Mosquitoinspections( sm.Where( psql.F("ST_Within", "geom", geom_query), ), @@ -873,12 +874,12 @@ func inspectionsByCell(ctx context.Context, org *models.Organization, c h3.Cell) } return toTemplateInspection(rows) } -func inspectionsBySource(ctx context.Context, org *models.Organization, sourceID string) ([]Inspection, error) { +func inspectionsBySource(ctx context.Context, org *models.Organization, sourceID uuid.UUID) ([]Inspection, error) { var results []Inspection - rows, err := org.FSMosquitoinspections( + rows, err := org.Mosquitoinspections( sm.Where( - models.FSMosquitoinspections.Columns.Pointlocid.EQ(psql.Arg(sourceID)), + models.FieldseekerMosquitoinspections.Columns.Pointlocid.EQ(psql.Arg(sourceID)), ), sm.OrderBy("enddatetime").Desc(), ).All(ctx, db.PGInstance.BobDB) @@ -895,7 +896,7 @@ func breedingSourcesByCell(ctx context.Context, org *models.Organization, c h3.C return results, fmt.Errorf("Failed to get cell boundary: %w", err) } geom_query := gisStatement(boundary) - rows, err := org.FSPointlocations( + rows, err := org.Pointlocations( sm.Where( psql.F("ST_Within", "geom", geom_query), ), @@ -905,10 +906,20 @@ func breedingSourcesByCell(ctx context.Context, org *models.Organization, c h3.C return results, fmt.Errorf("Failed to query rows: %w", err) } for _, r := range rows { + var last_inspected *time.Time + if !r.Lastinspectdate.IsNull() { + l := r.Lastinspectdate.MustGet() + last_inspected = &l + } + var last_treat_date *time.Time + if !r.Lasttreatdate.IsNull() { + l := r.Lasttreatdate.MustGet() + last_treat_date = &l + } results = append(results, BreedingSourceSummary{ - ID: r.Globalid, - LastInspected: fsTimestampToTime(r.Lastinspectdate), - LastTreated: fsTimestampToTime(r.Lasttreatdate), + ID: r.Globalid.MustGet(), + LastInspected: last_inspected, + LastTreated: last_treat_date, Type: r.Habitat.GetOr("none"), }) } @@ -923,9 +934,9 @@ func uuidShort(uuid string) string { return uuid[:3] + "..." + uuid[len(uuid)-4:] } -func sourceByGlobalId(ctx context.Context, org *models.Organization, id string) (*BreedingSourceDetail, error) { - row, err := org.FSPointlocations( - sm.Where(models.FSPointlocations.Columns.Globalid.EQ(psql.Arg(id))), +func sourceByGlobalId(ctx context.Context, org *models.Organization, id uuid.UUID) (*BreedingSourceDetail, error) { + row, err := org.Pointlocations( + sm.Where(models.FieldseekerPointlocations.Columns.Globalid.EQ(psql.Arg(id))), ).One(ctx, db.PGInstance.BobDB) if err != nil { return nil, fmt.Errorf("Failed to get point location: %w", err) diff --git a/model_conversion.go b/model_conversion.go index db5baddc..ea632a7d 100644 --- a/model_conversion.go +++ b/model_conversion.go @@ -8,6 +8,8 @@ import ( "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/Gleipnir-Technology/nidus-sync/db/sql" "github.com/aarondl/opt/null" + "github.com/google/uuid" + "github.com/rs/zerolog/log" "github.com/uber/h3-go/v4" ) @@ -17,8 +19,8 @@ type BreedingSourceDetail struct { Name string `json:"name"` Description string `json:"description"` LocationNumber int64 `json:"locationNumber"` - ObjectID int32 `json:"objectId"` - GlobalID string `json:"globalId"` + ObjectID int64 `json:"objectId"` + GlobalID uuid.UUID `json:"globalId"` ExternalID string `json:"externalId"` // Status Information @@ -44,7 +46,7 @@ type BreedingSourceDetail struct { // Inspection Data LarvaeInspectInterval int16 `json:"larvaeInspectInterval"` - LastInspectionDate time.Time `json:"lastInspectionDate"` + LastInspectionDate *time.Time `json:"lastInspectionDate"` LastInspectionActivity string `json:"lastInspectionActivity"` LastInspectionActionTaken string `json:"lastInspectionActionTaken"` LastInspectionAverageLarvae float64 `json:"lastInspectionAverageLarvae"` @@ -55,7 +57,7 @@ type BreedingSourceDetail struct { LastInspectionLifeStages string `json:"lastInspectionLifeStages"` // Treatment Data - LastTreatmentDate time.Time `json:"lastTreatmentDate"` + LastTreatmentDate *time.Time `json:"lastTreatmentDate"` LastTreatmentActivity string `json:"lastTreatmentActivity"` LastTreatmentProduct string `json:"lastTreatmentProduct"` LastTreatmentQuantity float64 `json:"lastTreatmentQuantity"` @@ -63,27 +65,27 @@ type BreedingSourceDetail struct { // Assignment & Schedule AssignedTechnician string `json:"assignedTechnician"` - NextActionScheduledDate time.Time `json:"nextActionScheduledDate"` + NextActionScheduledDate *time.Time `json:"nextActionScheduledDate"` // Metadata - Created time.Time `json:"created"` + Created *time.Time `json:"created"` Creator string `json:"creator"` - EditedAt time.Time `json:"editedAt"` + EditedAt *time.Time `json:"editedAt"` Editor string `json:"editor"` - Updated time.Time `json:"updated"` + //Updated *time.Time `json:"updated"` Comments string `json:"comments"` } type TrapNearby struct { Counts []*TrapCount Distance string - ID string + ID uuid.UUID } type TrapCount struct { Ended time.Time Females int - ID string + ID uuid.UUID Males int Total int } @@ -91,11 +93,11 @@ type TrapCount struct { type TrapData struct { // Basic Identifiers OrganizationID int32 `json:"organizationId"` - ObjectID int32 `json:"objectId"` - GlobalID string `json:"globalId"` + ObjectID int64 `json:"objectId"` + GlobalID uuid.UUID `json:"globalId"` LocationName string `json:"locationName"` - LocationID string `json:"locationId"` - SRID string `json:"srid"` + LocationID uuid.UUID `json:"locationId"` + SRID uuid.UUID `json:"srid"` Field int64 `json:"field"` // Trap Information @@ -111,8 +113,8 @@ type TrapData struct { SortedByTechnician string `json:"sortedByTechnician"` // Timing - StartDateTime time.Time `json:"startDateTime"` - EndDateTime time.Time `json:"endDateTime"` + StartDateTime *time.Time `json:"startDateTime"` + EndDateTime *time.Time `json:"endDateTime"` // Environmental Conditions AverageTemperature float64 `json:"averageTemperature"` @@ -126,7 +128,7 @@ type TrapData struct { RecordStatus int16 `json:"recordStatus"` Reviewed bool `json:"reviewed"` ReviewedBy string `json:"reviewedBy"` - ReviewedDate time.Time `json:"reviewedDate"` + ReviewedDate *time.Time `json:"reviewedDate"` GatewaySynced bool `json:"gatewaySynced"` LR bool `json:"laboratoryReported"` Voltage float64 `json:"voltage"` @@ -142,33 +144,33 @@ type TrapData struct { VectorSurveyTrapLocationID string `json:"vectorSurveyTrapLocationId"` // Metadata - Created time.Time `json:"created"` + Created *time.Time `json:"created"` Creator string `json:"creator"` CreatedByUser string `json:"createdByUser"` - CreatedDateAlt time.Time `json:"createdDateAlt"` - Edited time.Time `json:"edited"` + CreatedDateAlt *time.Time `json:"createdDateAlt"` + Edited *time.Time `json:"edited"` Editor string `json:"editor"` - LastEditedDate time.Time `json:"lastEditedDate"` + LastEditedDate *time.Time `json:"lastEditedDate"` LastEditedUser string `json:"lastEditedUser"` - Updated time.Time `json:"updated"` + //Updated *time.Time `json:"updated"` Comments string `json:"comments"` } type Treatment struct { CadenceDelta time.Duration - Date time.Time - LocationID string + Date *time.Time + LocationID uuid.UUID Notes string Product string } func toTemplateTraps(locations []sql.TrapLocationBySourceIDRow, trap_data []sql.TrapDataByLocationIDRecentRow, counts []sql.TrapCountByLocationIDRow) ([]TrapNearby, error) { results := make([]TrapNearby, 0) - count_by_trap_data_id := make(map[string]*sql.TrapCountByLocationIDRow) + count_by_trap_data_id := make(map[uuid.UUID]*sql.TrapCountByLocationIDRow) for _, c := range counts { - count_by_trap_data_id[c.TrapdataGlobalid] = &c + count_by_trap_data_id[c.TrapdataGlobalid.MustGet()] = &c } - counts_by_location_id := make(map[string][]*TrapCount) + counts_by_location_id := make(map[uuid.UUID][]*TrapCount) for _, td := range trap_data { c, ok := count_by_trap_data_id[td.Globalid] if !ok { @@ -176,11 +178,11 @@ func toTemplateTraps(locations []sql.TrapLocationBySourceIDRow, trap_data []sql. } loc_id := td.LocID count := &TrapCount{ - Ended: time.UnixMilli(td.Enddatetime), - Females: int(c.TotalFemales.IntPart()), + Ended: td.Enddatetime, + Females: int(c.TotalFemales), ID: td.Globalid, Males: int(c.TotalMales), - Total: int(c.Total.IntPart()), + Total: int(c.Total), } counts, ok := counts_by_location_id[loc_id] if !ok { @@ -191,32 +193,37 @@ func toTemplateTraps(locations []sql.TrapLocationBySourceIDRow, trap_data []sql. counts_by_location_id[loc_id] = counts } for _, location := range locations { - counts, ok := counts_by_location_id[location.TrapLocationGlobalid] + counts, ok := counts_by_location_id[location.TrapLocationGlobalid.MustGet()] if !ok { return results, errors.New(fmt.Sprintf("Failed to find counts for %s", location.TrapLocationGlobalid)) } trap := TrapNearby{ Counts: counts, Distance: location.Distance, - ID: location.TrapLocationGlobalid, + ID: location.TrapLocationGlobalid.MustGet(), } results = append(results, trap) } return results, nil } -func toTemplateTrapData(trap_data models.FSTrapdatumSlice) ([]TrapData, error) { +func toTemplateTrapData(trap_data models.FieldseekerTrapdatumSlice) ([]TrapData, error) { var results []TrapData for _, r := range trap_data { + geometry, err := getPoint(r.Geometry) + if err != nil { + log.Error().Err(err).Msg("Failed to get geometry for trap data") + continue + } results = append(results, TrapData{ // Basic Identifiers OrganizationID: r.OrganizationID, ObjectID: r.Objectid, - GlobalID: r.Globalid, + GlobalID: r.Globalid.MustGet(), LocationName: r.Locationname.GetOr(""), - LocationID: r.LocID.GetOr(""), - SRID: r.Srid.GetOr(""), - Field: r.Field.GetOr(0), + LocationID: r.LocID.GetOr(uuid.UUID{}), + SRID: r.Srid.GetOr(uuid.UUID{}), + Field: int64(r.Field.GetOr(0)), // Trap Information TrapType: r.Traptype.GetOr(""), @@ -231,8 +238,8 @@ func toTemplateTrapData(trap_data models.FSTrapdatumSlice) ([]TrapData, error) { SortedByTechnician: r.Sortbytech.GetOr(""), // Timing - StartDateTime: fsToTime(r.Startdatetime), - EndDateTime: fsToTime(r.Enddatetime), + StartDateTime: getTimeOrNull(r.Startdatetime), + EndDateTime: getTimeOrNull(r.Enddatetime), // Environmental Conditions AverageTemperature: r.Avetemp.GetOr(0), @@ -246,14 +253,14 @@ func toTemplateTrapData(trap_data models.FSTrapdatumSlice) ([]TrapData, error) { RecordStatus: r.Recordstatus.GetOr(0), Reviewed: fsIntToBool(r.Reviewed), ReviewedBy: r.Reviewedby.GetOr(""), - ReviewedDate: fsToTime(r.Revieweddate), + ReviewedDate: getTimeOrNull(r.Revieweddate), GatewaySynced: fsIntToBool(r.Gatewaysync), LR: fsIntToBool(r.LR), Voltage: r.Voltage.GetOr(0), // Location Data - GeometryX: r.GeometryX.GetOr(0), - GeometryY: r.GeometryY.GetOr(0), + GeometryX: geometry.Lng, + GeometryY: geometry.Lat, Zone: r.Zone.GetOr(""), Zone2: r.Zone2.GetOr(""), @@ -262,26 +269,26 @@ func toTemplateTrapData(trap_data models.FSTrapdatumSlice) ([]TrapData, error) { VectorSurveyTrapLocationID: r.Vectorsurvtraplocationid.GetOr(""), // Metadata - Created: fsToTime(r.Creationdate), + Created: getTimeOrNull(r.Creationdate), Creator: r.Creator.GetOr(""), CreatedByUser: r.CreatedUser.GetOr(""), - CreatedDateAlt: fsToTime(r.CreatedDate), - Edited: fsToTime(r.Editdate), + CreatedDateAlt: getTimeOrNull(r.CreatedDate), + Edited: getTimeOrNull(r.Editdate), Editor: r.Editor.GetOr(""), - LastEditedDate: fsToTime(r.LastEditedDate), + LastEditedDate: getTimeOrNull(r.LastEditedDate), LastEditedUser: r.LastEditedUser.GetOr(""), - Updated: r.Updated, + //Updated: r.Updated, Comments: r.Comments.GetOr(""), }) } return results, nil } -func toTemplateTreatment(rows models.FSTreatmentSlice) ([]Treatment, error) { +func toTemplateTreatment(rows models.FieldseekerTreatmentSlice) ([]Treatment, error) { var results []Treatment for _, r := range rows { results = append(results, Treatment{ - Date: *fsTimestampToTime(r.Enddatetime), - LocationID: r.Pointlocid.GetOr("none"), + Date: getTimeOrNull(r.Enddatetime), + LocationID: r.Pointlocid.GetOr(uuid.UUID{}), Notes: r.Comments.GetOr("none"), Product: r.Product.GetOr("none"), }) @@ -289,15 +296,15 @@ func toTemplateTreatment(rows models.FSTreatmentSlice) ([]Treatment, error) { return results, nil } -func toTemplateInspection(rows models.FSMosquitoinspectionSlice) ([]Inspection, error) { +func toTemplateInspection(rows models.FieldseekerMosquitoinspectionSlice) ([]Inspection, error) { var results []Inspection for _, r := range rows { results = append(results, Inspection{ Action: r.Actiontaken.GetOr("none"), - Date: *fsTimestampToTime(r.Enddatetime), + Date: getTimeOrNull(r.Enddatetime), Notes: r.Comments.GetOr("none"), Location: r.Locationname.GetOr("none"), - LocationID: r.Pointlocid.GetOr(""), + LocationID: r.Pointlocid.GetOr(uuid.UUID{}), }) } return results, nil @@ -323,15 +330,20 @@ func fsIntToBool(val null.Val[int16]) bool { } // toTemplateBreedingSource transforms the DB model into the display model -func toTemplateBreedingSource(source *models.FSPointlocation) *BreedingSourceDetail { +func toTemplateBreedingSource(source *models.FieldseekerPointlocation) *BreedingSourceDetail { + lat_lng, err := getPoint(source.Geometry) + if err != nil { + log.Error().Err(err).Msg("Failed to get point from point location") + return nil + } return &BreedingSourceDetail{ // Basic Information OrganizationID: source.OrganizationID, Name: source.Name.MustGet(), Description: source.Description.MustGet(), - LocationNumber: source.Locationnumber.GetOr(0), + LocationNumber: int64(source.Locationnumber.GetOr(0)), ObjectID: source.Objectid, - GlobalID: source.Globalid, + GlobalID: source.Globalid.MustGet(), ExternalID: source.Externalid.GetOr(""), // Status Information @@ -339,7 +351,7 @@ func toTemplateBreedingSource(source *models.FSPointlocation) *BreedingSourceDet DeactivateReason: source.DeactivateReason.GetOr(""), SourceStatus: source.Sourcestatus.GetOr(""), Priority: source.Priority.GetOr(""), - ScalarPriority: source.Scalarpriority.GetOr(0), + ScalarPriority: int64(source.Scalarpriority.GetOr(0)), // Classification SourceType: source.Stype.GetOr(""), @@ -349,10 +361,7 @@ func toTemplateBreedingSource(source *models.FSPointlocation) *BreedingSourceDet Symbology: source.Symbology.GetOr(""), // Geographical Data - LatLng: h3.LatLng{ - Lat: source.GeometryY, - Lng: source.GeometryX, - }, + LatLng: lat_lng, Zone: source.Zone.GetOr(""), Zone2: source.Zone2.GetOr(""), Jurisdiction: source.Jurisdiction.GetOr(""), @@ -360,7 +369,7 @@ func toTemplateBreedingSource(source *models.FSPointlocation) *BreedingSourceDet // Inspection Data LarvaeInspectInterval: source.Larvinspectinterval.GetOr(0), - LastInspectionDate: fsToTime(source.Lastinspectdate), + LastInspectionDate: getTimeOrNull(source.Lastinspectdate), LastInspectionActivity: source.Lastinspectactivity.GetOr(""), LastInspectionActionTaken: source.Lastinspectactiontaken.GetOr(""), LastInspectionAverageLarvae: source.Lastinspectavglarvae.GetOr(0), @@ -371,7 +380,7 @@ func toTemplateBreedingSource(source *models.FSPointlocation) *BreedingSourceDet LastInspectionLifeStages: source.Lastinspectlstages.GetOr(""), // Treatment Data - LastTreatmentDate: fsToTime(source.Lasttreatdate), + LastTreatmentDate: getTimeOrNull(source.Lasttreatdate), LastTreatmentActivity: source.Lasttreatactivity.GetOr(""), LastTreatmentProduct: source.Lasttreatproduct.GetOr(""), LastTreatmentQuantity: source.Lasttreatqty.GetOr(0), @@ -379,14 +388,22 @@ func toTemplateBreedingSource(source *models.FSPointlocation) *BreedingSourceDet // Assignment & Schedule AssignedTechnician: source.Assignedtech.GetOr(""), - NextActionScheduledDate: fsToTime(source.Nextactiondatescheduled), + NextActionScheduledDate: getTimeOrNull(source.Nextactiondatescheduled), // Metadata - Created: fsToTime(source.Creationdate), + Created: getTimeOrNull(source.Creationdate), Creator: source.Creator.GetOr(""), - EditedAt: fsToTime(source.Editdate), + EditedAt: getTimeOrNull(source.Editdate), Editor: source.Editor.GetOr(""), - Updated: source.Updated, + //Updated: source.Updated, Comments: source.Comments.GetOr(""), } } + +func getTimeOrNull(v null.Val[time.Time]) *time.Time { + if v.IsNull() { + return nil + } + val := v.MustGet() + return &val +} diff --git a/time.go b/time.go index ae405e4f..d7b611b1 100644 --- a/time.go +++ b/time.go @@ -20,7 +20,9 @@ type TreatmentModel struct { func modelTreatment(treatments []Treatment) []TreatmentModel { treatment_times := make([]time.Time, 0) for _, treatment := range treatments { - treatment_times = append(treatment_times, treatment.Date) + if treatment.Date != nil { + treatment_times = append(treatment_times, *treatment.Date) + } } models := calculateTreatmentModels(treatment_times) /*models_by_year := make(map[int]TreatmentModel)